git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7489 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-02-02 00:49:25 +00:00
parent 5011d94020
commit b743d2b6ed
3 changed files with 18 additions and 3 deletions

View File

@ -280,7 +280,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
char reason[128] = "";
switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
if (cause < 128) {
switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
} else {
switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
} else {

View File

@ -396,6 +396,7 @@ struct private_object {
char *video_fmtp_out;
uint32_t video_count;
sofia_dtmf_t dtmf_type;
int q850_cause;
};
struct callback_t {

View File

@ -136,6 +136,15 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
if (!session) return;
channel = switch_core_session_get_channel(session);
if (sip->sip_reason && sip->sip_reason->re_protocol &&
(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) &&
sip->sip_reason->re_cause) {
private_object_t *tech_pvt = switch_core_session_get_private(session);
tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
}
if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
}
@ -1784,8 +1793,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
} else {
int cause;
if (sip->sip_reason && sip->sip_reason->re_protocol && !strcasecmp(sip->sip_reason->re_protocol, "Q.850") && sip->sip_reason->re_cause) {
cause = atoi(sip->sip_reason->re_cause);
if (tech_pvt->q850_cause) {
cause = tech_pvt->q850_cause;
} else {
cause = sofia_glue_sip_cause_to_freeswitch(status);
}