Record congestion/failure rates per load balanced provider

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

Record congestion/failure rates per load balanced provider

Matt Riddell
Hi all,

I'm using OpenSips to balance around 20,000 channels of traffic across a
few different VoIP providers using the load balancer module.

Everything works fine but some of the providers provide a higher
percentage of congestion than others and I'd like to be able to log this
in some way (maybe acc) so that I can either reduce the number of
channels for a provider or disable them completely.

I can take care of the logic of changing the DB and resizing the load
balancing rules but don't see how I can log the failures/failure codes
for providers after I've called load_balance().

Anybody able to assist?

--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

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

Re: Record congestion/failure rates per load balanced provider

Matt Riddell
On 21/02/12 9:33 PM, Matt Riddell wrote:
> I can take care of the logic of changing the DB and resizing the load
> balancing rules but don't see how I can log the failures/failure codes
> for providers after I've called load_balance().

I can see that I could do a failure_route if load_balance returns a
negative but as far as I'm aware that only happens when all providers fail?

True/false?

--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

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

Re: Record congestion/failure rates per load balanced provider

SamyGo
AFAIK, in simple words if you are forwarding the call to a provider and if that one provider returns negative response you can reach into any of the failure_route as per your script.

....
t_on_failure("carrier-fail");
t_relay()
...
then do logic in failure route.

OR 

if(!t_relay())
{
           xlog("L_NOTICE","I couldnt send traffic to the destination now try with other carrier\n");
           $avp(carrier_index) = $avp(carrier_index)  +1;
           route(send_to_carrier);
}



Regards,
Sammy

Thats just an example so list spare me for the syntax and rest of the exception handling.


On Wed, Feb 22, 2012 at 5:18 AM, Matt Riddell <[hidden email]> wrote:
On 21/02/12 9:33 PM, Matt Riddell wrote:
I can take care of the logic of changing the DB and resizing the load
balancing rules but don't see how I can log the failures/failure codes
for providers after I've called load_balance().

I can see that I could do a failure_route if load_balance returns a negative but as far as I'm aware that only happens when all providers fail?

True/false?


--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

_______________________________________________
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: Record congestion/failure rates per load balanced provider

Matt Riddell
On 22/02/12 6:05 PM, Sammy Govind wrote:

> AFAIK, in simple words if you are forwarding the call to a provider and
> if that one provider returns negative response you can reach into any of
> the failure_route as per your script.
>
> ....
> t_on_failure("carrier-fail");
> t_relay()
> ...
> then do logic in failure route.
>
> OR
>
> if(!t_relay())
> {
>             xlog("L_NOTICE","I couldnt send traffic to the destination
> now try with other carrier\n");
>             $avp(carrier_index) = $avp(carrier_index)  +1;
>             route(send_to_carrier);
> }

But can I do this with load_balance()?

--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

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

Re: Record congestion/failure rates per load balanced provider

SamyGo
I can take care of the logic of changing the DB and resizing the load balancing rules but don't see how I can log the failures/failure codes for 

Yes why not, give it a try. If the carrier is already down in load-balancer list then it won't even try the itsp but if its available and return congestion you can definitely lock the response. 

hmmm..give it a try first. Why don';t you try the LCR module for this ! usually load_balancer is used for distributed load to internal servers, but you are using inverse..


On Wed, Feb 22, 2012 at 10:08 AM, Matt Riddell <[hidden email]> wrote:
On 22/02/12 6:05 PM, Sammy Govind wrote:
AFAIK, in simple words if you are forwarding the call to a provider and
if that one provider returns negative response you can reach into any of
the failure_route as per your script.

....
t_on_failure("carrier-fail");
t_relay()
...
then do logic in failure route.

OR

if(!t_relay())
{
           xlog("L_NOTICE","I couldnt send traffic to the destination
now try with other carrier\n");
           $avp(carrier_index) = $avp(carrier_index)  +1;
           route(send_to_carrier);
}

But can I do this with load_balance()?


--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

_______________________________________________
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: Record congestion/failure rates per load balanced provider

Matt Riddell
On 22/02/12 6:22 PM, Sammy Govind wrote:

>     I can take care of the logic of changing the DB and resizing the
>     load balancing rules but don't see how I can log the
>     failures/failure codes for
>
>
> Yes why not, give it a try. If the carrier is already down in
> load-balancer list then it won't even try the itsp but if its available
> and return congestion you can definitely lock the response.
>
> hmmm..give it a try first. Why don';t you try the LCR module for this !
> usually load_balancer is used for distributed load to internal servers,
> but you are using inverse..
> see this: http://www.opensips.org/html/docs/modules/1.7.x/drouting.html

Problem with LCR is that we're needing to go to a max number of
simultaneous channels to a provider - requiring dialog support rather
than just dispatching.

--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

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

Re: Record congestion/failure rates per load balanced provider

SamyGo
Anyways yes you can call failure route while using the load_balancer too. just use 

t_on_failure("record-stats");
before calling the 
if(!load_balancer("1","10"))

what it should do is send the call to an active destination and if that active destination returns negative stats you can do something about those in failure route.

Also her's some piece of code I collected from searching in 10 minutes.

# SELECT AN ACTIVE DESTINATION FROM LOAD_BALANCER ---RESULTSET GOES TO $du
if (!load_balance("1","mygws","0")) {
sl_send_reply("480","Temporarily Unavailable: service full");
exit;
         }
    ......
  .......
      # SEND THE CALL TO $du 
if (!t_relay("0x09")) {
xlog("L_ERR", "Carrier termination failed with status code $rs: $rr using outbound carrier: '$du' \n");
sl_reply_error();
};

Regards,
Sammy

On Wed, Feb 22, 2012 at 10:27 AM, Matt Riddell <[hidden email]> wrote:
On 22/02/12 6:22 PM, Sammy Govind wrote:
   I can take care of the logic of changing the DB and resizing the
   load balancing rules but don't see how I can log the
   failures/failure codes for


Yes why not, give it a try. If the carrier is already down in
load-balancer list then it won't even try the itsp but if its available
and return congestion you can definitely lock the response.

hmmm..give it a try first. Why don';t you try the LCR module for this !
usually load_balancer is used for distributed load to internal servers,
but you are using inverse..
see this: http://www.opensips.org/html/docs/modules/1.7.x/drouting.html

Problem with LCR is that we're needing to go to a max number of simultaneous channels to a provider - requiring dialog support rather than just dispatching.


--
Cheers,

Matt Riddell
_______________________________________________

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/pabx_on_disk.php (PABX on a Disk)
http://www.venturevoip.com/exchange.php (Full ITSP Solution)
http://www.venturevoip.com/cc.php (Call Centre Solutions)

_______________________________________________
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