A tale of the chan_sip to chan_pjsip conversion

All. This is more of a description of what I have learned converting from chan_sip (deprecated) to chan_pjsip. I had tried several times before and wasn’t successful but my most recent attempt has worked out very well! All is working and I’m very happy. I am running several Virtual PBX systems at Cyberlynk, all multiprocessor systems, lots of ram with ssd disk. My SIP provider is Telnyx. I had been having problems for years that were getting worse with every upgrade and patch install. The most recent patches (last 5-6 months) the issues were getting so noticeable that customers were complaining about audio quality issues on calls. It was time for some significant diagnostics. I added more ram, more CPU, started looking at different SIP servers, and new hosting, but nothing seems to help.

Basic config
All my PBX’s are at a hosting center, using FreePBX firewall with intrusion detection setup. I have all my networks whitelisted and set intrusion detection to be really strict, if you get banned on my pbx its just about forever. Once in a blue moon one of my customer IP’s get banned (usually after patches and a restart for some reason). After loading my monthly updates I look for any known IP’s to be banned and I just unban it and everything is fine. No issues otherwise. My setup is hosting <> firewall1 <> internet <> firewall2 <> extension. Firewall1 is part of the hosting environment (in FreePBX I have control over, but whatever hosting is using I don’t). Firewall2 is typically under my customers control and except for a few customers with SonicWALL routers I haven’t had to ask any customer to make a change in their firewall configs.

Hosting
Currently I am on Cyberlynk. Primarily because it included SYSADM and EPM for free and seemed to somehow be linked to Sangoma even if indirectly. When having problems I asked for suggestions here and got many different answers. Was all set to try another virtual and sip provider when the issue was resolved so I didn’t make the switch. It was going to be a lot of work to move 1000 numbers over so I wasn’t looking forward to that. Glad I don’t have to. Overall now I am happy there. Pricing is pretty good, support has been pretty good (although any time there is an issue its never “their equipment” but magically after I complain it goes away). Very easy to build a server and I have full access to console and VM manager.

Extensions
I have several different versions of FreePBX, most are fairly up to date All my PBX’s were using chan_sip for trunks and extensions on standard ports. When I started moveing over to pjsip I couldn’t get anything to work but it turns out there were lots of compatibility issues with the standard ports and several ISP’s. Some issueswere related to what I can only guess was SIG ALG options and others just seem to be old broadband routers with bad ARP cache issues. I would have phones that worked fine for months and then all of a sudden, a phone or two would stop working. I just couldn’t get them to work again, tried everything, factory reset the phone, delete re-add the extensions, I tried everything, ultimately I would just program a new phone send it out and then it would work. Bring the other non working phone back to the office and reprogram it and it would work fine. The only thing I can think happened is some how the broadband router/modem was caching something related to the mac on the phone and it just couldn’t get through to the PBX (i.e. I would no longer see any traffic from it to the pbx). New phone worked fine, old phone worked fine anywhere else. All these problems went away when I switch to pjsip and none standard ports. To add the extensions application->extensions click on add extension-> add pjsip, on “general” enter an extension number, name, CID must be a valid caller ID i.e. “name” <10digits> , on Other click brand, enter a mac, template, model but you need to create the template before hand (under settings->EPM->brand). Be sure to select the model in both the template and in “other”.

If your phone is already setup as chan_sip, I have used the "convert to pj_sip, then in EPM click “save/update phone”, the phone reboots and is now pj_sip!

Telnyx
Had an issue at first when I was trying to use none standard ports with Telnyx. They only support non standard ports in one direction. When sending to Telnyx you can ONLY use 5060 and 5160/5161. But when you add the connection at Telnyx you can enter any port number you want for the connection from Telnyx to your PBX. In freepbx->settings->asterisk sip settings under the chan_pjsip tab change the “listen to port on” field to the port you want to use (anything other than 5060, 5160, 5161) and what ever you use you will add a connection in Telnyx->sip connections->add and when you put in your IP use the same port number as freepbx by following the IP with :xxxx where xxx is your port number. I have found that on Telnyx, IP connections are much more reliable than “credential based” connections. All connections should be E.164 and in Freepbx all inbound routes are 11 digits (1NXXNXXXXXX). Telnyx has a quick document to setup FreePBX extension and a connection here-> How to configure a FreePBX V15 IP Trunk - PJSIP | Telnyx Support

Phones
Almost all phones are much easier to setup (except Sangoma zero touch) by using a web browser. I have been using grandstream gxp2170’s lately and they work every well. Go to the phone via a browser and click on “maintenance, provisioning”. You only need to set the config server IP and even if you choose tftp you must add :69 after the IP (don’t know why it doesn’t do that when you click the tftp button?). Enter the IP and :69 click save/apply and at the top click provision. The process takes about 20-30 seconds and the phone sets itself up, nothing else to do!

