Pjsip line feature broken in latest release?

Dear experts,

I have 5 different accounts with the same VOIP provider.
Used to work fine with setting up 5 trunks and the pjsip line option.

Recently it looks like the line option isn’t working anymore.

Looking at my VOIP providers GUI I can see that all five trunks just register with my external IP and the same port.

So in this case the VOIP provider can’t distinguish between the 5 trunks and all is broken.

Regards,
Andreas

Your post is pretty vague.

Are outbound calls still working ok? If not, provide details.

What goes wrong on incoming calls (not delivered to you, rejected by Asterisk, routed incorrectly by you, etc.)?

Why do you think it’s related to the line option (line tag not present in outbound register request, line tag not present in incoming invite request, tag present but pjsip selects wrong endpoint, etc.)?

Can you post a log showing a failing call, including SIP trace?

1 Like

Sorry for not providing more details initially.
I remembered that when looking at my VOIP provider Web interface I could see the registered endpoints and it showed some additional characters (assuming coming from the line option).

Now I see only:
|Device|Contact|

FPBX-14.0.11(16.3.0) 212.51.130.xxx:5060

I see the same registered device information for all 5 numbers (5 trunks defined)

This was definitely different compared to when I checked the last time and it was working.

Below some logs extracted from the FreePBX GUI.

What I’m getting when calling in is a message that the number is not in service.
Looking at the logs below this seems to come from Asterisk.

Here some logs from the FreePBX GUI:

[2019-06-19 04:02:01] Asterisk 16.3.0 built by mockbuild @ jenkins7 on a x86_64 running Linux on 2019-04-17 16:33:59 UTC
[2019-06-19 04:02:01] VERBOSE[43024] logger.c: Asterisk Queue Logger restarted
[2019-06-19 04:02:01] VERBOSE[43024] asterisk.c: Remote UNIX connection disconnected
[2019-06-19 14:36:11] VERBOSE[118433] pbx_variables.c: Setting global variable ‘SIPDOMAIN’ to ‘212.51.130.xxx’
[2019-06-19 14:36:11] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:1] NoOp(“PJSIP/Home610-00000001”, “No DID or CID Match”) in new stack
[2019-06-19 14:36:11] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:2] Answer(“PJSIP/Home610-00000001”, “”) in new stack
[2019-06-19 14:36:12] WARNING[13662][C-00000002] chan_sip.c: This function can only be used on SIP channels.
[2019-06-19 14:36:12] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:3] Log(“PJSIP/Home610-00000001”, "WARNING,Friendly Scanner from ") in new stack
[2019-06-19 14:36:12] WARNING[13662][C-00000002] Ext. s: Friendly Scanner from
[2019-06-19 14:36:12] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:4] Wait(“PJSIP/Home610-00000001”, “2”) in new stack
[2019-06-19 14:36:14] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:5] Playback(“PJSIP/Home610-00000001”, “ss-noservice”) in new stack
[2019-06-19 14:36:14] VERBOSE[13662][C-00000002] file.c: <PJSIP/Home610-00000001> Playing ‘ss-noservice.alaw’ (language ‘en’)
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:1] Macro(“PJSIP/Home610-00000001”, “hangupcall,”) in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:1] GotoIf(“PJSIP/Home610-00000001”, “1?theend”) in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:3] ExecIf(“PJSIP/Home610-00000001”, “0?Set(CDR(recordingfile)=)”) in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:4] NoOp(“PJSIP/Home610-00000001”, " montior file= ") in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:5] GotoIf(“PJSIP/Home610-00000001”, “1?skipagi”) in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx_builtins.c: Goto (macro-hangupcall,s,7)
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Executing [[email protected]:7] Hangup(“PJSIP/Home610-00000001”, “”) in new stack
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘PJSIP/Home610-00000001’ in macro ‘hangupcall’
[2019-06-19 14:36:15] VERBOSE[13662][C-00000002] pbx.c: Spawn extension (from-pstn, h, 1) exited non-zero on ‘PJSIP/Home610-00000001’
[2019-06-19 22:55:28] VERBOSE[15297] asterisk.c: Remote UNIX connection
[2019-06-19 22:55:40] VERBOSE[15297] asterisk.c: Remote UNIX connection
[2019-06-19 22:55:40] VERBOSE[93703] asterisk.c: Remote UNIX connection disconnected

I’m also looking through other logs and I see some errors in ucp_err.log
2019-06-19 00:24 +02:00: { Error: MySQL server has gone away code: 2006 }
There was an error with MySQL Connection
2019-06-19 08:24 +02:00: { Error: MySQL server has gone away code: 2006 }
There was an error with MySQL Connection
2019-06-19 16:24 +02:00: { Error: MySQL server has gone away code: 2006 }
There was an error with MySQL Connection

