[ previous ] [ next ] [ threads ]
 To :  Dimitris Sakellarios <dimitris.sakellarios@t...>
 From :  Gamaliel Bedolla <gbf@t...>
 Subject :  Re: [yate] How to bind port port for second leg
 Date :  Tue, 27 Mar 2012 11:47:13 -0600
Hi Dimitris,

I have made several tests, but now I think I have issues with iptables.
I will continue on iptables mailists.
Thanks for the info!

2012/3/23 Dimitris Sakellarios 

> ** **
>
> Hi Gamaliel,****
>
> ** **
>
> Try first of all to enable ip_forwarding if not enabled and secondary use
> the rule below.****
>
> ** **
>
> 1) sysctl net.ipv4.ip_forward=1****
>
> 2) iptables -t nat -A POSTROUTING -o {your 10.100.0.2 interface name} -j
> SNAT --to-source 10.100.0.2:5060****
>
> ** **
>
> Hopefully this will rewrite always the source port of ****box(2) to 5060**
> **.****
>
> ** **
>
> For your future help use the following mini how to:****
>
>
> http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables
> ****
>
> ** **
>
> BR****
>
> ** **
>
> * *
>
> *Sakellarios Dimitris*
>
> e-mail*:* dimitris.sakellarios@t...  url: http://www.telesuite.gr*
> ***
>  ------------------------------
>
> *From:* Gamaliel Bedolla [mailto:gbf@t...]
> *Sent:* Friday, March 23, 2012 10:14 PM
> *To:* yate@v...
> *Subject:* [yate] How to bind port port for second leg****
>
> ** **
>
> Dear Yate users/developers,****
>
> ** **
>
> I have to NAT via iptables address and port of the traffic in and out of
> mi YATE, ip address 10.100.0.2. When it receives an INVITE, it sends the
> answer to the correct port (5060), but when initiates the second leg (to
> where the call should be redirected) it initiates the call on variable
> port, 1030, 1070, etc. but I need to bind outgoing calls to port 5060 to
> accomplish the NAT rule.****
>
> ** **
>
> This is my ysipchan.conf:****
>
> [general]****
>
> port=5060****
>
> ** **
>
> I'm using YATE/4.0.1.****
>
> ** **
>
> And this is the flow of messages:****
>
> (1)Sofswitch == 10.100.0.1****
>
> (2)Yate      == 10.100.0.2****
>
> (3)Asterisk  == 10.100.0.3****
>
> ** **
>
> ** **
>
> (1)[5060]-----INVITE---->[5060](2)****
>
> (1)[5060]<--100 TRYING---[5060](2)****
>
>
> (2)[1030]-----INVITE---->[5060](3)     port 5060****
>
>                                           (2)[5060]<--100
> TRYING---[5060](3)****
>
>                                           (2)[5060]<---200
> OK------[5060](3)****
>
>
> (2)[1030]-------ACK----->[5060](3)     port 5060****
>
> (1)[5060]<-----200 OK----[5060](2)****
>
> ** **
>
> Can you help me on this?****
>
> Please let me know if more info is needed.****
>
> Best regards****
>
> ** **
>



Hi Dimitris,

I have made several tests, but now I think I have issues with iptables.
I will continue on iptables mailists.
Thanks for the info!

2012/3/23 Dimitris Sakellarios <dimitris.sakellarios@t...>

Hi Gamaliel,

 

Try first of all to enable ip_forwarding if not enabled and secondary use the rule below.

 

1) sysctl net.ipv4.ip_forward=1

2) iptables -t nat -A POSTROUTING -o {your 10.100.0.2 interface name} -j SNAT --to-source 10.100.0.2:5060

 

Hopefully this will rewrite always the source port of box(2) to 5060.

 

For your future help use the following mini how to:

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

 

BR

 

 

Sakellarios Dimitris

e-mail: dimitris.sakellarios@telesuite.gr  url: http://www.telesuite.gr


From: Gamaliel Bedolla [mailto:gbf@t...]
Sent: Friday, March 23, 2012 10:14 PM
To: yate@v...
Subject: [yate] How to bind port port for second leg

 

Dear Yate users/developers,

 

I have to NAT via iptables address and port of the traffic in and out of mi YATE, ip address 10.100.0.2. When it receives an INVITE, it sends the answer to the correct port (5060), but when initiates the second leg (to where the call should be redirected) it initiates the call on variable port, 1030, 1070, etc. but I need to bind outgoing calls to port 5060 to accomplish the NAT rule.

 

This is my ysipchan.conf:

[general]

port=5060

 

I'm using YATE/4.0.1.

 

And this is the flow of messages:

(1)Sofswitch == 10.100.0.1

(2)Yate      == 10.100.0.2

(3)Asterisk  == 10.100.0.3

 

 

(1)[5060]-----INVITE---->[5060](2)

(1)[5060]<--100 TRYING---[5060](2)

                                          (2)[1030]-----INVITE---->[5060](3)    <This is what I want to be exiting on port 5060

                                          (2)[5060]<--100 TRYING---[5060](3)

                                          (2)[5060]<---200 OK------[5060](3)

                                          (2)[1030]-------ACK----->[5060](3)    <This is what I want to be exiting on port 5060

(1)[5060]<-----200 OK----[5060](2)

 

Can you help me on this?

Please let me know if more info is needed.

Best regards