[OpenSIPS-Users] trouble with event_route.

johan johan at democon.be
Mon Aug 24 09:03:19 EST 2020


An update.


E_UL_CONTACT_INSERT is only called on the first registration of a user 
after a reload.

So either I am listening for the wrong event, or there is a bug.

Can you please let me know how to proceed.


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], mb 
[$mb]");
         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();
         $avp(filter) = "aor=*";
         xlog("callid=$ci: Route[0]: filter avp(filter) [$avp(filter)]");
notify_on_event("E_UL_CONTACT_INSERT",$avp(filter),"fork_call", 7200);
         exit;
     }

}


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");
}


this is the initial registration : route(fork_call) is called.

.: Route[0]: REGISTER comes in from fU [1000], mb [REGISTER 
sip:x.y.z.t:5061;transport=TLS SIP/2.0#015#012Via: SIP/2.0/TLS 
192.168.68.103:44518;branch=z9hG4bK-524287-1---80382afab4d6c26c;rport#015#012Max-Forwards: 
69#015#012Contact: 
<sip:1000 at 213.118.172.6:38277;transport=TLS;rinstance=3dc198bd81077bec>#015#012To: 
<sip:1000 at x.y.z.t:5061;transport=TLS>#015#012From: 
<sip:1000 at x.y.z.t:5061;transport=TLS>;tag=e8170278#015#012Call-ID: 
tEOl9JnRC541B5XfFGVEZw..#015#012CSeq: 2 REGISTER#015#012Expires: 
600#015#012Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, 
OPTIONS, INFO, SUBSCRIBE#015#012User-Agent: Z 5.3.8 
rv2.9.30-mod#015#012Authorization: Digest 
username="1000",realm="x.y.z.t",nonce="5f4378ec000000014920860cf8b6640d9b11be7ae5a7e089",uri="sip:x.y.z.t:5061;transport=TLS",response="8974c34deb9b6134fc352dc1d696bb4a",cnonce="ca81138c2af7046c6d62bd69b6d7b4c6",nc=00000001,qop=auth,algorithm=MD5#015#012Allow-Events: 
presence, kpml, talk#015#012Content-Length: 0#015#012#015#012]
Aug 24 08:22:38 ns365555 /data/opensips/sbin/opensips[6036]: 
callid=tEOl9JnRC541B5XfFGVEZw..: Route[0]: filter avp(filter) [aor=*]

Aug 24 08:22:38 ns365555 /data/opensips/sbin/opensips[6036]: 
ERROR:core:pv_get_callid: cannot parse Call-Id header
Aug 24 08:22:38 ns365555 /data/opensips/sbin/opensips[6036]: 
callid=<null>: Route[fork_call]:user 1000 registered a new contact 
sip:1000 at 213.118.172.6:38277;transport=TLS;rinstance=3dc198bd81077bec, 
injecting

This is a reregistration: route(fork_call) is not called.

Aug 24 08:24:29 ns365555 /data/opensips/sbin/opensips[6036]: 
callid=Tt3sdUusdcELwrmcGvxymw..: Route[0]: REGISTER comes in from fU 
[1000], mb [REGISTER sip:x.y.z.t:5061;transport=TLS SIP/2.0#015#012Via: 
SIP/2.0/TLS 
192.168.68.103:44518;branch=z9hG4bK-524287-1---0b26966ac285f389;rport#015#012Max-Forwards: 
69#015#012Contact: 
<sip:1000 at 213.118.172.6:38277;transport=TLS;rinstance=733859e2328994fa>#015#012To: 
<sip:1000 at x.y.z.t:5061;transport=TLS>#015#012From: 
<sip:1000 at x.y.z.t:5061;transport=TLS>;tag=97ef5a23#015#012Call-ID: 
Tt3sdUusdcELwrmcGvxymw..#015#012CSeq: 5 REGISTER#015#012Expires: 
600#015#012Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, 
OPTIONS, INFO, SUBSCRIBE#015#012User-Agent: Z 5.3.8 
rv2.9.30-mod#015#012Authorization: Digest 
username="1000",realm="x.y.z.t",nonce="5f43795b0000000528fc1b85a5fcc90749efb47a2035d303",uri="sip:x.y.z.t:5061;transport=TLS",response="b6438f3882f04d73a8e2444b9abf8b5f",cnonce="2b94a08747dbea05e5e110b16311fbbd",nc=00000001,qop=auth,algorithm=MD5#015#012Allow-Events: 
presence, kpml, talk#015#012Content-Length: 0#015#012#015#012]
Aug 24 08:24:29 ns365555 /data/opensips/sbin/opensips[6036]: 
callid=Tt3sdUusdcELwrmcGvxymw..: Route[0]: filter avp(filter) [aor=*]

....


On 21/08/2020 17:31, Liviu Chircu wrote:
> On 21.08.2020 18:14, Liviu Chircu wrote:
>> Let me re-test this feature and come back with an update. 
>
> Johan,
>
> I've successfully re-run my tests and both notify_on_event() and 
> async(wait_for_event()) worked just fine.
>
> I only have one idea that may explain why it doesn't work for you:  if 
> you have enabled the "usrloc.use_domain" [1] modparam, then the 
> correct way to subscribe to the usrloc registration event is:
>
> $avp(filter) = "aor=" + $rU + "@" + $rd;
>
> [1]: https://opensips.org/docs/modules/3.2.x/usrloc.html#param_use_domain
>



More information about the Users mailing list