]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: ss7 - added support for hex characters in calling/called numbers
authorKonrad Hammel <konrad@sangoma.com>
Fri, 5 Nov 2010 17:52:41 +0000 (13:52 -0400)
committerKonrad Hammel <konrad@sangoma.com>
Fri, 5 Nov 2010 18:24:12 +0000 (14:24 -0400)
freetdm: ss7 - added support for no-EC present indicatiation in ACM when 64k unrestricted TMR

libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c

index f2e34e6c2cffc3abb663a3c18d1aa6c71f124727..970d00675661e6fcde80d7122c8fb54057ed0bf3 100644 (file)
@@ -335,7 +335,26 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
        acm.bckCallInd.isdnAccInd.pres          = PRSNT_NODEF;
        acm.bckCallInd.isdnAccInd.val           = ISDNACC_NONISDN;
        acm.bckCallInd.echoCtrlDevInd.pres      = PRSNT_NODEF;
-       acm.bckCallInd.echoCtrlDevInd.val       = 0x1;  /* ec device present */
+       switch (ftdmchan->caller_data.bearer_capability) {
+       /**********************************************************************/
+       case (FTDM_BEARER_CAP_SPEECH):
+               acm.bckCallInd.echoCtrlDevInd.val       = 0x1;
+               break;
+       /**********************************************************************/
+       case (FTDM_BEARER_CAP_64K_UNRESTRICTED):
+               acm.bckCallInd.echoCtrlDevInd.val       = 0x0;
+               break;
+       /**********************************************************************/
+       case (FTDM_BEARER_CAP_3_1KHZ_AUDIO):
+               acm.bckCallInd.echoCtrlDevInd.val       = 0x1;
+               break;
+       /**********************************************************************/
+       default:
+               SS7_ERROR_CHAN(ftdmchan, "Unknown Bearer capability falling back to speech%s\n", " ");
+               acm.bckCallInd.echoCtrlDevInd.val       = 0x1;
+               break;
+       /**********************************************************************/
+       } /* switch (ftdmchan->caller_data.bearer_capability) */
        acm.bckCallInd.sccpMethInd.pres         = PRSNT_NODEF;
        acm.bckCallInd.sccpMethInd.val          = SCCPMTH_NOIND;
 
index 4d514caf8653711588b9d2c310e7751a84eeee1d..4d497b599dfea95b1d0ac642dc2ae06f4fdb0bb4 100644 (file)
@@ -132,7 +132,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
                tmp[0] = ftdm->cid_num.digits[k];
 
                /* check if the digit is a number and that is not null */
-               while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
+               while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                       SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                        /* move on to the next value */
                        k++;
                        tmp[0] = ftdm->cid_num.digits[k];
@@ -141,14 +142,15 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
                /* check if tmp is null or a digit */
                if (tmp[0] != '\0') {
                        /* push it into the lower nibble */
-                       lower = atoi(&tmp[0]);
+                       lower = strtol(&tmp[0], (char **)NULL, 16);
                        /* move to the next digit */
                        k++;
                        /* grab a digit from the ftdm digits */
                        tmp[0] = ftdm->cid_num.digits[k];
 
                        /* check if the digit is a number and that is not null */
-                       while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
+                       while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                               SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                                k++;
                                tmp[0] = ftdm->cid_num.digits[k];
                        } /* while(!(isdigit(tmp))) */
@@ -156,7 +158,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
                        /* check if tmp is null or a digit */
                        if (tmp[0] != '\0') {
                                /* push the digit into the upper nibble */
-                               upper = (atoi(&tmp[0])) << 4;
+                               upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4;
                        } else {
                                /* there is no upper ... fill in 0 */
                                upper = 0x0;
@@ -243,7 +245,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
                tmp[0] = ftdm->dnis.digits[k];
 
                /* check if the digit is a number and that is not null */
-               while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
+               while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                       SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                        /* move on to the next value */
                        k++;
                        tmp[0] = ftdm->dnis.digits[k];
@@ -252,14 +255,15 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
                /* check if tmp is null or a digit */
                if (tmp[0] != '\0') {
                        /* push it into the lower nibble */
-                       lower = atoi(&tmp[0]);
+                       lower = strtol(&tmp[0], (char **)NULL, 16);
                        /* move to the next digit */
                        k++;
                        /* grab a digit from the ftdm digits */
                        tmp[0] = ftdm->dnis.digits[k];
 
                        /* check if the digit is a number and that is not null */
-                       while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
+                       while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                               SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                                k++;
                                tmp[0] = ftdm->dnis.digits[k];
                        } /* while(!(isdigit(tmp))) */
@@ -267,7 +271,7 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
                        /* check if tmp is null or a digit */
                        if (tmp[0] != '\0') {
                                /* push the digit into the upper nibble */
-                               upper = (atoi(&tmp[0])) << 4;
+                               upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4;
                        } else {
                                /* there is no upper ... fill in ST */
                                upper = 0xF0;
@@ -984,6 +988,7 @@ ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int ty
 
                /* confirm it is a digit */
                if (!isdigit(tmp[0])) {
+                       SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                        /* move to the next character in subAddr */
                        x++;
 
@@ -1068,6 +1073,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ
 
                /* confirm it is a hex digit */
                while ((!isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                       SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                        /* move to the next character in subAddr */
                        x++;
                        tmp[0] = subAddr[x];
@@ -1084,6 +1090,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ
 
                        /* check if the digit is a hex digit and that is not null */
                        while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
+                               SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
                                x++;
                                tmp[0] = subAddr[x];
                        } /* while(!(isdigit(tmp))) */