[OpenSIPS-Users] how to cancel an INVITE before the callee receive it?

Liviu Chircu liviu at opensips.org
Tue Mar 3 13:57:32 CET 2015


Hello merlin,

First of all, from a user's perspective, a Post-Dial Delay of up to 30 
seconds should be quite annoying. Your SIP logic will also increase the 
amount of traffic received by your platform, due to lots of 
retransmissions for all failed calls.

That being said, here is what you should add in order to make it work:

t_newtran();
...
while (...) {
     if (t_was_cancelled()) {
         t_reply("487", "Request Cancelled");
         exit;
     }
     ...
}

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 03.03.2015 10:45, merlin.li at tsingch.com wrote:
> Hi,
>
> Or is there a way i can break the while loop in the route block when i 
> receive the CANCEL request?
>
> ------------------------------------------------------------------------
> merlin.li at tsingch.com
>
>     *From:* merlin.li at tsingch.com <mailto:merlin.li at tsingch.com>
>     *Date:* 2015-03-03 16:14
>     *To:* users <mailto:users at lists.opensips.org>
>     *Subject:* how to cancel an INVITE before the callee receive it?
>     Hi all,
>
>     Let me describe my scenario first.
>
>     if the callee is not online, opensips will wait for 30s.
>     During the 30s, if the callee be online, opensips will send the
>     invite to it.
>
>        $avp(timeout) = 30 ;
>                             while( !lookup("location","m") ){
>                                    if( $avp(timeout)==0 ){
>                                    send_reply("420","Can not find the callee!");
>                                     exit;
>                                 }
>                                 sleep("1");
>                                 $avp(timeout) = $avp(timeout)-1;
>                             }
>
>     This works well, the only problem is the caller can not cancel it
>     during that 30s
>     t_cancel_branch() only can be used in onreply_route, but at that
>     time, callee is offline.
>
>     My question is :
>     Is it possible that terminate a request in route block?
>
>
>     ------------------------------------------------------------------------
>     merlin.li at tsingch.com
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150303/a9747213/attachment.htm>


More information about the Users mailing list