]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add from-user param to gateways
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Nov 2007 22:45:15 +0000 (22:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Nov 2007 22:45:15 +0000 (22:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6293 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/directory/default.xml
conf/sip_profiles/default.xml
src/mod/endpoints/mod_sofia/sofia.c

index bcd4274adc7a1825ba48f4bae46ebe99057e40d7..81666f9f5ca9e4541ab2e65f9d7b88575881dce5 100644 (file)
@@ -18,6 +18,8 @@
       <!--<param name="username" value="cluecon"/>-->
       <!--/// auth realm: *optional* same as gateway name, if blank ///-->
       <!--<param name="realm" value="asterlink.com"/>-->
+      <!--/// username to use in from: *optional* same as  username, if blank ///-->
+      <!--<param name="from-user" value="cluecon"/>-->
       <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
       <!--<param name="from-domain" value="asterlink.com"/>-->
       <!--/// account password *required* ///-->
index a7f53310ccadc7f8783716d92a0a15badf44a872..91c7cdfe16aa64648967f85c26f9085db02a19a2 100644 (file)
@@ -10,6 +10,8 @@
     <!--<param name="username" value="cluecon"/>-->
     <!--/// auth realm: *optional* same as gateway name, if blank ///-->
     <!--<param name="realm" value="asterlink.com"/>-->
+    <!--/// username to use in from: *optional* same as  username, if blank ///-->
+    <!--<param name="from-user" value="cluecon"/>-->
     <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
     <!--<param name="from-domain" value="asterlink.com"/>-->
     <!--/// account password *required* ///-->
index d48e2400ada8a3dd182976d4859999cbeab1ad7b..b445b5e42af3311c47ad2d252f029e84768fc902 100644 (file)
@@ -561,6 +561,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                *context = "default",
                                *expire_seconds = "3600",
                                *retry_seconds = "30",
+                               *from_user = "",
                                *from_domain = "",
                                *register_proxy = NULL,
                                *contact_params = NULL,
@@ -599,6 +600,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                        expire_seconds = val;
                                } else if (!strcmp(var, "retry-seconds")) {
                                        retry_seconds = val;
+                               } else if (!strcmp(var, "from-user")) {
+                                       from_user = val;
                                } else if (!strcmp(var, "from-domain")) {
                                        from_domain = val;
                                } else if (!strcmp(var, "register-proxy")) {
@@ -629,6 +632,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                goto skip;
                        }
 
+                       if (switch_strlen_zero(from_user)) {
+                               from_user = username;
+                       }
+
                        if (switch_strlen_zero(extension)) {
                                extension = username;
                        }
@@ -672,9 +679,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
                        }
                        
-
+                       
                        gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", register_proxy,register_transport);
-                       gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", username, from_domain, register_transport);
+                       gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
                        gateway->register_contact = switch_core_sprintf(gateway->pool, "<sip:%s@%s:%d%s>", extension,
                                                                                                                        profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port, params);