<p>Hello world,</p><p>I have two freeswitch servers that I want to interconnect.
Each one of them has their own sip domain and we want to enable sip
communications between them. All the PC can ping together.</p><p>Client #1
------- Freeswitch #1 --(gateway)--- Freeswitch #2 ------ Client# 2.</p><p>We
have configured a sip gateway on Freeswitch #1 server with the configuration
below:</p><p>C:\Program
Files\FreeSWITCH\conf\sip_profiles\external\gw.xml</p><p>&lt;include&gt; <br
/>  &lt;gateway
name=&quot;gw&quot;&gt;                                               <br /> 
&lt;param name=&quot;username&quot; value=&quot;3000&quot;/&gt; <br /> 
&lt;param name=&quot;realm&quot; value=&quot;192.168.2.10&quot;/&gt; <br /> 
&lt;param name=&quot;from-domain&quot; value=&quot;192.168.2.10&quot;/&gt; <br
/>  &lt;param name=&quot;password&quot; value=&quot;2009&quot;/&gt; <br /> 
&lt;param name=&quot;expire-seconds&quot; value=&quot;3600&quot;/&gt; <br /> 
&lt;param name=&quot;register-transport&quot; value=&quot;udp&quot;/&gt; <br
/>  &lt;param name=&quot;retry-seconds&quot; value=&quot;30&quot;/&gt; <br /> 
&lt;param name=&quot;ping&quot; value=&quot;25&quot;/&gt; <br /> 
&lt;/gateway&gt; <br />&lt;/include&gt;</p><p>C:\Program
Files\FreeSWITCH\conf\dialplan\default\01_example.com.xml</p><p>&lt;include&gt;</p><p>&lt;extension
name=&quot;gw&quot;&gt; <br />  &lt;!--&lt;condition
field=&quot;${toll_allow}&quot; expression=&quot;gw&quot;/&gt;  --&gt;<br /> 
&lt;condition field=&quot;destination_number&quot;
expression=&quot;^(30[0-2][0-9])$&quot;&gt; <br />    &lt;action
application=&quot;bridge&quot; data=&quot;<a
href="mailto:sofia/gateway/gw/$1@192.168.2.10"/">sofia/gateway/gw/$1@192.168.2.10&quot;/</a>&gt;
<br />  &lt;/condition&gt; <br
/>&lt;/extension&gt;</p><p>&lt;/include&gt;</p><p>In the Freeswitch #2 server,
we have configured the 3000 extension:</p><p>C:\Program
Files\FreeSWITCH\conf\directory\default\3000.xml</p><p>&lt;include&gt;<br /> 
&lt;user id=&quot;3000&quot; mailbox=&quot;3000&quot;&gt;<br />   
&lt;params&gt;<br />      &lt;param name=&quot;password&quot;
value=&quot;1234&quot;/&gt;<br />      &lt;param name=&quot;vm-password&quot;
value=&quot;1000&quot;/&gt;<br />    &lt;/params&gt;<br />   
&lt;variables&gt;<br />      &lt;variable name=&quot;toll_allow&quot;
value=&quot;domestic,international,local&quot;/&gt;<br />      &lt;variable
name=&quot;accountcode&quot; value=&quot;3000&quot;/&gt;<br />     
&lt;variable name=&quot;user_context&quot; value=&quot;default&quot;/&gt;<br
/>      &lt;variable name=&quot;effective_caller_id_name&quot;
value=&quot;Extension 3000&quot;/&gt;<br />      &lt;variable
name=&quot;effective_caller_id_number&quot; value=&quot;3000&quot;/&gt;<br
/>      &lt;variable name=&quot;outbound_caller_id_name&quot;
value=&quot;$${outbound_caller_name}&quot;/&gt;<br />      &lt;variable
name=&quot;outbound_caller_id_number&quot;
value=&quot;$${outbound_caller_id}&quot;/&gt;<br />      &lt;variable
name=&quot;callgroup&quot; value=&quot;techsupport&quot;/&gt;<br />   
&lt;/variables&gt;<br />  &lt;/user&gt;<br />&lt;/include&gt;</p><p>We have our
gateway working.</p><p>&gt;&gt;sofia status gateway gw</p><p>But we can't do a
call between client#1 and
client#2.</p><p>=================================================================================================<br
/>Name            gw<br />Scheme          Digest<br />Realm          
10.0.2.10<br />Username        3000<br />Password        yes<br
/>From            &lt;sip:3000@192.168.2.10;transport=udp&gt;<br
/>Contact         &lt;sip:gw+gw@192.168.1.10:5080;transport=udp&gt;<br
/>Exten           3000<br />To              sip:3000@192.168.2.10<br
/>Proxy           sip:192.168.2.10<br />Context         public<br
/>Expires         3600<br />Freq            3600<br />Ping           
1248881849<br />PingFreq        25<br />State           REGED<br
/>Status          UP<br />CallsIN         0<br />CallsOUT        19<br
/>=================================================================================================</p><p>We
have the following debug when we make a call.</p><font size="2"><p>2009-07-29
17:19:52 [DEBUG] sofia_glue.c:2566 sofia_glue_negotiate_sdp() Set 2833 dtmf
payload to 101</p><p>2009-07-29 17:19:52 [DEBUG] sofia.c:2962
sofia_handle_sip_i_state() (sofia/internal/1311@192.168.1.10) State Change
CS_NEW -&gt; CS_INIT</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_session.c:868 switch_core_session_signal_state_change() Send signal
sofia/internal/1311@192.168.1.10 [BREAK]</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:390 switch_core_session_run()
(sofia/internal/1311@192.168.1.10) Running State Change
CS_INIT</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_state_machine.c:469
switch_core_session_run() (sofia/internal/1311@192.168.1.10) State
INIT</p><p>2009-07-29 17:19:52 [DEBUG] mod_sofia.c:83 sofia_on_init()
sofia/internal/1311@192.168.1.10 SOFIA INIT</p><p>2009-07-29 17:19:52 [DEBUG]
mod_sofia.c:111 sofia_on_init() (sofia/internal/1311@192.168.1.10) State Change
CS_INIT -&gt; CS_ROUTING</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_session.c:868 switch_core_session_signal_state_change() Send signal
sofia/internal/1311@192.168.1.10 [BREAK]</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:469 switch_core_session_run()
(sofia/internal/1311@192.168.1.10) State INIT going to sleep</p><p>2009-07-29
17:19:52 [DEBUG] switch_core_state_machine.c:390 switch_core_session_run()
(sofia/internal/1311@192.168.1.10) Running State Change
CS_ROUTING</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_state_machine.c:472
switch_core_session_run() (sofia/internal/1311@192.168.1.10) State
ROUTING</p><p>2009-07-29 17:19:52 [DEBUG] mod_sofia.c:130 sofia_on_routing()
sofia/internal/1311@192.168.1.10 SOFIA ROUTING</p><p>2009-07-29 17:19:52
[DEBUG] switch_core_state_machine.c:71 switch_core_standard_on_routing()
sofia/internal/1311@192.168.1.10 Standard ROUTING</p><p>2009-07-29 17:19:52
[INFO] mod_dialplan_xml.c:252 dialplan_hunt() Processing Chewaka
(test)-&gt;3021 in context default</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 parsing [default-&gt;unloop]
continue=false</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Regex (PASS)
[unloop] ${unroll_loops}(true) =~ /^true$/ break=on-false</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Regex (FAIL) [unloop] ${sip_looped_call}() =~
/^true$/ break=on-false</p><p>Dialplan: sofia/internal/1311@192.168.1.10
parsing [default-&gt;global] continue=true</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Regex (FAIL) [global]
${network_addr}(10.3.1.12) =~ /^$/ break=never</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 ANTI-Action
set(use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat :
default)})</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Regex (PASS)
[global] ${numbering_plan}() =~ /^$/ break=never</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Action
set_user(default@${domain_name})</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Regex (FAIL) [global] ${call_debug}(false) =~
/^true$/ break=never</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Regex
(FAIL) [global] ${sip_has_crypto}() =~
/^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$/
break=never</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Absolute Condition
[global]</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Action
db(insert/${domain_name}-spymap/${caller_id_number}/${uuid})</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Action
db(insert/${domain_name}-last_dial/${caller_id_number}/${destination_number})</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Action
db(insert/${domain_name}-last_dial/global/${uuid})</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 parsing [default-&gt;Local_Extension]
continue=false</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Regex (FAIL)
[Local_Extension] destination_number(3021) =~ /^(130[0-8] &amp;&amp;
131[0-9])$/ break=on-false</p><p>Dialplan: sofia/internal/1311@192.168.1.10
parsing [default-&gt;IFAU_global_demonstrator_Conference_Room]
continue=false</p><p>Dialplan: sofia/internal/1311@192.168.1.10 Regex (FAIL)
[IFAU_global_demonstrator_Conference_Room] destination_number(3021) =~ /^1309$/
break=on-false</p><p>Dialplan: sofia/internal/1311@192.168.1.10 parsing
[default-&gt;gw] continue=false</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Regex (PASS) [gw] destination_number(3021) =~
/^(30[0-2][0-9])$/ break=on-false</p><p>Dialplan:
sofia/internal/1311@192.168.1.10 Action
bridge(sofia/gateway/gw/3021@192.168.2.10)</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:107 switch_core_standard_on_routing()
(sofia/internal/1311@192.168.1.10) State Change CS_ROUTING -&gt;
CS_EXEC</p><p>UTE</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_session.c:868
switch_core_session_signal_state_change() Send signal
sofia/internal/1311@192.168.1.10 [BREAK]</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:472 switch_core_session_run()
(sofia/internal/1311@192.168.1.10) State ROUTING going to
sleep</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_state_machine.c:390
switch_core_session_run() (sofia/internal/1311@192.168.1.10) Running State
Change CS_EXECUTE</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:479 switch_core_session_run()
(sofia/internal/1311@192.168.1.10) State EXECUTE</p><p>2009-07-29 17:19:52
[DEBUG] mod_sofia.c:173 sofia_on_execute() sofia/internal/1311@192.168.1.10
SOFIA EXECUTE</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_state_machine.c:144
switch_core_standard_on_execute() sofia/internal/1311@192.168.1.10 Standard
EXECUTE</p><p>EXECUTE sofia/internal/1311@192.168.1.10
set(use_profile=default)</p><p>2009-07-29 17:19:52 [DEBUG] mod_dptools.c:747
set_function() sofia/internal/1311@192.168.1.10 SET
[use_profile]=[default]</p><p>EXECUTE sofia/internal/1311@192.168.1.10
set_user(default@192.168.1.10)</p><p>2009-07-29 17:19:52 [WARNING]
switch_ivr.c:2042 switch_ivr_set_user() can't find user
[default@192.168.1.10]</p><p>EXECUTE sofia/internal/1311@192.168.1.10
db(insert/192.168.1.10-spymap/1311/d851bbd1-c09c-474b-b1df-d433420b132b)</p><p>EXECUTE
sofia/internal/1311@192.168.1.10
db(insert/192.168.1.10-last_dial/1311/3021)</p><p>EXECUTE
sofia/internal/1311@192.168.1.10
db(insert/192.168.1.10-last_dial/global/d851bbd1-c09c-474b-b1df-d433420b132b)</p><p>EXECUTE
sofia/internal/1311@192.168.1.10
bridge(sofia/gateway/gw/3021@192.168.2.10)</p><p>2009-07-29 17:19:52 [NOTICE]
switch_channel.c:592 switch_channel_set_name() New Channel
sofia/external/3021@192.168.2.10
[35a85e69-d109-134f-81d3-1d21016f43e5]</p><p>2009-07-29 17:19:52 [DEBUG]
mod_sofia.c:2567 sofia_outgoing_channel() (sofia/external/3021@192.168.2.10)
State Change CS_NEW -&gt; CS_INIT</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_session.c:868 switch_core_session_signal_state_change() Send signal
sofia/external/3021@192.168.2.10 [BREAK]</p><p>2009-07-29 17:19:52 [DEBUG]
switch_core_state_machine.c:390 switch_core_session_run()
(sofia/external/3021@192.168.2.10) Running State Change
CS_INIT</p><p>2009-07-29 17:19:52 [DEBUG] switch_core_state_machine.c:469
switch_core_session_run() (sofia/external/3021@192.168.2.10) State
INIT</p><p>2009-07-29 17:19:52 [DEBUG] mod_sofia.c:83 sofia_on_init()
sofia/external/3021@192.168.2.10 SOFIA INIT</p><p>2009-07-29 17:20:18 [ERR]
sofia_glue.c:568 sofia_glue_ext_address_lookup() STUN Failed!
stun.freeswitch.org:3478 [Timeout]</p><p>2009-07-29 17:20:18 [NOTICE]
mod_sofia.c:103 sofia_on_init() Hangup sofia/external/3021@192.168.2.10
[CS_INIT] [DESTINATION_OUT_OF_ORDER]</p><p>2009-07-29 17:20:18 [DEBUG]
switch_channel.c:1612 switch_channel_perform_hangup() Send signal
sofia/external/3021@192.168.2.10 [KILL]</p><p>2009-07-29 17:20:18 [DEBUG]
switch_core_session.c:868 switch_core_session_signal_state_change() Send signal
sofia/external/3021@192.168.2.10 [BREAK]</p><p>With Wireshark, we have seen two
sip error frame : &quot;407 Proxy authentication required&quot; and &quot;502
bad gateway&quot;.</p><p>What I must do to make calls between the two sip
domains ?</p><p>Best regards.</p><p>G.C.</p></font>