Cisco 7940 registration problem RESOLVED

(Brendan) #1


Been working on migrating over to Asterisk 13 / FPBX 12, and wanting to control my Cisco endpoints with OSS EPM. Starting with the phones that have support out of the box - the Cisco 7940.

Using a PJSIP extension, I can confirm that the extensions are working via a softphone. When I fire up the Cisco 7940 it has trouble registering. Watching a tcpdump I can see…

Phone sends a REGISTER with no auth details (as normal)
Asterisk replies with 401 UNAUTHORIZED (the REGSITER challenge, normal again)
Then nothing … couple seconds later, the phone sends another REGISTER, with no auth details.

Wondering why these endpoints don’t reply to the 401 with a REGISTER that contains auth details? Is this a firmware thing (using SIP 8.12 that came in OSS EPM)? Is it a configuration thing? Is it a PJSIP thing (I’m having issues serving a config with different ports for one reason or another)?

Would really appreciate anyone’s input if they’ve had this problem before. Our other system, Asterisk 11 doesn’t have this problem. Although, I do all the configs manually on that system, and the only other difference is chan_sip instead of PJSIP.


Help with registering Cisco 7940s in FreePBX
Pjsip.endpoint_custom.conf Not Working RESOLVED
HELP! I can't get my Cisco CP-7960G IP hardphone to register on my Asterisk VoIP IP PBX SIP Server with FreePBX GUI

zirophyz I am only a beginner myself with freepbx and I have 7940’s too, they’re a sod to register with freepbx. What worked for me was changing the extension to the chan_sip driver and select NAT Mode: ‘Yes - force_rport,comedia’ and port 5061. You’ll also have to change the ports in SIPDefault.cnf but it does work. If the extension still doesn’t register delete it and build a new one, making sure you select Generic CHAN SIP Device before you click ‘submit’.

(Brendan) #3

HI neuronetv. Yes this was going to be my next move, I changed my test extension to chan_sip and have been using OSS EPM to configure the phones, however it doesn’t seem like the new ports are taking effect. This I need to look into, I think I only changed ports in the SEP($mac).cnf file, not sure there was anywhere in SIPDefault.cnf that referenced a port. Maybe I will build the config files myself (or rather, just copy them from my working Asterisk 11 install).

It’d be a little disappointing to not be able to use pjsip for these endpoints. As far as I see it, replying to the 401 challenge is a pretty stock standard SIP thing. Are there other methods for authorisation? Maybe allowing my handset /24 subnet to use IP auth? (Though, that isn’t very scalable…)

(Brendan) #4

I found this post-

At the bottom one of the Digium guys says change “force_rport=no” …

In Asterisk 11 / FPBX 2.11 there is a GUI option “nat” under the Extension settings where you can set this. In FPBX 12 there is no such “nat” option, or anything I can find to set no rport, even in the global SIP and PJSIP settings pages.

Do I need to add this option to certain extensions in the extensions_custom.conf file? I’d rather not, if I could help it, and keep as much configuration in the GUI as possible…

(Brendan) #5

The option appears when I swap to chan_sip, but no option to change for pjsip …?

(Brendan) #6

I threw this into pjsip.endpoint_custom.conf;


Now I can see the phone sending REGISTER’s but there seems to be no reply (using ngrep port 5060 to watch).

(Brendan) #7

This is what I get now. Added the force_rport option and recreated the extension (it wasn’t showing up in the chan_pjsip peers list, so thought that going back and forth between stacks had stuffed it up)…

U ->
REGISTER sip: SIP/2.0.
Via: SIP/2.0/UDP;branch=z9hG4bK505b3494.
From: <sip:[email protected]>;tag=001469a7180c0011603d4433-6cef1ff3.
To: <sip:[email protected]>.
Call-ID: [email protected]
Max-Forwards: 70.
Date: Wed, 22 Jul 2015 00:41:48 GMT.
User-Agent: Cisco-CP7940G/8.0.
Contact: <sip:[email protected]:5060;user=phone;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-0000-0000-001469a7180c>";+u.sip!"8".
Content-Length: 0.
Expires: 120.