Hope this saves someone some time. I have learned all this in my effort to switch from chan_sip to pjsip. All my audio issues went away after switching to pjsip. somehow, grandstream devices were having an issue with the chan_sip jitter mechanism? I was able to minimize the issue by setting jitter to small and buffer to minimum but completely eliminated it when switching to pjsip.

DJ

1 Like

Thanks for sharing.

In your efforts to modernize your systems, I would focus on abandoning tftp entirely, particularly with cloud hosted systems. GXP phones can provision happily using http/s and sysadmin pro supports provisioning credentials. This does make the provisioning string more complex for the initial phone setup if doing it manually.

I agree but EPM for grandtream is a little behind the times. The option is TFTP or HTTP not HTTPS
image
If you set the phone to https the phone will not reliably load the config when you “save and update phone” in EPM. Plus you have to manually edit the basefile for the template to chose https since EMP only has option 0, 1 and not 3
“# Firmware Provision Server - 0 TFTP, 1 HTTP, 2 HTTPS”
I lobve grandstream phones but the grandstream brand under EPM is falling behind. The latest firmware is 1.0.9.121 and my phones are now 1.0.11.10 also you have to manually edit the basefile to turn off screen saver which IMHO is a stupid feature for a phone with BLF’s enabled.

Perhaps it’s you that is behind, this is what I see on EPM ver. 15.0.41.54. Do you have https provisioning enabled in sysadmin port management.

you are correct, only a few of my PBX’s are running v15, the rest are V14. I see on 15 that https is in fact there. I am in the process of moving all my connections to pjsip and V15, actually testing V16 (as an upgrade to 15) and will probably skip 15 when my virtual server company has a V16 image avaiable.

This is an upgrade you do in place. Preferably from the command line.

The FreePBX 14 to 15 upgrade is basically only module updates. You barely need to reboot.

The FreePBX 15 to 16 update is more complex because they are switching to PHP7, but it is still SNG7 for the OS.

My virtual server provider now has a V16 version. I tried upgrading from V15 to V16 following your other post on the process and it was a dismal failure. I was able to get to the point where the “update check” completed with all green checks and no red X but when I did the upgrade there were many error messages about using commands that were deprecated and couldn’t update some database… I followed all the directions including the fwconsole chown, reboots, etc… when it was done I wasn’t able to access the console and I couldn’t ssh into it. After a reboot I could get back into it so I tried doing a “fwconsole ma updateall” and it started “updating” everything from 16.0.x to 15.x.x??? after that it was just a bunch of exception issues and I gave up. I just loaded a V16 from scratch, so far all is well.

This happens when it is not a clean freePBX-15 distro. I had the same problems with a system, where I forgot that I patched Asterisk and installed ImageMagick.

in my case I never applied any application or patch other than yum update and fwconsole ma updateall and I didn’t edit any files in freepbx. It was a clean distro install v14 and used freepbx update to go to v15 (went smoothly last year) and then tried to go to v16 which failed miserably.

You also have the option for TR069 provisioning using Grandstream’s gdms.cloud service. It is free. Take the phone out of box, scan the MAC, serial number, and password into the Add Device utility, assign a hosting provider or PBX that is preconfigured and the phone boots into firmware, acquires its personality and registers. You can then ship the phone to the customer. If you drop ship have the distributor provide the required info in advance and it will look like you actually know what you are doing to your customer.

I have had weird issues when using newer firmware then that listed in EPM. Some time ago there was a major issue with BLF if you used a version newer then the one listed in EPM.

Has that BLF issue not been resolved yet?

yes it was resolved, for a while I rolled back to the version listed in EPM and later a newer EPM version was updated in EPM so I updated again to the newer version. I am currently using the latest version on my desk phone but for my customers I am running the version listed in EPM for the version of FreePBX installed for them. (some customers are on 14, other 15. My dev system is on 16 as will all new roll outs.

Make sure that as you ‘integrate’ everyone is aware that chan_pjsip is listening on one port and chan_sip on another, in your interest, neither port should be 5060, so as you transition, don’t make that mistake, it’s easier to fix it at the beginning than fight it later

Yes, I am not using the standard port anymore. This actually fixed several issues I had.

Excellent, it will do exactly that :wink:

I no longer have sporadic issues with broadband routers and Verizon fios services. Once I switch off 5060 I no longer had issues with these companies blocking voip traffic or SIG-ALG issues any more.

1 Like

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