[asterisk-dev] Re: RTCP port always bound to 0.0.0.0?

Tony Mountifield tony at softins.clara.co.uk
Mon Sep 18 02:35:16 MST 2006


In article <8FC558BA-2C82-4B52-A60F-8BF58C19F307 at voop.com>,
Johansson Olle E <olle at voop.com> wrote:
> 
> 15 sep 2006 kl. 15.34 skrev Tony Mountifield:
> 
> > I was just looking at the open ports on one of my Asterisk systems
> > that uses a SIP-based ITSP (IP addresses changed):
> Doesn't it depend on the address you give for SIP in sip.conf?
> 
> /O

I haven't looked at where it gets the address from to bind the local
RTP port, although I expect it is from the bind address in sip.conf.

My point was purely to enquire why the local RTCP port wasn't given
the same address as the RTP port, and whether in fact it should be.

I think it should (and Kevin seems to agree) at least for tidiness'
sake, but it probably isn't significant until (a) Asterisk starts
sending RTCP information, and (b) is running on a multi-homed box.

Cheers
Tony

> >
> > [root at aster1 modules]# netstat -nap | grep asterisk
> > tcp        0      0 127.0.0.1:5038               
> > 0.0.0.0:*                   LISTEN      19239/asterisk
> > tcp        0      0 127.0.0.1:5038               
> > 127.0.0.1:38203             ESTABLISHED 19239/asterisk
> > tcp        0      0 127.0.0.1:5038               
> > 127.0.0.1:41982             ESTABLISHED 19239/asterisk
> > udp        0      0 123.45.678.9:14248           
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 0.0.0.0:14249                
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 123.45.678.9:12082           
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 0.0.0.0:12083                
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 123.45.678.9:5060            
> > 0.0.0.0:*                               19239/asterisk
> > udp        0    432 123.45.678.9:17488           
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 0.0.0.0:17489                
> > 0.0.0.0:*                               19239/asterisk
> > udp        0      0 123.45.678.9:4569            
> > 0.0.0.0:*                               19239/asterisk
> > unix  2      [ ACC ]     STREAM     LISTENING     1222807 19239/ 
> > asterisk      /var/run/asterisk.ctl
> > unix  3      [ ]         STREAM     CONNECTED     1586871 19239/ 
> > asterisk
> > [root at aster1 modules]#
> >
> > I noticed the pairs of ports, which I guessed to be RTP and RTCP  
> > ports.
> > The three pairs corresponded to three SIP channels being open:
> >
> > [root at aster1 modules]# rasterisk -x 'show channels'
> > Channel              Location             State   Application(Data)
> > SIP/194.54.172.1-086 ssp000059 at meetntalk: Up      MeetMe(mmp000059| 
> > diMswRTY)
> > SIP/194.54.172.1-086 ssp000059 at meetntalk: Up      MeetMe(mmp000059| 
> > diMswRTY)
> > Zap/pseudo-636396412 s at default:1          Rsrvd   (None)
> > Zap/pseudo-338724309 s at default:1          Rsrvd   (None)
> > SIP/194.54.172.1-086 smp000059 at meetntalk: Up      MeetMe(mmp000059| 
> > aAdiMsRTS(5)U
> > 5 active channels
> > 3 active calls
> > Verbosity is at least 5
> >     -- Remote UNIX connection
> > [root at aster1 modules]#
> >
> > I wondered why the second port of each pair was bound to 0.0.0.0  
> > instead of
> > to the local IP address, so I looked in rtp.c at  
> > ast_rtp_new_with_bindaddr().
> > The local address of the RTCP socket doesn't get set anywhere.  
> > Should it?
> >
> > I would be inclined to change this code:
> >
> >                 /* Must be an even port number by RTP spec */
> >                 rtp->us.sin_port = htons(x);
> >                 rtp->us.sin_addr = addr;
> >                 /* If there's rtcp, initialize it as well. */
> >                 if (rtp->rtcp)
> >                         rtp->rtcp->us.sin_port = htons(x + 1);
> >
> > to this:
> >
> >                 /* Must be an even port number by RTP spec */
> >                 rtp->us.sin_port = htons(x);
> >                 rtp->us.sin_addr = addr;
> >                 /* If there's rtcp, initialize it as well. */
> >                 if (rtp->rtcp) {
> >                         rtp->rtcp->us.sin_port = htons(x + 1);
> >                         rtp->rtcp->us.sin_addr = addr;
> >                 }
> >
> > Is there a reason not to?
> >
> > Cheers
> > Tony
> > -- 
> > Tony Mountifield
> > Work: tony at softins.co.uk - http://www.softins.co.uk
> > Play: tony at mountifield.org - http://tony.mountifield.org
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > asterisk-dev mailing list
> > To UNSUBSCRIBE or update options visit:
> >    http://lists.digium.com/mailman/listinfo/asterisk-dev
> 
> ---
> Olle E. Johansson * Asterisk Evangelist, developer * VOOP A/S
> olle at voop.com
> 
> 
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
> 


-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org


More information about the asterisk-dev mailing list