diff --git a/CHANGES b/CHANGES index 0fa0835fe5b6e6d5d30ea2df5355a366a8b12d35..dd6dfe0a5d19660496b3fa8ea08c0feaf05dd5e8 100644 --- a/CHANGES +++ b/CHANGES @@ -120,7 +120,8 @@ mISDN channel driver (chan_misdn) changes used by the rest of the system. * Made use the nationalprefix and internationalprefix misdn.conf parameters to prefix any received number from the ISDN link if that - number has the corresponding Type-Of-Number. + number has the corresponding Type-Of-Number. NOTE: This includes + comparing the incoming call's dialed number against the MSN list. * Added the following new parameters: unknownprefix, netspecificprefix, subscriberprefix, and abbreviatedprefix in misdn.conf to prefix any received number from the ISDN link if that number has the corresponding diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 3a5a5b4f152ed6c109db29b95f58c2a6352861f7..8f9d5fb0b40e5254ccadc0f02bdf894ebf7e12fc 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -9390,6 +9390,26 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel } } +/*! + * \internal + * \brief Determine if the given dialed party matches our MSN. + * \since 1.6.3 + * + * \param port ISDN port + * \param dialed Dialed party information of incoming call. + * + * \retval non-zero if MSN is valid. + * \retval 0 if MSN invalid. + */ +static int misdn_is_msn_valid(int port, const struct misdn_party_dialing *dialed) +{ + char number[sizeof(dialed->number)]; + + ast_copy_string(number, dialed->number, sizeof(number)); + misdn_add_number_prefix(port, dialed->number_type, number, sizeof(number)); + return misdn_cfg_is_msn_valid(port, number); +} + /************************************************************/ /* Receive Events from isdn_lib here */ /************************************************************/ @@ -9640,7 +9660,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) case EVENT_SETUP: { struct chan_list *ch = find_chan_by_bc(cl_te, bc); - int msn_valid = misdn_cfg_is_msn_valid(bc->port, bc->dialed.number); struct ast_channel *chan; int exceed; int ai; @@ -9657,7 +9676,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) } } - if (!bc->nt && ! msn_valid) { + if (!bc->nt && !misdn_is_msn_valid(bc->port, &bc->dialed)) { chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n"); return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */ }