[OpenSIPS-Users] change_reply_status() do not work with 2xx replies

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Aug 2 05:01:33 EDT 2018


Hi,

What you are trying to do it not logically correct ; even more, it is 
not SIP wise correct (a proxy must not mess up with the final replies as 
the end points will get de-syncronized .

This a well know race in SIP - caller canceling versus callee answering 
the call. The RFC says that the proxy must pass the 200 OK INVITE back 
to caller and let the caller device to decide what to do. If the device 
really wants to terminate, it will generate a BYE on the spot. If not, 
it can keep the call and ignore the fact it sent the cancel.
And you accounting must follow the caller's decision, by simply 
accounting the call as normal.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
   http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 08/01/2018 05:20 PM, kertor-f at yandex.ru wrote:
> Hello everyone! Need your help.
> Scheme: A <---> opensips <----> B, simple scheme of call:
> 1) INVITE                A ---> opensips ----> B
> 2) 100                   A <--- opensips <---- B
> 3) 183                   A <--- opensips <---- B
> 4) CANCEL                A ---> opensips ----> B
> 5) 200 Cancelling        A <--- opensips <---- B
> 6) 200 ok                A <--- opensips <---- B
> When customer B received CANCEL request, he answers "200 Cancelling" (Cseq: CANCEL) and "200 ok" (Cseq: INVITE) at the same time. This behavior generates is wrong CDR - i use accounting. For resolve this situation i trying to use this code in route BRANCH_REPLY, in snippet below you may see routes initializing chain:
> ```
> route {
> ...
>      t_on_failure("GETDATA");
> ...
> }
>
> failure_route[GETDATA] {
> ...
>       route("TRYING");
> ...
> }
>    
> route[TRYING] {
> ...
>      t_on_branch("BRANCH_CARRIER");
> ...
> }
>
> branch_route[BRANCH_CARRIER] {
> ...
>      t_on_reply("BRANCH_REPLY");
> ...
> }
>
> onreply_route[BRANCH_REPLY] {
> ...
>      xlog("L_INFO", "DEBUG OUT rs=$rs rr=$rr si=$si DLG_status=$DLG_status\n");
>      if ((t_check_status("18[0-9]|200")) && (t_was_cancelled())) { # Don't allow continue cancelled call
>          xlog("L_INFO", "DEBUG IN rs=$rs rr=$rr si=$si DLG_status=$DLG_status\n");
>          $DLG_timeout = 1;
>          change_reply_status("487", "Request Terminated");
>          $var(local_sip_code) = "487";
>          exit;
>      }
> ...
> }
> ```
>
> Reply "200 ok" falls into the route "BRANCH_REPLY" and block "Don't allow continue cancelled call", but change_reply_status() do not change rr and rs.
> One more question about accounting, any chance use function drop_accounting() in this scheme? I want drop accounting if opensips receives 200ok AFTER processing CANCEL.
> Thanks!
>
> opensips version:
> ```
> version: opensips 2.3.4 (x86_64/linux)
> flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, HP_MALLOC, FAST_LOCK-FUTEX-ADAPTIVE_WAIT
> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
> main.c compiled on 16:48:49 Jul  5 2018 with gcc 5.4.0
> ```
> The same ticket in git: https://github.com/OpenSIPS/opensips/issues/1435
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list