Merge branch 'master' into smgmaster
This commit is contained in:
commit
be798b4ed9
|
@ -1264,6 +1264,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
caller_data.ani.plan = (uint8_t)atoi(sipvar);
|
caller_data.ani.plan = (uint8_t)atoi(sipvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used by ftmod_sangoma_ss7 only */
|
||||||
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI-NADI");
|
||||||
|
if (sipvar) {
|
||||||
|
ftdm_usrmsg_add_var(&usrmsg, "ss7_clg_nadi", sipvar);
|
||||||
|
}
|
||||||
|
|
||||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI2");
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI2");
|
||||||
if (sipvar) {
|
if (sipvar) {
|
||||||
ftdm_set_string(caller_data.aniII, sipvar);
|
ftdm_set_string(caller_data.aniII, sipvar);
|
||||||
|
@ -1284,6 +1290,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
caller_data.dnis.plan = (uint8_t)atoi(sipvar);
|
caller_data.dnis.plan = (uint8_t)atoi(sipvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used by ftmod_sangoma_ss7 only */
|
||||||
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS-NADI");
|
||||||
|
if (sipvar) {
|
||||||
|
ftdm_usrmsg_add_var(&usrmsg, "ss7_clg_nadi", sipvar);
|
||||||
|
}
|
||||||
|
|
||||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS");
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS");
|
||||||
if (sipvar) {
|
if (sipvar) {
|
||||||
ftdm_set_string(caller_data.rdnis.digits, sipvar);
|
ftdm_set_string(caller_data.rdnis.digits, sipvar);
|
||||||
|
@ -1299,6 +1311,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
caller_data.rdnis.plan = (uint8_t)atoi(sipvar);
|
caller_data.rdnis.plan = (uint8_t)atoi(sipvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used by ftmod_sangoma_ss7 only */
|
||||||
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI");
|
||||||
|
if (sipvar) {
|
||||||
|
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar);
|
||||||
|
}
|
||||||
|
|
||||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen");
|
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen");
|
||||||
if (sipvar) {
|
if (sipvar) {
|
||||||
caller_data.screen = (uint8_t)atoi(sipvar);
|
caller_data.screen = (uint8_t)atoi(sipvar);
|
||||||
|
@ -1308,6 +1326,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
if (sipvar) {
|
if (sipvar) {
|
||||||
caller_data.pres = (uint8_t)atoi(sipvar);
|
caller_data.pres = (uint8_t)atoi(sipvar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) {
|
if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) {
|
||||||
|
|
|
@ -3563,6 +3563,16 @@ static FIO_WRITE_FUNCTION(ftdm_raw_write)
|
||||||
static FIO_READ_FUNCTION(ftdm_raw_read)
|
static FIO_READ_FUNCTION(ftdm_raw_read)
|
||||||
{
|
{
|
||||||
ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen);
|
ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen);
|
||||||
|
|
||||||
|
if (status == FTDM_SUCCESS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN)
|
||||||
|
&& (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) {
|
||||||
|
int i = 0;
|
||||||
|
unsigned char *rdata = data;
|
||||||
|
for (i = 0; i < *datalen; i++) {
|
||||||
|
rdata[i] = ftdmchan->rxgain_table[rdata[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) {
|
if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) {
|
||||||
ftdm_size_t dlen = *datalen;
|
ftdm_size_t dlen = *datalen;
|
||||||
if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) {
|
if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) {
|
||||||
|
@ -3730,7 +3740,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data
|
||||||
ftdm_status_t status = FTDM_FAIL;
|
ftdm_status_t status = FTDM_FAIL;
|
||||||
fio_codec_t codec_func = NULL;
|
fio_codec_t codec_func = NULL;
|
||||||
ftdm_size_t max = *datalen;
|
ftdm_size_t max = *datalen;
|
||||||
unsigned i = 0;
|
|
||||||
|
|
||||||
ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n");
|
ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n");
|
||||||
ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n");
|
ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n");
|
||||||
|
@ -3769,13 +3778,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN)
|
|
||||||
&& (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) {
|
|
||||||
unsigned char *rdata = data;
|
|
||||||
for (i = 0; i < *datalen; i++) {
|
|
||||||
rdata[i] = ftdmchan->rxgain_table[rdata[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handle_tone_generation(ftdmchan);
|
handle_tone_generation(ftdmchan);
|
||||||
|
|
||||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) {
|
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) {
|
||||||
|
|
|
@ -149,22 +149,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)
|
||||||
|
|
||||||
|
|
||||||
switch (sta->t.usta.alarm.cause) {
|
switch (sta->t.usta.alarm.cause) {
|
||||||
/******************************************************************/
|
|
||||||
case (LCM_CAUSE_UNKNOWN):
|
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s\n",
|
|
||||||
buf,
|
|
||||||
DECODE_LSD_EVENT(sta->t.usta.alarm.event));
|
|
||||||
break;
|
|
||||||
/******************************************************************/
|
|
||||||
case (LCM_CAUSE_MGMT_INITIATED):
|
case (LCM_CAUSE_MGMT_INITIATED):
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s[MGMT] %s\n",
|
ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s[MGMT] cause:%s event:%s\n",
|
||||||
buf,
|
buf,
|
||||||
|
DECODE_LCM_CAUSE(sta->t.usta.alarm.cause),
|
||||||
DECODE_LSD_EVENT(sta->t.usta.alarm.event));
|
DECODE_LSD_EVENT(sta->t.usta.alarm.event));
|
||||||
break;
|
break;
|
||||||
/******************************************************************/
|
case (LCM_CAUSE_UNKNOWN):
|
||||||
default:
|
default:
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s (***unknown cause***)\n",
|
ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s cause:%s event:%s\n",
|
||||||
buf,
|
buf,
|
||||||
|
DECODE_LCM_CAUSE(sta->t.usta.alarm.cause),
|
||||||
DECODE_LSD_EVENT(sta->t.usta.alarm.event));
|
DECODE_LSD_EVENT(sta->t.usta.alarm.event));
|
||||||
break;
|
break;
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@ -211,7 +206,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)
|
||||||
sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);
|
sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n",
|
ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s %s : %s\n",
|
||||||
buf,
|
buf,
|
||||||
DECODE_LSD_EVENT(sta->t.usta.alarm.event),
|
DECODE_LSD_EVENT(sta->t.usta.alarm.event),
|
||||||
DECODE_DISC_REASON(sta->t.usta.evntParm[1]));
|
DECODE_DISC_REASON(sta->t.usta.evntParm[1]));
|
||||||
|
@ -402,7 +397,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta)
|
||||||
break;
|
break;
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
default:
|
default:
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s(%d) : %s(%d)\n",
|
ftdm_log(FTDM_LOG_DEBUG,"[MTP3]%s %s(%d) : %s(%d)\n",
|
||||||
buf,
|
buf,
|
||||||
DECODE_LSN_EVENT(sta->t.usta.alarm.event),
|
DECODE_LSN_EVENT(sta->t.usta.alarm.event),
|
||||||
sta->t.usta.alarm.event,
|
sta->t.usta.alarm.event,
|
||||||
|
@ -421,7 +416,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta)
|
||||||
break;
|
break;
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
case (STLNKSET):
|
case (STLNKSET):
|
||||||
ftdm_log(FTDM_LOG_ERROR,"[MTP3][LNKSET:%d] %s : %s\n",
|
ftdm_log(FTDM_LOG_DEBUG,"[MTP3][LNKSET:%d] %s : %s\n",
|
||||||
sta->hdr.elmId.elmntInst1,
|
sta->hdr.elmId.elmntInst1,
|
||||||
DECODE_LSN_EVENT(sta->t.usta.alarm.event),
|
DECODE_LSN_EVENT(sta->t.usta.alarm.event),
|
||||||
DECODE_LSN_CAUSE(sta->t.usta.alarm.cause));
|
DECODE_LSN_CAUSE(sta->t.usta.alarm.cause));
|
||||||
|
|
|
@ -316,8 +316,11 @@ typedef struct sng_isup_ckt {
|
||||||
uint32_t typeCntrl;
|
uint32_t typeCntrl;
|
||||||
uint32_t ssf;
|
uint32_t ssf;
|
||||||
uint32_t switchType;
|
uint32_t switchType;
|
||||||
|
|
||||||
uint32_t clg_nadi;
|
uint32_t clg_nadi;
|
||||||
uint32_t cld_nadi;
|
uint32_t cld_nadi;
|
||||||
|
uint8_t rdnis_nadi;
|
||||||
|
|
||||||
uint32_t min_digits;
|
uint32_t min_digits;
|
||||||
void *obj;
|
void *obj;
|
||||||
uint16_t t3;
|
uint16_t t3;
|
||||||
|
@ -786,8 +789,12 @@ uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum
|
||||||
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
|
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
|
||||||
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
||||||
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
||||||
uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum);
|
||||||
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
|
||||||
|
|
||||||
|
ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
||||||
|
ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
||||||
|
ftdm_status_t copy_tknStr_to_sngss7(char* str, TknStr *tknStr, TknU8 *oddEven);
|
||||||
|
|
||||||
int check_for_state_change(ftdm_channel_t *ftdmchan);
|
int check_for_state_change(ftdm_channel_t *ftdmchan);
|
||||||
int check_cics_in_range(sngss7_chan_data_t *sngss7_info);
|
int check_cics_in_range(sngss7_chan_data_t *sngss7_info);
|
||||||
|
|
|
@ -183,7 +183,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||||
copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
|
copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
|
||||||
|
|
||||||
/* copy down the calling number information */
|
/* copy down the calling number information */
|
||||||
|
|
||||||
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
|
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
|
||||||
|
|
||||||
/* check if the user would like a custom NADI value for the calling Pty Num */
|
/* check if the user would like a custom NADI value for the calling Pty Num */
|
||||||
|
@ -244,6 +243,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||||
} /* if (subAddrIE[0] != '0') */
|
} /* if (subAddrIE[0] != '0') */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum);
|
||||||
|
|
||||||
/* check if the user would like us to send a cld_sub-address */
|
/* check if the user would like us to send a cld_sub-address */
|
||||||
cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr");
|
cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr");
|
||||||
if ((cld_subAddr != NULL) && (*cld_subAddr)) {
|
if ((cld_subAddr != NULL) && (*cld_subAddr)) {
|
||||||
|
|
|
@ -43,13 +43,6 @@ uint32_t sngss7_id;
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* PROTOTYPES *****************************************************************/
|
/* PROTOTYPES *****************************************************************/
|
||||||
uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
|
||||||
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
|
|
||||||
uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
|
|
||||||
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
|
|
||||||
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
|
||||||
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
|
|
||||||
|
|
||||||
int check_for_state_change(ftdm_channel_t *ftdmchan);
|
int check_for_state_change(ftdm_channel_t *ftdmchan);
|
||||||
int check_cics_in_range(sngss7_chan_data_t *sngss7_info);
|
int check_cics_in_range(sngss7_chan_data_t *sngss7_info);
|
||||||
int check_for_reset(sngss7_chan_data_t *sngss7_info);
|
int check_for_reset(sngss7_chan_data_t *sngss7_info);
|
||||||
|
@ -139,6 +132,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
|
||||||
* it finds the \0...since tmp is on the stack it will start going through the
|
* it finds the \0...since tmp is on the stack it will start going through the
|
||||||
* possibly causing corruption. Hard code a \0 to prevent this
|
* possibly causing corruption. Hard code a \0 to prevent this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
k = 0;
|
k = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -334,8 +328,68 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum)
|
||||||
|
{
|
||||||
|
const char* val = NULL;
|
||||||
|
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||||
|
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||||
|
uint8_t len = strlen(caller_data->rdnis.digits);
|
||||||
|
if (!len) {
|
||||||
|
return FTDM_SUCCESS;
|
||||||
|
}
|
||||||
|
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number %s\n", caller_data->rdnis.digits);
|
||||||
|
|
||||||
|
redirgNum->eh.pres = PRSNT_NODEF;
|
||||||
|
|
||||||
|
/* Nature of address indicator */
|
||||||
|
redirgNum->natAddr.pres = PRSNT_NODEF;
|
||||||
|
|
||||||
|
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_nadi");
|
||||||
|
if (!ftdm_strlen_zero(val)) {
|
||||||
|
redirgNum->natAddr.val = atoi(val);
|
||||||
|
} else {
|
||||||
|
redirgNum->natAddr.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].rdnis_nadi;
|
||||||
|
}
|
||||||
|
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val);
|
||||||
|
|
||||||
|
/* Screening indicator */
|
||||||
|
redirgNum->scrInd.pres = PRSNT_NODEF;
|
||||||
|
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_screen_ind");
|
||||||
|
if (!ftdm_strlen_zero(val)) {
|
||||||
|
redirgNum->scrInd.val = atoi(val);
|
||||||
|
} else {
|
||||||
|
redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED;
|
||||||
|
}
|
||||||
|
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val);
|
||||||
|
|
||||||
|
/* Address presentation restricted ind */
|
||||||
|
redirgNum->presRest.pres = PRSNT_NODEF;
|
||||||
|
|
||||||
|
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_pres_ind");
|
||||||
|
if (!ftdm_strlen_zero(val)) {
|
||||||
|
redirgNum->presRest.val = atoi(val);
|
||||||
|
} else {
|
||||||
|
redirgNum->presRest.val = FTDM_PRES_ALLOWED;
|
||||||
|
}
|
||||||
|
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val);
|
||||||
|
|
||||||
|
/* Numbering plan */
|
||||||
|
redirgNum->numPlan.pres = PRSNT_NODEF;
|
||||||
|
|
||||||
|
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_plan");
|
||||||
|
if (!ftdm_strlen_zero(val)) {
|
||||||
|
redirgNum->numPlan.val = atoi(val);
|
||||||
|
} else {
|
||||||
|
redirgNum->numPlan.val = caller_data->rdnis.plan;
|
||||||
|
}
|
||||||
|
|
||||||
|
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val);
|
||||||
|
|
||||||
|
return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven);
|
||||||
|
}
|
||||||
|
|
||||||
|
ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint8_t j;
|
uint8_t j;
|
||||||
|
@ -362,14 +416,14 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SS7_ERROR("Asked to copy tknStr that is not present!\n");
|
SS7_ERROR("Asked to copy tknStr that is not present!\n");
|
||||||
return 1;
|
return FTDM_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return FTDM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -382,7 +436,7 @@ uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||||
/* confirm that we found an acceptable length */
|
/* confirm that we found an acceptable length */
|
||||||
if ( j > 25 ) {
|
if ( j > 25 ) {
|
||||||
SS7_ERROR("string length exceeds maxium value...aborting append!\n");
|
SS7_ERROR("string length exceeds maxium value...aborting append!\n");
|
||||||
return 1;
|
return FTDM_FAIL;
|
||||||
} /* if ( j > 25 ) */
|
} /* if ( j > 25 ) */
|
||||||
|
|
||||||
/* copy in digits */
|
/* copy in digits */
|
||||||
|
@ -405,12 +459,100 @@ uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||||
} /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */
|
} /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */
|
||||||
} else {
|
} else {
|
||||||
SS7_ERROR("Asked to copy tknStr that is not present!\n");
|
SS7_ERROR("Asked to copy tknStr that is not present!\n");
|
||||||
return 1;
|
return FTDM_FAIL;
|
||||||
} /* if (str.pres == 1) */
|
} /* if (str.pres == 1) */
|
||||||
|
|
||||||
return 0;
|
return FTDM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ftdm_status_t copy_tknStr_to_sngss7(char* val, TknStr *tknStr, TknU8 *oddEven)
|
||||||
|
{
|
||||||
|
char tmp[2];
|
||||||
|
int k = 0;
|
||||||
|
int j = 0;
|
||||||
|
uint8_t flag = 0;
|
||||||
|
uint8_t odd = 0;
|
||||||
|
|
||||||
|
uint8_t lower = 0x0;
|
||||||
|
uint8_t upper = 0x0;
|
||||||
|
|
||||||
|
tknStr->pres = PRSNT_NODEF;
|
||||||
|
|
||||||
|
/* atoi will search through memory starting from the pointer it is given until
|
||||||
|
* it finds the \0...since tmp is on the stack it will start going through the
|
||||||
|
* possibly causing corruption. Hard code a \0 to prevent this
|
||||||
|
*/
|
||||||
|
tmp[1] = '\0';
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
/* grab a digit from the ftdm digits */
|
||||||
|
tmp[0] = val[k];
|
||||||
|
|
||||||
|
/* check if the digit is a number and that is not null */
|
||||||
|
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] = val[k];
|
||||||
|
} /* while(!(isdigit(tmp))) */
|
||||||
|
|
||||||
|
/* check if tmp is null or a digit */
|
||||||
|
if (tmp[0] != '\0') {
|
||||||
|
/* push it into the lower nibble */
|
||||||
|
lower = strtol(&tmp[0], (char **)NULL, 16);
|
||||||
|
/* move to the next digit */
|
||||||
|
k++;
|
||||||
|
/* grab a digit from the ftdm digits */
|
||||||
|
tmp[0] = val[k];
|
||||||
|
|
||||||
|
/* check if the digit is a number and that is not null */
|
||||||
|
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
|
||||||
|
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
|
||||||
|
k++;
|
||||||
|
tmp[0] = val[k];
|
||||||
|
} /* while(!(isdigit(tmp))) */
|
||||||
|
|
||||||
|
/* check if tmp is null or a digit */
|
||||||
|
if (tmp[0] != '\0') {
|
||||||
|
/* push the digit into the upper nibble */
|
||||||
|
upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4;
|
||||||
|
} else {
|
||||||
|
/* there is no upper ... fill in 0 */
|
||||||
|
upper = 0x0;
|
||||||
|
/* throw the odd flag */
|
||||||
|
odd = 1;
|
||||||
|
/* throw the end flag */
|
||||||
|
flag = 1;
|
||||||
|
} /* if (tmp != '\0') */
|
||||||
|
} else {
|
||||||
|
/* keep the odd flag down */
|
||||||
|
odd = 0;
|
||||||
|
/* break right away since we don't need to write the digits */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* push the digits into the trillium structure */
|
||||||
|
tknStr->val[j] = upper | lower;
|
||||||
|
|
||||||
|
/* increment the trillium pointer */
|
||||||
|
j++;
|
||||||
|
|
||||||
|
/* if the flag is up we're through all the digits */
|
||||||
|
if (flag) break;
|
||||||
|
|
||||||
|
/* move to the next digit */
|
||||||
|
k++;
|
||||||
|
} /* while(1) */
|
||||||
|
|
||||||
|
tknStr->len = j;
|
||||||
|
oddEven->pres = PRSNT_NODEF;
|
||||||
|
oddEven->val = odd;
|
||||||
|
return FTDM_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
int check_for_state_change(ftdm_channel_t *ftdmchan)
|
int check_for_state_change(ftdm_channel_t *ftdmchan)
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,6 +122,7 @@ typedef struct sng_ccSpan
|
||||||
uint32_t ssf;
|
uint32_t ssf;
|
||||||
uint32_t clg_nadi;
|
uint32_t clg_nadi;
|
||||||
uint32_t cld_nadi;
|
uint32_t cld_nadi;
|
||||||
|
uint32_t rdnis_nadi;
|
||||||
uint32_t min_digits;
|
uint32_t min_digits;
|
||||||
uint32_t t3;
|
uint32_t t3;
|
||||||
uint32_t t12;
|
uint32_t t12;
|
||||||
|
@ -1841,6 +1842,7 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)
|
||||||
int num_parms = cc_span->n_parameters;
|
int num_parms = cc_span->n_parameters;
|
||||||
int flag_clg_nadi = 0;
|
int flag_clg_nadi = 0;
|
||||||
int flag_cld_nadi = 0;
|
int flag_cld_nadi = 0;
|
||||||
|
int flag_rdnis_nadi = 0;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1912,16 +1914,17 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)
|
||||||
flag_clg_nadi = 1;
|
flag_clg_nadi = 1;
|
||||||
sng_ccSpan.clg_nadi = atoi(parm->val);
|
sng_ccSpan.clg_nadi = atoi(parm->val);
|
||||||
SS7_DEBUG("Found default CLG_NADI parm->value = %d\n", sng_ccSpan.clg_nadi);
|
SS7_DEBUG("Found default CLG_NADI parm->value = %d\n", sng_ccSpan.clg_nadi);
|
||||||
/**********************************************************************/
|
|
||||||
} else if (!strcasecmp(parm->var, "cld_nadi")) {
|
} else if (!strcasecmp(parm->var, "cld_nadi")) {
|
||||||
/**********************************************************************/
|
|
||||||
/* throw the flag so that we know we got this optional parameter */
|
/* throw the flag so that we know we got this optional parameter */
|
||||||
flag_cld_nadi = 1;
|
flag_cld_nadi = 1;
|
||||||
sng_ccSpan.cld_nadi = atoi(parm->val);
|
sng_ccSpan.cld_nadi = atoi(parm->val);
|
||||||
SS7_DEBUG("Found default CLD_NADI parm->value = %d\n", sng_ccSpan.cld_nadi);
|
SS7_DEBUG("Found default CLD_NADI parm->value = %d\n", sng_ccSpan.cld_nadi);
|
||||||
/**********************************************************************/
|
} else if (!strcasecmp(parm->var, "rdnis_nadi")) {
|
||||||
|
/* throw the flag so that we know we got this optional parameter */
|
||||||
|
flag_rdnis_nadi = 1;
|
||||||
|
sng_ccSpan.rdnis_nadi = atoi(parm->val);
|
||||||
|
SS7_DEBUG("Found default RDNIS_NADI parm->value = %d\n", sng_ccSpan.rdnis_nadi);
|
||||||
} else if (!strcasecmp(parm->var, "obci_bita")) {
|
} else if (!strcasecmp(parm->var, "obci_bita")) {
|
||||||
/**********************************************************************/
|
|
||||||
if (*parm->val == '1') {
|
if (*parm->val == '1') {
|
||||||
sngss7_set_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA);
|
sngss7_set_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA);
|
||||||
SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) enable option\n");
|
SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) enable option\n");
|
||||||
|
@ -2012,6 +2015,11 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)
|
||||||
sng_ccSpan.clg_nadi = 0x03;
|
sng_ccSpan.clg_nadi = 0x03;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!flag_rdnis_nadi) {
|
||||||
|
/* default the nadi value to national */
|
||||||
|
sng_ccSpan.rdnis_nadi = 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
/* pull up the SSF and Switchtype from the isup interface */
|
/* pull up the SSF and Switchtype from the isup interface */
|
||||||
sng_ccSpan.ssf = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].ssf;
|
sng_ccSpan.ssf = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].ssf;
|
||||||
sng_ccSpan.switchType = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].switchType;
|
sng_ccSpan.switchType = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].switchType;
|
||||||
|
@ -2901,6 +2909,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = ccSpan->ssf;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = ccSpan->ssf;
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].cld_nadi = ccSpan->cld_nadi;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].cld_nadi = ccSpan->cld_nadi;
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].clg_nadi = ccSpan->clg_nadi;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].clg_nadi = ccSpan->clg_nadi;
|
||||||
|
g_ftdm_sngss7_data.cfg.isupCkt[x].rdnis_nadi = ccSpan->rdnis_nadi;
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options;
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType;
|
||||||
g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits;
|
g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits;
|
||||||
|
|
Loading…
Reference in New Issue