NOTIFY nat_keepalive - Bad Event

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

NOTIFY nat_keepalive - Bad Event

Carlo Dimaggio
Hi all,

I'm using nat_traversal and the nat_keepalive function. For phones-
compatibility I have to use the "NOTIFY" method but all my registered  
phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS  
method some phones reply with "200 OK"). What I am wrong?

Can you help me?

Thanks,
Carlo Dimaggio



---- Opensips.cfg

modparam("nat_traversal", "keepalive_interval", 90)
modparam("nat_traversal", "keepalive_method", "NOTIFY")
modparam("nat_traversal", "keepalive_state_file", "/var/run/opensips/
keepalive_state")
[...]

if ((method=="REGISTER" || (method=="INVITE" && !has_totag())) &&  
client_nat_test("3"))
     {
         nat_keepalive();
     }

----

---- Trace with "NOTIFY"

#
U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
NOTIFY sip:10.0.8.183:5060 SIP/2.0.
Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
To: sip:10.0.8.183:5060.
Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
CSeq: 1 NOTIFY.
Event: keep-alive.
Content-Length: 0.
.

#
U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
SIP/2.0 489 Bad Event.
Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
To: <sip:10.0.8.183:5060>;tag=224300607.
Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
CSeq: 1 NOTIFY.
Contact: <sip:10.0.8.183:5060>.
Server: Aastra 55i/2.3.1.26.
Content-Length: 0.
.

-----

---- Trace with "OPTIONS"

#
U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
OPTIONS sip:10.0.8.183:5060 SIP/2.0.
Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
To: sip:10.0.8.183:5060.
Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
CSeq: 1 OPTIONS.
Content-Length: 0.
.

#
U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
To: <sip:10.0.8.183:5060>;tag=85691902.
Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
CSeq: 1 OPTIONS.
Allow:  INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE,  
PRACK, SUBSCRIBE, INFO.
Server: Aastra 55i/2.3.1.26.
Content-Length: 0.
.

-----

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

Re: NOTIFY nat_keepalive - Bad Event

Dan Pascu
On Friday 27 February 2009, Carlo Dimaggio wrote:
> Hi all,
>
> I'm using nat_traversal and the nat_keepalive function. For phones-
> compatibility I have to use the "NOTIFY" method but all my registered
> phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS
> method some phones reply with "200 OK"). What I am wrong?

You did nothing wrong. Those devices do not understand a NOTIFY method
with Event keep-alive, so they give a negative reply. In the end it
doesn't matter, all it matters is to get back something from the device.
The difference between OPTIONS and NOTIFY and all these effects are
explained in the nat_traversal module README. Did you read that?

