[SOLVED] PJSIP extension won't register when created via extension module

I am trying to setup a pjsip extension on my home office test system. The system seems to be up to date. When i run “cat /etc/schmooze/pbx-version” i get “10.13.66-22” back from the system.

The issue is when I build the extension using the Extensions Module within freepbx I cannot get any phone to register with that extension. I’ve tried a grand steam phone and a couple of soft phones.

All I keep getting is a 401 error and the asterisk terminal says “Request ‘REGISTER’ from ‘<1104…>’ failed for ‘IP’ (callid: qDKBOXaNp1sheYCteGbUtA…) - Failed to authenticate” and [2018-05-13 22:55:15] NOTICE[22363]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request ‘REGISTER’ from ‘<1104…>’ failed for ‘IP’ (callid: e1DbMLQdM6HdnWCUtZfWdQ…) - No matching endpoint found

So after countless hours of scratching my head, and looking for answers, i decided to manually configure build a pjsip extension using the pjsip_custom.conf files in config edit. This worked and i managed to register the extension.

Next i copied the config freepbx generates when i build the extension within the extensions module and copied it into the custom config area, then deleted the ext from extensions module to not cause any problems. Then i troubleshooted the config and i came to the conclusion that the extension module is generating some code that asterisk does not like. On my system it creates a line “auth=1104-auth” and then a “[1104-auth]” entry with the username and password.

When i manually build the same exact config as the extensions module the registration fails in the same manner, however if i tweak “auth=1104-auth” to be “auth=auth1104” and “[1104-auth]” to be “[auth1104]” the extension will register correctly. However now i can’t use all the options that freepbx has to offer and now i have to configure dial plan manually.

Is this something anyone else has seen? Is my system running an outdated module? Any insight or advice would be appreciated.

Here is a list of the modules and their version numbers on my system

