[Spce-user] How to force unregister a user

andreas tseiko a.tseiko at hotmail.com
Wed Jul 24 06:08:16 EDT 2013


Dear Daniel,
Actualy, we want to force unregister user A while user B is calling him and user A has lost his network connectivity but his registration timer has not expired yet. According to that we have placed functions:
t_reply("480", "User offline");  to reply with 480 instead of 408unregister("location", "$ru");  to unregister user A
into file root at sip:/etc/ngcp-config/templates/etc/kamailio/proxy/proxy.cfg.tt2
more specific:
######################################################################### Failure route 'base-standard-failure'########################################################################failure_route[FAILURE_ROUTE_LOCAL]{        xlog("L_INFO", "Failure route for local call - [% logreq -%]\n");
        # reset previous D-Uri, otherwise the wrong destination is        # used for cfb        $du = $null;
        # initialise variables when entering failure route        $var(loose_routed) = 0;        $var(no_acc) = 0;        $var(no_auth) = 0;        $var(forward) = 0;        $var(redirected_forward) = 0;        $var(external_domain) = 0;        $var(ext_timeout) = 0;        $var(no_auth) = 0;        $var(from_trusted) = 0;        $var(to_pstn) = 0;        $var(reset_acc_callee) = 0;        $var(no_sbc) = 0;        $var(sendfax) = 0;        $var(local_endpoint) = 0;        route(ROUTE_STOP_RTPPROXY_BRANCH);        .        .        .		check_status 		402|422|481|487		404		301|302		486	.        .        .			else if(t_check_status("408") && $var(ext_timeout) != 1)		{		t_reply("480", "User offline");                unregister("location", "$ru");                while($avp(s:callee_cft) != $null)                {                        $var(cf_id) = $(avp(s:callee_cft)[0]);                        xlog("L_INFO", "CFT to CF map id '$var(cf_id)' found - [% logreq -%]\n");                        route(ROUTE_LOAD_CF_MAP);                        while($avp(s:cf_destinations) != $null && $(avp(s:cf_destinations)[0]) =~ "^sip:localuser at .+\.local$")                        {                                xlog("L_INFO", "CFT breakout to local user skipped - [% logreq -%]\n");                                $(avp(s:cf_timeouts)[0]) = $null;                                $(avp(s:cf_destinations)[0]) = $null;                        }                        if($avp(s:cf_destinations) == $null)                        {                                xlog("L_INFO", "CFT skipped due to forward destinations definitions - [% logreq -%]\n");                        }                        else                        {                                route(ROUTE_CHECK_CF_PERIOD);                                if($rc == 1)                                {                                        xlog("L_INFO", "CFT to destination '$(avp(s:cf_destinations)[0])' with timeout '$(avp(s:cf_timeouts)[0])' activated - [% logreq -%]\n");                                        $ru = $(avp(s:cf_destinations)[0]);                                        $(avp(s:cf_destinations)[0]) = $null;                                        $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000;                                        t_set_fr("$avp(s:callee_fr_inv_timer)");                                        $(avp(s:cf_timeouts)[0]) = $null;                                        $(avp(s:cf_depth)[*]) = $(avp(s:cf_depth){s.int}) + 1;                                        $(avp(s:acc_state)[*]) = "cft";                                        $(avp(s:acc_caller_user)[*]) = $avp(s:acc_callee_user);                                        $(avp(s:acc_caller_domain)[*]) = $avp(s:acc_callee_domain);                                        append_branch();                                        route(ROUTE_EXECUTE_CF_LOOP);                                        exit;                                }                                else                                {                                        xlog("L_INFO", "CFT skipped due to time period definitions - [% logreq -%]\n");                                }                        }                        $(avp(s:callee_cft)[0]) = $null;                }                $var(announce_handle) = "callee_tmp_unavailable";                $var(announce_set) = $avp(s:callee_sound_set);                $(avp(s:announce_code)[*]) = 408;                $(avp(s:announce_reason)[*]) = "Request Timeout";                route(ROUTE_EARLY_REJECT);        }		while($avp(s:callee_cfna) != $null)        {                $var(cf_id) = $(avp(s:callee_cfna)[0]);                xlog("L_INFO", "CFNA to CF map id '$var(cf_id)' found - [% logreq -%]\n");                route(ROUTE_LOAD_CF_MAP);                while($avp(s:cf_destinations) != $null && $(avp(s:cf_destinations)[0]) =~ "^sip:localuser at .+\.local$")                {                        xlog("L_INFO", "CFNA breakout to local user skipped - [% logreq -%]\n");                        $(avp(s:cf_timeouts)[0]) = $null;                        $(avp(s:cf_destinations)[0]) = $null;                }                if($avp(s:cf_destinations) == $null)                {                        xlog("L_INFO", "CFNA skipped due to forward destinations definitions - [% logreq -%]\n");                }                else                {                        route(ROUTE_CHECK_CF_PERIOD);                        if($rc == 1)                        {                                xlog("L_INFO", "CFNA to destination '$(avp(s:cf_destinations)[0])' with timeout '$(avp(s:cf_timeouts)[0])' activated - [% logreq -%]\n");                                $ru = $(avp(s:cf_destinations)[0]);                                $(avp(s:cf_destinations)[0]) = $null;                                $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000;                                t_set_fr("$avp(s:callee_fr_inv_timer)");                                $(avp(s:cf_timeouts)[0]) = $null;                                $(avp(s:cf_depth)[*]) = $(avp(s:cf_depth){s.int}) + 1;                                $(avp(s:acc_state)[*]) = "cfna";                                $(avp(s:acc_caller_user)[*]) = $avp(s:acc_callee_user);                                $(avp(s:acc_caller_domain)[*]) = $avp(s:acc_callee_domain);                                append_branch();                                route(ROUTE_EXECUTE_CF_LOOP);                                exit;                        }                        else                        {                                xlog("L_INFO", "CFNA skipped due to time period definitions - [% logreq -%]\n");                        }                }                $(avp(s:callee_cfna)[0]) = $null;        }
        $var(announce_handle) = "callee_tmp_unavailable";        $var(announce_set) = $avp(s:callee_sound_set);        $(avp(s:announce_code)[*]) = $T_rpl($rs);        $(avp(s:announce_reason)[*]) = $T_rpl($rr);        route(ROUTE_EARLY_REJECT);}


