PJSIP outbound proxy issue

(Egypt) #41

tcpdump not showing any output Dial-numbers general incoming out


I’m completely stumped. I have no idea whether this is a problem with the OS, Asterisk, or FreePBX and whether there is a bug somewhere or you have a configuration error that I missed.

As a test, I created a new chan_sip trunk called ‘dummy’ with Peer Details and User Details completely blank, and with this Register String:
Using sip set debug on, I see:

Reliably Transmitting (NAT) to
REGISTER sip:foo.com SIP/2.0
Via: SIP/2.0/UDP xx.xx.xx.xx:pppp;branch=z9hG4bK64c620ab;rport
Max-Forwards: 70
From: <sip:1234@foo.com>;tag=as68a8367b
To: <sip:1234@foo.com>
Call-ID: 1fd9e46a38a4dd785c0013221cd01b5d@[::1]
Supported: replaces, timer
User-Agent: FPBX-
Expires: 1800
Contact: <sip:s@xx.xx.xx.xx:pppp>
Content-Length: 0

I recommend that you try the same, and verify the result.

Next, change the Registration String to match your username, domain and secret, but leave the ‘proxy’ IP address at Confirm that this still goes out as expected.

Then, replace with y.y.y.y and see what happens. If this fails to go out, we can see whether it’s a problem with SIP settings (bind port or address, etc.) or with the OS such as a routing issue.

If the requests do go out, report whether any replies are seen.

(Egypt) #43

I think the issue in incoming only outgoing showing same results as you mentioned


Please provide more detail. Are you saying that tcpdump shows properly formatted REGISTER requests going out from eth2 but there are no replies? If that’s true, there is a problem with your provider or your connection to them. But, that is not consistent with the errors being logged that you showed earlier, which indicate that nothing was being sent via eth2.

(Egypt) #45

TCPDUMP not showing any output
here is the sip error
[2021-02-20 21:55:48] ERROR[20923]: chan_sip.c:4344 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data
[2021-02-20 21:55:48] NOTICE[20923]: chan_sip.c:16046 sip_reg_timeout:    – Registration for ‘MY-PASSWORD@OUTBOUND PROXY (Y.Y.Y.Y)’ timed out, trying again (At
tempt #16)
Really destroying SIP dialog ‘5ad62c2f2356ecd76b4f0f3b6dd193f6@eth2’ Method: REGISTER

Here is also SIP debug out put

[2021-02-20 22:12:48] WARNING[20923]: acl.c:1029 ast_ouraddrfor: Cannot connect to (null): Invalid argument
REGISTER 11 headers, 0 lines
Reliably Transmitting (NAT) to (null):
REGISTER sip:bali.site SIP/2.0
Via: SIP/2.0/UDP eth2:5083;branch=z9hG4bK0d169b6b;rport
Max-Forwards: 70
From: <sip:MY-USER-NAME@Domain.com>;tag=as54ccdff3
To: <sip:MY-USER-NAME@Domain.com>
Call-ID: 5ad62c2f2356ecd76b4f0f3b6dd193f6@eth2
Supported: replaces, timer
User-Agent: FPBX-
Expires: 120
Contact: <sip:s@eth2:5083>
Content-Length: 0


Aha! Either FreePBX or Asterisk must be parsing the Register String incorrectly, because for obvious security reasons, passwords should never appear in any log file.

What characters, other than digits and letters, appear in your username or password?

Look at the file /etc/asterisk/sip_registrations.conf
If it has garbage (FreePBX parsed the Register String improperly), remove the register string from your trunk settings and add it manually to /etc/asterisk/sip_registrations_custom.conf , restart Asterisk and test.

If it’s good (Asterisk is parsing it improperly), do you have a way to get a different password that doesn’t contain the offending characters? Asterisk might support escaping the problematic characters, but I don’t know the details.

(Egypt) #47

Sorry for this mistake
Registration for ‘MY-User-name@OUTBOUND PROXY (Y.Y.Y.Y)’ timed out, trying again (At
tempt #16)
Registration line is using user name not password it is my error sorry for this

(Egypt) #48

I replaced user name with my account name and now 2 sips outgoing and incoming registered but i can’t receive calls or send calls to outside .


I still believe that there is a format problem with the register string.

Look at /etc/asterisk/sip_registrations.conf
There should be a line for the trunk in question that begins with ‘register=’ (without the quotes)
Please post that line exactly with these modifications:
For your privacy, replace any letters or digits in the user name with ‘u’, any letters or digits in the password with ‘p’, any letters or digits in the domain name with ‘d’ and all digits in the proxy address with ‘x’. Be sure that any characters other than letters or digits remain unchanged. The result should be exactly the same number or characters as the original.

For example, you might post
if the username, password and domain name have no special characters.

But if there are any characters other than letters or digits, please leave them alone, for example:

(Egypt) #50

i removed the string completely
and 2 sips registered


Is that good or bad (do you have two trunks that you are trying to register)?


In the most recent screenshot, Peer Details shows
it should be
Then, what happens when you try to make a call? Receive a call?

(Egypt) #53


(Egypt) #54

i can’t receive or make calls to out side here is a notice i found when trying to call from outside

NOTICE[8081]: res_pjsip/pjsip_distributor.c:670 log_failed_request: Request ‘INVITE’ from ‘<sip:22338724@Domain.site>’ failed for ‘Y.Y.Y.Y:5083’ (callid: ba15e0001cf5-60318b8d-2191376f-20e58628-128a73-01-UASession-jRaOWOB56T-UASession-0EAOoz48fR) - No matching endpoint found after 5
tries in 4.529 ms


OK, so the provider is sending calls to whatever port pjsip “Port to Listen On” is set. I assume that you want the calls to go to chan_sip.

Depending on your provider, they may send calls to the port from which you register, to a port that you specify on their portal, or always send calls to port 5060.

You might fix this by setting up a pjsip trunk (maybe just for incoming).
Or, resolve the port number discrepancy.

(Egypt) #56

I’m using PJSIP for extensions and SIP for trunk can i use PJSIP for booth ?


Sure. Try the pjsip settings earlier in this thread, but also add:
Match (Permit): y.y.y.y

Since they seem to be sending calls without registration, start with Registration set to None.

Create a catch-all Inbound Route (both DID Number and CallerID number left blank) that routes to an extension. With luck, incoming will work. If not, use
pjsip set logger on
and post details.

(Egypt) #58

Incoming calls working but no sound
Outgoing not working


Confirm that on calls between extensions, you have normal sound in both directions.

If you have any other trunks, are they working properly (with sound)?

If the IP address in the SDP of the incoming INVITE is other than y.y.y.y and the provider requires the audio to be sent via eth2, then you will have to adjust your routing table to include the subnet they are using for audio.

Otherwise, turn on pjsip logging, make a test call, paste the Asterisk log for the call at pastebin.freepbx.org and post the link here. If you redact anything, change only letters and digits and make it clear in your post what the changed items represent.

(Egypt) #60

I can hear my sound between extensions .But now incoming calls not working .
here is the error
res_pjsip/pjsip_distributor.c:676 log_failed_request: Request ‘REGISTER’ from ‘“490” <sip:490@eth1>’ failed
for ‘’ (callid: irXlYWKygUl0GMnHt6nsSw…) - Failed to authenticate
Note : eth1 is my public IP address .