±---------------------±------------±----------------------------------±-----------+
| Module | Version | Status | License |
±---------------------±------------±----------------------------------±-----------+
| accountcodepreserve | 13.0.2.2 | Enabled | GPLv2 |
| announcement | 13.0.7.1 | Enabled | GPLv3+ |
| areminder | 13.0.10.6 | Enabled | Commercial |
| arimanager | 13.0.4 | Enabled | GPLv3+ |
| asterisk-cli | 13.0.4 | Enabled | GPLv3+ |
| asteriskinfo | 13.0.7.1 | Enabled | GPLv3+ |
| backup | 13.0.27.18 | Enabled | GPLv3+ |
| blacklist | 13.0.14.8 | Enabled | GPLv3+ |
| bria | 13.0.20 | Enabled | Commercial |
| broadcast | 13.0.12.10 | Enabled | Commercial |
| builtin | | Enabled | |
| bulkdids | 13.0.2 | Enabled | GPLv3+ |
| bulkextensions | 13.0.3 | Enabled | GPLv3+ |
| bulkhandler | 13.0.14.4 | Enabled | GPLv3+ |
| callback | 13.0.5.2 | Enabled | GPLv3+ |
| callerid | 13.0.8.9 | Enabled | Commercial |
| callforward | 13.0.4.2 | Enabled | AGPLv3+ |
| calllimit | 13.0.5.5 | Enabled | Commercial |
| callrecording | 13.0.11.4 | Enabled | AGPLv3+ |
| callwaiting | 13.0.4.1 | Enabled | GPLv3+ |
| campon | 13.0.4.1 | Enabled | GPLv3+ |
| cdr | 13.0.32 | Enabled | GPLv3+ |
| cel | 13.0.26.2 | Enabled | GPLv3+ |
| certman | 13.0.37.7 | Enabled | AGPLv3+ |
| cidlookup | 13.0.12.2 | Enabled | GPLv3+ |
| conferences | 13.0.23.11 | Enabled | GPLv3+ |
| conferencespro | 13.0.27.7 | Enabled | Commercial |
| configedit | 13.0.7.1 | Enabled | AGPLv3+ |
| contactmanager | 13.0.42.12 | Enabled | GPLv3+ |
| core | 13.0.122.16 | Enabled | GPLv3+ |
| cos | 13.0.12.1 | Enabled | Commercial |
| customappsreg | 13.0.5.4 | Enabled | GPLv3+ |
| cxpanel | 13.0.5.1 | Enabled | GPLv3 |
| dahdiconfig | 13.0.33.13 | Enabled | GPLv3+ |
| dashboard | 13.0.25.3 | Enabled | AGPLv3+ |
| daynight | 13.0.15 | Enabled | GPLv3+ |
| dictate | 13.0.5 | Enabled | GPLv3+ |
| digium_phones | | Not Installed (Locally available) | GPLv2 |
| digiumaddoninstaller | | Not Installed (Locally available) | GPLv2 |
| directory | 13.0.19.5 | Enabled | GPLv3+ |
| disa | 13.0.6.1 | Enabled | AGPLv3+ |
| donotdisturb | 13.0.3.1 | Enabled | GPLv3+ |
| endpoint | 13.0.118.21 | Enabled | Commercial |
| extensionroutes | 13.0.10.5 | Enabled | Commercial |
| extensionsettings | 13.0.4 | Enabled | GPLv3+ |
| fax | 13.0.40.5 | Enabled | GPLv3+ |
| faxpro | 13.0.38.9 | Enabled | Commercial |
| featurecodeadmin | 13.0.6.4 | Enabled | GPLv3+ |
| findmefollow | 13.0.38.11 | Enabled | GPLv3+ |
| firewall | 13.0.55.1 | Enabled | AGPLv3+ |
| framework | 13.0.195 | Enabled | GPLv2+ |
| freepbx_ha | 13.0.11 | Enabled | Commercial |
| fw_langpacks | 12.0.7 | Enabled | GPLv3+ |
| hotelwakeup | 13.0.17.1 | Enabled | GPLv2 |
| iaxsettings | 13.0.6.6 | Enabled | AGPLv3 |
| infoservices | 13.0.1.2 | Enabled | GPLv2+ |
| irc | 2.11.0.7 | Enabled | GPLv3+ |
| ivr | 13.0.27.7 | Enabled | GPLv3+ |
| languages | 13.0.6 | Enabled | GPLv3+ |
| logfiles | 13.0.10.4 | Enabled | GPLv3+ |
| manager | 13.0.2.5 | Enabled | GPLv2+ |
| miscapps | 13.0.3.1 | Enabled | GPLv3+ |
| miscdests | 13.0.5 | Enabled | GPLv3+ |
| motif | 13.0.3.2 | Enabled | GPLv3+ |
| music | 13.0.22.3 | Enabled | GPLv3+ |
| outroutemsg | 13.0.2.1 | Enabled | GPLv3+ |
| paging | 13.0.26.5 | Enabled | GPLv3+ |
| pagingpro | 13.0.19.7 | Enabled | Commercial |
| parking | 13.0.19.8 | Enabled | GPLv3+ |
| parkpro | 13.0.30.13 | Enabled | Commercial |
| pbdirectory | 2.11.0.6 | Enabled | GPLv3+ |
| phonebook | 13.0.6.1 | Enabled | GPLv3+ |
| phpinfo | 13.0.2 | Enabled | GPLv2+ |
| pinsets | 13.0.8 | Enabled | GPLv3+ |
| pinsetspro | 13.0.9.8 | Enabled | Commercial |
| pm2 | 13.0.5 | Enabled | AGPLv3+ |
| pms | 13.0.2.14 | Enabled | Commercial |
| presencestate | 13.0.8 | Enabled | GPLv3+ |
| printextensions | 13.0.3.1 | Enabled | GPLv3+ |
| queueprio | 13.0.2 | Enabled | GPLv3+ |
| queues | 13.0.34.9 | Enabled | GPLv2+ |
| qxact_reports | 13.0.15.6 | Enabled | Commercial |
| recording_report | 13.0.24.6 | Enabled | Commercial |
| recordings | 13.0.30.12 | Enabled | GPLv3+ |
| restapi | 13.0.21.1 | Enabled | AGPLv3 |
| restapps | 13.0.92.5 | Enabled | Commercial |
| ringgroups | 13.0.23.2 | Enabled | GPLv3+ |
| rmsadmin | 13.0.14.1 | Enabled | Commercial |
| sangomacrm | 13.0.4.30 | Enabled | Commercial |
| setcid | 13.0.6.2 | Enabled | GPLv3+ |
| sipsettings | 13.0.27.1 | Enabled | AGPLv3+ |
| sipstation | 13.0.14.8 | Enabled | Commercial |
| sms | 13.0.12.3 | Enabled | Commercial |
| sng_mcu | 13.0.5 | Enabled | Commercial |
| soundlang | 13.0.24.5 | Enabled | GPLv3+ |
| speeddial | 2.11.0.4 | Enabled | GPLv3+ |
| superfecta | 13.0.4.5 | Enabled | GPLv2+ |
| sysadmin | 13.0.76.4 | Enabled | Commercial |
| timeconditions | 13.0.34.9 | Enabled | GPLv3+ |
| tts | 13.0.10 | Enabled | GPLv3+ |
| ttsengines | 13.0.7.3 | Enabled | AGPLv3 |
| ucp | 13.0.42.5 | Enabled | AGPLv3+ |
| ucpnode | 13.0.34.9 | Enabled | Commercial |
| userman | 13.0.76.37 | Enabled | AGPLv3+ |
| versionupgrade | 13.0.1.2 | Enabled | Commercial |
| vmblast | 13.0.8 | Enabled | GPLv3+ |
| vmnotify | 13.0.22 | Enabled | Commercial |
| voicemail | 13.0.54.20 | Enabled | GPLv3+ |
| voicemail_report | 13.0.13.3 | Enabled | Commercial |
| vqplus | 13.0.39 | Enabled | Commercial |
| weakpasswords | 13.0.2 | Enabled | GPLv3+ |
| webcallback | 13.0.11.2 | Enabled | Commercial |
| webrtc | 13.0.32.8 | Enabled | GPLv3+ |
| xmpp | 13.0.17.13 | Enabled | AGPLv3 |
| zulu | 13.0.53.4 | Enabled | Commercial |
±---------------------±------------±----------------------------------±-----------+

