Chan_sip to PJSIP settings

another issue -
with my matrix Gateway…
on chansip all is working fine but on pjsip outgoing calls are going fine…
but incoming calls are not landing on the freepbx…
asterisk log
matrix sngrep log

my chansip settings

type=peer
qualify=yes
port=5060
nat=yes
insecure=very
host=192.168.1.240
context=from-internal

sip and pjsip listen on different ports. You are stating that pjsip is not working but you only posted the sip configuration. Make sure your calls are being sent to the proper UDP port for pjsip.

is there a command for CLI from where i can get the pjsip conf settings for the trunk?
it is very inconvenient to take screenshots and post them here and then experts like you to read it.

The log in your penultimate post shows a complete call, but there was an attempt on line 717 to call 31 at BSNL, which of course was rejected. The call was then sent to the Matrix and accepted. I did not attempt to analyze why this happened, but BSNL might block your account if you send them too many invalid requests.

The Asterisk log in your last post only shows an outbound call via the Matrix, which appeared to be completely successful. If something was wrong with it, please explain.

The ‘sngrep’ log in your last post shows Asterisk requesting authentication from the Matrix, which it apparently didn’t provide. Try configuring the pjsip trunk for Authentication None. If it’s already set that way, put 192.168.1.240 in Match (Permit) for the trunk. If you still have trouble, paste the Asterisk log for such a call, including pjsip logger.

Screenshots or your trunk settings, both the General and Advanced tabs of pjsip Settings, should be fine.

Or, from the Asterisk command prompt:
pjsip show endpoint matrix_pjsip
pjsip show auth matrix_pjsip
pjsip show aor matrix_pjsip
pjsip show identify matrix_pjsip
pjsip show registration matrix_pjsip

mnhpbx*CLI> pjsip show endpoint matrix_pjsip

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  matrix_pjsip                                         Invalid       0 of inf
        Aor:  matrix_pjsip                                       0
      Contact:  matrix_pjsip/sip:192.168.1.240:5060        e7d1d1462e NonQual         nan
  Transport:  0.0.0.0-udp               udp      3     96  0.0.0.0:5160
   Identify:  matrix_pjsip/matrix_pjsip
        Match: 192.168.1.240/32


 ParameterName                      : ParameterValue
 ===================================================================================================
 100rel                             : yes
 accept_multiple_sdp_answers        : false
 accountcode                        :
 acl                                :
 aggregate_mwi                      : true
 allow                              : (ulaw|alaw|gsm|g726|g722|h265|h264|mpeg4)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 allow_unauthenticated_options      : false
 aors                               : matrix_pjsip
 asymmetric_rtp_codec               : false
 auth                               :
 bind_rtp_to_media_address          : false
 bundle                             : false
 call_group                         :
 callerid                           : <unknown>
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       :
 codec_prefs_incoming_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_incoming_offer         : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_offer         : prefer:pending, operation:union, keep:all, transcode:allow
 connected_line_method              : invite
 contact_acl                        :
 context                            : from-internal
 cos_audio                          : 0
 cos_video                          : 0
 device_state_busy_at               : 0
 direct_media                       : false
 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                          : auto
 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
 geoloc_incoming_call_profile       :
 geoloc_outgoing_call_profile       :
 ice_support                        : false
 identify_by                        : username,ip
 ignore_183_without_sdp             : false
 inband_progress                    : false
 incoming_call_offer_pref           : local
 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                : false
 outbound_auth                      :
 outbound_proxy                     :
 outgoing_call_offer_pref           : remote_merge
 pickup_group                       :
 preferred_codec_only               : false
 record_off_feature                 : automixmon
 record_on_feature                  : automixmon
 refer_blind_progress               : true
 rewrite_contact                    : false
 rpid_immediate                     : false
 rtcp_mux                           : false
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : true
 rtp_timeout                        : 0
 rtp_timeout_hold                   : 0
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_aoc                           : false
 send_connected_line                : no
 send_diversion                     : true
 send_history_info                  : false
 send_pai                           : false
 send_rpid                          : false
 set_var                            :
 srtp_tag_32                        : false
 stir_shaken                        : off
 stir_shaken_profile                :
 sub_min_expiry                     : 0
 subscribe_context                  :
 suppress_q850_reason_headers       : false
 t38_bind_udptl_to_media_address    : 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                          : 0
 tos_video                          : 0
 transport                          : 0.0.0.0-udp
 trust_connected_line               : yes
 trust_id_inbound                   : false
 trust_id_outbound                  : false
 use_avpf                           : false
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                :
 webrtc                             : no

