Opensips 1.9.1 and NAT

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Opensips 1.9.1 and NAT

Denis

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

nat_problem.txt (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Ali Pey
Hello,

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

Regards,
Ali


On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Denis

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Ali Pey
You also examining isbflagset(10). Isn't that set?

Regards,
Ali Pey


On Mon, Nov 25, 2013 at 3:09 AM, dpa <[hidden email]> wrote:

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Denis

OK, but in the current case another question.

Is nat_bflag appear in transaction when call goes TO uac behind nat (by using lookup(), for example), or it appears  in transaction when call goes FROM uac behind nat?

 

Thank you.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Monday, November 25, 2013 8:38 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

You also examining isbflagset(10). Isn't that set?

 

Regards,

Ali Pey

 

On Mon, Nov 25, 2013 at 3:09 AM, dpa <[hidden email]> wrote:

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Ali Pey
As I said earlier, there is no such a thing as FROM or TO (i.e. direction) unless it's implemented in your logic. When a SIP request reaches the IP address of your opensips server, it goes through your routing script in opensips.cfg and then it's routed out. What you have there, it would apply to the request message. Put yourself in opensips shoes and follow the logic - that's how we debugged code while at uni :)

If you have a concept of direction and you need different behavior based on your concept of direction, you need to implement it in your logic. For instance you can examine the source IP or subnet to decide if this message is from internal or external and then apply different logic to it - or whatever else that is specific to your environment. 

What is it that you are trying to do?

Regards,
Ali Pey


On Mon, Nov 25, 2013 at 10:52 PM, dpa <[hidden email]> wrote:

OK, but in the current case another question.

Is nat_bflag appear in transaction when call goes TO uac behind nat (by using lookup(), for example), or it appears  in transaction when call goes FROM uac behind nat?

 

Thank you.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Monday, November 25, 2013 8:38 PM


To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

You also examining isbflagset(10). Isn't that set?

 

Regards,

Ali Pey

 

On Mon, Nov 25, 2013 at 3:09 AM, dpa <[hidden email]> wrote:

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Denis

What is it that you are trying to do?

 

I try to check if message came from behind NAT or not and make some actions depending on result of checking.

To speak the truth I tried to include in opensips.cfg logic about direction of the call.

 

What I thought. I thought that nat_bflag activated only after lookup() function processing, i.e. when call goes TO UAC behind NAT and NOT activated when call came FROM UAC behind NAT. So in onreply route I make the test about this flag and waiting (in my current case) that the test of natb_flag will be failed.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Tuesday, November 26, 2013 8:16 AM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

As I said earlier, there is no such a thing as FROM or TO (i.e. direction) unless it's implemented in your logic. When a SIP request reaches the IP address of your opensips server, it goes through your routing script in opensips.cfg and then it's routed out. What you have there, it would apply to the request message. Put yourself in opensips shoes and follow the logic - that's how we debugged code while at uni :)

 

If you have a concept of direction and you need different behavior based on your concept of direction, you need to implement it in your logic. For instance you can examine the source IP or subnet to decide if this message is from internal or external and then apply different logic to it - or whatever else that is specific to your environment. 

 

What is it that you are trying to do?

 

Regards,

Ali Pey

 

 

On Mon, Nov 25, 2013 at 10:52 PM, dpa <[hidden email]> wrote:

OK, but in the current case another question.

Is nat_bflag appear in transaction when call goes TO uac behind nat (by using lookup(), for example), or it appears  in transaction when call goes FROM uac behind nat?

 

Thank you.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Monday, November 25, 2013 8:38 PM


To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

You also examining isbflagset(10). Isn't that set?

 

Regards,

Ali Pey

 

On Mon, Nov 25, 2013 at 3:09 AM, dpa <[hidden email]> wrote:

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips 1.9.1 and NAT

Ali Pey
Why don't you use "nat_uac_test()" when you receive a request to examine NAT? Using nat_uac_tes() you can tell if the message is coming from a client behind the nat or not. With lookup and the nat_bflg, you can tell if the destination is behind a nat. They are two different things.

Regards,
Ali Pey


On Mon, Nov 25, 2013 at 11:40 PM, dpa <[hidden email]> wrote:

What is it that you are trying to do?

 

I try to check if message came from behind NAT or not and make some actions depending on result of checking.

To speak the truth I tried to include in opensips.cfg logic about direction of the call.

 

What I thought. I thought that nat_bflag activated only after lookup() function processing, i.e. when call goes TO UAC behind NAT and NOT activated when call came FROM UAC behind NAT. So in onreply route I make the test about this flag and waiting (in my current case) that the test of natb_flag will be failed.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Tuesday, November 26, 2013 8:16 AM


To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

As I said earlier, there is no such a thing as FROM or TO (i.e. direction) unless it's implemented in your logic. When a SIP request reaches the IP address of your opensips server, it goes through your routing script in opensips.cfg and then it's routed out. What you have there, it would apply to the request message. Put yourself in opensips shoes and follow the logic - that's how we debugged code while at uni :)

 

If you have a concept of direction and you need different behavior based on your concept of direction, you need to implement it in your logic. For instance you can examine the source IP or subnet to decide if this message is from internal or external and then apply different logic to it - or whatever else that is specific to your environment. 

 

What is it that you are trying to do?

 

Regards,

Ali Pey

 

 

On Mon, Nov 25, 2013 at 10:52 PM, dpa <[hidden email]> wrote:

OK, but in the current case another question.

Is nat_bflag appear in transaction when call goes TO uac behind nat (by using lookup(), for example), or it appears  in transaction when call goes FROM uac behind nat?

 

Thank you.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Monday, November 25, 2013 8:38 PM


To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

You also examining isbflagset(10). Isn't that set?

 

Regards,

Ali Pey

 

On Mon, Nov 25, 2013 at 3:09 AM, dpa <[hidden email]> wrote:

Hello

 

I understand but in onreply route I make a test: nat_uac_test("55") and only if it successful I make “fix_nated_contact()”.

In my case nat_uac_test("55") must be fail after checking 183 ringing and 200 OK.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Ali Pey
Sent: Friday, November 22, 2013 5:37 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.9.1 and NAT

 

Hello,

 

The question is not quite clear. In your opensips.cfg you call "fix_nated_contact()" on both route and reply route. that's why it changes the route.

 

There is no such a thing as direction in opensips unless it's implemented in your logic. A message goes through your route or reply route scripts when it reaches opensips. 

 

Regards,

Ali

 

On Fri, Nov 22, 2013 at 1:10 AM, dpa <[hidden email]> wrote:

Hello

 

I have a one question about nat processing of Opensips.

 

There is such scheme

 

UAC1 (softphone behind nat) à Opensips -> UAC2 (another softswitch), i.e. UAC1 initiates a call to Opensips and a signaling port = 5068.

 

So UAC2 becomes “ringing” by sending 183 message.

 

In attachment 183 message from UAC2 and some parts of opensips.cfg

 

After 183 processing by Opensips port in Contact header of 183 (and later 200 OK) messages become 5060, i.e. Opensips detects NAT and changes Contact header.

 

So my question is, Why does Opensips changes Contact header?

Once Opensips detects nat transaction (setting setflag(21)) is it check all reply messages (and doesn`t matter from which UAC they have been received) or Opensips can detect direction and makes decision about nat process?

 

Thank you  for any help.

 

 

 

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users