This works on thousands of systems in the way you say it doesn’t just fine and has been working this way since version 12 which was released almost 4 years ago

Oh I believe you. We sell freepbx and pbxact at work and we have in house production and test systems that are not exhibiting this problem that have pjsip extensions

I just would like to know if there is something i could try on my system before i decide to give up and nuke / reinstall. This is one thing that bothers me about freepbx / pbxact, you get this one off issue and if you don’t pay for paid help and no one in the forums is willing to help, its pretty much nuke it and start over…

Just a shot in the dark: SIP and PJSIP are on different ports. If you request to authenticate to the PBX for a PJSIP extension on the SIP port you’ll get a 401, and vice versa.

Michael,

I’m fully aware of this. My end points were set connect to the server on port 6060 which is the port i designated for pjsip in “Asterisk SIP Settings”

My chan_sip is set to 5060 / 5061 if i recall correctly.

As noted in my long most likely incoherent original post. I managed to get my endpoint connected via pjsip on 6060 when i manually built the extension in pjsip_custom.conf

Some phones (especially with outdated firmware) are bot happy with long passwords. Try a shorter password.

This error is commonly indicative of a SIP port mismatch.

Can you connect to the /var/log/asterisk/full log file and show us the actual error in the log? The ‘dash’ in the authname context shouldn’t be a problem, but it may be giving you some issues. Figuring out where that’s coming from will get us closer.

Showing us the working vs. non-working contexts from the extensions_custom.conf file might help.

Do you have any custom code or custom “modules” that have been added to Asterisk?

Here is the error from /var/log/asterisk/full

[2018-05-14 17:50:49] NOTICE[25927] res_pjsip/pjsip_distributor.c: Request ‘REGISTER’ from ‘“1104” <sip:[email protected] IP address of server>’ failed for ‘obfuscated IP address of endpoint:49752’ (callid: BNRT2mxwQYMRwpFv679MxQ…) - No matching endpoint found
[2018-05-14 17:50:49] NOTICE[25927] res_pjsip/pjsip_distributor.c: Request ‘REGISTER’ from ‘“1104” <sip:[email protected] IP address of server>’ failed for ‘obfuscated IP address of endpoint:49752’ (callid: BNRT2mxwQYMRwpFv679MxQ…) - No matching endpoint found
[2018-05-14 17:50:49] NOTICE[25927] res_pjsip/pjsip_distributor.c: Request ‘REGISTER’ from ‘“1104” <sip:[email protected] IP address of server>’ failed for ‘obfuscated IP address of endpoint:49752’ (callid: BNRT2mxwQYMRwpFv679MxQ…) - Failed to authenticate

