Grandstream, Asterisk, and PJSIP. Are they compatible?

It might be that you need to enable ‘readonly’ options in advanced settings before you will see it.

Edit: Nah , not needed.

The tech helped to the setup back in 2016. Maybe he thought ChanSip was OK moving forward? I have no clue.
The Advanced Setting-Sip Channel Driver is set to both.
The ports no longer conflict (but they are opposite of what I understand the standard is moving forward).
I think they set the ChanSip and just totally ignored PJsip. That would explain why the port conflict.

How do I get you the log files needed to know if it’s actually using PJsip? And why would I not be able to change the default TLS port over to PJsip?

‘Standard’ is perhaps a mis-nomer perhaps ‘default’, even so , 5060 is the ‘conventional’ sip port, but there are many reasons NOT to use and no GOOD ones to actually use it especially for UDP transport.

I don’t think it switched. When I go to the Extension GUI-Advanced-Change SIP Driver it says I can change it to PJSip Driver. If I select that, submit, and apply the phone won’t connect. If I were to run the scrip on all extensions I’d lose connection with every phone we have. That would be really bad.

That is the expected behavior on all systems. Asterisk requires pjsip and chan_sip transports to bind to different ports. In Asterisk SIP Settings, on the pjsip tab, you’ll see Port to Listen On for each transport. Assuming that the phone was using UDP, the relevant setting is the one for 0.0.0.0 (udp). On the chan_sip tab, you’ll see a setting for Bind Port. That’s the port to which the phone was connecting when the extension was set to chan_sip.

Now, you must go into the phone’s settings and change the value of SIP Server to reflect the new port. Restart the phone and it should connect to pjsip. If not, you need to find out what is going wrong. Does anything appear in the Asterisk log when the phone attempts to register?

Steward. That doesn’t work. In the Advance settings-SIP Settings-Sip settings chan_pjsip, the UDP port to listen on is set to 5161.

On the SIP Chan_sip the bind port is set to 5060

On the Grandstream phone itself the SIP Server is set to 192.168.12.250:5161 As a result I would expect the phone to connect to PJSip however in the extensions tab it shows a link to convert to PJSIP, so it’s connected as chanSip currently.

And you’re right… I need to figure out what’s wrong. That’s the point.

I don’t see the Asterisk log files change at all when I reboot the phone. I just did for example at 2:24pm but the log file shows nothing since 2:16pm. If I reload the log, it’s the same with the last log still at 2:16.

I was able to grab log files after changing the extension to PJsip. Do these help?

	
652280	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'app-dictate-record' tries to include nonexistent context 'app-dictate-record-custom'	
652281	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-pjsip-auto-answer-redirect' tries to include nonexistent context 'c-x-3-operator-panel-pjsip-auto-answer-redirect-custom'	
652282	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-pjsip-auto-answer-headers' tries to include nonexistent context 'c-x-3-operator-panel-pjsip-auto-answer-headers-custom'	
652283	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-spy' tries to include nonexistent context 'c-x-3-operator-panel-spy-custom'	
652284	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-listen-to-recording' tries to include nonexistent context 'c-x-3-operator-panel-listen-to-recording-custom'	
652285	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-listen-to-voice-mail' tries to include nonexistent context 'c-x-3-operator-panel-listen-to-voice-mail-custom'	
652286	[2022-04-15 14:26:55] WARNING[17108] pbx.c: Context 'c-x-3-operator-panel-park-announce-answer' tries to include nonexistent context 'c-x-3-operator-panel-park-announce-answer-custom'	

