[SR-Users] How to intercept an INVITE after (ts_append)

Oleg Podguyko podguiko at mail.ru
Wed Nov 20 07:38:42 CET 2019


Hi Henning,
 
Yes I used it. But мy mistake was I called function «ts_store» before «t_on_branch»
Now, I’ve corrected it and everything is ok!
 
Thank you so much for help!
 
  
>Вторник, 19 ноября 2019, 17:15 +03:00 от Henning Westerholt <hw at skalatan.de>:
> 
>Hello Oleg,
> 
>quick question – do you already tried to setup a branch_route to interact with the branch?
> 
>t_on_branch(“MANAGE_BRANCH”);
>>branch_route[MANAGE_BRANCH] { …}
> 
>Cheers,
> 
>Henning
> 
>-- 
>Henning Westerholt –  https://skalatan.de/blog/
>Kamailio services –  https://gilawa.com
>Kamailio Merchandising –  https://skalatan.de/merchandising
> 
>From: sr-users < sr-users-bounces at lists.kamailio.org >  On Behalf Of  Oleg Podguyko
>Sent: Monday, November 18, 2019 10:21 PM
>To: sr-users at lists.kamailio.org
>Subject: [SR-Users] How to intercept an INVITE after (ts_append)
> 
>Hello everybody!
> 
>Kamailio works as a Registrar. Additionally, rtpengine is deployed next to it. Using rtpgngine module I proxy media stream via rtpengine(rtpengine_manage()). I change SDP.  SiP2SIP calls work fine. Now I would like to have possibility to "wake up" sip-clients(at the android and ios phones) which are usually not on-line via push notification. Trying to use TSILO module. 
> 
># User location service
>route[LOCATION] {
>    lookup("location"); 
>    $var(rc) = $rc;
>    if (is_method("INVITE")) 
>    {
>        if (t_newtran()) 
>        {
>            ts_store(); # if it a new transuction ,it will be store for some time.
>        }
>    }
>    switch ($var(rc)) 
>    {
>    case  1:
>         route(RELAY);
>         break; 
>    case -1:
>         break;
>    case -3:
>         send_reply("404", "Not Found");
>         exit;
>    case -2:
>         send_reply("405", "Method Not Allowed");
>         exit;
>    }
>}
>
># Handle SIP registrations
>route[REGISTRAR] {
>    if (!is_method("REGISTER")) return;
>    if (!save("location")) 
>    {
>        sl_reply_error();
>    }
>    ts_append("location", "$tu"); # if transuction for this sip-client is exist. The invite will be send. 
>    exit;
>}
>
>If the client is not registered at the kamailio during the call. Then such calls are stored through the "ts_store" function for some time. And if during this time the client send register, kamailio  will be sent INVITE to it. But I have the problem. Such calls after "wake up"go through a special branch route that I don't know how to intercept. As a result, I can't change SDP(using rtpengite_manage commands) and rtp stream do not proxy via rtpengine… and call failed.
> 
>/usr/sbin/kamailio[9957]: exec: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} *** cfgtrace:request_route=[REGISTRAR] c=[/etc/kamailio/kamailio.cfg] l=428 a=26 n=ts_append
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tsilo [ts_append.c:72]: ts_append(): transaction 36343:92182831 found for 777777777, going to append branches
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_lookup.c:1629]: t_lookup_ident_filter(): transaction found
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} registrar [lookup.c:255]: lookup_helper(): contact for [777777777] found by address
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} registrar [lookup.c:456]: lookup_helper(): instance is
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_append_branches.c:77]: t_append_branches(): transaction 36343:92182831 in status 0
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_append_branches.c:99]: t_append_branches(): Call uvAzTGsEV9N2ReDjmWoo8A..: 0 (1) outgoing branches
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_append_branches.c:126]: t_append_branches(): Current uri  sip:77777777 at 95.165.146.181:63618;transport=TCP;rinstance=8b1865b95767b7ba
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} <core> [core/msg_translator.c:2933]: create_via_hf(): id added: <;i=1>, rcv proto=2
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_append_branches.c:149]: t_append_branches(): added branch [ sip:777777777 at 95.165.146.181:63618;transport=TCP;rinstance=8b1865b95767b7ba ] with ruid [uloc-5dd2faa0-26e5-1]
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} tm [t_append_branches.c:163]: t_append_branches(): Call uvAzTGsEV9N2ReDjmWoo8A..: 0 (0) outgoing branches after clear_branches()
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} <core> [core/tcp_main.c:2238]: tcpconn_send_put(): send from reader (9957 (22)), reusing fd
>/usr/sbin/kamailio[9957]: DEBUG: {1 2 REGISTER JxPcA9D1hIJ8PmkcnOvI7g..} <core> [core/tcp_main.c:2473]: tcpconn_do_send(): sending...
> 
> 
> 
>--
>Oleg Podguyko 
 
 
--
Олег Подгуйко
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191120/bb1c1d45/attachment.html>


More information about the sr-users mailing list