I -> 3:3
....E..:)[email protected]&..REGISTER sip: SIP/2.0.
Via: SIP/2.0/UDP;branch=z9hG4bK505b3494.
From: <sip:[email protected]>;tag=001469a7180c0011603d4433-6cef1ff3.
To: <sip:[email protected]>.
Call-ID: [email protected]
Max-Forwards: 70.
Date: Wed, 22 Jul 2015 00:41:48 GMT.
User-Agent: Cisco-CP7940G/8.0.
Contact: <sip:[email protected]:5060;user=phone;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-0000-0000-001469a7180c>";+u.sip!"8".

Weird that the second packet is cut off? Not sure about that …

(Brendan) #8

Okay I’ve found the problem to the solution…

pjsip.endpoint_custom.conf isn’t being included properly, or I have the syntax in that file wrong.

I added force_rport=no under [233] in pjsip.endpoint.conf and reloaded only Asterisk. It worked!

My pjsip.endpoint_custom.conf looks simply like this;


But this setting takes no effect. What am I doing wrong with the custom file?

(Lorne Gaetz) #9

In the custom file try using this syntax:


(Brendan) #10

That didn’t work either. Seeing as though I have found the solution for why the 7940’s aren’t registering, I’ve started a new ticket to address why the custom file isn’t working - Pjsip.endpoint_custom.conf Not Working RESOLVED

(Lorne Gaetz) #11

It doesn’t work, but it should (imo). I have filed a bug report with additional details here:


I’ve wasted days in the past trying to get a 7940 to register with pjsip and I was only able to get registration with chan_sip. I also went down the ‘force_rport=no’ rabbit hole and it went nowhere. The ports in SIPDefault.cnf are right at the top of the file labelled: proxy1_port:, proxy_emergency_port, proxy_backup_port: etc. I changed all mine to 5061 as indicated in the extensions module, rebooted the phones and they’re working now.

(Wekpas) #13

Your not alone having same issue with the Cisco 7941/7961 phones. Tried to change firmware to sip from sccp and some got stuck to the point where I put it down to see clearly from another pov. I have nine phones total 6-7941g,3-7961g and I want to scream.

(Brendan) #14

This has now been fixed in core v12.0.39 as per

Add the force_rport=no config to pjsip.endpoint_custom_post.conf file.

I can confirm that my 7940’s are working well with PJSIP.

(Brendan) #15

Seems that I was slightly premature with claiming this was resolved …

When a phone sends anything to the PBX, the PBX will reply on port 5060 (instead of the random high source port the phone sent on) - so force_rport=no seems to be working in that respect.

Eg. Phone sends REGISTER on 52799, PBX replies with 401 UNAUTHORIZED on 5060 --> working as required.

However, when I try to ring another endpoint, the PBX sends INVITES to that endpoint on it’s random high port -
Eg. PhoneA sends INVITE:52799, PBX replies 100 TRYING : 5060, then 180 RINGING:5060
PBX then sends to PhoneB INVITE:52465, and repeats forever because PhoneB only wants to receive on 5060.
PhoneA hears ringing, hangs up and sends 487 Request Terminated, the PBX will reply 200 OK on 5060.

It seems that whenever Asterisk replies to anything, it won’t use the source port. If Asterisk generates something new, it will try sending that on the random high source port. How can I get Asterisk to send new requests on port 5060?

(Brendan) #16

Bah … I changed Rewrite Contact to NO, reloaded FreepBX and made no difference. Rebooted the phones so they re-registered and now it seems to be working properly. Also, each endpoint is now showing it’s contact address as port 5060.

(Ryan Petersen) #17

I’ve just installed a fresh version - FreePBX Framework is 12.0.70 and this issue referenced in bug FREEPBX-9810 seems to be back. If I put the below in pjsip.endpoint_custom.conf and reload it does not function. If I edit the FreePBX generated file, pjsip.endpoint.conf and add force_rport=no to the extension the phone registers and all is well.


(Lorne Gaetz) #18

Try pjsip.endpoint_custom_post.conf instead.

(Ryan Petersen) #19

pjsip.endpoint_custom_post.conf did not exist, created and added the same info with no luck.

(Ryan Petersen) #20

So I see in the issue ticket the resolution was to add an include in pjsip.conf for pjsip.endpoint_custom_post.conf at the end of the file, it is not present. When I add the include statement back and setup the pjsip.endpoint_custom_post.conf file this everything works! Obviously until FreePBX overrides the pjsip.conf file. I’m now more convinced the original bug was somehow reintroduced…