[asterisk-dev] stun support in asterisk ? (and a related hack for rtp.c)

Luigi Rizzo rizzo at icir.org
Wed Jul 11 07:29:17 CDT 2007


On Wed, Jul 11, 2007 at 07:30:46PM +0800, Dinesh Nair wrote:
> On Wed, 11 Jul 2007 04:02:37 -0700, Luigi Rizzo wrote:
> > As a temporary workaround, I implemented a simple hack inspired by
> > an idea from Olle at
> >     http://www.voip-info.org/wiki/view/Asterisk+SIP+chan_sip2
> > where the remote endpoint of the rtp is rewritten with the source
> > address from incoming RTP packets. This way, if asterisk receives
> > the audio stream, can reply back to the sender even if sdp had
> > a bogus address.
> 
> code to do the same thing exists in asterisk 1.2.21 as well, and is turned
> on by setting the nat option in sip.conf, for sip channels. there's even
> an api, ast_rtp_setnat which can be used to turn it on and off for
> different rtp structures.

oh, now i see it... thanks. The code is also in trunk, so probably my
patch is totally useless and it suffices to turn nat=yes.

I was misled by the fact that I had the problem in this setting

   [sip-client][NAT]--<->--[provider]--<->--[asterisk]

but the provider did not stay in the media path, so it was passing
the SDP (including the bogus addresses) from the client unchanged.

I suppose I should update the documentation in sip.conf to mention
explicitly that nat=yes may be of help even if you are talking SIP
to someone on a public IP address, because the RTCP path may be different
(and reinvite=no won't help you here...)

	cheers
	luigi



More information about the asterisk-dev mailing list