Search code examples
voipfreeswitch

How to connect FreeSwitch to FreeSwitch?


i have a problem with FreeSwitch. I tried for hours to connect a FreeSwitch server on my system with a FreeSwitch server on another system. However, what i want is to call with user "abc@myip" the user "123@buddysIp". What i tried is to add a new "list" item to the acl.conf.xml

<list name="buddy" default="deny">
      <node type="allow" cidr="hisip/32"/>
  </list>

also i tried to add an extension in the conf/dialplan/default directory

<include>
<extension name="outbound_calls">
    <condition field="destination_number" expression="^(.*)$">
        <action application="bridge" data="sofia/gateway/buddy/$1"/>
    </condition>
</extension>

and his gateway which is stored in conf/sip_profiles/buddy.xml and looks like this

<include>
<gateway name="buddy">
    <param name="realm" value="hisip"/>
    <param name="username" value="myuser"/>
    <param name="password" value="mypw"/>
</gateway>

I hope somebody can help me. Maybe i forgot something. We are in the same network. Please tell me if you need more informations, thanks.

Here are my call log:

 INVITE sip:666@myip SIP/2.0
   Via: SIP/2.0/UDP myip:51155;rport;branch=z9hG4bKPjyv0EW.k04poUhm7kdxHae5kheAypVEBc
   Max-Forwards: 70
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>
   Contact: "me" <sip:1001@myip:51155;ob>
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24074 INVITE
   Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
   Supported: replaces, 100rel, timer, norefersub
   Session-Expires: 1800
   Min-SE: 90
   User-Agent: Telephone 1.1.4
   Content-Type: application/sdp
   Content-Length:   479

   v=0
   o=- 3621578544 3621578544 IN IP4 myip
   s=pjmedia
   b=AS:84
   t=0 0
   a=X-nat:0
   m=audio 4032 RTP/AVP 103 102 104 109 3 0 8 9 101
   c=IN IP4 myip
   b=TIAS:64000
   a=rtcp:4033 IN IP4 myip
   a=sendrecv
   a=rtpmap:103 speex/16000
   a=rtpmap:102 speex/8000
   a=rtpmap:104 speex/32000
   a=rtpmap:109 iLBC/8000
   a=fmtp:109 mode=30
   a=rtpmap:3 GSM/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:8 PCMA/8000
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-15
   ------------------------------------------------------------------------
send 382 bytes to udp/[myip]:51155 at 12:02:24.444389:
   ------------------------------------------------------------------------
   SIP/2.0 100 Trying
   Via: SIP/2.0/UDP myip:51155;rport=51155;branch=z9hG4bKPjyv0EW.k04poUhm7kdxHae5kheAypVEBc
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24074 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Content-Length: 0

   ------------------------------------------------------------------------
2014-10-06 12:02:24.435021 [NOTICE] switch_channel.c:1055 New Channel sofia/internal/1001@myip [2b0eddac-0ad5-41b3-a9f4-eebf1a81565e]
send 884 bytes to udp/[myip]:51155 at 12:02:24.450259:
   ------------------------------------------------------------------------
   SIP/2.0 407 Proxy Authentication Required
   Via: SIP/2.0/UDP myip:51155;rport=51155;branch=z9hG4bKPjyv0EW.k04poUhm7kdxHae5kheAypVEBc
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>;tag=9Q0rj5B37FS7H
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24074 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Accept: application/sdp
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Proxy-Authenticate: Digest realm="myip", nonce="72eb4930-85ce-4590-b2a2-b3420109fb4e", algorithm=MD5, qop="auth"
   Content-Length: 0

   ------------------------------------------------------------------------
recv 345 bytes from udp/[myip]:51155 at 12:02:24.450538:
   ------------------------------------------------------------------------
   ACK sip:666@myip SIP/2.0
   Via: SIP/2.0/UDP myip:51155;rport;branch=z9hG4bKPjyv0EW.k04poUhm7kdxHae5kheAypVEBc
   Max-Forwards: 70
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>;tag=9Q0rj5B37FS7H
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24074 ACK
   Content-Length:  0

   ------------------------------------------------------------------------
