diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index f2e34e6c2c..970d006756 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -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; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 4d514caf86..4d497b599d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -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))) */