>
> Can you help me?
>
> Thanks,
> Carlo Dimaggio
>
>
>
> ---- Opensips.cfg
>
> modparam("nat_traversal", "keepalive_interval", 90)
> modparam("nat_traversal", "keepalive_method", "NOTIFY")
> modparam("nat_traversal", "keepalive_state_file", "/var/run/opensips/
> keepalive_state")
> [...]
>
> if ((method=="REGISTER" || (method=="INVITE" && !has_totag())) &&
> client_nat_test("3"))
>      {
>          nat_keepalive();
>      }
>
> ----
>
> ---- Trace with "NOTIFY"
>
> #
> U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
> NOTIFY sip:10.0.8.183:5060 SIP/2.0.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
> To: sip:10.0.8.183:5060.
> Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
> CSeq: 1 NOTIFY.
> Event: keep-alive.
> Content-Length: 0.
> .
>
> #
> U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
> SIP/2.0 489 Bad Event.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
> To: <sip:10.0.8.183:5060>;tag=224300607.
> Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
> CSeq: 1 NOTIFY.
> Contact: <sip:10.0.8.183:5060>.
> Server: Aastra 55i/2.3.1.26.
> Content-Length: 0.
> .
>
> -----
>
> ---- Trace with "OPTIONS"
>
> #
> U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
> OPTIONS sip:10.0.8.183:5060 SIP/2.0.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
> To: sip:10.0.8.183:5060.
> Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
> CSeq: 1 OPTIONS.
> Content-Length: 0.
> .
>
> #
> U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
> SIP/2.0 200 OK.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
> To: <sip:10.0.8.183:5060>;tag=85691902.
> Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
> CSeq: 1 OPTIONS.
> Allow:  INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE,
> PRACK, SUBSCRIBE, INFO.
> Server: Aastra 55i/2.3.1.26.
> Content-Length: 0.
> .
>
> -----
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



--
Dan

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

Re: NOTIFY nat_keepalive - Bad Event

Bogdan-Andrei Iancu
In reply to this post by Carlo Dimaggio
Hi Carlo,

I think the problem is with the phone as they do not understand the
"keep-alive" event sent in NOTIFY.

It is nothing you can do about this (in is not on the proxy side). Maybe
in the future we can add a module parameter for removing the Event
header from the REQUEST and make the dummy phone happy.

Anyhow, as best practice , the OPTIONS method is more appropriate for
nat pinging.

Regards,
Bogdan

Carlo Dimaggio wrote:

> Hi all,
>
> I'm using nat_traversal and the nat_keepalive function. For phones-
> compatibility I have to use the "NOTIFY" method but all my registered  
> phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS  
> method some phones reply with "200 OK"). What I am wrong?
>
> Can you help me?
>
> Thanks,
> Carlo Dimaggio
>
>
>
> ---- Opensips.cfg
>
> modparam("nat_traversal", "keepalive_interval", 90)
> modparam("nat_traversal", "keepalive_method", "NOTIFY")
> modparam("nat_traversal", "keepalive_state_file", "/var/run/opensips/
> keepalive_state")
> [...]
>
> if ((method=="REGISTER" || (method=="INVITE" && !has_totag())) &&  
> client_nat_test("3"))
>      {
>          nat_keepalive();
>      }
>
> ----
>
> ---- Trace with "NOTIFY"
>
> #
> U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
> NOTIFY sip:10.0.8.183:5060 SIP/2.0.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
> To: sip:10.0.8.183:5060.
> Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
> CSeq: 1 NOTIFY.
> Event: keep-alive.
> Content-Length: 0.
> .
>
> #
> U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
> SIP/2.0 489 Bad Event.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=4c2a2dbf.
> To: <sip:10.0.8.183:5060>;tag=224300607.
> Call-ID: 2fe80f67-6c647fe7-27@<IP_OPENSIPS>.
> CSeq: 1 NOTIFY.
> Contact: <sip:10.0.8.183:5060>.
> Server: Aastra 55i/2.3.1.26.
> Content-Length: 0.
> .
>
> -----
>
> ---- Trace with "OPTIONS"
>
> #
> U <IP_OPENSIPS>:5060 -> 10.0.8.183:5060
> OPTIONS sip:10.0.8.183:5060 SIP/2.0.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
> To: sip:10.0.8.183:5060.
> Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
> CSeq: 1 OPTIONS.
> Content-Length: 0.
> .
>
> #
> U 10.0.8.183:5060 -> <IP_OPENSIPS>:5060
> SIP/2.0 200 OK.
> Via: SIP/2.0/UDP <IP_OPENSIPS>:5060;branch=0.
> From: sip:keepalive@<IP_OPENSIPS>;tag=6386f398.
> To: <sip:10.0.8.183:5060>;tag=85691902.
> Call-ID: 406b0979-64c6436a-27@<IP_OPENSIPS>.
> CSeq: 1 OPTIONS.
> Allow:  INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE,  
> PRACK, SUBSCRIBE, INFO.
> Server: Aastra 55i/2.3.1.26.
> Content-Length: 0.
> .
>
> -----
>
> _______________________________________________
> 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: NOTIFY nat_keepalive - Bad Event

Thomas Gelf
In reply to this post by Carlo Dimaggio
There is nothing wrong, most phones just don't "understand" the "keep
alive" event in your NOTIFY request - but that's fine, as you don't
need a positive answer for the "keep-alive-effect", you just need a
packet keeping the hole open.

You can find this explanation also in the nat_traversal documentation:

http://www.opensips.org/html/docs/modules/devel/nat_traversal.html#id228272

Best regards,
Thomas Gelf

Carlo Dimaggio schrieb:

> Hi all,
>
> I'm using nat_traversal and the nat_keepalive function. For phones-
> compatibility I have to use the "NOTIFY" method but all my registered  
> phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS  
> method some phones reply with "200 OK"). What I am wrong?
>
> Can you help me?
>
> Thanks,
> Carlo Dimaggio


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