recv 1372 bytes from udp/[myip]:51155 at 12:02:24.450608:
   ------------------------------------------------------------------------
   INVITE sip:666@myip SIP/2.0
   Via: SIP/2.0/UDP myip:51155;rport;branch=z9hG4bKPjdQcDT3A-9MHF6CkHL-i9ocmvZjxVxGnD
   Max-Forwards: 70
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>
   Contact: "me" <sip:1001@myip:51155;ob>
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24075 INVITE
   Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
   Supported: replaces, 100rel, timer, norefersub
   Session-Expires: 1800
   Min-SE: 90
   User-Agent: Telephone 1.1.4
   Proxy-Authorization: Digest username="1001", realm="myip", nonce="72eb4930-85ce-4590-b2a2-b3420109fb4e", uri="sip:666@myip", response="1220921ada500668b903722228634e1a", algorithm=MD5, cnonce="P1gGhwXHyrEHo1zMDrBEk3ryp1uKHbaK", qop=auth, nc=00000001
   Content-Type: application/sdp
   Content-Length:   479

   v=0
   o=- 3621578544 3621578544 IN IP4 myip
   s=pjmedia
   b=AS:84
   t=0 0
   a=X-nat:0
   m=audio 4032 RTP/AVP 103 102 104 109 3 0 8 9 101
   c=IN IP4 myip
   b=TIAS:64000
   a=rtcp:4033 IN IP4 myip
   a=sendrecv
   a=rtpmap:103 speex/16000
   a=rtpmap:102 speex/8000
   a=rtpmap:104 speex/32000
   a=rtpmap:109 iLBC/8000
   a=fmtp:109 mode=30
   a=rtpmap:3 GSM/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:8 PCMA/8000
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-15
   ------------------------------------------------------------------------
send 382 bytes to udp/[myip]:51155 at 12:02:24.450830:
   ------------------------------------------------------------------------
   SIP/2.0 100 Trying
   Via: SIP/2.0/UDP myip:51155;rport=51155;branch=z9hG4bKPjdQcDT3A-9MHF6CkHL-i9ocmvZjxVxGnD
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24075 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Content-Length: 0

   ------------------------------------------------------------------------
2014-10-06 12:02:24.484827 [INFO] mod_dialplan_xml.c:558 Processing me <1001>->666 in context default
2014-10-06 12:02:24.484827 [CRIT] mod_dptools.c:1628 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2014-10-06 12:02:24.484827 [CRIT] mod_dptools.c:1628 Open /usr/local/freeswitch/conf/vars.xml and change the default_password.
2014-10-06 12:02:24.484827 [CRIT] mod_dptools.c:1628 Once changed type 'reloadxml' at the console.
2014-10-06 12:02:24.495177 [CRIT] mod_dptools.c:1628 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
2014-10-06 12:02:34.854471 [NOTICE] switch_channel.c:1055 New Channel sofia/external/666 [3bc1a418-d55d-4dab-863b-9742ec0ae187]
send 1113 bytes to udp/[buddyip]:5060 at 12:02:34.865554:
   ------------------------------------------------------------------------
   INVITE sip:666@buddyip SIP/2.0
   Via: SIP/2.0/UDP myip:5080;rport;branch=z9hG4bK94rXNDv8U6KDg
   Max-Forwards: 69
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958813 INVITE
   Contact: <sip:gw+amr@myip:5080;transport=udp;gw=amr>
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 292
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Extension 1001" <sip:2706446@buddyip>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1412565842 1412565843 IN IP4 myip
   s=FreeSWITCH
   c=IN IP4 myip
   t=0 0
   m=audio 23912 RTP/AVP 3 0 8 9 101 13
   a=rtpmap:3 GSM/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:8 PCMA/8000
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 363 bytes from udp/[buddyip]:5060 at 12:02:34.867644:
   ------------------------------------------------------------------------
   SIP/2.0 100 Trying
   Via: SIP/2.0/UDP myip:5080;rport=5080;branch=z9hG4bK94rXNDv8U6KDg
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958813 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.5.14b+git~20141001T023048Z~a39db86863~64bit
   Content-Length: 0

   ------------------------------------------------------------------------
