PJSIP Extension

Hello,

Currently I am using Freepbx 15.0.24 and for my own reasons I changed PJSIP ports to 5080 and I have UDP & TCP enabled. I have many chan_sip clients cooperating flawlessly with Inbound and Outbound routes, ring groups, behind NAT etc including another IAX2 server and some SIP trunks in both of sides. I’m just giving a taste of my office installation and what I am trying to say is that all this works almost perfectly.

My problem is regarding PJSIP extensions. Let’s say you create one (or more) pjsip extensions and you hook on them two new phones. Devices seems registered correctly and you are able to make calls through them to other chan_sip extensions as well trunks etc BUT you cannot call pjsip extensions to each other AND no chan_sip extension can reach them. In other words, no incoming calls. And always gives you a “SIP/2.0 503 Service Unavailable”

Any idea???

<--- Transmitting (NAT) to 192.168.0.17:1024 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.17:1024;branch=z9hG4bK-9dda4831;received=192.168.0.17;rport=1024
From: "Anonymous" <sip:[email protected]>;tag=8be1b21c59542310o0
To: "Office Wireless #251" <sip:[email protected]>;tag=as71f60d9d
Call-ID: 63b380c-919ed5e0@localhost
CSeq: 102 INVITE
Server: FPBX-15.0.24(16.21.1)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:[email protected]:5060>
P-Asserted-Identity: "DESK 01 #251" <sip:[email protected]>
Content-Length: 0


<------------>
  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio TOS bits 184 in TCLASS field.
  == Using SIP RTP Audio CoS mark 5
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dial-one:56] ExecIf("SIP/201-00000026", "0?MacroExit()") in new stack
    -- Executing [s@macro-dial-one:57] ExecIf("SIP/201-00000026", "0?Set(DIALSTATUS=)") in new stack
    -- Executing [s@macro-dial-one:58] GosubIf("SIP/201-00000026", "0?s-CHANUNAVAIL,1()") in new stack
    -- Executing [s@macro-dial-one:59] MacroExit("SIP/201-00000026", "") in new stack
    -- Executing [s@macro-exten-vm:15] Set("SIP/201-00000026", "SV_DIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [s@macro-exten-vm:16] GosubIf("SIP/201-00000026", "0?docfu,1()") in new stack
    -- Executing [s@macro-exten-vm:17] GosubIf("SIP/201-00000026", "0?docfb,1()") in new stack
    -- Executing [s@macro-exten-vm:18] Set("SIP/201-00000026", "DIALSTATUS=CHANUNAVAIL") in new stack
    -- Executing [s@macro-exten-vm:19] ExecIf("SIP/201-00000026", "0?MacroExit()") in new stack
    -- Executing [s@macro-exten-vm:20] GotoIf("SIP/201-00000026", "1?s-CHANUNAVAIL,1") in new stack
    -- Goto (macro-exten-vm,s-CHANUNAVAIL,1)
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:1] GotoIf("SIP/201-00000026", "0?exit,1") in new stack
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:2] PlayTones("SIP/201-00000026", "congestion") in new stack
    -- Executing [s-CHANUNAVAIL@macro-exten-vm:3] Congestion("SIP/201-00000026", "10") in new stack

<--- Reliably Transmitting (NAT) to 192.168.0.17:1024 --->
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 192.168.0.17:1024;branch=z9hG4bK-9dda4831;received=192.168.0.17;rport=1024
From: "Anonymous" <sip:[email protected]>;tag=8be1b21c59542310o0
To: "Office Wireless #251" <sip:[email protected]>;tag=as71f60d9d
Call-ID: 63b380c-919ed5e0@localhost
CSeq: 102 INVITE
Server: FPBX-15.0.24(16.21.1)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
X-Asterisk-HangupCause: Unallocated (unassigned) number
X-Asterisk-HangupCauseCode: 1
Content-Length: 0


