]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add from-domain param to sofia.conf for mmurdock
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 12 May 2007 17:57:30 +0000 (17:57 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 12 May 2007 17:57:30 +0000 (17:57 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5166 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 4355fe0ccfddd10e8a9ba169b84715e53e13f649..932d3beaad938cc5c738b68831ae7795815475c4 100644 (file)
@@ -9,6 +9,8 @@
       <!--<param name="username" value="cluecon"/>-->
       <!--/// auth realm: *optional* same as gateway name, if blank ///-->
       <!--<param name="realm" value="asterlink.com"/>-->
+      <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+      <!--<param name="from-domain" value="asterlink.com"/>-->
       <!--/// account password *required* ///-->
       <!--<param name="password" value="2007"/>--> 
       <!--/// replace the INVITE from user with the channel's caller-id ///-->
       <!--<param name="expire-seconds" value="60"/>-->
       <!--/// do not register ///-->
       <!--<param name="register" value="false"/>-->
+      <!--How many seconds before a retry when a failure or timeout occurs -->
+      <!--<param name="retry_seconds" value="30"/>-->
+      <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
+      <!--<param name="caller-id-in-from" value="false"/>-->
       <!--</gateway>-->
     </gateways>
     <params>
index a812eba556552e75e756271d297949492ca9702b..66c52fae2ab46baa58535769d1826da40eef30b3 100644 (file)
@@ -12,6 +12,8 @@
          <!--<param name="username" value="cluecon"/>-->
          <!--/// auth realm: *optional* same as gateway name, if blank ///-->
          <!--<param name="realm" value="asterlink.com"/>-->
+         <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+         <!--<param name="from-domain" value="asterlink.com"/>-->
          <!--/// account password *required* ///-->
          <!--<param name="password" value="2007"/>--> 
          <!--/// replace the INVITE from user with the channel's caller-id ///-->
index fbc6ee048ddf5ee78bfe7b9b8a09a9e047051d4d..09c2c665ac3185931ec470691b26434511370f7c 100644 (file)
@@ -476,7 +476,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                *proxy = NULL,
                                *context = "default",
                                *expire_seconds = "3600",
-                               *retry_seconds = "30";
+                               *retry_seconds = "30",
+                               *from_domain = "";
                        
                        gateway->pool = profile->pool;
                        gateway->profile = profile;
@@ -510,6 +511,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-domain")) {
+                                       from_domain = val;
                                }
                        }
 
@@ -539,6 +542,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                gateway->state = REG_STATE_NOREG;
                        }
 
+                       if (switch_strlen_zero(from_domain)) {
+                               from_domain = realm;
+                       }
+
                        gateway->retry_seconds = atoi(retry_seconds);
                        if (gateway->retry_seconds < 10) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "INVALID: retry_seconds correcting the value to 30\n");
@@ -552,7 +559,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                        if (switch_true(caller_id_in_from)) {
                                switch_set_flag(gateway, REG_FLAG_CALLERID);
                        }
-                       gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm);
+                       gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, from_domain);
                        gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port);
 
                        if (!strncasecmp(proxy, "sip:", 4)) {