Outbound PJSIP trunk username underscore bug

Hello, thought i’d post here to know if I should create a issue in Jira. I searched the forum and the archived issues but only found similar bug with the trunk name as opposed to the SIP username. here it is…


I am experiencing a bug with the creation of an outbound pjsip trunk to Voip.ms that use underscore in sub-account sip username therefore in the SIP URI. Upon creation, the GUI add a space character immediately after the underscore and break the trunk. I was able to find the issue in reviewing the asterisk logs when the trunk was failing. I was able to fix this by manually editing the config files using SSH but upon reloads the space character get loaded back into the pjsip config files and break the trunk again.

SIP URI: mainAccount_ [email protected]

As a test, I created a trunk with (examples):
SIP Server: seattle1.voip.ms
Username: 123456_1
Secret: Abcd1234
and it registered ok.
Please me more specific about which config parameters are corrupted.

On my system, searching the pjsip config files found:

# grep 123456 pjs*
pjsip.aor.conf:contact=sip:[email protected]
pjsip.registration.conf:client_uri=sip:[email protected]

Possibly, this a new bug related to a specific version of some module.

Thanks for your reply Stewart.
Here are related config files

grep ‘MainAccount_ sub’Account /etc/asterisk/pjsip*
/etc/asterisk/pjsip.aor.conf:contact=sip:MainAccount_ [email protected]
/etc/asterisk/pjsip.auth.conf:username=MainAccount_ subAccount
/etc/asterisk/pjsip.registration.conf:client_uri=sip:MainAccount_ [email protected]

In the log:
[2022-01-22 11:48:54] ERROR[27669] res_pjsip.c: Unable to create outbound OPTIONS request to endpoint VoiPms-Trunk as URI ‘sip:MainAccount_ [email protected]’ is not valid

What versions of FreePBX Framework and Core do you have? Was this system installed from the Distro? If not, how was it built?

New Install from the FreePBX distro ISO SNG7-PBX-64bit-2104-1.iso then updated OS and modules post install.

FreePBX Framework:

Is there a temp fix I could do to avoid config file of continuously being corrupted upon reload?

Sure, try putting this in /etc/asterisk/pjsip_custom_post.conf then doing a reload:

contact=sip:[email protected]
client_uri=sip:[email protected]

The custom configs get pushed but they get corrupted shortly after.

I attempted to rollback to FreePBX Framework but the issue is still present

Please explain. Did /etc/asterisk/pjsip_custom_post.conf get overwritten? Or is it no longer being read? Or something else?

IMO this is more likely in Core than Framework. Also, please confirm that your issue is not related to e.g. browser customization – try from another browser, preferably on another computer.

You were bang on with regards to my browser! I was using Firefox then tried Chrome on a different computer and was able to see from the UI the culprit space character in the pjsip configuration tab! Removed it, re-submitted and deleted the /etc/asterisk/pjsip_custom_post.conf and the sip URI is now fine!

Thanks @Stewart1 ! Your help is much appreciated :slight_smile:

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