[asterisk-dev] RTP port knowledge

Russell Bryant russell at digium.com
Mon Jun 22 10:43:58 CDT 2009


stefania magistrali wrote:
> I need to develop an AGI that uses the information about RTP port that 
> Asterisk assigned for a channel just established.
> Because the RTP assignement is dynamic and I can only set the range 
> (rtpstart, rtpend in the rtp.conf file), I need to know where this 
> information (RTP port selected by Asterisk to listen to) is stored in 
> the system (variable? log file?).
> I've seen that I can open the "rtp debug" in the"rasterisk window", but 
> I wouldn't parse it....

The short answer is that the information is not available.  However, 
since this is the -dev list, I'll point out the easiest way to add it. 
Patches welcome.  ;-)

In Asterisk 1.6, the CHANNEL() function is close.  If you look in 
acf_channel_read() of chan_sip.c, you'll see the "rtpdest" argument. 
So, evaluating CHANNEL(rtpdest,audio) will get you the address and port 
where we are sending audio RTP.  I think it makes sense to add another 
option to get the IP/port where we expect to receive audio.

-- 
Russell Bryant
Digium, Inc. | Engineering Manager, Open Source Software
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list