PJSIP outbound proxy issue

Those can’t both be true. Do incoming calls ring the called phone? Did you change something in between?

It was working at the first time i installed PJSIP trunk ,now not working .
for outgoing calls i upload it here .

For the outbound, line 46 shows
-- Executing [[email protected]:7] GotoIf("PJSIP/1122-00000007", "1?restrictedroute-c4ca4238a0b923820dcc509a6f75849b,66663247,2:outbound-allroutes,66663247,2") in new stack
so the system still finds the selected Outbound Route restricted from extension 1122.
Assuming that the route that 66663247 should match is the first or only route in your Outbound Routes, please post screenshots of that route (all tabs).

For incoming, if you believe registration is required, please post a screenshot of Reports->Asterisk Info->Registries

Also, what, if anything, shows in sngrep when you attempt an incoming call?

When the number is called, what does the caller hear?

The route Dial pattern is :
NXXNXXXXXX
And it is the only pattern i use i use it with the extensions also .
I enabled the extensions in my only route .
For sngrep
I used command sngrep -c
here is the output
│INVITE sip:[email protected] SIP/2.
Y.Y.Y.Y:5083 MY-eh2:5060 193.107.216.4:58137 91.140.224.242:5060 Y.Y.Y.Y:5│Via: SIP/2.0/UDP Y.Y.Y.Y:5083;rpo
──────────┬───────── ──────────┬───────── ──────────┬───────── ──────────┬───────── ──────────┬──────│;branch=z9hG4bKac392817551
│ INVITE (SDP) │ │ │ │ │Max-Forwards: 67
04:20:14.458511 │ ──────────────────────────> │ │ │ │ │From: sip:[email protected];tag=1c149
+0.104509 │ │ │ INVITE (SDP) │ │ │95383
04:20:14.563020 │ │ │ ──────────────────────────> │ │ │To: sip:[email protected]
+0.519644 │ │ INVITE (SDP) │ │Call-ID: ba15e0001cf5-603306d0-5fb3413b-
04:20:15.082664 │ │ <────────────────────────────────────────────────────────────────────────────────────── │ │583a98-12b599-01-UASession-d837LS0nVl-UA
+0.835252 │ │ │ │ │ │ssion-iRj7DUp-!-
04:20:15.917916 │ │ │ │ │ ─────│CSeq: 1 INVITE
+0.565660 │ │ │ │ │ │Contact: sip:Y.Y.Y.Y:5083
SD04:20:16.483576 │ │ │ │ │ │Supported: timer,sdp-anat
+0.806927 │ │ │ │ │ │Allow: INVITE,ACK,CANCEL,BYE,INFO,REGIST
04:20:17.290503 │ │ │ │ │ │,NOTIFY
+0.567806 │ │ │ │ │ │User-Agent: TELES-SBC
04:20:17.858309 │ │ │ │ │ │Accept: application/sdp
+4.346003 │ │ │ │ │ │Unsupported: refer
04:20:22.204312 │ │ │ │ │ │Allow-Events: talk
+12.894903 │ │ │ │ │ │Content-Type: application/sdp
04:20:35.099215 │ │ │ │ │ │Content-Length: 417
+0.640043 │ │ │ │ │ │X-IP-Info: 10.7.103.102
04:20:35.739258 │ │ │ │ │ │
+2.341715 │ │ │ │ │ │v=0
04:20:38.080973 │ │ │ │ │ │o=- 1845745202 513269132 IN IP4 213.132.
+1.129313 │ │ │ │ │ │8.37
04:20:39.210286 │ │ │ │ │ │s=TELES-SBC
+1.384406 │ │ │ │ │ │c=IN IP4 Y.Y.Y.Y
04:20:40.594692 │ │ │ │ │ │t=0 0
+0.594594 │ │ │ │ │ │m=audio 22455 RTP/AVP 8 0 18 96 101
04:20:41.189286 │ │ │ │ │ │a=rtpmap:8 PCMA/8000
+14.587473 │ │ │ │ │ │a=rtpmap:0 PCMU/8000
04:20:55.776759 │ │ │ │ │ │a=rtpmap:18 G729/8000
+0.654085 │ │ │ │ │ │a=fmtp:18 annexb=yes
04:20:56.430844 │ │ │ │ │ │a=rtpmap:96 PCMA/8000
│ │ │ │ │ │a=gpmd:96 vbd=yes
│ │ │ │ │ │a=rtpmap:101 telephone-event/8000
│ │ │ │ │ │a=fmtp:101 0-15
│ │ │ │ │ │a=mptime:20 20 20 20 -
│ │ │ │ │ │a=silenceSupp:off - - - -
│ │ │ │ │ │a=sendrecv
│ │ │ │ │ │a=rtcp:22456 IN IP4 Y.Y.Y.Y