Re: NOTIFY nat_keepalive - Bad Event

Carlo Dimaggio

Il giorno 27/feb/09, alle ore 15:01, Thomas Gelf ha scritto:

> You can find this explanation also in the nat_traversal documentation:


Thank you all,

I have read "with attention" the nat traversal section :-)
Now I have set the keepalive_method to "OPTIONS".


Regards,
Carlo Dimaggio

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

Re: NOTIFY nat_keepalive - Bad Event

Dan Pascu
In reply to this post by Bogdan-Andrei Iancu
On Friday 27 February 2009, Bogdan-Andrei Iancu wrote:
> Hi Carlo,
>
> I think the problem is with the phone as they do not understand the
> "keep-alive" event sent in NOTIFY.
>
> It is nothing you can do about this (in is not on the proxy side).
> Maybe in the future we can add a module parameter for removing the
> Event header from the REQUEST and make the dummy phone happy.

That's not gonna work. A NOTIFY without an Event header is invalid and I
see no reason why a phone could accept it that way. Most likely one will
get the same (or maybe some different) negative reply.

> Anyhow, as best practice , the OPTIONS method is more appropriate for
> nat pinging.

I have to disagree. OPTIONS generate 2-3 times more traffic because of the
bigger replies. OTOH, it doesn't really matter if we get a 200 OK or a
negative reply to such a keep-alive request, does it? All it matters is
that the device behind NAT sends something (anything) to keep the NAT
open from inside. NOTIFY gets the job done with less traffic, which makes
it better.

>
> Regards,
> Bogdan
>
> Carlo Dimaggio wrote:
> > Hi all,
> >
> > I'm using nat_traversal and the nat_keepalive function. For phones-
> > compatibility I have to use the "NOTIFY" method but all my registered
> > phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS
> > method some phones reply with "200 OK"). What I am wrong?

--
Dan

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

Re: NOTIFY nat_keepalive - Bad Event

Bogdan-Andrei Iancu
Hi Dan,

Dan Pascu wrote:

> On Friday 27 February 2009, Bogdan-Andrei Iancu wrote:
>  
>> Hi Carlo,
>>
>> I think the problem is with the phone as they do not understand the
>> "keep-alive" event sent in NOTIFY.
>>
>> It is nothing you can do about this (in is not on the proxy side).
>> Maybe in the future we can add a module parameter for removing the
>> Event header from the REQUEST and make the dummy phone happy.
>>    
>
> That's not gonna work. A NOTIFY without an Event header is invalid and I
> see no reason why a phone could accept it that way. Most likely one will
> get the same (or maybe some different) negative reply.
>  
I see. Thanks for the fix.

>  
>> Anyhow, as best practice , the OPTIONS method is more appropriate for
>> nat pinging.
>>    
>
> I have to disagree. OPTIONS generate 2-3 times more traffic because of the
> bigger replies. OTOH, it doesn't really matter if we get a 200 OK or a
> negative reply to such a keep-alive request, does it? All it matters is
> that the device behind NAT sends something (anything) to keep the NAT
> open from inside. NOTIFY gets the job done with less traffic, which makes
> it better.
>  
Indeed, the OPTIONS may generate more traffic (depends on the
implementation - kphone sends with SDP also, other not). But when comes
to interoperability, OPTIONS is more accepted by end devices, rather
then NOTIFY (where the phone must implement the method and the event).

On the other hand I totally agree - the reply to a SIP ping is not
relevant as code - relevant is just the fact that the client sends back
traffic.

Regards,
Bogdan

