<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>following Volga's advice, I added lookup(location)  after the
      subscribe but to no avail, that event doesn't want to pop.  <br>
    </p>
    <p><br>
              xlog("callid=$ci: Route[userlocation]:we call t_newtran
      and subscribe for E_UL_CONTACT_INSERT");<br>
              # prepare transaction for branch injection; it is
      mandatory<br>
              # to create the transaction before the subscription,
      otherwise<br>
              # the EBR module will not pass the transaction ID into the<br>
              # notification route<br>
              t_newtran();<br>
              # keep the transaction alive (even if all branches will <br>
              # terminate) until the FR INVITE timer hits (we want to
      wait<br>
              # for new possible contacts being registered)<br>
              t_wait_for_new_branches();<br>
              # subscribe to new contact registration event,<br>
              # but for our callee only<br>
              $avp(filter) = "aor=" + $tU + "@" + $td;<br>
              $avp(filter) = "aor=*";<br>
              xlog("callid=$ci: Route[userlocation]: filter avp(filter)
      [$avp(filter)]");<br>
              #async( wait_for_event("E_UL_CONTACT_INSERT",$avp(filter),
      40), "fork_call");<br>
             
      notify_on_event("E_UL_CONTACT_INSERT",$avp(filter),"fork_call",
      180);<br>
          <br>
              if (lookup("location"))<br>
              {<br>
                  route(relay);<br>
              }</p>
    <p><br>
    </p>
    <p>Is there somebody out there who did this on 3.1 ? <br>
    </p>
    <p><br>
    </p>
    <p>version: opensips 3.1.0 (x86_64/linux)<br>
      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<br>
      ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN
      16, MAX_URI_SIZE 1024, BUF_SIZE 65535<br>
      poll method support: poll, epoll, sigio_rt, select.<br>
      git revision: 58804282f<br>
      main.c compiled on 08:25:14 Jul 24 2020 with gcc 8<br>
    </p>
    <div class="moz-cite-prefix">On 21/08/2020 15:40, johan wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:90b6d96c-9c1a-7d72-cbd2-1ac8f69a8724@democon.be">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hello, using opensips3.1 I don't arrive at catching event
        E_UL_CONTACT_INSERT. <br>
      </p>
      <p>As you can see in below logs, <br>
      </p>
      <p>the route seems to be correctly armed, but the event is not
        triggered on the registration of the user. <br>
      </p>
      <p>Can somebody give a hint on what I am overlooking ? <br>
      </p>
      <p>Do I need to enable the events in usrloc ? <br>
      </p>
      <p><br>
      </p>
      <p>wkr, <br>
      </p>
      <p>    xlog("callid=$ci: Route[userlocation]:avp(messagepn)
        [$avp(messagepn)] avp(callpn) [$avp(callpn)]");<br>
            if (($avp(callpn)!="null") or ($avp(messagepn)!=null))<br>
            {<br>
                xlog("callid=$ci: Route[userlocation]:we call t_newtran
        and subscribe for E_UL_CONTACT_INSERT");<br>
                # prepare transaction for branch injection; it is
        mandatory<br>
                # to create the transaction before the subscription,
        otherwise<br>
                # the EBR module will not pass the transaction ID into
        the<br>
                # notification route<br>
                t_newtran();<br>
                # keep the transaction alive (even if all branches will
        <br>
                # terminate) until the FR INVITE timer hits (we want to
        wait<br>
                # for new possible contacts being registered)<br>
                t_wait_for_new_branches();<br>
                # subscribe to new contact registration event,<br>
                # but for our callee only<br>
                <b>$avp(filter) = "aor=" + $tU + "@" + $td;</b><br>
                #$avp(filter) = "aor=*";<br>
                xlog("callid=$ci: Route[userlocation]: filter
        avp(filter) [$avp(filter)]");<br>
                async(
        wait_for_event("E_UL_CONTACT_INSERT",$avp(filter), 40),
        "fork_call");<br>
               
        #notify_on_event("E_UL_CONTACT_INSERT",$avp(filter),"fork_call",
        "180");<br>
            }<br>
      </p>
      <p><br>
        route[fork_call]<br>
        {<br>
            xlog("callid=$ci: Route[fork_call]:user $avp(aor) registered
        a new contact $avp(uri), injecting\n");<br>
            # take the contact described by the E_UL_CONTACT_INSERT<br>
            # event and inject it as a new branch into the original<br>
            # transaction<br>
            t_inject_branches("event");<br>
        }</p>
      <p><br>
      </p>
      <p>route[0]</p>
      <p>{</p>
      <p>... <br>
      </p>
      <p>    if (is_method("REGISTER"))<br>
            {<br>
                #TLS<br>
                if (isflagset("SRC_TLS"))<br>
                {<br>
                    setbflag("DST_TLS");<br>
                }<br>
                #TLS end TLS<br>
                if (!www_authorize("", "subscriber"))<br>
                {<br>
                    www_challenge("", "auth");<br>
                    exit;<br>
                }<br>
                <br>
                if (!save("location")){            <br>
                    sl_reply_error();<br>
                    exit;<br>
                }<br>
                xlog("callid=$ci: Route[0]: REGISTER comes in from fU
        $fU");<br>
                exit;<br>
            }<br>
        }<br>
      </p>
      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<br>
      Aug 21 12:53:09 ns365555 /data/opensips/sbin/opensips[18730]:
      callid=AmrM407AUsLjipDqbtNFjQ..: Route[userlocation]: filter
      avp(filter) [<a class="moz-txt-link-abbreviated"
        href="mailto:aor=1002@46.105.105.119" moz-do-not-send="true">aor=1002@46.105.105.119</a>]<br>
      Aug 21 12:53:11 ns365555 /data/opensips/sbin/opensips[18729]:
      callid=KFzAmny6Ot: Route[0]: REGISTER comes in from fU 1002<br>
    </blockquote>
  </body>
</html>