forked from Mirrors/freeswitch
ss7: Adding support of Access Transport IE in IAM message
Adding sip x-header and channel variable to set the value of Access Transport IE
This commit is contained in:
parent
4f5a6557fc
commit
ce46a57b85
@ -1400,6 +1400,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
if (sipvar) {
|
||||
ftdm_set_string(caller_data.loc.digits, sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Access-Transport");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_access_transport_urlenc", sipvar);
|
||||
}
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-LOC-Screen");
|
||||
if (sipvar) {
|
||||
@ -1865,6 +1870,11 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc));
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_access_transport_urlenc");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Access-Transport", "%s", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_indicator");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Indicator", "%s", var_value);
|
||||
|
@ -221,6 +221,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
} else {
|
||||
SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " ");
|
||||
}
|
||||
copy_access_transport_from_sngss7(ftdmchan, &siConEvnt->accTrnspt);
|
||||
copy_ocn_from_sngss7(ftdmchan, &siConEvnt->origCdNum);
|
||||
copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum);
|
||||
copy_redirgInfo_from_sngss7(ftdmchan, &siConEvnt->redirInfo);
|
||||
|
@ -916,6 +916,8 @@ ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *r
|
||||
ftdm_status_t copy_ocn_to_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum);
|
||||
ftdm_status_t copy_ocn_from_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum);
|
||||
|
||||
ftdm_status_t copy_access_transport_from_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt);
|
||||
ftdm_status_t copy_access_transport_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt);
|
||||
ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum);
|
||||
ftdm_status_t copy_locPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum);
|
||||
ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb);
|
||||
|
@ -138,6 +138,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
/* Original Called Number */
|
||||
copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum);
|
||||
}
|
||||
copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt);
|
||||
}
|
||||
} else if (sngss7_info->circuit->transparent_iam &&
|
||||
sngss7_retrieve_iam(ftdmchan, &iam) == FTDM_SUCCESS) {
|
||||
@ -160,6 +161,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
|
||||
/* Original Called Number */
|
||||
copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum);
|
||||
|
||||
copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt);
|
||||
} else {
|
||||
/* Nature of Connection Indicators */
|
||||
copy_natConInd_to_sngss7(ftdmchan, &iam.natConInd);
|
||||
@ -199,8 +202,13 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
/* Original Called Number */
|
||||
copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum);
|
||||
|
||||
/* Access Transport */
|
||||
/* Access Transport - old implementation, taking from channel variable of ss7_clg_subaddr */
|
||||
copy_accTrnspt_to_sngss7(ftdmchan, &iam.accTrnspt);
|
||||
|
||||
/* Access Transport - taking from channel variable of ss7_access_transport_urlenc.
|
||||
This will overwirte the IE value set be above old implementation.
|
||||
*/
|
||||
copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d), loc = %s (NADI=%d)\n",
|
||||
sngss7_info->circuit->cic,
|
||||
|
@ -637,6 +637,49 @@ ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *r
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_access_transport_from_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt)
|
||||
{
|
||||
char *val=NULL;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
if (accTrnspt->eh.pres != PRSNT_NODEF || accTrnspt->infoElmts.pres !=PRSNT_NODEF) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Access Transport IE available\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
val = ftdm_malloc(3*accTrnspt->infoElmts.len);
|
||||
ftdm_url_encode((const char*)accTrnspt->infoElmts.val, val, accTrnspt->infoElmts.len);
|
||||
sngss7_add_var (sngss7_info, "ss7_access_transport_urlenc", val);
|
||||
ftdm_safe_free(val);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
ftdm_status_t copy_access_transport_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt)
|
||||
{
|
||||
const char *val = NULL;
|
||||
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_access_transport_urlenc");
|
||||
if (ftdm_strlen_zero(val)) {
|
||||
accTrnspt->eh.pres = NOTPRSNT;
|
||||
accTrnspt->infoElmts.pres = NOTPRSNT;
|
||||
}
|
||||
else {
|
||||
char *val_dec = NULL;
|
||||
int val_len = strlen (val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found Access Transport IE encoded : %s\n", val);
|
||||
|
||||
accTrnspt->eh.pres = PRSNT_NODEF;
|
||||
accTrnspt->infoElmts.pres = PRSNT_NODEF;
|
||||
|
||||
val_dec = ftdm_strdup(val);
|
||||
ftdm_url_decode(val_dec, (ftdm_size_t*)&val_len);
|
||||
memcpy (accTrnspt->infoElmts.val, val_dec, val_len);
|
||||
accTrnspt->infoElmts.len = val_len;
|
||||
ftdm_safe_free(val_dec);
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_ocn_from_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum)
|
||||
{
|
||||
char val[20];
|
||||
|
Loading…
Reference in New Issue
Block a user