Hello All,


I'm receiving calls on, say IP 1.2.3.4 and i want to send them out on IP 1.2.3.4 or IP 5.6.7.8 depending on the gateway I want to use.
For this, i created TWO profiles, one binding to IP1, the other to IP2.
Then I created one gateway on each profile.

BUT, FS is loading both GWs on BOTH PROFILES!

Is this normal? Can anyone give me a hand with this?

Thanks!

David

my fs-cli output:

freeswitch@127.0.0.1@internal> sofia xmlstatus

<?xml version="1.0" encoding="ISO-8859-1"?>
<profiles>
<profile>
<name>IP_REAL</name>
<type>profile</type>
<data>sip:mod_sofia@1.2.3.4:5060</data>
<state>RUNNING (0)</state>
</profile>
<gateway>
<name>example.com</name>
<type>gateway</type>
<data>sip:@example.com</data>
<state>NOREG</state>
</gateway>

<gateway>
<name>test</name>
<type>gateway</type>
<data>sip:@Y.Y.Y.Y</data>
<state>NOREG</state>
</gateway>

<gateway>
<name>GREAT</name>
<type>gateway</type>
<data>sip:@X.X.X.X</data>
<state>NOREG</state>
</gateway>

<profile>
<name>IP_SPAIN_1</name>
<type>profile</type>
<data>sip:mod_sofia@5.6.7.8:5060</data>
<state>RUNNING (0)</state>
</profile>
<gateway>
<name>example.com</name>
<type>gateway</type>
<data>sip:@example.com</data>
<state>NOREG</state>
</gateway>

<gateway>
<name>test</name>
<type>gateway</type>
<data>sip:@Y.Y.Y.Y</data>
<state>NOREG</state>
</gateway>

<gateway>
<name>GREAT</name>
<type>gateway</type>
<data>sip:@X.X.X.X</data>
<state>NOREG</state>
</gateway>

</profiles>