652338	[2022-04-15 14:26:55] ERROR[17108] res_sorcery_config.c: Unable to load config file 'pjproject.conf'	
652339	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_pjsip.so' (Basic SIP resource)	
652340	[2022-04-15 14:26:55] ERROR[17153] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652341	[2022-04-15 14:26:55] ERROR[17153] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652342	[2022-04-15 14:26:55] ERROR[17153] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652343	[2022-04-15 14:26:55] ERROR[17153] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652344	[2022-04-15 14:26:55] NOTICE[17153] sorcery.c: Type 'system' is not reloadable, maintaining previous values	
652345	[2022-04-15 14:26:55] ERROR[17153] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652346	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_outbound_publish.so' (PJSIP Outbound Publish Support)	
652347	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_crypto.so' (Cryptographic Digital Signatures)	
652348	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_fax.so' (Generic FAX Applications)	
652349	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_ari.so' (Asterisk RESTful Interface)	
652350	[2022-04-15 14:26:55] VERBOSE[17108] loader.c: Reloading module 'res_digium_phone.so' (Digium Phone Module for Asterisk)	
652351	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_parking.so' (Call Parking Resource)	
652352	[2022-04-15 14:26:56] VERBOSE[17108] pbx.c: Remove parkedcalls/700/1, registrar=res_parking/default; con=<nil>((nil)); con->root=(nil)	
652353	[2022-04-15 14:26:56] VERBOSE[17108] pbx.c: Remove parkedcalls/701/1, registrar=res_parking/default; con=<nil>((nil)); con->root=(nil)	
652354	[2022-04-15 14:26:56] VERBOSE[17108] pbx.c: Remove parkedcalls/702/1, registrar=res_parking/default; con=<nil>((nil)); con->root=(nil)	
652355	[2022-04-15 14:26:56] VERBOSE[17108] pbx.c: Remove parkedcalls/703/1, registrar=res_parking/default; con=<nil>((nil)); con->root=(nil)	
652356	[2022-04-15 14:26:56] VERBOSE[17108] pbx.c: Remove parkedcalls/280/1, registrar=res_parking; con=<nil>((nil)); con->root=(nil)	
652357	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_config_mysql.so' (MySQL RealTime Configuration Driver)	
652358	[2022-04-15 14:26:56] VERBOSE[17108] res_config_mysql.c: MySQL RealTime reloaded.	
652359	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_config_curl.so' (Realtime Curl configuration)	
652360	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_authenticator_digest.so' (PJSIP authentication resource)	
652361	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_endpoint_identifier_ip.so' (PJSIP IP endpoint identifier)	
652362	[2022-04-15 14:26:56] ERROR[17108] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
	
652365	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_rtp_asterisk.so' (Asterisk RTP Stack)	
652366	[2022-04-15 14:26:56] VERBOSE[17108] res_rtp_asterisk.c: RTP Allocating from port range 10000 -> 20000	
652367	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_publish_asterisk.so' (PJSIP Asterisk Event PUBLISH Support)	
652368	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_mwi.so' (PJSIP MWI resource)	
652369	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'chan_dahdi.so' (DAHDI Telephony w/PRI & SS7 & MFC/R2)	
652370	[2022-04-15 14:26:56] WARNING[17108] chan_dahdi.c: Ignoring any changes to 'signalling' (on reload) at line 12.	
652371	[2022-04-15 14:26:56] WARNING[17108] chan_dahdi.c: Ignoring any changes to 'rxwink' (on reload) at line 13.	
652372	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'chan_iax2.so' (Inter Asterisk eXchange (Ver 2))	
652373	[2022-04-15 14:26:56] WARNING[17108] iax2/firmware.c: Error opening firmware directory '/var/lib/asterisk/firmware/iax': No such file or directory	
652374	[2022-04-15 14:26:56] NOTICE[17108] iax2/provision.c: No IAX provisioning configuration found, IAX provisioning disabled.	
652375	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'chan_sip.so' (Session Initiation Protocol (SIP))	
652376	[2022-04-15 14:26:56] VERBOSE[2851] chan_sip.c: Reloading SIP	
652377	[2022-04-15 14:26:56] VERBOSE[2851] netsock2.c: Using SIP TOS bits 96	
652378	[2022-04-15 14:26:56] VERBOSE[2851] netsock2.c: Using SIP CoS mark 4	
652379	[2022-04-15 14:26:56] ERROR[2851] tcptls.c: TLS/SSL error loading cert file. <asterisk.pem>	
652380	[2022-04-15 14:26:56] ERROR[2851] tcptls.c: 140128197031424:error:02001002:system library:fopen:No such file or directory:bss_file.c:402:fopen('asterisk.pem','r')	
652381	[4442455-10-17 07:23:44] - error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:404:	
652382	[4442455-10-17 07:23:44] - error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib:ssl_rsa.c:701:	
652383		
652384	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_adsi.so' (ADSI Resource)	
652385	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support)	
652386	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'res_pjsip_outbound_registration.so' (PJSIP Outbound Registration Support)	
652387	[2022-04-15 14:26:56] ERROR[17108] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'	
652388	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'app_meetme.so' (MeetMe conference bridge)	
652389	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'app_confbridge.so' (Conference Bridge Application)	
652390	[2022-04-15 14:26:56] NOTICE[17108] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge	
652391	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'cel_manager.so' (Asterisk Manager Interface CEL Backend)	
652392	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'cel_odbc.so' (ODBC CEL backend)	
652393	[2022-04-15 14:26:56] VERBOSE[17108] cel_odbc.c: Found CEL table cel@asteriskcdrdb.	
652394	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'app_flite.so' (Flite TTS Interface)	
652395	[2022-04-15 14:26:56] WARNING[17108] app_flite.c: Flite: Unable to read config file flite.conf. Using default settings	
652396	[2022-04-15 14:26:56] VERBOSE[17108] loader.c: Reloading module 'app_voicemail.so' (Comedian Mail (Voicemail System))	
652397	[2022-04-15 14:26:56] NOTICE[2851] chan_sip.c: '' is not a valid transport type. if no other is specified, the defaults from general will be used.	

