Hello All,
I'm trying to code something on the on_reply part to do something if I receive a 183 ( Session in progress ) , followed immediately by a "180"
I tried to sleep 1 second the 183 and recheck if I received before a 180 but seems the "sleep" function sleeps everything ( also the received 180 )
Is a developper can confirm that ?
The goal is to detect if a 180 follow the 183.
Hi Nicolas,
The sleep functions block an entire SIP worker thread, of which there is a small number. While it's blocked, new incoming SIP messages will be picked up by other SIP workers. You can read more about how this works here (shameless plug, it's my article):
http://blog.csrpswitch.com/tuning-kamailio-for-high-throughput-and-performan...
In general, most ideas that rely on these functions are bad ones for the reasons explained in the article.
If you want to check whether replies were received in a particular order, just use flags, which are transaction-persistent, in an onreply_route. That is, you can do something like:
#!define FL_183_RECEIVED 1
onreply_route[REPLY] { if(t_check_status("183")) setflag(FL_183_RECEIVED);
if(t_check_status("180")) { if(isflagset(FL_183_RECEIVED)) { xlog("[$ci] 180 received after 183! The horror!\n"); ... } }
These flags can be accessed from any route that is called in connection with the given transaction.
You can also used AVPs or XAVPs if you need to keep some more sophisticated state associated with these messages, of course.
-- Alex
Hello Alex,
Thanks for your interesting reply.
I think it will not match because I want to send a "180" in case I receive a 183 without SDP and no 180 from the carrier.
if(t_check_status("180")) { if(isflagset(FL_183_RECEIVED)) { ## 180 received OK xlog("[$ci] 180 received after 183! The horror!\n"); ... } else {
# No 180 received , so will send one :)
Send_reply(180, Ringing)
}
That will not work :)
I tried to delay the processing of the "183" and :
If a 180 is received before the delay expires , I forward the "180" If no 180 is received, I can send a 180 manually
But again in my test, during the "delay" all incoming requests related to this dialog are delayed also
-----Message d'origine----- De : sr-users [mailto:sr-users-bounces@lists.kamailio.org] De la part de Alex Balashov Envoyé : lundi 31 juillet 2017 23:23 À : Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Objet : Re: [SR-Users] Usleep on Reply Importance : Haute
Hi Nicolas,
The sleep functions block an entire SIP worker thread, of which there is a small number. While it's blocked, new incoming SIP messages will be picked up by other SIP workers. You can read more about how this works here (shameless plug, it's my article):
http://blog.csrpswitch.com/tuning-kamailio-for-high-throughput-and-performan...
In general, most ideas that rely on these functions are bad ones for the reasons explained in the article.
If you want to check whether replies were received in a particular order, just use flags, which are transaction-persistent, in an onreply_route. That is, you can do something like:
#!define FL_183_RECEIVED 1
onreply_route[REPLY] { if(t_check_status("183")) setflag(FL_183_RECEIVED);
if(t_check_status("180")) { if(isflagset(FL_183_RECEIVED)) { xlog("[$ci] 180 received after 183! The horror!\n"); ... } }
These flags can be accessed from any route that is called in connection with the given transaction.
You can also used AVPs or XAVPs if you need to keep some more sophisticated state associated with these messages, of course.
-- Alex
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Tue, Aug 01, 2017 at 03:40:56PM +0000, Nicolas Breuer wrote:
I think it will not match because I want to send a "180" in case I receive a 183 without SDP and no 180 from the carrier.
...
Why not simply always send a 180 (when receiving the initial INVITE) and always drop the 183 without SDP?
Hello Daniel
Yes i can also do that :) Thanks for your input !
-----Message d'origine----- De : sr-users [mailto:sr-users-bounces@lists.kamailio.org] De la part de Daniel Tryba Envoyé : mardi 1 août 2017 18:11 À : Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Objet : Re: [SR-Users] Usleep on Reply
On Tue, Aug 01, 2017 at 03:40:56PM +0000, Nicolas Breuer wrote:
I think it will not match because I want to send a "180" in case I receive a 183 without SDP and no 180 from the carrier.
...
Why not simply always send a 180 (when receiving the initial INVITE) and always drop the 183 without SDP?
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users