recv 865 bytes from udp/[buddyip]:5060 at 12:02:34.869949:
   ------------------------------------------------------------------------
   SIP/2.0 407 Proxy Authentication Required
   Via: SIP/2.0/UDP myip:5080;rport=5080;branch=z9hG4bK94rXNDv8U6KDg
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>;tag=ytX68BX46p4Kp
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958813 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.5.14b+git~20141001T023048Z~a39db86863~64bit
   Accept: application/sdp
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Proxy-Authenticate: Digest realm="buddyip", nonce="56db4231-66c0-4603-bec6-7d6fb163a011", algorithm=MD5, qop="auth"
   Content-Length: 0

   ------------------------------------------------------------------------
send 324 bytes to udp/[buddyip]:5060 at 12:02:34.870119:
   ------------------------------------------------------------------------
   ACK sip:666@buddyip SIP/2.0
   Via: SIP/2.0/UDP myip:5080;rport;branch=z9hG4bK94rXNDv8U6KDg
   Max-Forwards: 69
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>;tag=ytX68BX46p4Kp
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958813 ACK
   Content-Length: 0

   ------------------------------------------------------------------------
send 1389 bytes to udp/[buddyip]:5060 at 12:02:34.882192:
   ------------------------------------------------------------------------
   INVITE sip:666@buddyip SIP/2.0
   Via: SIP/2.0/UDP myip:5080;rport;branch=z9hG4bKaejpQ8ccSFa0B
   Max-Forwards: 69
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958814 INVITE
   Contact: <sip:gw+amr@myip:5080;transport=udp;gw=amr>
   Expires: 3600
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, refer
   Proxy-Authorization: Digest username="FreeSWITCH", realm="buddyip", nonce="56db4231-66c0-4603-bec6-7d6fb163a011", cnonce="vGWirMfiEjKJDk184GBbsg", algorithm=MD5, uri="sip:666@buddyip", response="9455fd51fcf3ce264eb85a35fd311f23", qop=auth, nc=00000001
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 292
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Extension 1001" <sip:2706446@buddyip>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1412565842 1412565843 IN IP4 myip
   s=FreeSWITCH
   c=IN IP4 myip
   t=0 0
   m=audio 23912 RTP/AVP 3 0 8 9 101 13
   a=rtpmap:3 GSM/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:8 PCMA/8000
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 363 bytes from udp/[buddyip]:5060 at 12:02:34.883681:
   ------------------------------------------------------------------------
   SIP/2.0 100 Trying
   Via: SIP/2.0/UDP myip:5080;rport=5080;branch=z9hG4bKaejpQ8ccSFa0B
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958814 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.5.14b+git~20141001T023048Z~a39db86863~64bit
   Content-Length: 0

   ------------------------------------------------------------------------
recv 724 bytes from udp/[buddyip]:5060 at 12:02:34.891400:
   ------------------------------------------------------------------------
   SIP/2.0 403 Forbidden
   Via: SIP/2.0/UDP myip:5080;rport=5080;branch=z9hG4bKaejpQ8ccSFa0B
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>;tag=Z3pZa7D83Zt6H
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958814 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.5.14b+git~20141001T023048Z~a39db86863~64bit
   Accept: application/sdp
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Length: 0

   ------------------------------------------------------------------------
