PJSIP outbound proxy issue

That error is irrelevant, the result of some hacker using automated tools on a system in Canada attempting to access your system. Assuming that you have strong passwords, you don’t have to worry about these guys yet. Eventually, you can set up FreePBX firewall to block them.

What I asked for is the complete Asterisk log for a failing call, including pjsip logger. It’s typically several hundred lines. Paste it at pastebin.freepbx.org and post the link here.

When i try to make incoming call from my mobile phone ,the Asterisk not showing any log errors about the call but i can hear the phone ring on my mobile .
i only found this error :
WARNING[31899]: pjproject: <?>:                      SSL 6 [SSL_ERROR_ZERO_RETURN] (Read) ret: 0 len: 65535
When i try to make outgoing call
i pasted the log here

You apparently installed a module “extension routing” or “class of service” whose purpose is to control which extensions are allowed to use which Outbound Routes. By default, all routes are blocked from all extensions. You need to set your extension 1122 (or all extensions) to allow all routes. See
https://wiki.freepbx.org/display/FPG/Extension+Routing-Admin+Guide

I did that with no success in outgoing or incoming calls .
I notice something :
The PJSIP show my trunk in peers but not in registrations .I think that’s means we are not registered in the trunk yet .

OK, so maybe something went wrong (IMO unlikely) or it failed further on. In either case, paste a new log (with pjsip logger on) and we’ll take a look.

Some providers don’t require registration, because they send calls to a previously configured IP address. I believe that is your situation. If incoming INVITEs hit your PBX, you don’t need registration.

Paste a separate log of a failing incoming call.

Did I not see on this thread that we are using IP Auth and not registration ?

PJSIP not show any logs it show SIP logs do i have to disable SIP ?

@Stewart1
After >core restart now
No i can the following
 == Endpoint MY-USER-NAME is now Reachable
   – Contact MY-USER-NAME/sip:Y.Y.Y.Y:5083 is now Reachable.  RTT: 16.922 msec
WARNING[24715]: pjproject: <?>:                      SSL 6 [SSL_ERROR_ZERO_RETURN] (Read) ret: 0 len: 65535

That is probably unrelated to your trunk. Are you using TLS on any of your trunks or extensions?

In any case, turn on both loggers:
pjsip set logger on
sip set debug on
make an outgoing test call, paste the complete Asterisk log for the call, post the link.

Then, do the same for an incoming call attempt.

I use WebRTC in extensions
for the outgoing call logs i upload it here
For incoming calls logs ( No logs ) .

I am getting a 404 error on that link. Please upload it again. Make sure that ‘Delete After’ is set to ‘Keep Forever’, so future readers can learn from this thread. If you had accidentally selected ‘Burn on reading’, then it may have been deleted after someone else read it.

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 [66663247@from-internal: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:DID-number@MY-eh2 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.