That pattern is intended for numbers in US, Canada and a few other countries. It won’t match the numbers you are dialing.
Replace the pattern with
XXXX.
which will accept anything with 5 or more digits. After Apply Config for the new pattern, you will need to turn pjsip logger and sip debug back on. The call will likely still fail, but it should get much further. Paste a new log.

When i make call from my mobile i hear a message that says "the minimum cost of this call not available in your credit "
when i call from my extensions to outside i saw this error
res_pjsip_header_funcs.c:410 remove_header: No headers had been previously added to this session.

I don’t know what that means but suspect that it is a result of the provider eventually rejecting the call. It appears that the INVITE is coming in but is sent repeatedly, so there was no response (or an incorrect response).

I have trouble reading your sngrep because it was badly butchered by the forum software.
Please post it again, preceding it with three backquotes “```” (but without the “”) on a line by itself and following it with three backquotes on a line by itself. Look at the preview to confirm format before posting.

That is not relevant to what went wrong, please paste a new complete log.

So they are sending the call to port 5060 but no reply. If you are sure that you had pjsip logger on when the call was made and nothing was logged, there are two likely possibilities:

  1. pjsip Port to Listen On was not set to 5060 – confirm that this is properly set.
  2. blocked by FreePBX firewall.

For the Firewall, go to Admin -> System Admin ->Intrusion Detection. Do any addresses appear in the currently banned list?

Also, go to Connectivity -> Firewall, Networks tab and add y.y.y.y to Trusted zone.

Retest incoming with pjsip logger on. If anything gets logged, paste it and post the link.

For outgoing, after fixing the Outbound Route pattern, we need a new log.

I checked the ports also firewall and here is the error for incoming call
ERROR[27580]: res_pjsip_session.c:934 handle_incoming_sdp:MY-USER-NAME: Couldn’t negotiate stream 0:audio-0:audio:sendrecv (nothing)
for the outgoing call i see this error
ERROR[27580]: res_pjsip_header_funcs.c:410 remove_header: No headers had been previously added to this session.

So in your pjsip trunk, what codecs do you have enabled? Try with only alaw and ulaw checked.

Where are you seeing this error? Normally, the Asterisk log (go to Reports -> Asterisk Logfiles) has timestamps. Are you just looking at the console? If so, there are (non-error) entries in the log that may not show up on the console that would show what is going wrong.

If you have trouble looking at Reports -> Asterisk Logfiles, the raw data is in /var/log/asterisk/full
you can download that file and extract the data you need. Find the “couldn’t negotiate stream” error and assume that everything starting one second earlier through one second later may be associated with the incoming call. Paste that and post the link.

Alternatively, if you want to see all this stuff on the console, at the Asterisk command prompt type
core set verbose 3
and then try your incoming or outgoing call.

Codecs ULAW and ALAW only
the calls logs here

The outbound call got much further and was sent to the trunk, but the provider rejected the call with a service unavailable; see lines 202 - 204.

However, the important data was missing, because pjsip logger was not on (it gets turned off on every reload and restart). So, turn it on again
pjsip set logger on
make new calls and paste logs.

On incoming, possibly this is your issue:

The provider doesn’t support encryption, so make sure that any settings related to encryption are turned off. In particular, make sure that Media Encryption for the trunk is set to None.

Incoming & outgoing call logs here

The issue now with webrtc extensions i have to enable media encryption and DTLS to make it work cause it use SIP.JS
I can receive the call but with no sound

On the incoming call, in theory there should be no conflict between an encrypted extension and an unencrypted trunk. Asterisk should encrypt media from the trunk before passing it to the extension, and decrypt media from the extension before passing it to the trunk.

If you are certain that you had set Media Encryption for the trunk to None, properly did Submit, Apply Config and restarted Asterisk, and still get the Couldn’t negotiate stream error, you have probably found a bug in pjsip. If you’re not sure, please retest. If there is a bug, I suggest that for now you work around it by using unencrypted devices (IP phone, ATA, softphone such as Zoiper, PhonerLite, etc., or SIP app for a mobile device).

This error may have also affected the outgoing call but the important part of the log is missing. Please paste everything with timestamps 10:16:20 through 10:16:22.

After asterisk restart still the same so it appears this is a bug .As you said .
Where we can report it ?

I recommend that you do it in three stages:

  1. Verify that this is the problem. Turn off encryption and confirm that an unencrypted extension can make and receive calls.

  2. Find out whether this issue is with FreePBX or pjsip. Look at the pjsip config files in /etc/asterisk and see whether FreePBX generated them incorrectly (asked for encryption on the trunk, when there should be none).

  3. If this is a FreePBX problem, sign up and open an issue at issues.freepbx.org ; if it’s a pjsip problem I suggest first posting on their mailing list. More info at https://www.pjsip.org/ .

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