[Freeswitch-trunk] [commit] r6988 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN brian at freeswitch.org
Wed Dec 26 17:41:40 EST 2007


Author: brian
Date: Wed Dec 26 17:41:40 2007
New Revision: 6988

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
collect info from bye and so we can get it in cdr

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Wed Dec 26 17:41:40 2007
@@ -106,6 +106,33 @@
 	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 @@
 	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:



More information about the Freeswitch-trunk mailing list