<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Dear Daniel,<div><br></div><div>I have tried $tU but with no success.</div><div>Additionaly I saw into log file the following:</div><div><div>Jul 24 14:51:51 sip /usr/sbin/kamailio[6115]: ERROR: registrar [common.c:69]: failed to parse Address of Record</div><div>Jul 24 14:51:51 sip /usr/sbin/kamailio[6115]: ERROR: registrar [save.c:895]: failed to extract Address Of Record</div><div>After that I used <span style="font-size: 12pt;">"sip:$tU@example.com" with no success again but with error in log file.</span></div><div><span style="font-size: 12pt;">Do I need something more that should work together with unregister or shall i place this function somewherelse like impresence?</span></div><div><br></div><div>If the function syntax is correct and has been executed should I be able to see immediately the relevant contact be removed from location table <b>(mysql> select * from location;)</b>  or not?</div><div><br></div><div>Best regards.</div><br><div>> Date: Wed, 24 Jul 2013 13:09:45 +0200<br>> From: dgrotti@sipwise.com<br>> To: spce-user@lists.sipwise.com<br>> Subject: Re: [Spce-user] How to force unregister a user<br>> <br>> Hi,<br>> <br>> you can use the To header instead of the R-URI.<br>> Since you work on failure route messages there is no R-URI.<br>> You can try to use $tu, but you have to be sure that the To URI match<br>> exactly you "userA@your.domain" stored in the location DB.<br>> <br>> <br>> Daniel<br>> <br>> <br>> <br>> On 07/24/2013 12:08 PM, andreas tseiko wrote:<br>> > Dear Daniel,<br>> > <br>> > Actualy, we want to force unregister user A while user B is calling him<br>> > and user A has lost his network connectivity but his registration timer<br>> > has not expired yet. <br>> > According to that we have placed functions:<br>> > <br>> > *t_reply("480", "User offline");  *to reply with 480 instead of 408<br>> > *unregister("location", "$ru");  *to unregister user A<br>> > <br>> > into<br>> > file root@sip:/etc/ngcp-config/templates/etc/kamailio/proxy/proxy.cfg.tt2<br>> > <br>> > more specific:<br>> > <br>> > ########################################################################<br>> > # Failure route 'base-standard-failure'<br>> > ########################################################################<br>> > failure_route[FAILURE_ROUTE_LOCAL]<br>> > {<br>> >         xlog("L_INFO", "Failure route for local call - [% logreq -%]\n");<br>> > <br>> >         # reset previous D-Uri, otherwise the wrong destination is<br>> >         # used for cfb<br>> >         $du = $null;<br>> > <br>> >         # initialise variables when entering failure route<br>> >         $var(loose_routed) = 0;<br>> >         $var(no_acc) = 0;<br>> >         $var(no_auth) = 0;<br>> >         $var(forward) = 0;<br>> >         $var(redirected_forward) = 0;<br>> >         $var(external_domain) = 0;<br>> >         $var(ext_timeout) = 0;<br>> >         $var(no_auth) = 0;<br>> >         $var(from_trusted) = 0;<br>> >         $var(to_pstn) = 0;<br>> >         $var(reset_acc_callee) = 0;<br>> >         $var(no_sbc) = 0;<br>> >         $var(sendfax) = 0;<br>> >         $var(local_endpoint) = 0;<br>> >         route(ROUTE_STOP_RTPPROXY_BRANCH);<br>> >         .<br>> >         .<br>> >         .<br>> > check_status <br>> > 402|422|481|487<br>> > 404<br>> > 301|302<br>> > 486<br>> > .<br>> >         .<br>> >         .<br>> > else if(t_check_status("408") && $var(ext_timeout) != 1)<br>> > {<br>> > *t_reply("480", "User offline");*<br>> > *                unregister("location", "$ru");*<br>> >                 while($avp(s:callee_cft) != $null)<br>> >                 {<br>> >                         $var(cf_id) = $(avp(s:callee_cft)[0]);<br>> >                         xlog("L_INFO", "CFT to CF map id '$var(cf_id)'<br>> > found - [% logreq -%]\n");<br>> >                         route(ROUTE_LOAD_CF_MAP);<br>> >                         while($avp(s:cf_destinations) != $null &&<br>> > $(avp(s:cf_destinations)[0]) =~ "^sip:localuser@.+\.local$")<br>> >                         {<br>> >                                 xlog("L_INFO", "CFT breakout to local<br>> > user skipped - [% logreq -%]\n");<br>> >                                 $(avp(s:cf_timeouts)[0]) = $null;<br>> >                                 $(avp(s:cf_destinations)[0]) = $null;<br>> >                         }<br>> >                         if($avp(s:cf_destinations) == $null)<br>> >                         {<br>> >                                 xlog("L_INFO", "CFT skipped due to<br>> > forward destinations definitions - [% logreq -%]\n");<br>> >                         }<br>> >                         else<br>> >                         {<br>> >                                 route(ROUTE_CHECK_CF_PERIOD);<br>> >                                 if($rc == 1)<br>> >                                 {<br>> >                                         xlog("L_INFO", "CFT to<br>> > destination '$(avp(s:cf_destinations)[0])' with timeout<br>> > '$(avp(s:cf_timeouts)[0])' activated - [% logreq -%]\n");<br>> >                                         $ru = $(avp(s:cf_destinations)[0]);<br>> >                                         $(avp(s:cf_destinations)[0]) =<br>> > $null;<br>> >                                         $(avp(s:callee_fr_inv_timer)[*])<br>> > = $(avp(s:cf_timeouts)[0]) * 1000;<br>> >                                        <br>> > t_set_fr("$avp(s:callee_fr_inv_timer)");<br>> >                                         $(avp(s:cf_timeouts)[0]) = $null;<br>> >                                         $(avp(s:cf_depth)[*]) =<br>> > $(avp(s:cf_depth){s.int}) + 1;<br>> >                                         $(avp(s:acc_state)[*]) = "cft";<br>> >                                         $(avp(s:acc_caller_user)[*]) =<br>> > $avp(s:acc_callee_user);<br>> >                                         $(avp(s:acc_caller_domain)[*]) =<br>> > $avp(s:acc_callee_domain);<br>> >                                         append_branch();<br>> >                                         route(ROUTE_EXECUTE_CF_LOOP);<br>> >                                         exit;<br>> >                                 }<br>> >                                 else<br>> >                                 {<br>> >                                         xlog("L_INFO", "CFT skipped due<br>> > to time period definitions - [% logreq -%]\n");<br>> >                                 }<br>> >                         }<br>> >                         $(avp(s:callee_cft)[0]) = $null;<br>> >                 }<br>> >                 $var(announce_handle) = "callee_tmp_unavailable";<br>> >                 $var(announce_set) = $avp(s:callee_sound_set);<br>> >                 $(avp(s:announce_code)[*]) = 408;<br>> >                 $(avp(s:announce_reason)[*]) = "Request Timeout";<br>> >                 route(ROUTE_EARLY_REJECT);<br>> >         }<br>> > while($avp(s:callee_cfna) != $null)<br>> >         {<br>> >                 $var(cf_id) = $(avp(s:callee_cfna)[0]);<br>> >                 xlog("L_INFO", "CFNA to CF map id '$var(cf_id)' found -<br>> > [% logreq -%]\n");<br>> >                 route(ROUTE_LOAD_CF_MAP);<br>> >                 while($avp(s:cf_destinations) != $null &&<br>> > $(avp(s:cf_destinations)[0]) =~ "^sip:localuser@.+\.local$")<br>> >                 {<br>> >                         xlog("L_INFO", "CFNA breakout to local user<br>> > skipped - [% logreq -%]\n");<br>> >                         $(avp(s:cf_timeouts)[0]) = $null;<br>> >                         $(avp(s:cf_destinations)[0]) = $null;<br>> >                 }<br>> >                 if($avp(s:cf_destinations) == $null)<br>> >                 {<br>> >                         xlog("L_INFO", "CFNA skipped due to forward<br>> > destinations definitions - [% logreq -%]\n");<br>> >                 }<br>> >                 else<br>> >                 {<br>> >                         route(ROUTE_CHECK_CF_PERIOD);<br>> >                         if($rc == 1)<br>> >                         {<br>> >                                 xlog("L_INFO", "CFNA to destination<br>> > '$(avp(s:cf_destinations)[0])' with timeout '$(avp(s:cf_timeouts)[0])'<br>> > activated - [% logreq -%]\n");<br>> >                                 $ru = $(avp(s:cf_destinations)[0]);<br>> >                                 $(avp(s:cf_destinations)[0]) = $null;<br>> >                                 $(avp(s:callee_fr_inv_timer)[*]) =<br>> > $(avp(s:cf_timeouts)[0]) * 1000;<br>> >                                 t_set_fr("$avp(s:callee_fr_inv_timer)");<br>> >                                 $(avp(s:cf_timeouts)[0]) = $null;<br>> >                                 $(avp(s:cf_depth)[*]) =<br>> > $(avp(s:cf_depth){s.int}) + 1;<br>> >                                 $(avp(s:acc_state)[*]) = "cfna";<br>> >                                 $(avp(s:acc_caller_user)[*]) =<br>> > $avp(s:acc_callee_user);<br>> >                                 $(avp(s:acc_caller_domain)[*]) =<br>> > $avp(s:acc_callee_domain);<br>> >                                 append_branch();<br>> >                                 route(ROUTE_EXECUTE_CF_LOOP);<br>> >                                 exit;<br>> >                         }<br>> >                         else<br>> >                         {<br>> >                                 xlog("L_INFO", "CFNA skipped due to time<br>> > period definitions - [% logreq -%]\n");<br>> >                         }<br>> >                 }<br>> >                 $(avp(s:callee_cfna)[0]) = $null;<br>> >         }<br>> > <br>> >         $var(announce_handle) = "callee_tmp_unavailable";<br>> >         $var(announce_set) = $avp(s:callee_sound_set);<br>> >         $(avp(s:announce_code)[*]) = $T_rpl($rs);<br>> >         $(avp(s:announce_reason)[*]) = $T_rpl($rr);<br>> >         route(ROUTE_EARLY_REJECT);<br>> > }<br>> > <br>> > <br>> > <br>> >> Date: Wed, 24 Jul 2013 10:43:21 +0200<br>> >> From: dgrotti@sipwise.com<br>> >> To: spce-user@lists.sipwise.com<br>> >> Subject: Re: [Spce-user] How to force unregister a user<br>> >><br>> >> Hi Andreas,<br>> >><br>> >> it depends when you want to perform the de-registration.<br>> >> The URI must be the SIP URI address of the user which to remove the<br>> >> contact addresses for.<br>> >><br>> >> Can you share your code?<br>> >><br>> >> Daniel<br>> >><br>> >><br>> >><br>> >> On 07/19/2013 04:57 PM, andreas tseiko wrote:<br>> >> > Dear Daniel,<br>> >> ><br>> >> > I have used the following combinations but with no success:<br>> >> > unregister("location", "$ru");<br>> >> > unregister("location", "sip:$ru@example.com");<br>> >> > unregister("location", "$avp(s:callee_user)");<br>> >> > unregister("location", "sip:$avp(s:callee_user)@example.com");<br>> >> ><br>> >> > Could you please help regarding what is the correct variable that I<br>> >> > should use for "URI" field?<br>> >> ><br>> >> > Best regards.<br>> >> ><br>> >> >> Date: Fri, 19 Jul 2013 16:46:35 +0200<br>> >> >> From: dgrotti@sipwise.com<br>> >> >> To: spce-user@lists.sipwise.com<br>> >> >> Subject: Re: [Spce-user] How to force unregister a user<br>> >> >><br>> >> >> Hi,<br>> >> >><br>> >> >> you can use "unregister(domain, uri)" function:<br>> >> >><br>> >> >><br>> >> ><br>> > http://www.kamailio.org/docs/modules/3.3.x/modules_k/registrar.html#idp6222944<br>> >> >><br>> >> >> br,<br>> >> >> Daniel<br>> >> >><br>> >> >><br>> >> >> On 07/19/2013 04:41 PM, andreas tseiko wrote:<br>> >> >> > Hi Daniel,<br>> >> >> ><br>> >> >> > Yes , I want to unregister the user via kamailio.cfg during a call<br>> >> > parsing.<br>> >> >> ><br>> >> >> > Best regards.<br>> >> >> ><br>> >> >> >> Date: Fri, 19 Jul 2013 16:35:29 +0200<br>> >> >> >> From: dgrotti@sipwise.com<br>> >> >> >> To: spce-user@lists.sipwise.com<br>> >> >> >> Subject: Re: [Spce-user] How to force unregister a user<br>> >> >> >><br>> >> >> >> Hi Andreas,<br>> >> >> >><br>> >> >> >> do you want to unregister the user from kamailio.cfg during a call<br>> >> >> >> parsing or what ?<br>> >> >> >><br>> >> >> >><br>> >> >> >> br,<br>> >> >> >> Daniel<br>> >> >> >><br>> >> >> >><br>> >> >> >><br>> >> >> >> On 07/19/2013 04:10 PM, andreas tseiko wrote:<br>> >> >> >> > Dear John,<br>> >> >> >> ><br>> >> >> >> > Let me rephrase my question,<br>> >> >> >> ><br>> >> >> >> > I would like automaticaly a registered user to be unregistered<br>> >> > when for<br>> >> >> >> > example his network connection has been lost and another user is<br>> >> > calling<br>> >> >> >> > him.<br>> >> >> >> ><br>> >> >> >> > Best regards.<br>> >> >> >> ><br>> >> >> >> > Date: Fri, 19 Jul 2013 15:59:49 +0200<br>> >> >> >> > From: jbonilla@sipwise.com<br>> >> >> >> > To: spce-user@lists.sipwise.com<br>> >> >> >> > Subject: Re: [Spce-user] How to force unregister a user<br>> >> >> >> ><br>> >> >> >> > El Fri, 19 Jul 2013 16:50:28 +0300<br>> >> >> >> > andreas tseiko <a.tseiko@hotmail.com> escribió:<br>> >> >> >> ><br>> >> >> >> >> Dear All,<br>> >> >> >> >> Is it possible to unregister a user if a specified criteria is<br>> >> >> > matched before<br>> >> >> >> >> his registration expires?If yes, what is the function that I<br>> > should<br>> >> >> > call?<br>> >> >> >> >> Best regards.<br>> >> >> >> ><br>> >> >> >> ><br>> >> >> >> > You can use "delete_subscriber_registered_device" function to<br>> > delete<br>> >> >> > any device<br>> >> >> >> > registration.<br>> >> >> >> ><br>> >> >> >> ><br>> >> >> >> ><br>> >> >> >> > _______________________________________________ Spce-user mailing<br>> >> > list<br>> >> >> >> > Spce-user@lists.sipwise.com<br>> >> > http://lists.sipwise.com/listinfo/spce-user<br>> >> >> >> ><br>> >> >> >> ><br>> >> >> >> > _______________________________________________<br>> >> >> >> > Spce-user mailing list<br>> >> >> >> > Spce-user@lists.sipwise.com<br>> >> >> >> > http://lists.sipwise.com/listinfo/spce-user<br>> >> >> >> ><br>> >> >> >><br>> >> >> >> _______________________________________________<br>> >> >> >> Spce-user mailing list<br>> >> >> >> Spce-user@lists.sipwise.com<br>> >> >> >> http://lists.sipwise.com/listinfo/spce-user<br>> >> >> ><br>> >> >> ><br>> >> >> > _______________________________________________<br>> >> >> > Spce-user mailing list<br>> >> >> > Spce-user@lists.sipwise.com<br>> >> >> > http://lists.sipwise.com/listinfo/spce-user<br>> >> >> ><br>> >> >><br>> >> >> _______________________________________________<br>> >> >> Spce-user mailing list<br>> >> >> Spce-user@lists.sipwise.com<br>> >> >> http://lists.sipwise.com/listinfo/spce-user<br>> >><br>> >> _______________________________________________<br>> >> Spce-user mailing list<br>> >> Spce-user@lists.sipwise.com<br>> >> http://lists.sipwise.com/listinfo/spce-user<br>> > <br>> > <br>> > _______________________________________________<br>> > Spce-user mailing list<br>> > Spce-user@lists.sipwise.com<br>> > http://lists.sipwise.com/listinfo/spce-user<br>> > <br>> <br>> _______________________________________________<br>> Spce-user mailing list<br>> Spce-user@lists.sipwise.com<br>> http://lists.sipwise.com/listinfo/spce-user<br></div></div>                                      </div></body>
</html>