[Asterisk-Dev] Multiple ports for SIP listener + minor bug

Anthony Wood woody+asterisk at switchonline.com.au
Mon Jun 9 18:37:39 MST 2003

On Fri, Jun 06, 2003 at 12:24:44AM -0700, John Todd wrote:
> >On Thu, Jun 05, 2003 at 12:43:45PM -0700, John Todd wrote:
> >>  That's not quite what I'm looking for, and I know that I can get the
> >>  whole Asterisk process to listen on a different port. I need Asterisk
> >>  to listen on multiple ports at the same time.
> >>
> >>  port=5060,5061,9060
> >
> >How about this for a hack:
> >get your OS to do port redirection from ports 5061 and 9060 to port 5060.
> >
> >You don't need to distinguish between the ports, so asterisk doesn't need
> >to know which port they are trying to connect to.
> >--
> >Woody
> I'm not certain if this is true.  The NAT code within Asterisk will 
> look at the source port and the destination port of an inbound SIP 
> packet, and send replies out with exactly the opposite information. 
> The remote NAT gateways keep state based on outbound/inbound ports of 
> packets.  If I used a port redirector on the Asterisk server, would 
> Asterisk reply with packets stamped (outbound) with the "real" 
> destination port on the Asterisk server, or would they reply with 
> 5060?   I don't know enough about Linux port mapping tools, but my 
> gut instinct is that Asterisk would not know that data, and would 
> reply with the wrong port in the outbound packet.  The NAT box would 
> reject it, since it would not match it's state table.
> My understanding of port redirection is admittedly incomplete, and 
> I'm interested to hear about why I'm wrong.  Also, what package would 
> you suggest for this redirection?

We use ipmasqadm.  I think you have valid points,
perhaps get the external boxes to try and connect to a third box
(e.g. your firewall) which uses ipamasq to redirect internally.

It *could* work on the same box, depending where the ipmasq layer
fits in the packet handling sequence.

Maybe also try redirecting to port 5060 on



More information about the asterisk-dev mailing list