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

kertor-f at yandex.ru kertor-f at yandex.ru
Wed Aug 1 10:20:37 EDT 2018


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



More information about the Users mailing list