]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add params to use sip callid as uuid on inbound calls and uuid as sip callid on outbo...
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 15 Nov 2008 17:44:27 +0000 (17:44 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 15 Nov 2008 17:44:27 +0000 (17:44 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10418 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index e742a2189c1cf28ffb0bea4e7deea7124c5bfb21..7d64b6ddc71a71c3781fb062950ce76e0a12edb3 100644 (file)
     -->
     <param name="challenge-realm" value="auto_from"/>
     <!--<param name="disable-rtp-auto-adjust" value="true"/>-->
+    <!-- on inbound calls make the uuid of the session equal to the sip call id of that call -->
+    <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
+    <!-- on outbound calls set the callid to match the uuid of the session -->
+    <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
   </settings>
 </profile>
 
index a83ab6b04802924fada2e0955ab7cbc577202ce4..5950f7f6a18bfefd1ca79c54bf304ab49f500527 100644 (file)
@@ -164,7 +164,9 @@ typedef enum {
        PFLAG_FUNNY_STUN = (1 << 26),
        PFLAG_STUN_ENABLED = (1 << 27),
        PFLAG_STUN_AUTO_DISABLE = (1 << 28),
-       PFLAG_3PCC_PROXY = (1 << 29)
+       PFLAG_3PCC_PROXY = (1 << 29),
+       PFLAG_CALLID_AS_UUID = (1 << 30),
+       PFLAG_UUID_AS_CALLID = (1 << 31)
 } PFLAGS;
 
 typedef enum {
index 425161b771d61e71a751531b429bf372a71d05dd..dc66dfdf5b983901022d7716707e818ce5184802 100644 (file)
@@ -1075,6 +1075,18 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                } else {
                                                        switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
                                                }
+                                       } else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
+                                               if (switch_true(val)) {
+                                                       profile->pflags |= PFLAG_CALLID_AS_UUID;
+                                               } else {
+                                                       profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+                                               }
+                                       } else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
+                                               if (switch_true(val)) {
+                                                       profile->pflags |= PFLAG_UUID_AS_CALLID;
+                                               } else {
+                                                       profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+                                               }
                                        } else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact")) {
                                                if (switch_true(val)) {
                                                        profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
@@ -1474,6 +1486,18 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
                                        } else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
                                                switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+                                       } else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
+                                               if (switch_true(val)) {
+                                                       profile->pflags |= PFLAG_CALLID_AS_UUID;
+                                               } else {
+                                                       profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+                                               }
+                                       } else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
+                                               if (switch_true(val)) {
+                                                       profile->pflags |= PFLAG_UUID_AS_CALLID;
+                                               } else {
+                                                       profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+                                               }
                                        } else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
                                                profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
                                        } else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
@@ -3497,7 +3521,15 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                return;
        }
 
-       if (!sofia_endpoint_interface || !(session = switch_core_session_request(sofia_endpoint_interface, NULL))) {
+       if (sofia_endpoint_interface) {
+               if (tech_pvt->profile->pflags & PFLAG_CALLID_AS_UUID) {
+                       session = switch_core_session_request_uuid(sofia_endpoint_interface, NULL, sip->sip_call_id->i_id);
+               } else {
+                       session = switch_core_session_request(sofia_endpoint_interface, NULL);
+               }
+       }
+
+       if (!session) {
                nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
                return;
        }
index 38f7b74e4539ef1b567405417d126a215f482cca..2645e02ec3d99f28d911ad97acf9594ea2ebf835 100644 (file)
@@ -1189,7 +1189,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
                
                if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
-                       call_id = switch_core_session_get_uuid(session);
+                       if (tech_pvt->profile->pflags & PFLAG_UUID_AS_CALLID) {
+                               call_id = switch_core_session_get_uuid(session);
+                       }
                }
                
                tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,