652406	[2022-04-15 14:26:56] VERBOSE[2839] chan_iax2.c: Registered IAX2 to 'Hidden', who sees us as Hidden with no messages waiting

This log segment just shows actions during reload and is not useful. If nothing gets logged when you reboot the phone (after setting it to register to port 5161), run sngrep and see whether the registration attempts appear there. If not, run tcpdump and see whether there is any traffic from the phone. If not, do you have a way to see what the phone is sending, e.g. managed switch?

It’s possible that the Grandstream doesn’t honor the :5161 properly. You might try configuring a softphone to register to the pjsip extension as a test.

I have 16 accounts on my GXV3380 , using variously TCP,TLS and UDP, omn variuos ports (none are in thew range 50000-5099 and on various different server some of which are Asterisk , and never had a problem .

Running sngrep I see the following lines for ext. 202, the one I’m working with. Does this help?

x [ ] 31 REGISTER [email protected]:5161 [email protected]:5161 4
x [ ] 32 OPTIONS [email protected] [email protected]:5060 2
x [ ] 33 SUBSCRIBE [email protected]:5161 [email protected]:5161 6
x [ ] 34 SUBSCRIBE [email protected]:5161 [email protected]:5161 6
x [ ] 35 SUBSCRIBE [email protected]:5161 [email protected]:5161 6

Now high light a ‘REGISTER’ and press enter . . .

If I set the extension to PJSip reboot and click on the registration line I see a bunch of stuff but it’s in columns and when I try to do a copy it gets all jumbled up.

I see a line Via: Sip/2.0/UDP 192.1682.202:5060;bran=(long code)-192.168.2.202;report-5060.
from “Jerry” <sip:[email protected]:5161:tag=(long code)
To: sip:[email protected]:5161;tag-as3e6227

Is there a way to copy the text when I bring up a highlighted line that doesn’t get all jumbled up?

Figured out how to get it into a non-garbled format. It registers when I have the extension set to ChanSip, but not when it’s set to PJsip.

REGISTER sip:192.168.2.148:5161 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.202:5060;branch=<deleted>
From: "Jerry Warner" <sip:[email protected]:5161>;tag=<deleted>
To: <sip:[email protected]:5161>
Contact: <sip:[email protected]:5060;transport=udp>
Supported: path
X-Grandstream-PBX: true
Call-ID: <deleted>@192.168.2.202
CSeq: 10001 REGISTER
Expires: 3600
User-Agent: Grandstream GXP2010 1.2.5.3
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK,MESSAGE
Content-Length: 0

I’m going to give up on it for the weekend. Happy Easter everyone!

The 4 at the end means 4 packets were sent or received, which could be a normal registration sequence, or an error may have occurred. Show us the other 3 packets in that sequence, so we can whether the registration was successful or why it was rejected.

When I pull it the rest of that line it has SIP/2.0 after the 5161 port. But this is when I’m using ChanSIP for the extension. It never registers when I have the extension set to PJsip.

2022/04/15 16:27:02.734968 192.168.2.202:5060 → 192.168.2.148:5060
REGISTER sip:192.168.2.148:5161 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.202:5060;branch=

This sure looks like the packet was sent to port 5161, presumably where pjsip was listening.
Please show the following 3 packets.

Sorry, I missed that. Please confirm that the Outbound Proxy field on the phone is blank.

Actually it’s not. The outbound proxy is still listed as just 192.168.2.148 with no port.

Should this also have the :5161 port added?

You could try that. If no luck, try leaving it blank.