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

Freeswitch SVN anthm at freeswitch.org
Fri Jan 26 16:12:20 EST 2007


Author: anthm
Date: Fri Jan 26 16:12:19 2007
New Revision: 4062

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

Log:
add sip_call_id variable to sofia

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Jan 26 16:12:19 2007
@@ -306,6 +306,7 @@
 	char *chat_from;
 	char *chat_to;
 	char *e_dest;
+    char *call_id;
 	unsigned long rm_rate;
 	switch_payload_t pt;
 	switch_mutex_t *flag_mutex;
@@ -800,6 +801,7 @@
 	}
 }
 
+
 static void attach_private(switch_core_session_t *session,
 						   sofia_profile_t *profile,
 						   private_object_t *tech_pvt,
@@ -829,6 +831,7 @@
 	tech_set_codecs(tech_pvt);
 	snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
     switch_channel_set_name(channel, name);
+
 }
 
 static void terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line)
@@ -2632,9 +2635,8 @@
 
 		tech_pvt = switch_core_session_get_private(session);
 		assert(tech_pvt != NULL);
-		
-		tech_pvt->nh = nh;
-		
+        assert(tech_pvt->nh != NULL);
+
 		if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
             switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
         }
@@ -4223,6 +4225,11 @@
     switch_channel_set_variable(channel, "sip_contact_host", contact_host);
     switch_channel_set_variable(channel, "sip_contact_port", contact_port);
 
+    if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
+        tech_pvt->call_id = switch_core_session_strdup(session, (char *)sip->sip_call_id->i_id);
+        switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
+    }
+
     via_host = (char *) sip->sip_via->v_host;
     if (!(via_port = (char *) sip->sip_via->v_port)) {
         via_port = "5060";
@@ -4324,7 +4331,7 @@
     memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
     switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
     nua_handle_bind(nh, tech_pvt->sofia_private);
-
+    tech_pvt->nh = nh;
 }
 
 static void sip_i_register(nua_t *nua,
@@ -4500,7 +4507,10 @@
                 if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
                     switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
                 }
-
+                if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
+                    tech_pvt->call_id = switch_core_session_strdup(session, (char *)sip->sip_call_id->i_id);
+                    switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
+                }
             } else {
                 /* too late */
                 return;            



More information about the Freeswitch-svn mailing list