Asterisk version:
Asterisk 16.3.0, Copyright © 1999 - 2018, Digium, Inc. and others.

Also some error recently after a reboot in messages:
Jun 18 00:24:10 freepbx php: Unable to see safemode in services… Sleeping 5 seconds and retrying
Jun 18 00:24:10 freepbx systemd: Stopping Fail2Ban Service…
Jun 18 00:24:15 freepbx php: Unparseable output from getservices - [“Exception: Asterisk is not connected in file /var/www/html/admin/libraries/php-asmanager.php on line 242”,“Stack trace:”," 1. Exception->() /var/www/html/admin/libraries/php-asmanager.php:242"," 2. AGI_AsteriskManager->send_request() /var/www/html/admin/modules/firewall/Smart.class.php:447"," 3. FreePBX\modules\Firewall\Smart->getPjsipContacts() /var/www/html/admin/modules/firewall/Smart.class.php:437"," 4. FreePBX\modules\Firewall\Smart->getRegistrations() /var/www/html/admin/modules/firewall/Smart.class.php:69"," 5. FreePBX\modules\Firewall\Smart->getAllPorts() /var/www/html/admin/modules/firewall/Firewall.class.php:1026"," 6. FreePBX\modules\Firewall->getSmartPorts() /var/www/html/admin/modules/firewall/bin/getservices:22"] - returned 1
Jun 18 00:24:15 freepbx php: Unable to see safemode in services… Sleeping 5 seconds and retrying
Jun 18 00:24:16 freepbx fail2ban-client: Shutdown successful
Jun 18 00:24:16 freepbx systemd: Stopped Fail2Ban Service.
Jun 18 00:24:16 freepbx systemd: Starting Fail2Ban Service…
Jun 18 00:24:16 freepbx fail2ban-client: 2019-06-18 00:24:16,955 fail2ban.server [15175]: INFO Starting Fail2ban v0.8.14
Jun 18 00:24:16 freepbx fail2ban-client: 2019-06-18 00:24:16,955 fail2ban.server [15175]: INFO Starting in daemon mode
Jun 18 00:24:18 freepbx systemd: Started Fail2Ban Service.
Jun 18 00:24:20 freepbx systemd: Reloading.
Jun 18 00:24:21 freepbx php: Unparseable output from getservices - [“Exception: Asterisk is not connected in file /var/www/html/admin/libraries/php-asmanager.php on line 242”,“Stack trace:”," 1. Exception->() /var/www/html/admin/libraries/php-asmanager.php:242"," 2. AGI_AsteriskManager->send_request() /var/www/html/admin/modules/firewall/Smart.class.php:447"," 3. FreePBX\modules\Firewall\Smart->getPjsipContacts() /var/www/html/admin/modules/firewall/Smart.class.php:437"," 4. FreePBX\modules\Firewall\Smart->getRegistrations() /var/www/html/admin/modules/firewall/Smart.class.php:69"," 5. FreePBX\modules\Firewall\Smart->getAllPorts() /var/www/html/admin/modules/firewall/Firewall.class.php:1026"," 6. FreePBX\modules\Firewall->getSmartPorts() /var/www/html/admin/modules/firewall/bin/getservices:22"] - returned 1
Jun 18 00:24:21 freepbx php: Unable to see safemode in services… Sleeping 5 seconds and retrying
Jun 18 00:24:26 freepbx wall[15434]: wall: user root broadcasted 2 lines (34 chars)
Jun 18 00:24:26 freepbx php: Wall: ‘Firewall service now starting.#012#012’ returned 0
Jun 18 00:24:26 freepbx kernel: nf_conntrack version 0.5.0 (16384 buckets, 65536 max)

Basically I have to manually start asterisk with
fwconsole start

So something seems to be wrong with my system

There seem to be more errors in the whole system.
Just did a reload after a module upgrade and I see errors like:

