PJSIP outbound proxy issue

(Egypt) #81

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.

(Egypt) #83

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.

(Egypt) #86

Incoming & outgoing call logs here

(Egypt) #87

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.

(Egypt) #89

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/ .