freetdm: Only hangup with user message when release location information is set

This commit is contained in:
James Zhang 2012-01-30 18:02:26 -05:00
parent c1ad567742
commit d1a772bfe9

View File

@ -506,10 +506,6 @@ 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);
@ -577,19 +573,20 @@ 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;
const char *var = NULL;
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);
var = switch_channel_get_variable(channel, "ss7_rel_loc");
if (var) {
ftdm_usrmsg_t usrmsg;
memset(&usrmsg, 0, sizeof(ftdm_usrmsg_t));
ftdm_usrmsg_add_var(&usrmsg, "ss7_rel_loc", var);
ftdm_channel_call_hangup_with_cause_ex(tech_pvt->ftdmchan, hcause, &usrmsg);
} else {
ftdm_channel_call_hangup_with_cause(tech_pvt->ftdmchan, hcause);
}
/*
ftdm_channel_call_hangup_with_cause(tech_pvt->ftdmchan, hcause);
*/
ftdm_channel_call_hangup_with_cause_ex(tech_pvt->ftdmchan, hcause, &usrmsg);
}
break;
default: