From e04f9ba9fe30cfde184d63323cbed2ae75a91a63 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Nov 2011 13:52:43 -0600 Subject: [PATCH] move the thing that passes proto_specific_hangup_cause to the core and prefix it with last_bridge_ and also log last_bridge_hangup_cauuse for good measure --- src/mod/endpoints/mod_sofia/sofia.c | 2 -- src/switch_channel.c | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 59a9d5734a..1e82aa7f60 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -545,7 +545,6 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, switch_snprintf(st, sizeof(st), "%d", status); switch_channel_set_variable(channel, "sip_term_status", st); switch_snprintf(st, sizeof(st), "sip:%d", status); - switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st); switch_channel_set_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st); if (phrase) { @@ -6027,7 +6026,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_snprintf(st, sizeof(st), "%d", status); switch_channel_set_variable(channel, "sip_term_status", st); switch_snprintf(st, sizeof(st), "sip:%d", status); - switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st); switch_channel_set_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st); if (phrase) { switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase); diff --git a/src/switch_channel.c b/src/switch_channel.c index 6902ac7ad8..8af8c25c37 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2811,6 +2811,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan if (channel->state < CS_HANGUP) { switch_channel_state_t last_state; switch_event_t *event; + const char *var; switch_mutex_lock(channel->state_mutex); last_state = channel->state; @@ -2829,6 +2830,14 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause)); + switch_channel_set_variable_partner(channel, "last_bridge_hangup_cause", switch_channel_cause2str(hangup_cause)); + + if ((var = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE))) { + printf("WTF %s\n", var); + switch_channel_set_variable_partner(channel, "last_bridge_" SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, var); + } + + if (!switch_core_session_running(channel->session) && !switch_core_session_started(channel->session)) { switch_core_session_thread_launch(channel->session); }