From ed8051537a5be3f21301f5d710c0a7a493994453 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 26 Dec 2007 22:41:40 +0000 Subject: [PATCH] collect info from bye and so we can get it in cdr git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6988 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f59400baa4..32101d791d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -106,6 +106,33 @@ error: return; } +void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, + char const *phrase, + nua_t *nua, + sofia_profile_t *profile, + nua_handle_t *nh, + sofia_private_t *sofia_private, + sip_t const *sip, + tagi_t tags[]) +{ + switch_channel_t *channel = NULL; + const char *rtp_txstat_header; + const char *rtp_rxstat_header; + if (session) { + channel = switch_core_session_get_channel(session); + 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); + } + if ((rtp_txstat_header = sofia_glue_get_unknown_header(sip, "rtp-txstat"))) { + switch_channel_set_variable(channel, "sip_rtp_txstat", rtp_txstat_header); + } + if ((rtp_rxstat_header = sofia_glue_get_unknown_header(sip, "rtp-rxstat"))) { + switch_channel_set_variable(channel, "sip_rtp_rxstat", rtp_rxstat_header); + } + + } + return; +} void sofia_event_callback(nua_event_t event, int status, @@ -222,7 +249,10 @@ void sofia_event_callback(nua_event_t event, case nua_i_fork: case nua_r_info: case nua_r_bye: + break; case nua_i_bye: + sofia_handle_sip_i_bye(session, status, phrase, nua, profile, nh, sofia_private, sip, tags); + break; case nua_r_unsubscribe: case nua_r_publish: case nua_i_cancel: