diff --git a/CHANGES b/CHANGES index b062024..7b9ba7f 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ HEAD - don't send more DATA_B3 messages than allowed by CAPI_MAX_B3_BLOCKS - added 'k' option to capi receivefax command for not deleting bad faxes - added b-channel number to channel name for better identification +- added variable setting REDIRECTIONNUMBER on outgoing call QSIG: - added support for different qsig variants - added support for rerouting informations on incoming calls diff --git a/README b/README index 8ffcd27..9d48849 100644 --- a/README +++ b/README @@ -393,5 +393,9 @@ REDIRECTINGNUMBER REDIRECTREASON If the incoming call was redirected to you, this variable is set with the reason value. - + +REDIRECTIONNUMBER + If an outgoing call is redirected, this variable may be set to the + new destination. + diff --git a/chan_capi.c b/chan_capi.c index 4213a9a..a102dfe 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -3065,6 +3065,7 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig _cmsg CMSG2; struct ast_frame fr = { AST_FRAME_NULL, }; char *p = NULL; + char *p2 = NULL; int val = 0; INFO_RESP_HEADER(&CMSG2, capi_ApplID, HEADER_MSGNUM(CMSG), PLCI); @@ -3156,6 +3157,25 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig i->owner->cid.cid_rdnis = strdup(p); } break; + case 0x0076: /* Redirection Number */ + p = capi_number(INFO_IND_INFOELEMENT(CMSG), 2); + p2 = emptyid; + if (INFO_IND_INFOELEMENT(CMSG)[0] > 1) { + val = INFO_IND_INFOELEMENT(CMSG)[1] & 0x70; + if (val == CAPI_ETSI_NPLAN_NATIONAL) { + p2 = capi_national_prefix; + } else if (val == CAPI_ETSI_NPLAN_INTERNAT) { + p2 = capi_international_prefix; + } + } + cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: info element REDIRECTION NUMBER '(%s)%s'\n", + i->vname, p2, p); + if (i->owner) { + char numberbuf[64]; + snprintf(numberbuf, sizeof(numberbuf) - 1, "%s%s", p2, p); + pbx_builtin_setvar_helper(i->owner, "REDIRECTIONNUMBER", numberbuf); + } + break; case 0x00a1: /* Sending Complete */ cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: info element Sending Complete\n", i->vname);