[2019-06-19 23:44:19] WARNING[118777]: pbx.c:7089 add_priority: Extension ‘s’ priority 13 in ‘macro-user-logon’, label ‘gotpass’ already in use at priority 9
[2019-06-19 23:44:19] ERROR[118777]: pbx.c:7313 ast_add_extension2_lockopt: You have to be kidding-- add exten ‘’ to context clean? Figure out a name and call me back. Action ignored.
[2019-06-19 23:44:19] WARNING[118777]: pbx_config.c:1891 pbx_load_config: Unable to register extension at line 4795 of /etc/asterisk/extensions_additional.conf
[2019-06-19 23:44:19] ERROR[118777]: pbx.c:7313 ast_add_extension2_lockopt: You have to be kidding-- add exten ‘’ to context clean? Figure out a name and call me back. Action ignored.
[2019-06-19 23:44:19] WARNING[118777]: pbx_config.c:1891 pbx_load_config: Unable to register extension at line 4796 of /etc/asterisk/extensions_additional.conf
[2019-06-19 23:44:19] ERROR[118777]: pbx.c:7313 ast_add_extension2_lockopt: You have to be kidding-- add exten ‘’ to context clean? Figure out a name and call me back. Action ignored.
[2019-06-19 23:44:19] WARNING[118777]: pbx_config.c:1891 pbx_load_config: Unable to register extension at line 4797 of /etc/asterisk/extensions_additional.conf
[2019-06-19 23:44:19] ERROR[118777]: pbx.c:7313 ast_add_extension2_lockopt: You have to be kidding-- add exten ‘’ to context mini-bar? Figure out a name and call me back. Action ignored.

[2019-06-19 23:44:19] ERROR[37115]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’
[2019-06-19 23:44:19] ERROR[37115]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’
[2019-06-19 23:44:19] WARNING[37115]: res_pjsip/config_transport.c:653 transport_apply: TOS and COS values ignored for websocket transport
[2019-06-19 23:44:19] WARNING[37115]: res_pjsip/config_transport.c:653 transport_apply: TOS and COS values ignored for websocket transport
[2019-06-19 23:44:19] WARNING[37115]: res_pjsip/config_transport.c:653 transport_apply: TOS and COS values ignored for websocket transport
[2019-06-19 23:44:19] WARNING[37115]: res_pjsip/config_transport.c:653 transport_apply: TOS and COS values ignored for websocket transport
[2019-06-19 23:44:19] ERROR[37115]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’
[2019-06-19 23:44:19] ERROR[37115]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’
[2019-06-19 23:44:19] NOTICE[37115]: sorcery.c:1334 sorcery_object_load: Type ‘system’ is not reloadable, maintaining previous values
[2019-06-19 23:44:19] ERROR[37115]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’
– Reloading module ‘res_pjsip_authenticator_digest.so’ (PJSIP authentication resource)
– Reloading module ‘res_resolver_unbound.so’ (Unbound DNS Resolver Support)
[2019-06-19 23:44:19] ERROR[118777]: config_options.c:710 aco_process_config: Unable to load config file ‘resolver_unbound.conf’
– Reloading module ‘res_pjsip_endpoint_identifier_ip.so’ (PJSIP IP endpoint identifier)
[2019-06-19 23:44:19] ERROR[118777]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’

[2019-06-19 23:44:19] ERROR[118777]: res_pjsip_config_wizard.c:1091 object_type_loaded_observer: Unable to load config file ‘pjsip_wizard.conf’

If you really want to troubleshoot the ‘line’ feature, at the Asterisk command prompt type
pjsip set logger on
which will include the SIP traffic in the normal Asterisk log. Look at whether an incoming INVITE includes the line tag in the URI; if not check the Contact header of an outgoing REGISTER request. Or, post the relevant log segments.

However, I know nothing (so far) about your system that would require the line feature. In pjsip Settings -> Advanced for your trunks, try setting Contact User to the DID for that trunk (in the same format that you have in your Inbound Routes).

Alternatively, In pjsip Settings -> General for your trunks, try changing Context from from-pstn to from-pstn-toheader, which should cause the DID (or perhaps the account number, whatever the provider sends) for the trunk to be used for routing incoming. Temporarily set up an Inbound Route with DID Number and CallerID Number left blank, pointing to a working extension. Call in and see what appears in the DID field of your CDR. Change your production Inbound Routes accordingly, then delete the temporary route.

Thanks a lot for the suggestions.

I mentioned the pjsip line option because this was the way to get it working a while ago:

I tried both of your options on two different trunks and they both work.

For the other trunks I didn’t change I get:
Executing [[email protected]:1] NoOp(“PJSIP/Office611-0000000e”, “No DID or CID Match”) in new stack

So something might have change on the provider end recently, but it looks like I have now a solution to adapt to that change.

Regards,
Andreas

For the benefit of others reading this: The ‘line’ option allows pjsip to determine which trunk is the source of an inbound call. Users sometimes require this to limit the number of simultaneous calls on a trunk, or to identify it for billing, accounting, quality monitoring or similar purposes.

But in your case (and that of most users), you simply want to know which number was called, so you can route it to the correct extension, ring group, queue, etc.

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