TUTORIAL SIP2SIP Settings for PIAF

Discussion in 'Trunks & Providers' started by [email protected], Jun 6, 2011.

  1. rlust@mac.com

    Joined:
    Feb 17, 2009
    Messages:
    35
    Likes Received:
    0
    I am trying to get sip2sip trunks to work with no luck. I have set up a Nortel 1535 and Blink on sip2sip and they work fine.

    When I do
    pbx*CLI> sip show registry
    Host dnsmgr Username Refresh State Reg.Time
    sip2sip.info:5060 Y 2233492845 120 Request Sent

    Any ideas would be helpful!

    Here is my trunk settings:


    username=22334xxxx
    type=peer
    canreinvite=yes
    secret=xxxxx
    qualify=yes
    nat=yes
    insecure=invite,port
    host=81.23.228.150
    dtmfmode=rfc2833
    disallow=all
    context=from-trunk
    allow=ulaw&gsm&h263
    outboundproxy=proxy.sipthor.net


    Register String is
    223349xxxx:[email protected]/22334xxxxx
     
  2. mainenotarynet

    mainenotarynet Not really a Guru - Just a long time user

    Joined:
    May 29, 2010
    Messages:
    564
    Likes Received:
    63
    I haven't had my S2S register since *1.8. There is a line item in Sip Info section (Peers?) that shows a different IP that it tries to register on and I have added all 3 (that I have found) to the IPTables to let it through but they seem to jump every so often.

    There is a post in the Trunks forum of a suggestion to make your host line look like host=a.b.c.d&e.f.g.h&etc...

    Now I read & to mean all must be true like registering an operator extension at office and home in 2 locations (as it mentions you can do this in extensions too (in deny/permit)) at all times. So what is the Symbol for an OR instead of an AND -- this may try the first and if it fails do the 2nd and so on.

    Worth a shot.
     
  3. vcallaway

    vcallaway Guru

    Joined:
    May 6, 2008
    Messages:
    170
    Likes Received:
    2
    try setting:

    host=sip2sip.info

    It is what I had to do.
     
  4. rlust@mac.com

    Joined:
    Feb 17, 2009
    Messages:
    35
    Likes Received:
    0
    Piaf 1.8 with sip2sip

    Has anyone been able to get a sip2sip trunk register on 1.8?
     
  5. vcallaway

    vcallaway Guru

    Joined:
    May 6, 2008
    Messages:
    170
    Likes Received:
    2
    Running 1.8.0

    Here is my trunk peer settings:
    Code:
    username=223nnnnnnn
    type=peer
    canreinvite=no
    secret=secret
    nat=yes
    insecure=invite,port
    host=sip2sip.info
    dtmfmode=rfc2833
    disallow=all
    context=from-trunk
    allow=h263&g722&ulaw&gsm
    qualify=yes
    
    Register string:
    Code:
    223nnnnnnn:[email protected]/223nnnnnnn
    
    I am having an issue with inbound calls. They connect fine but calls drop after about 30 seconds. Have not had a chance to dive into the issue. I'm using sip2sip for enum registration.
     
  6. mainenotarynet

    mainenotarynet Not really a Guru - Just a long time user

    Joined:
    May 29, 2010
    Messages:
    564
    Likes Received:
    63
    Same settings for me but the trunk never registers -- sits at 120 Request Sent. as I said I don't REALLY need it but since I have it I'd like it to work.
     
  7. tech1

    tech1 New Member

    Joined:
    May 18, 2011
    Messages:
    14
    Likes Received:
    0
    what version of PIAF are u using and what version of Asterisk?
     
  8. rlust@mac.com

    Joined:
    Feb 17, 2009
    Messages:
    35
    Likes Received:
    0
    Here is my system info

    Asterisk (Ver. 1.8.3.3):
    PIAF Ver 1.7.5.6
    Centos 5.6
    Purple

    Still looking for help on getting sip2sip to register!

    Thanks!!
     
  9. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,413
    Likes Received:
    2,448
    Current SIP2SIP settings info is available here: http://wiki.sip2sip.info/projects/sip2sip/wiki/SipDevicesAsterisk

    Create a SIP Trunk called sip2sip as shown below. Be sure to add ALL 4 of the hosts in your Peer Details for sip2sip:

    Code:
    type=peer
    canreinvite=no
    nat=yes
    qualify=yes
    domain=sip2sip.info
    fromdomain=sip2sip.info
    outboundproxy=proxy.sipthor.net
    fromuser=223XXXXXXX
    defaultuser=223XXXXXXX
    secret=yourpassword
    insecure=invite
    context=from-trunk
    host=sip2sip.info&81.23.228.129&81.23.228.150&85.17.186.7
    
    Registration string: 223XXXXXXX:[email protected]/223XXXXXXX

    Setting srvlookup=yes in sip_general_custom.conf is mandatory!
    Setting enable=yes in dnsmgr.conf is mandatory!

    Be sure to WhiteList all 4 hosts in IPtables. Use add-fqdn and add-ip with Travelin' Man 3.

    To avoid having to Allow Anonymous Calls, you will need to cut-and-paste the [from-sip-external] context from extensions.conf into extensions_override_freepbx.conf.
    Then add a new section for your SIP2SIP-type calls telling it the appropriate Inbound Route. Here's where it should go...

    Code:
    [from-sip-external]
    exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
    exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
    exten => _.,n,Goto(s,1)
    exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"="yes"]?checklang:noanonymous)
     
    exten => 223XXXXXXX,1,Dial(local/[email protected])
     
    ... rest of context goes here
    And then... amportal restart
     
  10. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,413
    Likes Received:
    2,448
  11. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,413
    Likes Received:
    2,448
    lgaetz: Thanks. You're absolutely correct on the SIP Settings alternative. Unfortunately, it doesn't work with some of the earlier releases of FreePBX, and we try to keep the setups as generic as possible to avoid further questions/problems. Also worth mentioning is you cannot add srvlookup=yes as a manual entry under the SIP Settings tab, or it fails because FreePBX doesn't remove the default srvlookup=no entry which will override your manual entry. The SIP Settings approach also forces you to add entries for External IP Address and Local Network Subnets which may or may not be necessary for some implementations.

    As for enabling DNS Manager, all I can tell you is Sip2Sip won't work without it. There's not much in the way of documentation that I could find either. But it obviously has something to do with the round-robin IP address routing that Sip2Sip uses for its service.
     
  12. sukasem

    sukasem Guru

    Joined:
    Sep 13, 2008
    Messages:
    143
    Likes Received:
    26
    I tried to setup Sip2Sip this morning but end up took me whole day to figure it out what wrong with it.
    When I set srvlookup=yes (either in sip_general_custom or in FreePBX sip setting), Every trunks is not register and take very long time for amportal to stop.

    I found the problem now. Normally, I setup primary DNS by enter my router IP address which is causing DNS lookup problem. After I enter ISP Primary IP address, everything works like charm.
     
    wardmundy likes this.
  13. Rrrr

    Rrrr Guru

    Joined:
    May 28, 2009
    Messages:
    319
    Likes Received:
    22
    ward

    I am using sip2sip for the past few months and its really stable.
    I would like to add that that the SIP To: header contains the DID.

    In fact, SIP2SIP allows you to create many new aliases for incoming calls just under one single account.
    So, if you have a DID service provider that can send your incoming calls to a SIP URI, then you can do as in this example

    DID 11231234566 forward to [email protected]
    DID 11231234567 forward to [email protected]
    DID 11231234568 forward to [email protected]

    So you can use this code, found in extensions.conf.
    Code:
    [from-pstn-toheader]
    exten => _.,1,Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
     
    Like this:
    exten => 223XXXXXXX,1,Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
    And then create an inbound route as normal for
    11231234566, nerdvittles and for 11231234568

    My question to you is, with instructions from previous posts, I am confused as to where best to use this code, should it be in
    a) my own [from-trunk-custom-sip2sip] and use this in the sip2sip trunk settings?
    b) [from-sip-external] into extensions_override_freepbx.conf and use this in the sip2sip trunk settings?
    c) or use [from-pstn-toheader] in the sip2sip trunk settings

    What is safest or most common?
     
    VaHam likes this.
  14. Rrrr

    Rrrr Guru

    Joined:
    May 28, 2009
    Messages:
    319
    Likes Received:
    22
    FWIW: Just one remark regarding the suggested trunk settings for SIP2SIP from the article and as referred above.
    and
    I also encountered issues with receiving calls, the "congestion" issue, but rather than following the trick, I decided to disable the SIP2SIP trunk in Freepbx.
    I then installed as per the SIP2SIP wiki article, the trunk registration in sip_registrations_custom.conf and the trunk settings in sip_custom.conf
    After this the congestion issue did not appear anymore.

    So I did not mess with extensions_override_freepbx.conf, but I messed with two other .conf files. :)
    The benefit for me was that I can continue to use Freepbx for inbound routes from SIP2SIP
     
  15. visionlogic

    visionlogic Guru? Nope

    Joined:
    Oct 11, 2009
    Messages:
    117
    Likes Received:
    33
    SOLVED! Please pardon my brain fart. Ignore the following.


    The insertion of the line "exten => 223XXXXXXX,1,Dial(local/[email protected])" shown above as an example appears to me to route the calls entering on the 223XXXXXXX DID to Lenny. What changes do I need to make to that line in order to route those calls to a specific extension or IVR?
    Thanks for your help!