send 324 bytes to udp/[buddyip]:5060 at 12:02:34.891596:
   ------------------------------------------------------------------------
   ACK sip:666@buddyip SIP/2.0
   Via: SIP/2.0/UDP myip:5080;rport;branch=z9hG4bKaejpQ8ccSFa0B
   Max-Forwards: 69
   From: "Extension 1001" <sip:FreeSWITCH@buddyip>;tag=2N77KS1Ke6gpN
   To: <sip:666@buddyip>;tag=Z3pZa7D83Zt6H
   Call-ID: bc64e628-c7e2-1232-0e89-4d7ce0605bb2
   CSeq: 65958814 ACK
   Content-Length: 0

   ------------------------------------------------------------------------
2014-10-06 12:02:34.884694 [NOTICE] sofia.c:7306 Hangup sofia/external/666 [CS_CONSUME_MEDIA] [CALL_REJECTED]
2014-10-06 12:02:34.899162 [INFO] mod_dptools.c:3234 Originate Failed.  Cause: CALL_REJECTED
2014-10-06 12:02:34.899162 [NOTICE] switch_channel.c:4685 Hangup sofia/internal/1001@myip [CS_EXECUTE] [CALL_REJECTED]
send 888 bytes to udp/[myip]:51155 at 12:02:34.910248:
   ------------------------------------------------------------------------
   SIP/2.0 403 Forbidden
   Via: SIP/2.0/UDP myip:51155;rport=51155;branch=z9hG4bKPjdQcDT3A-9MHF6CkHL-i9ocmvZjxVxGnD
   Max-Forwards: 70
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>;tag=a1SHm0v64rFtD
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24075 INVITE
   User-Agent: FreeSWITCH-mod_sofia/1.4.9+git~20140929T194948Z~ae069dcca7~64bit
   Accept: application/sdp
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Reason: Q.850;cause=21;text="CALL_REJECTED"
   Content-Length: 0
   Remote-Party-ID: "666" <sip:666@myip>;party=calling;privacy=off;screen=no

   ------------------------------------------------------------------------
recv 345 bytes from udp/[myip]:51155 at 12:02:34.910602:
   ------------------------------------------------------------------------
   ACK sip:666@myip SIP/2.0
   Via: SIP/2.0/UDP myip:51155;rport;branch=z9hG4bKPjdQcDT3A-9MHF6CkHL-i9ocmvZjxVxGnD
   Max-Forwards: 70
   From: "me" <sip:1001@myip>;tag=Hd47q6ldQvMGLJO5RcMsO4AJQwWmRU28
   To: <sip:666@myip>;tag=a1SHm0v64rFtD
   Call-ID: WW8ZDSQvHKuKTSjTJTX.hiefO6liAh7W
   CSeq: 24075 ACK
   Content-Length:  0

   ------------------------------------------------------------------------
2014-10-06 12:02:34.914727 [NOTICE] switch_core_session.c:1633 Session 28 (sofia/external/666) Ended
2014-10-06 12:02:34.914727 [NOTICE] switch_core_session.c:1637 Close Channel sofia/external/666 [CS_DESTROY]
2014-10-06 12:02:34.945164 [NOTICE] switch_core_session.c:1633 Session 27 (sofia/internal/1001@myip) Ended
2014-10-06 12:02:34.945164 [NOTICE] switch_core_session.c:1637 Close Channel sofia/internal/1001@myip [CS_DESTROY]

Solution

  • It works know. I created a gateway in sip_profiles/external/mygateway.xml looks like

    <include>
        <gateway name="buddygateway">
            <param name="proxy" value="buddyip"/>
            <param name="register" value="false"/>
            <param name="caller-id-in-from" value="true"/> <!--Most gateways seem to want this-->
        </gateway>
    </include>
    

    and created an outbound extension in dialplan/default/outbound_calls.xml looks like this:

    <include>
        <extension name="outbound_calls">
            <condition field="destination_number" expression="^BUDDYPREFIX(\d*)$">
                <action application="bridge" data="sofia/gateway/buddygateway/$1"/>
            </condition>
        </extension>
    </include>
    

    so every number i call now starts with BUDDYPREFIX calls the number on the remote server.

    Thanks for the answers :) Hope this will help somebody.