Failover Solution in OpenSIPS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Failover Solution in OpenSIPS

Faisal Rehman
Hi Everyone,

I have different sip trunks, I want to implement the fail over solution with dispatcher/load balancer. Means if call fails from one trunk/gateway, like if we get 503 Service Un-available from one trunk call should be routed to next trunk. Basic routing should be handled from dispatcher but if the call is failed the call should be routed to next trunk according to my dispatcher. I want to implement both timer based and response based fail over, so any suggestions for such implementation?

 
Regards,

Faisal Rehman

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Failover Solution in OpenSIPS

Vlad Paiu
Hello,

You have to catch the failure in failure_route, and based on the status code ( 408 is internally generated by OpenSIPS in case no reply, or other response codes that you want ), mark the trunk as disabled, either by lb_disable() or ds_mark_dst(), and call again the load_balance() or ds_select_dst() to let OpenSIPS choose another destination.

Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com

Pe 3/5/2012 9:54 PM, Faisal Rehman a scris:
Hi Everyone,

I have different sip trunks, I want to implement the fail over solution with dispatcher/load balancer. Means if call fails from one trunk/gateway, like if we get 503 Service Un-available from one trunk call should be routed to next trunk. Basic routing should be handled from dispatcher but if the call is failed the call should be routed to next trunk according to my dispatcher. I want to implement both timer based and response based fail over, so any suggestions for such implementation?

 
Regards,

Faisal Rehman


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Failover Solution in OpenSIPS

Pavel Eremin-3
I do it with  do_routing, like this:

route {
...
#do lookup with method filtering
...some default config

if (do_routing())  { route(1); } else { sl_send_reply("404","No route"); exit; }
#when routing via usrloc,...

failure_route {
... some default config
#at the end of block
if (t_check_status("(50.)|(40.)|(6..)") {
 if (!use_next_gw()) {
    exit;
 } else { route(1); }

}
}

is this solution has some bad code(logicaly)?

2012/3/6 Vlad Paiu <[hidden email]>:

> Hello,
>
> You have to catch the failure in failure_route, and based on the status code
> ( 408 is internally generated by OpenSIPS in case no reply, or other
> response codes that you want ), mark the trunk as disabled, either by
> lb_disable() or ds_mark_dst(), and call again the load_balance() or
> ds_select_dst() to let OpenSIPS choose another destination.
>
> Regards,
>
> Vlad Paiu
> OpenSIPS Developer
> http://www.opensips-solutions.com
>
> Pe 3/5/2012 9:54 PM, Faisal Rehman a scris:
>
> Hi Everyone,
>
> I have different sip trunks, I want to implement the fail over solution with
> dispatcher/load balancer. Means if call fails from one trunk/gateway, like
> if we get 503 Service Un-available from one trunk call should be routed to
> next trunk. Basic routing should be handled from dispatcher but if the call
> is failed the call should be routed to next trunk according to my
> dispatcher. I want to implement both timer based and response based fail
> over, so any suggestions for such implementation?
>
>
> Regards,
>
> Faisal Rehman
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Failover Solution in OpenSIPS

Bogdan-Andrei Iancu-2
Hi Pavel,

when do_routing() is successful and before you send the call out via
route(1), be sure you arm the failure route by doing t_on_failure("");

Regards,
Bogdan

On 03/06/2012 04:38 AM, [hidden email] wrote:

> I do it with  do_routing, like this:
>
> route {
> ...
> #do lookup with method filtering
> ...some default config
>
> if (do_routing())  { route(1); } else { sl_send_reply("404","No route"); exit; }
> #when routing via usrloc,...
>
> failure_route {
> ... some default config
> #at the end of block
> if (t_check_status("(50.)|(40.)|(6..)") {
>   if (!use_next_gw()) {
>      exit;
>   } else { route(1); }
>
> }
> }
>
> is this solution has some bad code(logicaly)?
>
> 2012/3/6 Vlad Paiu<[hidden email]>:
>> Hello,
>>
>> You have to catch the failure in failure_route, and based on the status code
>> ( 408 is internally generated by OpenSIPS in case no reply, or other
>> response codes that you want ), mark the trunk as disabled, either by
>> lb_disable() or ds_mark_dst(), and call again the load_balance() or
>> ds_select_dst() to let OpenSIPS choose another destination.
>>
>> Regards,
>>
>> Vlad Paiu
>> OpenSIPS Developer
>> http://www.opensips-solutions.com
>>
>> Pe 3/5/2012 9:54 PM, Faisal Rehman a scris:
>>
>> Hi Everyone,
>>
>> I have different sip trunks, I want to implement the fail over solution with
>> dispatcher/load balancer. Means if call fails from one trunk/gateway, like
>> if we get 503 Service Un-available from one trunk call should be routed to
>> next trunk. Basic routing should be handled from dispatcher but if the call
>> is failed the call should be routed to next trunk according to my
>> dispatcher. I want to implement both timer based and response based fail
>> over, so any suggestions for such implementation?
>>
>>
>> Regards,
>>
>> Faisal Rehman
>>
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


--
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users