Summary:ASTERISK-21374: [patch] One-way Audio With auto_* NAT Settings When SIP Calls Initiated By PBX
Reporter:Michael L. Young (elguero)Labels:
Date Opened:2013-04-02 14:53:00Date Closed:2013-05-13 16:15:38
Versions:11.3.0 Frequency of
cannot be resolved before completion ofASTERISK-21225 [patch] Setting nat=force_rport in [general] sip.conf will never work
causesASTERISK-22236 REGISTER reply send to bad port with nat=yes(or force_rport,comedia) in 11.5.0
causesASTERISK-26457 [patch] force_rport,auto_comedia: No NAT detection triggered.
is related toASTERISK-20904 RFC1918 NAT Issue On Prune
Environment:Attachments:( 0) asterisk-21374-auto-nat-outgoing-fix.diff
( 1) asterisk-21374-fix-crash-and-rt-peers.diff
( 2) gdb.txt
Description:I found another case where the force_rport and comedia flags are not being set automatically when using the new auto_* settings.  This time it involves calls initiated by the PBX.

When we reload asterisk the default flags turned on and off by auto_force_rport (force_rport) and auto_comedia (comedia) go back to the default setting of off.  These flags are turned on, as needed, when a peer re-registers or initiates a call.  This would apply to even just having the default global setting "nat=auto_force_rport".

Everything is good except in the following scenario:

We reload Asterisk and the peer's registration has not expired.  We load in the default settings for the peer which turns force_rport and comedia back to off.  Since the peer has not re-registered or placed a call yet, they remain off.  We then initiate a call to the peer from the PBX.  The force_rport and comedia flags stay off.  If NAT is involved, we end up with one-way audio since we never checked to see if the peer is behind NAT or not.
Comments:By: Michael L. Young (elguero) 2013-04-02 14:54:32.264-0500

The patch from ASTERISK-21225 needs to be applied as well as this patch.

By: David Brillert (aragon) 2013-04-10 13:13:23.579-0500

I'm waiting for this patch to get committed but I don't see any progress on https://reviewboard.asterisk.org/r/2421/

By: Michael L. Young (elguero) 2013-04-10 13:15:14.210-0500

Yep, me too.  Have you been able to test the patch?  If so, I take it you have had good results?

By: David Brillert (aragon) 2013-04-10 13:48:08.226-0500

I haven't tested the patch.  Only my hosted production servers seem effected and I have no way to reproduce on any development systems.  I'd prefer to wait until the patch passes review and then try it on the production system...

By: Michael L. Young (elguero) 2013-04-12 12:16:27.227-0500

@David, The patch has been committed and should show up in Asterisk 11.5.

By: jmls (jmls) 2013-04-25 15:46:00.251-0500

well, this kinda broke asterisk for me ;) using an ip address instead of a peer name causes a crash. backtrace attached

By: Michael L. Young (elguero) 2013-04-25 16:14:12.754-0500

Doh!  Sorry about that... it even made it through code review... I'll work on fixing that up.

By: David Brillert (aragon) 2013-04-27 22:43:25.822-0500

Another ping ;)

By: Michael L. Young (elguero) 2013-04-30 21:04:29.546-0500

I have been testing this patch, [^asterisk-21374-fix-crash-and-rt-peers.diff], with success.  It is based off of Asterisk 11 branch.  Tomorrow will be a good test on a production server.

If anyone else could test this, that would be great to get more confirmation that this patch works as intended.


By: David Brillert (aragon) 2013-05-01 13:59:47.917-0500

I held off upgrading to 11.4-rc1 due to the crash report.
So I never experienced the crash.
Hopefully jmls can test since he reported the issue.

I am glad to see you wrote a patch though since that means that soon I can finally upgrade to 11.4.0 or 11.5, or SVN (whenever this gets committed).  I have been holding off while waiting for this ticket to get closed.

By: David Brillert (aragon) 2013-05-08 08:32:25.895-0500


I really wish I could test this patch but I can't.
I'm still waiting for a commit and jmls hasn't replied.
How about throwing your patch asterisk-21374-fix-crash-and-rt-peers.diff onto the review board so we can get it shipped?

By: Michael L. Young (elguero) 2013-05-08 23:19:20.454-0500


This crash would happen right now in current 11 branch, not 11.4.0-rc1.

I was kind of hoping for some additional confirmation besides my own testing plus I have been busy as well.

Will work on getting this on review board.

By: David Brillert (aragon) 2013-05-09 11:18:55.160-0500

Hooray, I see a ship it from Mark Michelson!
I'm really looking forward to 11.5

By: David Brillert (aragon) 2013-05-13 12:18:52.515-0500

The patch on reviewboard got a ship it.
Will you be committing soon so it makes it way into 11.5 or are you waiting for more ship its?
I can't test an uncommitted patch on a production server...
When you commit I will probably a do an SVN checkout for production.