<------------>
  == Spawn extension (macro-exten-vm, s-CHANUNAVAIL, 3) exited non-zero on 'SIP/201-00000026' in macro 'exten-vm'
  == Spawn extension (from-internal, 251, 3) exited non-zero on 'SIP/201-00000026'
    -- Executing [h@from-internal:1] Macro("SIP/201-00000026", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/201-00000026", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("SIP/201-00000026", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] Hangup("SIP/201-00000026", "") in new stack
  == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/201-00000026' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/201-00000026'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording SIP/201-00000026

<--- SIP read from UDP:192.168.0.17:1024 --->
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.0.17:1024;branch=z9hG4bK-9dda4831
From: "Anonymous" <sip:[email protected]>;tag=8be1b21c59542310o0
To: "Office Wireless #251" <sip:[email protected]>;tag=as71f60d9d
Call-ID: 63b380c-919ed5e0@localhost
CSeq: 102 ACK
Max-Forwards: 70
Authorization: Digest username="201",realm="asterisk",nonce="75bf1ced",uri="sip:[email protected]",algorithm=MD5,response="26d12a7906c23cbbc87b4299df16a839"
Contact: "Anonymous" <sip:[email protected]:1024>
User-Agent: Cisco/SPA525G2-7.6.2e
Content-Length: 0

There isn’t a lot to go on, but I would say that the extensions using PJSIP have not registered successfully. As best I can tell, from the incomplete logging, you are getting channel unavailable with no attempt to send anything to the endpoint, which means that the endpoint has an unavailable status recorded against it, or it is not a valid endpoint. As well as registration, it could be qualify failures, but I think registration is much more likely.

Hello david, do you have any suggestion on how can I check my extension’s validity?

Capture the registration attempt. Look at the device to see whether it thinks it has registered. Use the appropriate CLI commands (something like pjsip show endpoint xxx, or if you cannot be that specific, pjsip show endpoints; these should show successful registrations, under contacts.

You could also try “help pjsip”, or maybe “help pjsip show” and experiment to see what information is available (I don’t have access to something to try them on, and I haven’t found an up to date list.

Here we are:

*CLI> pjsip list endpoints:

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
==========================================================================================

 Endpoint:  251/251                                              Not in use    0 of inf
 Endpoint:  252/252                                              Not in use    0 of inf
 Endpoint:  253/253                                              Not in use    0 of inf
 Endpoint:  254/254                                              Not in use    0 of inf
 Endpoint:  255/255                                              Not in use    0 of inf

*CLI> pjsip show endpoints

Endpoint:  251/251                                              Not in use    0 of inf
     InAuth:  251/10023101
        Aor:  251                                                1
      Contact:  251/sip:[email protected]:49356;user=phone; 43281bbebb Avail        12.181

 Endpoint:  252/252                                              Not in use    0 of inf
     InAuth:  252/10023102
        Aor:  252                                                1
      Contact:  252/sip:[email protected]:49356;user=phone; 1d994e6b73 Avail        13.721

 Endpoint:  253/253                                              Not in use    0 of inf
     InAuth:  253/10023103
        Aor:  253                                                1
      Contact:  253/sip:[email protected]:49356;user=phone; 6e36cd48e9 Avail        14.705

 Endpoint:  254/254                                              Not in use    0 of inf
     InAuth:  254/10023104
        Aor:  254                                                1
      Contact:  254/sip:[email protected]:49356;user=phone; 0878f0b4c5 Avail        14.712

 Endpoint:  255/255                                              Not in use    0 of inf
     InAuth:  255/10023105
        Aor:  255                                                1
      Contact:  255/sip:[email protected]:49356;user=phone; 3371ff5b68 Avail        15.824

*CLI> pjsip show endpoint 251

 Endpoint:  251/251                                              Not in use    0 of inf
     InAuth:  251/10023101
        Aor:  251                                                1
      Contact:  251/sip:[email protected]:49356;user=phone; 43281bbebb Avail        19.698


 ParameterName                      : ParameterValue
 ===================================================================
 100rel                             : yes
 accept_multiple_sdp_answers        : false
 accountcode                        :
 acl                                :
 aggregate_mwi                      : true
 allow                              : (g722|ulaw|alaw|gsm|g726|g729)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 allow_unauthenticated_options      : false
 aors                               : 251
 asymmetric_rtp_codec               : false
 auth                               : 251
 bind_rtp_to_media_address          : false
 bundle                             : false
 call_group                         :
 callerid                           : "Office Wireless #251" <251>
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       :
 connected_line_method              : invite
 contact_acl                        :
 context                            : from-internal
 cos_audio                          : 5
 cos_video                          : 4
 device_state_busy_at               : 0
 direct_media                       : true
 direct_media_glare_mitigation      : none
 direct_media_method                : invite
 disable_direct_media_on_nat        : false
 dtls_auto_generate_cert            : No
 dtls_ca_file                       :
 dtls_ca_path                       :
 dtls_cert_file                     :
 dtls_cipher                        :
 dtls_fingerprint                   : SHA-256
 dtls_private_key                   :
 dtls_rekey                         : 0
 dtls_setup                         : active
 dtls_verify                        : No
 dtmf_mode                          : rfc4733
 fax_detect                         : false
 fax_detect_timeout                 : 0
 follow_early_media_fork            : true
 force_avp                          : false
 force_rport                        : true
 from_domain                        :
 from_user                          :
 g726_non_standard                  : false
 ice_support                        : false
 identify_by                        : username,ip
 ignore_183_without_sdp             : false
 inband_progress                    : false
 incoming_mwi_mailbox               :
 language                           : en
 mailboxes                          :
 max_audio_streams                  : 1
 max_video_streams                  : 1
 media_address                      :
 media_encryption                   : no
 media_encryption_optimistic        : false
 media_use_received_transport       : false
 message_context                    :
 moh_passthrough                    : false
 moh_suggest                        : default
 mwi_from_user                      :
 mwi_subscribe_replaces_unsolicited : no
 named_call_group                   :
 named_pickup_group                 :
 notify_early_inuse_ringing         : false
 one_touch_recording                : true
 outbound_auth                      :
 outbound_proxy                     :
 pickup_group                       :
 preferred_codec_only               : false
 record_off_feature                 : apprecord
 record_on_feature                  : apprecord
 refer_blind_progress               : true
 rewrite_contact                    : true
 rpid_immediate                     : false
 rtcp_mux                           : false
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : true
 rtp_timeout                        : 30
 rtp_timeout_hold                   : 3600
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_connected_line                : yes
 send_diversion                     : true
 send_history_info                  : false
 send_pai                           : true
 send_rpid                          : false
 set_var                            :
 srtp_tag_32                        : false
 stir_shaken                        : false
 sub_min_expiry                     : 0
 subscribe_context                  :
 suppress_q850_reason_headers       : false
 t38_udptl                          : false
 t38_udptl_ec                       : none
 t38_udptl_ipv6                     : false
 t38_udptl_maxdatagram              : 0
 t38_udptl_nat                      : false
 timers                             : yes
 timers_min_se                      : 90
 timers_sess_expires                : 1800
 tone_zone                          :
 tos_audio                          : 184
 tos_video                          : 136
 transport                          :
 trust_connected_line               : yes
 trust_id_inbound                   : true
 trust_id_outbound                  : false
 use_avpf                           : false
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                :
 webrtc                             : no

With pjsip logger on, make a failing test call to extension 251. Paste the complete Asterisk log for the call at pastebin.freepbx.org and post the link here.

Thanks for your time. Here is the link: https://pastebin.freepbx.org/view/a0b523e7

So the device at 192.168.0.17 rejected the call with a 404. Somewhat suspicious is the
x-ast-orig-host=192.168.0.139:49356
on line 232. Do you know what is at that address or why that would appear?
Possibly, the problem is caused by all 5 registrations coming from the same address and port. There may be a device setting to avoid this.

I assume that the device is a cordless phone base with 5 handsets, but there is no Server header in the response. Make/model? Link to manual (admin guide, not end user docs)?

Hi Stewart

The 192.168.0.17 is an AP witch was doing NAT accidentally. Chan_SIP extensions was not so sensitive on this but PJSIPs confused. Thanks for your time and your help once again

Leo

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.