Here is the config generated by the extensions module:

[0.0.0.0-udp]
type=transport
protocol=udp
bind=0.0.0.0:6060
external_media_address=obfuscated IP address
external_signaling_address=obfuscated IP address
allow_reload=yes
local_net=192.168.100.0/24
local_net=192.168.5.0/24

[0.0.0.0-tcp]
type=transport
protocol=tcp
bind=0.0.0.0:6061
external_media_address=obfuscated IP address
external_signaling_address=obfuscated IP address
allow_reload=yes
local_net=192.168.100.0/24
local_net=192.168.5.0/24

[1104]
type=aor
max_contacts=1
remove_existing=yes
maximum_expiration=7200
minimum_expiration=60
qualify_frequency=60

[1104-auth]
type=auth
auth_type=userpass
password=password
username=1104

[1104]
type=endpoint
aors=1104
auth=1104-auth
allow=ulaw,alaw,gsm,g726,g723,speex,g722,silk
context=from-internal
callerid=device <1104>
dtmf_mode=rfc4733
aggregate_mwi=yes
use_avpf=no
rtcp_mux=no
ice_support=no
media_use_received_transport=no
trust_id_inbound=yes
media_encryption=no
timers=yes
media_encryption_optimistic=no
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
language=en

[1104-identify]
type=identify
endpoint=1104

If i delete the ext from extensions module and build a config manually with the config shown below it will register:

[1104]
type=aor
max_contacts=1
remove_existing=yes
maximum_expiration=7200
minimum_expiration=60
qualify_frequency=60

[auth1104]
type=auth
auth_type=userpass
password=password
username=1104

[1104]
type=endpoint
aors=1104
auth=auth1104
allow=ulaw,alaw,gsm,g726,g723,speex,g722,silk
context=from-internal
callerid=device <1104>
dtmf_mode=rfc4733
aggregate_mwi=yes
use_avpf=no
rtcp_mux=no
ice_support=no
media_use_received_transport=no
trust_id_inbound=yes
media_encryption=no
timers=yes
media_encryption_optimistic=no
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
language=en

[1104-identify]
type=identify
endpoint=1104

I do not have any custom modules or code at the moment for troubleshooting purposes.

Does it matter what version of asterisk I’m running? I’m running Asterisk 13.19.1

When you restart asterisk it will tell you in the logs what issues it’s having.

Found this in /var/log/asterisk/full after reloading asterisk. Could not find anything else on that ext other than it being loaded to the dial plan. This is with 1104 built within extensions module and nothing built in the custom area of configuration file editor.

[2018-05-14 22:00:26] ERROR[17492] config_options.c: Error parsing allow=ulaw,alaw,gsm,g726,g723,speex,g722,silk at line 15 of /etc/asterisk/pjsip.endpoint.conf
[2018-05-14 22:00:26] ERROR[17492] res_sorcery_config.c: Could not create an object of type ‘endpoint’ with id ‘1104’ from configuration file ‘pjsip.conf’
[2018-05-14 22:00:26] ERROR[17492] res_pjsip_config_wizard.c: Unable to load config file ‘pjsip_wizard.conf’

Well I would like to thank everyone that helped. Its fixed and working now.

After seeing the error in the log as Andrew mentioned, it seemed like it was something to do with the codec part of the config.

I ended up going into the advanced tab for that extension and i set “Disallowed Codecs” = all
and “Allowed Codecs” to ulaw and the error went away and my extension now registers properly and everything works as it should.

Thank you once again!

These should be separated by “&” and appears to be a bug because in chan_sip comma is what it wants here but not in pjsip

Bug report https://issues.freepbx.org/browse/FREEPBX-17492

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