Error between trunk SIP - PJSIP

Hello, I’m migrating from SIP to PJSIP and now I’m configuring my trunks following https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip and https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard tutorials .

So I created a SIP peer on a Asterisk 13.11.2 server (172.16.15.2) and configured the trunk into one PJSIP Asterisk 13.11.2 server (172.16.15.154).

My PJSIP Wizard for this register follows:

[7799]
type=wizard
sends_auth=yes
sends_registrations=yes
accepts_registrations=yes
remote_hosts=172.16.15.2:5060
endpoint/allow = !all,g729
endpoint/context=recebida_clientes
outbound_auth/username=7799
outbound_auth/password=7799
aor/qualify_frequency=15

This is what the SIP peer looks like:

PabxIP-Teste*CLI> sip show peer 7799

  • Name : 7799
    Description :
    Realtime peer: Yes, cached
    Secret :
    MD5Secret :
    Remote Secret:
    Context : from-pstn
    Record On feature : automon
    Record Off feature : automon
    Subscr.Cont. :
    Language :
    Tonezone :
    AMA flags : Unknown
    Transfer mode: open
    CallingPres : Presentation Allowed, Not Screened
    Callgroup : 1
    Pickupgroup : 1
    Named Callgr :
    Nam. Pickupgr:
    MOH Suggest :
    Mailbox :
    VM Extension : asterisk
    LastMsgsSent : 0/0
    Call limit : 1
    Max forwards : 0
    Dynamic : Yes
    Callerid : “eu” <7799>
    MaxCallBR : 384 kbps
    Expire : 3465
    Insecure : no
    Force rport : Yes
    Symmetric RTP: Yes
    ACL : No
    DirectMedACL : No
    T.38 support : No
    T.38 EC mode : Unknown
    T.38 MaxDtgrm: 4294967295
    DirectMedia : No
    PromiscRedir : No
    User=Phone : No
    Video Support: Yes
    Text Support : No
    Ign SDP ver : No
    Trust RPID : No
    Send RPID : No
    Path support : No
    Path : N/A
    TrustIDOutbnd: Legacy
    Subscriptions: Yes
    Overlap dial : Yes
    DTMFmode : rfc2833
    Timer T1 : 500
    Timer B : 32000
    ToHost :
    Addr->IP : 172.16.15.154:5060
    Defaddr->IP : (null)
    Prim.Transp. : UDP
    Allowed.Trsp : UDP
    Def. Username: 7799
    SIP Options : (none)
    Codecs : (ulaw|t140|h261|h263|h264|h263p|g729)
    Auto-Framing : No
    Status : OK (24 ms)
    Useragent : Asterisk PBX 13.11.2
    Reg. Contact : sip:s@172.16.15.154:5060
    Qualify Freq : 60000 ms
    Keepalive : 0 ms
    Sess-Timers : Accept
    Sess-Refresh : uas
    Sess-Expires : 1800 secs
    Min-Sess : 90 secs
    RTP Engine : asterisk
    Parkinglot :
    Use Reason : No
    Encryption : No

The Dialplan context I’m using for the trunk (in my PJSIP server) follows:

[trunk-sip]

exten => _XXXX,1,NoOp(TRUNK)
same => n,Set(CALLERID(num)=12345)
same => n,Dial(PJSIP/${EXTEN}@7799,75,T)
same => n,Hangup()

I can make a single call, I can see the flow in both asterisk’s consoles and there is no aparent error or warning relevant (can provide if necessary), but a moment after that first call the peer loses it’s register in server 172.16.15.2,

PabxIP-Teste*CLI> sip show peer 7799
Peer 7799 not found.

One thing I noticed is if I try to “qualify” the SIP peer before making the call, I can see the following NOTICE in my PJSIP server:

[Dez 28 09:50:40] NOTICE[1871]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request ‘OPTIONS’ from ‘“asterisk” sip:asterisk@172.16.15.2’ failed for ‘172.16.15.2:5060’ (callid: 0e994d3117173c78534006357e4b32a8@172.16.15.2:5060) - No matching endpoint found

So my problem is that I can make only a single call per trunk and have to restart my Asterisk to it get register again and make another call, wich is not too good. Any lights?
Thanks in advance.

1 Like

We are also trying to connect to a SIP Trunk through a PJSIP Server, and we stumbled upon the same issue. Have you found something yet?

You’ll need to provide more information. For example how is chan_sip configured? (File or database)? As the problem appears to be on that side, and not on the chan_pjsip side. You will also need to provide all the console output on both sides.

Hello, @jcolp, I figured out the problem was on using pjsip_wizard.conf instead of pjsip.conf since it was needed to use realtime. The solution was simple: return to pjsip.conf.