mnhpbx*CLI> pjsip show auth matrix_pjsip

  I/OAuth:  <AuthId/UserName.............................................................>
==========================================================================================

     Auth:  matrix_pjsip/matrix_pjsip

 ParameterName  : ParameterValue
 ===============================
 auth_type      : userpass
 md5_cred       :
 nonce_lifetime : 32
 oauth_clientid :
 oauth_secret   :
 password       :
 realm          :
 refresh_token  :
 username       : matrix_pjsip

mnhpbx*CLI> pjsip show aor matrix_pjsip

      Aor:  <Aor..............................................>  <MaxContact>
    Contact:  <Aor/ContactUri............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

      Aor:  matrix_pjsip                                         0
    Contact:  matrix_pjsip/sip:192.168.1.240:5060          e7d1d1462e Avail        13.027


 ParameterName        : ParameterValue
 =============================================
 authenticate_qualify : false
 contact              : sip:192.168.1.240:5060
 default_expiration   : 3600
 mailboxes            :
 max_contacts         : 0
 maximum_expiration   : 7200
 minimum_expiration   : 60
 outbound_proxy       :
 qualify_frequency    : 60
 qualify_timeout      : 3.000000
 remove_existing      : false
 remove_unavailable   : false
 support_path         : false
 voicemail_extension  :

mnhpbx*CLI> pjsip show identify matrix_pjsip

 Identify:  <Identify/Endpoint...........................................................>
      Match:  <criteria...........................>
==========================================================================================

 Identify:  matrix_pjsip/matrix_pjsip
      Match: 192.168.1.240/32


 ParameterName : ParameterValue
 =============================================
 endpoint      : matrix_pjsip
 match         : 192.168.1.240/255.255.255.255
 match_header  :
 srv_lookups   : true

mnhpbx*CLI> pjsip show registration matrix_pjsip
Unable to find object matrix_pjsip.



I’m puzzled. If both FreePBX and Matrix are statically configured (neither side is registering to the other) and you have Authentication None, I don’t understand why Asterisk is trying to auth the INVITE from the Matrix.

Paste the Asterisk log (with pjsip logger on) for a failing call from Matrix to FreePBX.

Sorry, I missed what was wrong:

You have pjsip Port to Listen On = 5160 and chan_sip Bind Port =5060. That’s backwards from the default settings, but is not a problem.

Then, you have the Matrix configured to send calls to port 5060 on FreePBX, so it’s going to chan_sip, where there is no trunk, so a phony auth request gets dummied up, and the Matrix chokes.

Configure the Matrix to send these calls to port 5160 and you should be good to go.

ok yeah … thats correct…

another thing…

is it possible to have all FXO ports on the matrix register as individual trunks rather than peer-2-peer connection as a single trunk… the rotation of the trunks is done at matrix end…also i can select specific trunk using specific prefix when dialing and matrix removes that prefix at its end…

Just on a side note…is it significantly better to use pjsip instead on chansip??
i personally find chansip much easier to configure and is more forgiving…

i changed the port on matrix as well as on freepbx trunk side…
i am able to make outbound calls but inbound calls are still not not authorised

You don’t have to change anything on the PBX side if you changed Matrix to send UDP traffic to port 5160 on your end.

Is there a firewall that needs to be configured to port forward the correct ports for inbound traffic?

sorry for the delay in replying … it is still not working…
i will post the changes with pictures after the working hours to avoid any disconnections.

For your logs, do both
pjsip set logger on
and
sip set debug on
so we can see if any traffic is going (incorrectly) to chan_sip.

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