> Date: Wed, 24 Jul 2013 10:43:21 +0200
> From: dgrotti at sipwise.com
> To: spce-user at lists.sipwise.com
> Subject: Re: [Spce-user] How to force unregister a user
> 
> Hi Andreas,
> 
> it depends when you want to perform the de-registration.
> The URI must be the SIP URI address of the user which to remove the
> contact addresses for.
> 
> Can you share your code?
> 
> Daniel
> 
> 
> 
> On 07/19/2013 04:57 PM, andreas tseiko wrote:
> > Dear Daniel,
> > 
> > I have used the following combinations but with no success:
> > unregister("location", "$ru");
> > unregister("location", "sip:$ru at example.com");
> > unregister("location", "$avp(s:callee_user)");
> > unregister("location", "sip:$avp(s:callee_user)@example.com");
> > 
> > Could you please help regarding what is the correct variable that I
> > should use for "URI" field?
> > 
> > Best regards.
> > 
> >> Date: Fri, 19 Jul 2013 16:46:35 +0200
> >> From: dgrotti at sipwise.com
> >> To: spce-user at lists.sipwise.com
> >> Subject: Re: [Spce-user] How to force unregister a user
> >>
> >> Hi,
> >>
> >> you can use "unregister(domain, uri)" function:
> >>
> >>
> > http://www.kamailio.org/docs/modules/3.3.x/modules_k/registrar.html#idp6222944
> >>
> >> br,
> >> Daniel
> >>
> >>
> >> On 07/19/2013 04:41 PM, andreas tseiko wrote:
> >> > Hi Daniel,
> >> >
> >> > Yes , I want to unregister the user via kamailio.cfg during a call
> > parsing.
> >> >
> >> > Best regards.
> >> >
> >> >> Date: Fri, 19 Jul 2013 16:35:29 +0200
> >> >> From: dgrotti at sipwise.com
> >> >> To: spce-user at lists.sipwise.com
> >> >> Subject: Re: [Spce-user] How to force unregister a user
> >> >>
> >> >> Hi Andreas,
> >> >>
> >> >> do you want to unregister the user from kamailio.cfg during a call
> >> >> parsing or what ?
> >> >>
> >> >>
> >> >> br,
> >> >> Daniel
> >> >>
> >> >>
> >> >>
> >> >> On 07/19/2013 04:10 PM, andreas tseiko wrote:
> >> >> > Dear John,
> >> >> >
> >> >> > Let me rephrase my question,
> >> >> >
> >> >> > I would like automaticaly a registered user to be unregistered
> > when for
> >> >> > example his network connection has been lost and another user is
> > calling
> >> >> > him.
> >> >> >
> >> >> > Best regards.
> >> >> >
> >> >> > Date: Fri, 19 Jul 2013 15:59:49 +0200
> >> >> > From: jbonilla at sipwise.com
> >> >> > To: spce-user at lists.sipwise.com
> >> >> > Subject: Re: [Spce-user] How to force unregister a user
> >> >> >
> >> >> > El Fri, 19 Jul 2013 16:50:28 +0300
> >> >> > andreas tseiko <a.tseiko at hotmail.com> escribió:
> >> >> >
> >> >> >> Dear All,
> >> >> >> Is it possible to unregister a user if a specified criteria is
> >> > matched before
> >> >> >> his registration expires?If yes, what is the function that I should
> >> > call?
> >> >> >> Best regards.
> >> >> >
> >> >> >
> >> >> > You can use "delete_subscriber_registered_device" function to delete
> >> > any device
> >> >> > registration.
> >> >> >
> >> >> >
> >> >> >
> >> >> > _______________________________________________ Spce-user mailing
> > list
> >> >> > Spce-user at lists.sipwise.com
> > http://lists.sipwise.com/listinfo/spce-user
> >> >> >
> >> >> >
> >> >> > _______________________________________________
> >> >> > Spce-user mailing list
> >> >> > Spce-user at lists.sipwise.com
> >> >> > http://lists.sipwise.com/listinfo/spce-user
> >> >> >
> >> >>
> >> >> _______________________________________________
> >> >> Spce-user mailing list
> >> >> Spce-user at lists.sipwise.com
> >> >> http://lists.sipwise.com/listinfo/spce-user
> >> >
> >> >
> >> > _______________________________________________
> >> > Spce-user mailing list
> >> > Spce-user at lists.sipwise.com
> >> > http://lists.sipwise.com/listinfo/spce-user
> >> >
> >>
> >> _______________________________________________
> >> Spce-user mailing list
> >> Spce-user at lists.sipwise.com
> >> http://lists.sipwise.com/listinfo/spce-user
> 
> _______________________________________________
> Spce-user mailing list
> Spce-user at lists.sipwise.com
> http://lists.sipwise.com/listinfo/spce-user
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/mailman/private/spce-user_lists.sipwise.com/attachments/20130724/3f24840b/attachment.html>


More information about the Spce-user mailing list