[OpenSIPS-Users] trouble with event_route.

johan johan at democon.be
Fri Aug 21 14:39:51 EST 2020


following Volga's advice, I added lookup(location)  after the subscribe 
but to no avail, that event doesn't want to pop.


         xlog("callid=$ci: Route[userlocation]:we call t_newtran and 
subscribe for E_UL_CONTACT_INSERT");
         # prepare transaction for branch injection; it is mandatory
         # to create the transaction before the subscription, otherwise
         # the EBR module will not pass the transaction ID into the
         # notification route
         t_newtran();
         # keep the transaction alive (even if all branches will
         # terminate) until the FR INVITE timer hits (we want to wait
         # for new possible contacts being registered)
         t_wait_for_new_branches();
         # subscribe to new contact registration event,
         # but for our callee only
         $avp(filter) = "aor=" + $tU + "@" + $td;
         $avp(filter) = "aor=*";
         xlog("callid=$ci: Route[userlocation]: filter avp(filter) 
[$avp(filter)]");
         #async( wait_for_event("E_UL_CONTACT_INSERT",$avp(filter), 40), 
"fork_call");
notify_on_event("E_UL_CONTACT_INSERT",$avp(filter),"fork_call", 180);

         if (lookup("location"))
         {
             route(relay);
         }


Is there somebody out there who did this on 3.1 ?


version: opensips 3.1.0 (x86_64/linux)
flags: STATS: On, EXTRA_DEBUG, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, 
PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, 
FAST_LOCK-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, sigio_rt, select.
git revision: 58804282f
main.c compiled on 08:25:14 Jul 24 2020 with gcc 8

On 21/08/2020 15:40, johan wrote:
>
> Hello, using opensips3.1 I don't arrive at catching event 
> E_UL_CONTACT_INSERT.
>
> As you can see in below logs,
>
> the route seems to be correctly armed, but the event is not triggered 
> on the registration of the user.
>
> Can somebody give a hint on what I am overlooking ?
>
> Do I need to enable the events in usrloc ?
>
>
> wkr,
>
>     xlog("callid=$ci: Route[userlocation]:avp(messagepn) 
> [$avp(messagepn)] avp(callpn) [$avp(callpn)]");
>     if (($avp(callpn)!="null") or ($avp(messagepn)!=null))
>     {
>         xlog("callid=$ci: Route[userlocation]:we call t_newtran and 
> subscribe for E_UL_CONTACT_INSERT");
>         # prepare transaction for branch injection; it is mandatory
>         # to create the transaction before the subscription, otherwise
>         # the EBR module will not pass the transaction ID into the
>         # notification route
>         t_newtran();
>         # keep the transaction alive (even if all branches will
>         # terminate) until the FR INVITE timer hits (we want to wait
>         # for new possible contacts being registered)
>         t_wait_for_new_branches();
>         # subscribe to new contact registration event,
>         # but for our callee only
> *$avp(filter) = "aor=" + $tU + "@" + $td;*
>         #$avp(filter) = "aor=*";
>         xlog("callid=$ci: Route[userlocation]: filter avp(filter) 
> [$avp(filter)]");
>         async( wait_for_event("E_UL_CONTACT_INSERT",$avp(filter), 40), 
> "fork_call");
> #notify_on_event("E_UL_CONTACT_INSERT",$avp(filter),"fork_call", "180");
>     }
>
>
> route[fork_call]
> {
>     xlog("callid=$ci: Route[fork_call]:user $avp(aor) registered a new 
> contact $avp(uri), injecting\n");
>     # take the contact described by the E_UL_CONTACT_INSERT
>     # event and inject it as a new branch into the original
>     # transaction
>     t_inject_branches("event");
> }
>
>
> route[0]
>
> {
>
> ...
>
>     if (is_method("REGISTER"))
>     {
>         #TLS
>         if (isflagset("SRC_TLS"))
>         {
>             setbflag("DST_TLS");
>         }
>         #TLS end TLS
>         if (!www_authorize("", "subscriber"))
>         {
>             www_challenge("", "auth");
>             exit;
>         }
>
>         if (!save("location")){
>             sl_reply_error();
>             exit;
>         }
>         xlog("callid=$ci: Route[0]: REGISTER comes in from fU $fU");
>         exit;
>     }
> }
>
> Aug 21 12:53:09 ns365555 /data/opensips/sbin/opensips[18730]: 
> callid=AmrM407AUsLjipDqbtNFjQ..: Route[userlocation]:we call t_newtran 
> and subscribe for E_UL_CONTACT_INSERT
> Aug 21 12:53:09 ns365555 /data/opensips/sbin/opensips[18730]: 
> callid=AmrM407AUsLjipDqbtNFjQ..: Route[userlocation]: filter 
> avp(filter) [aor=1002 at 46.105.105.119]
> Aug 21 12:53:11 ns365555 /data/opensips/sbin/opensips[18729]: 
> callid=KFzAmny6Ot: Route[0]: REGISTER comes in from fU 1002
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200821/0e0d525c/attachment.html>


More information about the Users mailing list