Merge remote branch 'smgfs/master'
This commit is contained in:
commit
929b69ea5d
|
@ -1298,32 +1298,72 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS");
|
||||
if (sipvar) {
|
||||
ftdm_set_string(caller_data.rdnis.digits, sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-TON");
|
||||
if (sipvar) {
|
||||
caller_data.rdnis.type = (uint8_t)atoi(sipvar);
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_digits", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan");
|
||||
if (sipvar) {
|
||||
caller_data.rdnis.plan = (uint8_t)atoi(sipvar);
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_plan", 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-RDNIS-Screen");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_screen_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_digits", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumQual");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_numqual", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NADI");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_nadi", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Screen");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_screen_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Presentation");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_pres_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Plan");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_npi", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumInComp");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_num_inc_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen");
|
||||
if (sipvar) {
|
||||
caller_data.screen = (uint8_t)atoi(sipvar);
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Presentation");
|
||||
if (sipvar) {
|
||||
caller_data.pres = (uint8_t)atoi(sipvar);
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1342,19 +1382,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) {
|
||||
caller_data.bearer_layer1 = (uint8_t)atoi(var);
|
||||
caller_data.bearer_layer1 = (uint8_t)atoi(var);
|
||||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) {
|
||||
ftdm_set_screening_ind(var, &caller_data.screen);
|
||||
ftdm_set_screening_ind(var, &caller_data.screen);
|
||||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) {
|
||||
ftdm_set_presentation_ind(var, &caller_data.pres);
|
||||
ftdm_set_presentation_ind(var, &caller_data.pres);
|
||||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) {
|
||||
ftdm_set_ton(var, &caller_data.dnis.type);
|
||||
ftdm_set_ton(var, &caller_data.dnis.type);
|
||||
} else {
|
||||
caller_data.dnis.type = outbound_profile->destination_number_ton;
|
||||
}
|
||||
|
@ -1585,8 +1625,53 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
|
|||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan);
|
||||
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-NADI", "%d", channel_caller_data->rdnis.type);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan);
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_screen_ind");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Screen", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_pres_ind");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN", "%d", var_value);
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_numqual");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumQual", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_nadi");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NADI", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_screen_ind");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Screen", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_pres_ind");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Presentation", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_npi");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Plan", "%d", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_num_inc_ind");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%d", var_value);
|
||||
}
|
||||
} /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */
|
||||
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres);
|
||||
|
|
|
@ -360,11 +360,15 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call)
|
|||
static void ft_r2_accept_call(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan;
|
||||
// FIXME: not always accept as no charge, let the user decide that
|
||||
// also we should check the return code from openr2_chan_accept_call and handle error condition
|
||||
ftdm_r2_data_t *r2data = ftdmchan->span->signal_data;
|
||||
|
||||
// FIXME: we should check the return code from openr2_chan_accept_call and handle error condition
|
||||
// hanging up the call with protocol error as the reason, this openr2 API will fail only when there something
|
||||
// wrong at the I/O layer or the library itself
|
||||
openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE);
|
||||
if (r2data->charge_calls)
|
||||
openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
|
||||
else
|
||||
openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE);
|
||||
}
|
||||
|
||||
static void ft_r2_answer_call(ftdm_channel_t *ftdmchan)
|
||||
|
@ -1697,6 +1701,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
|||
r2data->category = r2conf.category;
|
||||
r2data->allow_collect_calls = r2conf.allow_collect_calls;
|
||||
r2data->flags = 0;
|
||||
r2data->charge_calls = r2conf.charge_calls;
|
||||
r2data->forced_release = r2conf.forced_release;
|
||||
spanpvt->r2context = r2data->r2context;
|
||||
|
||||
/* just the value must be freed by the hash */
|
||||
|
@ -1854,6 +1860,10 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan)
|
|||
{
|
||||
if (!r2call->disconnect_rcvd) {
|
||||
openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan);
|
||||
/* overwrite the hangup cause if this is an incoming call and forced_release is set */
|
||||
if (openr2_chan_get_direction(r2chan) == OR2_DIR_BACKWARD && r2data->forced_release) {
|
||||
disconnect_cause = OR2_CAUSE_FORCED_RELEASE;
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause));
|
||||
/* this will disconnect the call, but need to wait for the call end before moving to DOWN */
|
||||
openr2_chan_disconnect_call(r2chan, disconnect_cause);
|
||||
|
|
|
@ -185,17 +185,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " ");
|
||||
}
|
||||
|
||||
/* fill in rdnis information*/
|
||||
if (siConEvnt->redirgNum.eh.pres) {
|
||||
if (siConEvnt->redirgNum.addrSig.pres) {
|
||||
/* fill in the rdnis digits */
|
||||
copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig,
|
||||
ftdmchan->caller_data.rdnis.digits,
|
||||
siConEvnt->cgPtyNum.oddEven);
|
||||
}
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " ");
|
||||
}
|
||||
copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum);
|
||||
|
||||
copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb);
|
||||
|
||||
/* fill in the TMR/bearer capability */
|
||||
if (siConEvnt->txMedReq.eh.pres) {
|
||||
|
@ -490,6 +482,47 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
case (SUBDIRNUM):
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic);
|
||||
break;
|
||||
#ifdef SANGOMA_SPIROU
|
||||
case (CHARGE_ACK):
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx TXA\n", sngss7_info->circuit->cic);
|
||||
break;
|
||||
case (CHARGE_UNIT):
|
||||
{
|
||||
uint32_t charging_unit = 0;
|
||||
uint32_t msg_num = 0;
|
||||
char val[3];
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ITX\n", sngss7_info->circuit->cic);
|
||||
|
||||
memset(val, '\0', sizeof(val));
|
||||
|
||||
if (siCnStEvnt->chargUnitNum.eh.pres == PRSNT_NODEF &&
|
||||
siCnStEvnt->chargUnitNum.chargUnitNum.pres == PRSNT_NODEF) {
|
||||
|
||||
charging_unit = siCnStEvnt->chargUnitNum.chargUnitNum.val;
|
||||
}
|
||||
|
||||
if (siCnStEvnt->msgNum.eh.pres == PRSNT_NODEF &&
|
||||
siCnStEvnt->msgNum.msgNum.pres == PRSNT_NODEF) {
|
||||
|
||||
msg_num = siCnStEvnt->msgNum.msgNum.val;
|
||||
}
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Charging Unit:%d Msg Num:%d\n", charging_unit, msg_num);
|
||||
|
||||
sprintf(val, "%d", charging_unit);
|
||||
sngss7_add_var(sngss7_info, "ss7_itx_charge_unit", val);
|
||||
|
||||
sprintf(val, "%d", msg_num);
|
||||
sngss7_add_var(sngss7_info, "ss7_itx_msg_num", val);
|
||||
|
||||
if (sngss7_info->circuit->itx_auto_reply) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Auto-reply with TXA msg\n");
|
||||
ft_to_sngss7_txa (ftdmchan);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
/**************************************************************************/
|
||||
default:
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic);
|
||||
|
@ -532,7 +565,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
|
||||
/* go to UP */
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
|
@ -609,6 +642,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
|||
break;
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_RING:
|
||||
case FTDM_CHANNEL_STATE_RINGING:
|
||||
case FTDM_CHANNEL_STATE_PROGRESS:
|
||||
case FTDM_CHANNEL_STATE_PROGRESS_MEDIA:
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
|
|
|
@ -674,6 +674,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
} else {
|
||||
/*INBOUND...so FS told us it was going to answer...tell the stack */
|
||||
ft_to_sngss7_anm(ftdmchan);
|
||||
#if 1 /* DAVIDY */
|
||||
ft_to_sngss7_itx(ftdmchan);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -320,8 +320,18 @@ typedef struct sng_isup_ckt {
|
|||
uint32_t clg_nadi;
|
||||
uint32_t cld_nadi;
|
||||
uint8_t rdnis_nadi;
|
||||
|
||||
/* Generic Number defaults */
|
||||
uint8_t gn_nmbqual; /* Number Qualifier */
|
||||
uint8_t gn_nadi; /* Nature of Address indicator */
|
||||
uint8_t gn_screen_ind; /* Screening Indicator */
|
||||
uint8_t gn_pres_ind; /* Presentation Indicator */
|
||||
uint8_t gn_npi; /* Numbering Plan Indicator */
|
||||
uint8_t gn_num_inc_ind; /* Number Incomplete Indicator */
|
||||
/* END - Generic Number defaults */
|
||||
|
||||
uint32_t min_digits;
|
||||
uint8_t itx_auto_reply;
|
||||
void *obj;
|
||||
uint16_t t3;
|
||||
uint16_t t12;
|
||||
|
@ -728,6 +738,9 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan);
|
|||
void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan);
|
||||
void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan);
|
||||
void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan);
|
||||
void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan);
|
||||
void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan);
|
||||
|
||||
|
||||
/* in ftmod_sangoma_ss7_in.c */
|
||||
void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt);
|
||||
|
@ -785,12 +798,14 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
|
|||
ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data);
|
||||
|
||||
/* in ftmod_sangoma_ss7_support.c */
|
||||
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);
|
||||
ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum);
|
||||
ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum);
|
||||
ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum);
|
||||
ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum);
|
||||
ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum);
|
||||
|
||||
ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum);
|
||||
ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb);
|
||||
ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb);
|
||||
|
||||
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);
|
||||
|
|
|
@ -74,8 +74,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;;
|
||||
const char *clg_nadi = NULL;
|
||||
const char *cld_nadi = NULL;
|
||||
const char *clg_subAddr = NULL;
|
||||
const char *cld_subAddr = NULL;
|
||||
char subAddrIE[MAX_SIZEOF_SUBADDR_IE];
|
||||
|
@ -180,33 +178,18 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
} /* if ANSI */
|
||||
|
||||
/* copy down the called number information */
|
||||
copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
|
||||
copy_cdPtyNum_to_sngss7 (ftdmchan, &iam.cdPtyNum);
|
||||
|
||||
/* copy down the calling number information */
|
||||
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
|
||||
copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum);
|
||||
|
||||
/* check if the user would like a custom NADI value for the calling Pty Num */
|
||||
clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi");
|
||||
if ((clg_nadi != NULL) && (*clg_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi);
|
||||
iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi);
|
||||
} else {
|
||||
iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi;
|
||||
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val);
|
||||
}
|
||||
/* copy down the generic number information */
|
||||
copy_genNmb_to_sngss7(ftdmchan, &iam.genNmb);
|
||||
|
||||
cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi");
|
||||
if ((cld_nadi != NULL) && (*cld_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi);
|
||||
iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi);
|
||||
} else {
|
||||
iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi;
|
||||
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val);
|
||||
}
|
||||
|
||||
/* TODO - move this to copy_clg_subAddr_to_sngss7 function */
|
||||
/* check if the user would like us to send a clg_sub-address */
|
||||
clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr");
|
||||
if ((clg_subAddr != NULL) && (*clg_subAddr)) {
|
||||
if (!ftdm_strlen_zero(clg_subAddr)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr);
|
||||
|
||||
/* clean out the subAddrIE */
|
||||
|
@ -302,7 +285,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
@ -382,7 +364,6 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
|
|||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
@ -892,6 +873,69 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan)
|
|||
return;
|
||||
}
|
||||
|
||||
/* French SPIROU send Charge Unit */
|
||||
/* No one calls this function yet, but it has been implemented to complement TXA messages */
|
||||
void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
#ifndef SANGOMA_SPIROU
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n");
|
||||
#else
|
||||
const char* var = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SiCnStEvnt itx;
|
||||
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
memset (&itx, 0x0, sizeof (itx));
|
||||
|
||||
itx.msgNum.eh.pres = PRSNT_NODEF;
|
||||
itx.msgNum.msgNum.pres = PRSNT_NODEF;
|
||||
var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_msg_num");
|
||||
if (!ftdm_strlen_zero(var)) {
|
||||
itx.msgNum.msgNum.val = atoi(var);
|
||||
} else {
|
||||
itx.msgNum.msgNum.val = 0x1;
|
||||
}
|
||||
|
||||
itx.chargUnitNum.eh.pres = PRSNT_NODEF;
|
||||
itx.chargUnitNum.chargUnitNum.pres = PRSNT_NODEF;
|
||||
var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_charge_unit");
|
||||
if (!ftdm_strlen_zero(var)) {
|
||||
itx.chargUnitNum.chargUnitNum.val = atoi(var);
|
||||
} else {
|
||||
itx.chargUnitNum.chargUnitNum.val = 0x1;
|
||||
}
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val);
|
||||
sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &itx, CHARGE_UNIT);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ITX\n", sngss7_info->circuit->cic);
|
||||
#endif
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* French SPIROU send Charging Acknowledgement */
|
||||
void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
#ifndef SANGOMA_SPIROU
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "TXA message not supported!, please update your libsng_ss7\n");
|
||||
#else
|
||||
SiCnStEvnt txa;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
memset (&txa, 0x0, sizeof(txa));
|
||||
|
||||
sng_cc_con_status(1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &txa, CHARGE_ACK);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx TXA\n", sngss7_info->circuit->cic);
|
||||
#endif
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* For Emacs:
|
||||
|
|
|
@ -91,254 +91,241 @@ FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING)
|
|||
FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31)
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
|
||||
ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum)
|
||||
{
|
||||
|
||||
return 0;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
|
||||
ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum)
|
||||
{
|
||||
int k;
|
||||
int j;
|
||||
int flag;
|
||||
int odd;
|
||||
char tmp[2];
|
||||
uint8_t lower;
|
||||
uint8_t upper;
|
||||
const char *val;
|
||||
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
|
||||
/**************************************************************************/
|
||||
cgPtyNum->eh.pres = PRSNT_NODEF;
|
||||
/**************************************************************************/
|
||||
|
||||
cgPtyNum->natAddrInd.pres = PRSNT_NODEF;
|
||||
cgPtyNum->natAddrInd.val = 0x03;
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
cgPtyNum->scrnInd.pres = PRSNT_NODEF;
|
||||
cgPtyNum->scrnInd.val = ftdm->screen;
|
||||
/**************************************************************************/
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_screen_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
cgPtyNum->scrnInd.val = atoi(val);
|
||||
} else {
|
||||
cgPtyNum->scrnInd.val = caller_data->screen;
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val);
|
||||
|
||||
cgPtyNum->presRest.pres = PRSNT_NODEF;
|
||||
cgPtyNum->presRest.val = ftdm->pres;
|
||||
/**************************************************************************/
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
cgPtyNum->presRest.val = atoi(val);
|
||||
} else {
|
||||
cgPtyNum->presRest.val = caller_data->pres;
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val);
|
||||
|
||||
cgPtyNum->numPlan.pres = PRSNT_NODEF;
|
||||
cgPtyNum->numPlan.val = 0x01;
|
||||
/**************************************************************************/
|
||||
|
||||
cgPtyNum->niInd.pres = PRSNT_NODEF;
|
||||
cgPtyNum->niInd.val = 0x00;
|
||||
/**************************************************************************/
|
||||
cgPtyNum->addrSig.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';
|
||||
k = 0;
|
||||
j = 0;
|
||||
flag = 0;
|
||||
odd = 0;
|
||||
upper = 0x0;
|
||||
lower = 0x0;
|
||||
|
||||
while (1) {
|
||||
/* 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 (!(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];
|
||||
} /* 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] = ftdm->cid_num.digits[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] = ftdm->cid_num.digits[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 */
|
||||
cgPtyNum->addrSig.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) */
|
||||
|
||||
cgPtyNum->addrSig.len = j;
|
||||
|
||||
/**************************************************************************/
|
||||
cgPtyNum->oddEven.pres = PRSNT_NODEF;
|
||||
cgPtyNum->oddEven.val = odd;
|
||||
/**************************************************************************/
|
||||
return 0;
|
||||
return copy_tknStr_to_sngss7(caller_data->cid_num.digits, &cgPtyNum->addrSig, &cgPtyNum->oddEven);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
|
||||
ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum)
|
||||
{
|
||||
|
||||
return 0;
|
||||
/* TODO: Implement me */
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
|
||||
{
|
||||
int k;
|
||||
int j;
|
||||
int flag;
|
||||
int odd;
|
||||
char tmp[2];
|
||||
uint8_t lower;
|
||||
uint8_t upper;
|
||||
|
||||
/**************************************************************************/
|
||||
ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum)
|
||||
{
|
||||
const char *cld_nadi = NULL;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
cdPtyNum->eh.pres = PRSNT_NODEF;
|
||||
/**************************************************************************/
|
||||
|
||||
cdPtyNum->natAddrInd.pres = PRSNT_NODEF;
|
||||
cdPtyNum->natAddrInd.val = 0x03;
|
||||
/**************************************************************************/
|
||||
cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi");
|
||||
if (!ftdm_strlen_zero(cld_nadi)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called NADI value \"%s\"\n", cld_nadi);
|
||||
cdPtyNum->natAddrInd.val = atoi(cld_nadi);
|
||||
} else {
|
||||
cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val);
|
||||
}
|
||||
|
||||
cdPtyNum->numPlan.pres = PRSNT_NODEF;
|
||||
cdPtyNum->numPlan.val = 0x01;
|
||||
/**************************************************************************/
|
||||
|
||||
cdPtyNum->innInd.pres = PRSNT_NODEF;
|
||||
cdPtyNum->innInd.val = 0x01;
|
||||
/**************************************************************************/
|
||||
cdPtyNum->addrSig.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
|
||||
*/ /* dnis */
|
||||
tmp[1] = '\0';
|
||||
k = 0;
|
||||
j = 0;
|
||||
flag = 0;
|
||||
odd = 0;
|
||||
upper = 0x0;
|
||||
lower = 0x0;
|
||||
|
||||
while (1) {
|
||||
/* 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 (!(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];
|
||||
} /* 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] = ftdm->dnis.digits[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] = ftdm->dnis.digits[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 ST */
|
||||
upper = 0xF0;
|
||||
/* keep the odd flag down */
|
||||
odd = 0;
|
||||
/* throw the end flag */
|
||||
flag = 1;
|
||||
} /* if (tmp != '\0') */
|
||||
} else {
|
||||
/* throw the odd flag */
|
||||
odd = 1;
|
||||
/* need to add the ST */
|
||||
lower = 0xF;
|
||||
upper = 0x0;
|
||||
/* throw the flag */
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
/* push the digits into the trillium structure */
|
||||
cdPtyNum->addrSig.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) */
|
||||
|
||||
cdPtyNum->addrSig.len = j;
|
||||
|
||||
/**************************************************************************/
|
||||
cdPtyNum->oddEven.pres = PRSNT_NODEF;
|
||||
|
||||
cdPtyNum->oddEven.val = odd;
|
||||
|
||||
/**************************************************************************/
|
||||
return 0;
|
||||
|
||||
return copy_tknStr_to_sngss7(caller_data->dnis.digits, &cdPtyNum->addrSig, &cdPtyNum->oddEven);
|
||||
}
|
||||
|
||||
ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb)
|
||||
{
|
||||
const char *val = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SS7_FUNC_TRACE_ENTER(__FUNCTION__);
|
||||
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number qualifier \"%s\"\n", val);
|
||||
if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number qualifier \"%s\"\n", val);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
genNmb->eh.pres = PRSNT_NODEF;
|
||||
genNmb->addrSig.pres = PRSNT_NODEF;
|
||||
|
||||
genNmb->nmbQual.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"%s\"\n", val);
|
||||
genNmb->nmbQual.val = atoi(val);
|
||||
} else {
|
||||
genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual;
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \n");
|
||||
}
|
||||
genNmb->natAddrInd.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"nature of address\" \"%s\"\n", val);
|
||||
genNmb->natAddrInd.val = atoi(val);
|
||||
} else {
|
||||
genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val);
|
||||
}
|
||||
genNmb->scrnInd.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val);
|
||||
genNmb->scrnInd.val = atoi(val);
|
||||
} else {
|
||||
genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val);
|
||||
}
|
||||
genNmb->presRest.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val);
|
||||
genNmb->presRest.val = atoi(val);
|
||||
} else {
|
||||
genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val);
|
||||
}
|
||||
genNmb->numPlan.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val);
|
||||
genNmb->numPlan.val = atoi(val);
|
||||
} else {
|
||||
genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val);
|
||||
}
|
||||
genNmb->niInd.pres = PRSNT_NODEF;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val);
|
||||
genNmb->niInd.val = atoi(val);
|
||||
} else {
|
||||
genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val);
|
||||
}
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb)
|
||||
{
|
||||
char val[64];
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SS7_FUNC_TRACE_ENTER(__FUNCTION__);
|
||||
|
||||
memset(val, 0, sizeof(val));
|
||||
|
||||
if (genNmb->eh.pres != PRSNT_NODEF || genNmb->addrSig.pres != PRSNT_NODEF) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Generic Number available\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
copy_tknStr_from_sngss7(genNmb->addrSig, val, genNmb->oddEven);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number:%s\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_digits", val);
|
||||
|
||||
if (genNmb->nmbQual.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_numqual", val);
|
||||
}
|
||||
|
||||
if (genNmb->natAddrInd.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->natAddrInd.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"nature of address\" \"%s\"\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_nadi", val);
|
||||
}
|
||||
|
||||
if (genNmb->scrnInd.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->scrnInd.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"screening indicator\" \"%s\"\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_screen_ind", val);
|
||||
}
|
||||
|
||||
if (genNmb->presRest.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->presRest.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"presentation indicator\" \"%s\"\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_pres_ind", val);
|
||||
}
|
||||
|
||||
if (genNmb->numPlan.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->numPlan.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"numbering plan\" \"%s\"\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_npi", val);
|
||||
}
|
||||
|
||||
if (genNmb->niInd.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", genNmb->niInd.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number incomplete indicator\" \"%s\"\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_gn_num_inc_ind", val);
|
||||
}
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_digits");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val);
|
||||
if (copy_tknStr_to_sngss7((char*)val, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else if (!ftdm_strlen_zero(caller_data->rdnis.digits)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val);
|
||||
if (copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Number\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number %s\n", caller_data->rdnis.digits);
|
||||
|
||||
redirgNum->eh.pres = PRSNT_NODEF;
|
||||
|
||||
|
@ -351,7 +338,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
|
|||
} 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);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val);
|
||||
|
||||
/* Screening indicator */
|
||||
redirgNum->scrInd.pres = PRSNT_NODEF;
|
||||
|
@ -361,7 +348,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
|
|||
} else {
|
||||
redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED;
|
||||
}
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val);
|
||||
|
||||
/* Address presentation restricted ind */
|
||||
redirgNum->presRest.pres = PRSNT_NODEF;
|
||||
|
@ -372,7 +359,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
|
|||
} else {
|
||||
redirgNum->presRest.val = FTDM_PRES_ALLOWED;
|
||||
}
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val);
|
||||
|
||||
/* Numbering plan */
|
||||
redirgNum->numPlan.pres = PRSNT_NODEF;
|
||||
|
@ -384,18 +371,64 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
|
|||
redirgNum->numPlan.val = caller_data->rdnis.plan;
|
||||
}
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "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_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum)
|
||||
{
|
||||
char val[20];
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
|
||||
if (redirgNum->eh.pres != PRSNT_NODEF || redirgNum->addrSig.pres != PRSNT_NODEF) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Number available\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits);
|
||||
snprintf(val, sizeof(val), "%s", ftdmchan->caller_data.rdnis.digits);
|
||||
sngss7_add_var(sngss7_info, "ss7_rdnis_digits", val);
|
||||
|
||||
|
||||
if (redirgNum->natAddr.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%s\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_rdnis_nadi", val);
|
||||
caller_data->rdnis.type = redirgNum->natAddr.val;
|
||||
}
|
||||
|
||||
if (redirgNum->scrInd.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%s\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val);
|
||||
}
|
||||
|
||||
if (redirgNum->presRest.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", redirgNum->presRest.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Presentation Ind:%s\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val);
|
||||
}
|
||||
|
||||
if (redirgNum->numPlan.pres == PRSNT_NODEF) {
|
||||
snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%s\n", val);
|
||||
sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val);
|
||||
caller_data->rdnis.plan = redirgNum->numPlan.val;
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t j;
|
||||
|
||||
/* check if the token string is present */
|
||||
|
||||
if (str.pres == 1) {
|
||||
j = 0;
|
||||
|
||||
|
@ -564,7 +597,7 @@ int check_for_state_change(ftdm_channel_t *ftdmchan)
|
|||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
|
||||
/* the flag is still up...so we have a problem */
|
||||
SS7_DEBUG_CHAN(ftdmchan, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n",
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n",
|
||||
ftdm_channel_state2str (ftdmchan->state));
|
||||
|
||||
return 1;
|
||||
|
@ -1606,7 +1639,7 @@ void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_statu
|
|||
ftdm_sigmsg_t sig;
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Signalling link status changed to %s\n",
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n",
|
||||
ftdm_signaling_status2str(status));
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
|
@ -1660,12 +1693,12 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
|
|||
|
||||
/* check if the interface is paused or resumed */
|
||||
if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is PAUSED\n", sngss7_intf->id);
|
||||
/* throw the pause flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is RESUMED\n", sngss7_intf->id);
|
||||
/* throw the resume flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
|
|
|
@ -124,6 +124,7 @@ typedef struct sng_ccSpan
|
|||
uint32_t cld_nadi;
|
||||
uint32_t rdnis_nadi;
|
||||
uint32_t min_digits;
|
||||
uint32_t itx_auto_reply;
|
||||
uint32_t t3;
|
||||
uint32_t t12;
|
||||
uint32_t t13;
|
||||
|
@ -1892,7 +1893,9 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)
|
|||
sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type;
|
||||
SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type);
|
||||
}
|
||||
/**********************************************************************/
|
||||
} else if (!strcasecmp(parm->var, "itx_auto_reply")) {
|
||||
sng_ccSpan.itx_auto_reply = ftdm_true(parm->val);
|
||||
SS7_DEBUG("Found itx_auto_reply %d\n", sng_ccSpan.itx_auto_reply);
|
||||
} else if (!strcasecmp(parm->var, "cicbase")) {
|
||||
/**********************************************************************/
|
||||
sng_ccSpan.cicbase = atoi(parm->val);
|
||||
|
@ -2913,6 +2916,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
|
|||
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].min_digits = ccSpan->min_digits;
|
||||
g_ftdm_sngss7_data.cfg.isupCkt[x].itx_auto_reply = ccSpan->itx_auto_reply;
|
||||
|
||||
if (ccSpan->t3 == 0) {
|
||||
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200;
|
||||
|
|
Loading…
Reference in New Issue