FreeTDM: adding variable ss7_rel_loc for REL location indicator (to support SPIROU)

This commit is contained in:
James Zhang 2012-01-26 16:39:43 -05:00
parent 90f538c0a0
commit 98d566b29c
2 changed files with 21 additions and 1 deletions

View File

@ -506,6 +506,9 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
int chan_id = 0;
const char *name = NULL;
ftdm_usrmsg_t usrmsg;
memset(&usrmsg, 0, sizeof(ftdm_usrmsg_t));
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@ -574,11 +577,19 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
case FTDM_CHAN_TYPE_CAS:
case FTDM_CHAN_TYPE_B:
{
const char *sipvar;
ftdm_call_cause_t hcause = switch_channel_get_cause_q850(channel);
if (hcause < 1 || hcause > 127) {
hcause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER;
}
sipvar = switch_channel_get_variable(channel, "ss7_rel_loc");
if (sipvar) {
ftdm_usrmsg_add_var(&usrmsg, "ss7_rel_loc", sipvar);
}
/*
ftdm_channel_call_hangup_with_cause(tech_pvt->ftdmchan, hcause);
*/
ftdm_channel_call_hangup_with_cause_ex(tech_pvt->ftdmchan, hcause, &usrmsg);
}
break;
default:

View File

@ -259,6 +259,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
/******************************************************************************/
void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
{
const char *loc_ind = NULL;
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
@ -268,7 +269,15 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
rel.causeDgn.eh.pres = PRSNT_NODEF;
rel.causeDgn.location.pres = PRSNT_NODEF;
rel.causeDgn.location.val = 0x01;
loc_ind = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rel_loc");
if (!ftdm_strlen_zero(loc_ind)) {
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied location indicator in REL, value \"%s\"\n", loc_ind);
rel.causeDgn.location.val = atoi(loc_ind);
} else {
rel.causeDgn.location.val = 0x01;
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied location indicator in REL, using 0x01\"%s\"\n", "");
}
rel.causeDgn.cdeStand.pres = PRSNT_NODEF;
rel.causeDgn.cdeStand.val = 0x00;
rel.causeDgn.recommend.pres = NOTPRSNT;