>  
>> Regards,
>> Bogdan
>>
>> Carlo Dimaggio wrote:
>>    
>>> Hi all,
>>>
>>> I'm using nat_traversal and the nat_keepalive function. For phones-
>>> compatibility I have to use the "NOTIFY" method but all my registered
>>> phones reply to opensips with "Bad Request / Bad Event" (with OPTIONS
>>> method some phones reply with "200 OK"). What I am wrong?
>>>      
>
>  


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

Re: NOTIFY nat_keepalive - Bad Event

Dan Pascu
On Monday 02 March 2009, Bogdan-Andrei Iancu wrote:

> >> Anyhow, as best practice , the OPTIONS method is more appropriate
> >> for nat pinging.
> >
> > I have to disagree. OPTIONS generate 2-3 times more traffic because
> > of the bigger replies. OTOH, it doesn't really matter if we get a 200
> > OK or a negative reply to such a keep-alive request, does it? All it
> > matters is that the device behind NAT sends something (anything) to
> > keep the NAT open from inside. NOTIFY gets the job done with less
> > traffic, which makes it better.
>
> Indeed, the OPTIONS may generate more traffic (depends on the
> implementation - kphone sends with SDP also, other not). But when comes
> to interoperability, OPTIONS is more accepted by end devices, rather
> then NOTIFY (where the phone must implement the method and the event).

I don't think the phone needs to implement or for that matter even be
aware of the NOTIFY method. Any device should reply with a "not
implemented" or "method not understood" negative reply to any method it
doesn't support. Any reply will do for the purpose of keepalive, be it
positive or negative. In practice I have not encountered any device that
would not reply to a keep-alive NOTIFY.

--
Dan

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

Re: NOTIFY nat_keepalive - Bad Event

Iñaki Baz Castillo
2009/3/2 Dan Pascu <[hidden email]>:

>> Indeed, the OPTIONS may generate more traffic (depends on the
>> implementation - kphone sends with SDP also, other not). But when comes
>> to interoperability, OPTIONS is more accepted by end devices, rather
>> then NOTIFY (where the phone must implement the method and the event).
>
> I don't think the phone needs to implement or for that matter even be
> aware of the NOTIFY method. Any device should reply with a "not
> implemented" or "method not understood" negative reply to any method it
> doesn't support. Any reply will do for the purpose of keepalive, be it
> positive or negative. In practice I have not encountered any device that
> would not reply to a keep-alive NOTIFY.

Indeed. In fact a custom request could be used for pinging:

  COOL-PING! sip:[hidden email] SIP/2.0

Any UAS receiving that request MUST reply "Not implemented".


--
Iñaki Baz Castillo
<[hidden email]>

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

Re: NOTIFY nat_keepalive - Bad Event

Bogdan-Andrei Iancu
In reply to this post by Dan Pascu
yes, form strict practical point of view, you are right here.

Regards,
Bogdan

Dan Pascu wrote:

> On Monday 02 March 2009, Bogdan-Andrei Iancu wrote:
>  
>>>> Anyhow, as best practice , the OPTIONS method is more appropriate
>>>> for nat pinging.
>>>>        
>>> I have to disagree. OPTIONS generate 2-3 times more traffic because
>>> of the bigger replies. OTOH, it doesn't really matter if we get a 200
>>> OK or a negative reply to such a keep-alive request, does it? All it
>>> matters is that the device behind NAT sends something (anything) to
>>> keep the NAT open from inside. NOTIFY gets the job done with less
>>> traffic, which makes it better.
>>>      
>> Indeed, the OPTIONS may generate more traffic (depends on the
>> implementation - kphone sends with SDP also, other not). But when comes
>> to interoperability, OPTIONS is more accepted by end devices, rather
>> then NOTIFY (where the phone must implement the method and the event).
>>    
>
> I don't think the phone needs to implement or for that matter even be
> aware of the NOTIFY method. Any device should reply with a "not
> implemented" or "method not understood" negative reply to any method it
> doesn't support. Any reply will do for the purpose of keepalive, be it
> positive or negative. In practice I have not encountered any device that
> would not reply to a keep-alive NOTIFY.
>
>  


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