My sofia:

     <configuration name="sofia.conf" description="sofia Endpoint">
     
       <global_settings>
         <param name="log-level" value="0"/>
         <!-- <param name="auto-restart" value="false"/> -->
         <param name="debug-presence" value="0"/>
       </global_settings>


            <profiles>
     
                 <profile name="IP_REAL">
                      <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files --> 
                      <!-- This profile is only for outbound registrations to providers -->
                      <gateways>
                    
          
                         <gateway name="test">
                              <param name="realm" value="Y.Y.Y.Y"/>
                              <param name="username" value=""/>
                              <param name="password" value=""/>
                              <param name="register" value="false"/>
                              <param name="retry-seconds" value="30"/>
                              <param name="caller-id-in-from" value="true"/>
                         </gateway>
                              
                      </gateways>
                    
                      <aliases>
                        <!-- 
                        <alias name="outbound"/>
                        <alias name="nat"/>
                        -->
                      </aliases>
                    
                      <domains>
                        <domain name="all" alias="false" parse="true"/>
                      </domains>
                    
                      <settings>
                        <param name="debug" value="0"/>
                     <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
                     <!-- <param name="shutdown-on-fail" value="true"/> -->
                        <param name="sip-trace" value="no"/>
                        <param name="rfc2833-pt" value="101"/>
                        <param name="sip-port" value="5060"/>
                    <!--    <param name="sip-port" value="5061"/>                         -->
                        <param name="dialplan" value="XML"/> 
                        <param name="context" value="IP_REAL"/>
                        <param name="dtmf-duration" value="2000"/>
                        <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
                        <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
                        <param name="hold-music" value="$${hold_music}"/>
                        <param name="rtp-timer-name" value="soft"/>
                        <!--<param name="enable-100rel" value="true"/>-->
                        <!-- This could be set to "passive" -->
                        <param name="local-network-acl" value="localnet.auto"/>
                        <param name="manage-presence" value="false"/>
                    
                        <!-- used to share presence info across sofia profiles 
                      manage-presence needs to be set to passive on this profile
                      if you want it to behave as if it were the internal profile 
                      for presence.
                        -->
                        <!-- Name of the db to use for this profile -->
                        <!--<param name="dbname" value="share_presence"/>-->
                        <!--<param name="presence-hosts" value="$${domain}"/>-->
                        <!--<param name="force-register-domain" value="$${domain}"/>-->
                        <!--all inbound reg will stored in the db using this domain -->
                        <!--<param name="force-register-db-domain" value="$${domain}"/>-->
                        <!-- ************************************************* -->
                    
                        <param name="apply-nat-acl" value="rfc1918"/>
                        <param name="aggressive-nat-detection" value="true"/>
                        <param name="inbound-codec-negotiation" value="generous"/>
                        <param name="nonce-ttl" value="60"/>
                        <param name="auth-calls" value="false"/>
                        <!--
                     DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
                        -->
                        <param name="rtp-ip" value="1.2.3.4"/>
                        <param name="sip-ip" value="1.2.3.4"/>
                        <param name="ext-rtp-ip" value="auto-nat"/>
                        <param name="ext-sip-ip" value="auto-nat"/>
                        <param name="rtp-timeout-sec" value="3600"/>
                        <param name="rtp-hold-timeout-sec" value="1800"/>
                        <!--<param name="enable-3pcc" value="true"/>-->
                    
                        <!-- TLS: disabled by default, set to "true" to enable -->
                        <param name="tls" value="$${external_ssl_enable}"/>
                        <!-- additional bind parameters for TLS -->
                        <param name="tls-bind-params" value="transport=tls"/>
                        <!-- Port to listen on for TLS requests. (5081 will be used if unspecified) -->
                        <param name="tls-sip-port" value="$${external_tls_port}"/>
                        <!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
                        <param name="tls-cert-dir" value="$${external_ssl_dir}"/>
                        <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
                        <param name="tls-version" value="$${sip_tls_version}"/>
                    
                      </settings>
                    </profile>
     
                 <profile name="IP_SPAIN_1">
                      <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files --> 
                      <!-- This profile is only for outbound registrations to providers -->
                      <gateways>
                    
          
                         <gateway name="GREAT">
                              <param name="realm" value="X.X.X.X"/>
                              <param name="username" value=""/>
                              <param name="password" value=""/>
                              <param name="register" value="false"/>
                              <param name="retry-seconds" value="30"/>
                              <param name="caller-id-in-from" value="true"/>
                         </gateway>
                              
                      </gateways>
                    
                      <aliases>
                        <!-- 
                        <alias name="outbound"/>
                        <alias name="nat"/>
                        -->
                      </aliases>
                    
                      <domains>
                        <domain name="all" alias="false" parse="true"/>
                      </domains>
                    
                      <settings>
                        <param name="debug" value="0"/>
                     <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
                     <!-- <param name="shutdown-on-fail" value="true"/> -->
                        <param name="sip-trace" value="no"/>
                        <param name="rfc2833-pt" value="101"/>
                        <param name="sip-port" value="5060"/>
                    <!--    <param name="sip-port" value="5061"/>                         -->
                        <param name="dialplan" value="XML"/> 
                        <param name="context" value="IP_SPAIN_1"/>
                        <param name="dtmf-duration" value="2000"/>
                        <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
                        <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
                        <param name="hold-music" value="$${hold_music}"/>
                        <param name="rtp-timer-name" value="soft"/>
                        <!--<param name="enable-100rel" value="true"/>-->
                        <!-- This could be set to "passive" -->
                        <param name="local-network-acl" value="localnet.auto"/>
                        <param name="manage-presence" value="false"/>
                    
                        <!-- used to share presence info across sofia profiles 
                      manage-presence needs to be set to passive on this profile
                      if you want it to behave as if it were the internal profile 
                      for presence.
                        -->
                        <!-- Name of the db to use for this profile -->
                        <!--<param name="dbname" value="share_presence"/>-->
                        <!--<param name="presence-hosts" value="$${domain}"/>-->
                        <!--<param name="force-register-domain" value="$${domain}"/>-->
                        <!--all inbound reg will stored in the db using this domain -->
                        <!--<param name="force-register-db-domain" value="$${domain}"/>-->
                        <!-- ************************************************* -->
                    
                        <param name="apply-nat-acl" value="rfc1918"/>
                        <param name="aggressive-nat-detection" value="true"/>
                        <param name="inbound-codec-negotiation" value="generous"/>
                        <param name="nonce-ttl" value="60"/>
                        <param name="auth-calls" value="false"/>
                        <!--
                     DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
                        -->
                        <param name="rtp-ip" value="5.6.7.8"/>
                        <param name="sip-ip" value="5.6.7.8"/>
                        <param name="ext-rtp-ip" value="auto-nat"/>
                        <param name="ext-sip-ip" value="auto-nat"/>
                        <param name="rtp-timeout-sec" value="3600"/>
                        <param name="rtp-hold-timeout-sec" value="1800"/>
                        <!--<param name="enable-3pcc" value="true"/>-->
                    
                        <!-- TLS: disabled by default, set to "true" to enable -->
                        <param name="tls" value="$${external_ssl_enable}"/>
                        <!-- additional bind parameters for TLS -->
                        <param name="tls-bind-params" value="transport=tls"/>
                        <!-- Port to listen on for TLS requests. (5081 will be used if unspecified) -->
                        <param name="tls-sip-port" value="$${external_tls_port}"/>
                        <!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
                        <param name="tls-cert-dir" value="$${external_ssl_dir}"/>
                        <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
                        <param name="tls-version" value="$${sip_tls_version}"/>
                    
                      </settings>
                    </profile>
     
       </profiles>
     
     </configuration>