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:[email protected]] De la part de Alex 
Balashov
Envoyé : lundi 31 juillet 2017 23:23
À : Kamailio (SER) - Users Mailing List <[email protected]>
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-performance/

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
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to