Re: [OpenSIPS-Users] OpenSips Load balancer. - Overcome limitations of Call Driven Load Balancing

2020-07-24 Thread Chandan PR
Thanks for the response Jon.
Let me have a look at it.

On Fri, Jul 24, 2020 at 7:42 PM Jon Abrams  wrote:

> Hi Chandan,
>
> There may be something else purpose built for this, but you can use
> the dialog profiles to track and limit the port usage:
>
> set_dlg_profile("outcarrier","$avp(out_carrier_id)");
>
> if ($avp(out_max_call_limit) > 0)
> {
> set_dlg_profile("profile","$avp(out_qos_profile_id)");
> if
> (get_profile_size("profile","$avp(out_qos_profile_id)","$var(out_gw_count)"))
> {
> if ($var(out_gw_count)>$avp(out_max_call_limit))
> {
> xlog("LIMIT: Call $ci - Max call limit hit by
> $avp(src_addr) on QosProfile $avp(out_qos_profile_id) to gw
> $avp(out_gw_id)\n");
> return(-1);
> }
> }
> }
>
> On Fri, Jul 24, 2020 at 8:55 AM Chandan PR  wrote:
> >
> > Hello Everyone,
> >
> > Currently, we are using Open Sips Load balancer in Call Driven load
> balancing.
> >
> > Our scenario is as below:
> >
> > D - Total Destinations configured at OpenSips
> > P - No of Ports/Sessions Each Destination can handle concurrently
> > C - Total Capacity = D*P
> >
> > We have a Call Loader which loads calls to OpenSips at C and as when the
> result comes further calls get loaded.
> > For some reason, if any destination is not in the right state and sends
> error responses without accepting calls, this introduces a drain scenario.
> > In the drain scenario where all new calls are given to the faulty
> destination as it has more availability.
> >
> > We are currently handling this by
> >
> > Running the loader at 80% of C
> > Disabling the destination in Opensips if 75% of the calls fail for the
> particular destination (Attached loadbalancer.cfg file).
> >
> >
> > But even in this case, it is possible that may call error out as the
> destination is free and calls are loaded.
> >
> > We would like to avoid this scenario to the max possible extent by
> limiting the number of calls we send to this particular destination.
> >
> > Couple of options I see are as below:
> >
> > Wait for a brief period before sending the response to loader when the
> error happens
> > Make OpenSips aware of the destination capacity and adjust ports
> accordingly
> >
> > Write a custom script to poll destination capacity and use MI functions
> to adjust accordingly
> > Or is there any possibility to integrate similar to FreeSwitch driven
> routing
> >
> > Are there any other possibilities of adjusting the OpenSips capacity
> dynamically or make it limit the calls sent to the particular destination?
> >
> > --
> >
> > Regards,
> > Chandan Ravishankar
> > ___
> > Users mailing list
> > Users@lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


-- 

Regards,
Chandan Ravishankar 
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips MS Teams lost BYE

2020-07-24 Thread Mark Miranda
I have basically the same problem where the BYE packet does not seem to be 
routing properly, however I am not using any of the nat functions.

> On Jul 6, 2020, at 3:46 AM, John Quick  wrote:
> 
> Chris,
> 
> You must not call fix_nated_contact() for any SIP requests or SIP responses
> coming from MS Teams.
> If you do, it will cause exactly the problems you describe for loose-routed
> sequential requests such as BYE.
> 
> Just to explain: fix_nated_contact() should only be used when the messages
> come via a NAT router. It must not be used for messages coming from a Proxy
> (assuming the Proxy adds a Record-Route header, as happens with Teams), even
> though both cases may appear to need fixing when you use nat_uac_test().
> 
> John Quick
> Smartvox Limited
> Web: www.smartvox.co.uk
> 
>> I've managed to get the PBX to send the BYE to the SBC and it is now
> forwarding on to MS (although MS are not sending a reply but we have opened
> a case for this).
> 
>> We are struggling to get the BYE packet to go back to MS Teams when the
> call is initiated by Teams.
> 
> 
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSips Load balancer. - Overcome limitations of Call Driven Load Balancing

2020-07-24 Thread Jon Abrams
Hi Chandan,

There may be something else purpose built for this, but you can use
the dialog profiles to track and limit the port usage:

set_dlg_profile("outcarrier","$avp(out_carrier_id)");

if ($avp(out_max_call_limit) > 0)
{
set_dlg_profile("profile","$avp(out_qos_profile_id)");
if 
(get_profile_size("profile","$avp(out_qos_profile_id)","$var(out_gw_count)"))
{
if ($var(out_gw_count)>$avp(out_max_call_limit))
{
xlog("LIMIT: Call $ci - Max call limit hit by
$avp(src_addr) on QosProfile $avp(out_qos_profile_id) to gw
$avp(out_gw_id)\n");
return(-1);
}
}
}

On Fri, Jul 24, 2020 at 8:55 AM Chandan PR  wrote:
>
> Hello Everyone,
>
> Currently, we are using Open Sips Load balancer in Call Driven load balancing.
>
> Our scenario is as below:
>
> D - Total Destinations configured at OpenSips
> P - No of Ports/Sessions Each Destination can handle concurrently
> C - Total Capacity = D*P
>
> We have a Call Loader which loads calls to OpenSips at C and as when the 
> result comes further calls get loaded.
> For some reason, if any destination is not in the right state and sends error 
> responses without accepting calls, this introduces a drain scenario.
> In the drain scenario where all new calls are given to the faulty destination 
> as it has more availability.
>
> We are currently handling this by
>
> Running the loader at 80% of C
> Disabling the destination in Opensips if 75% of the calls fail for the 
> particular destination (Attached loadbalancer.cfg file).
>
>
> But even in this case, it is possible that may call error out as the 
> destination is free and calls are loaded.
>
> We would like to avoid this scenario to the max possible extent by limiting 
> the number of calls we send to this particular destination.
>
> Couple of options I see are as below:
>
> Wait for a brief period before sending the response to loader when the error 
> happens
> Make OpenSips aware of the destination capacity and adjust ports accordingly
>
> Write a custom script to poll destination capacity and use MI functions to 
> adjust accordingly
> Or is there any possibility to integrate similar to FreeSwitch driven routing
>
> Are there any other possibilities of adjusting the OpenSips capacity 
> dynamically or make it limit the calls sent to the particular destination?
>
> --
>
> Regards,
> Chandan Ravishankar
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] opensips-cp for 3.1

2020-07-24 Thread johan


   Hi,


is it okay to use opensips-cp 3.0 for opensips 3.1 ?


wkr,


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] OpenSips Load balancer. - Overcome limitations of Call Driven Load Balancing

2020-07-24 Thread Chandan PR
Hello Everyone,

Currently, we are using Open Sips Load balancer in Call Driven load
balancing .

Our scenario is as below:

*D* - Total Destinations configured at OpenSips
*P* - No of Ports/Sessions Each Destination can handle concurrently
*C* - Total Capacity = D*P

We have a Call Loader which loads calls to OpenSips at C and as when the
result comes further calls get loaded.
For some reason, if any destination is not in the right state and sends
error responses without accepting calls, this introduces a drain scenario.
In the drain scenario where all new calls are given to the faulty
destination as it has more availability.

We are currently handling this by

   1. Running the loader at 80% of C
   2. Disabling the destination in Opensips if 75% of the calls fail for
   the particular destination (Attached loadbalancer.cfg file).


But even in this case, it is possible that may call error out as the
destination is free and calls are loaded.

We would like to avoid this scenario to the max possible extent by limiting
the number of calls we send to this particular destination.

Couple of options I see are as below:

   1. Wait for a brief period before sending the response to loader when
   the error happens
   2. Make OpenSips aware of the destination capacity and adjust ports
   accordingly
  - Write a custom script to poll destination capacity and use MI
  functions to adjust accordingly
  - Or is there any possibility to integrate similar to FreeSwitch
  driven routing
  


Are there any other possibilities of adjusting the OpenSips capacity
dynamically or make it limit the calls sent to the particular destination?

-- 

Regards,
Chandan Ravishankar 


loadbalancer.cfg
Description: Binary data
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to delay a branch

2020-07-24 Thread Liviu Chircu

On 24.07.2020 16:25, Ben Newlin wrote:


I think the issue here is that the sleep function pauses the OpenSIPS 
process in which it is running; it doesn’t matter what type of route 
you call it in, the whole process will sleep. Since all message 
processing, and all branch routes, are running in the same process 
then sleeping that process will delay everything.


Even asynchronous sleep is performed by suspending all message 
processing for that message, not individual branches.


Spot on, Ben!  All branches are forked out by the same process: if you 
pause it, you pause the forking of the remaining branches in the set... 
which somehow leads me to believe that doing an async(sleep) after 
t_relay()'ing the last mobile phone branch _should work_, at least in 
theory... such that after the sleep is completed, the remaining branches 
in the set will be forked out.


Now, the tricky part is making sure that the mobile phone branches are 
always ahead of the desk phone ones, so they parallel fork first.  I do 
not see an easy solution to this, nor are there any handy script 
functions to help you do this... you will have to "swap" the branch data 
around using the $branch properties and other variables (e.g. $ru, $du, 
$socket_out) until you obtain the desired effect.


Curious to hear other opinions as well :)

Best regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2020 Distributed
  www.opensips.org/events/Summit-2020Distributed

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to delay a branch

2020-07-24 Thread Ben Newlin
I think the issue here is that the sleep function pauses the OpenSIPS process 
in which it is running; it doesn’t matter what type of route you call it in, 
the whole process will sleep. Since all message processing, and all branch 
routes, are running in the same process then sleeping that process will delay 
everything.

Even asynchronous sleep is performed by suspending all message processing for 
that message, not individual branches.

Ben Newlin

From: Users  on behalf of ryan embgrets 

Reply-To: OpenSIPS users mailling list 
Date: Friday, July 24, 2020 at 8:16 AM
To: OpenSIPS users mailling list 
Subject: Re: [OpenSIPS-Users] How to delay a branch

Hi,

Thanks for coming back to me on this query. I did not want to do serial 
forking.  Let me try to explain my query in better detail.

So, i have desktop phones and mobile phones registered to same AOR, what i 
wanted to do was,

If we have mobile phone devices registered we send invites to them instantly 
but desktop devices need to be rung after some delay from phone devices.
But if no phone device was registered, we simply do parallel forking to desktop 
devices.

Ryan.

On Fri, 24 Jul 2020 at 15:14, Liviu Chircu 
mailto:li...@opensips.org>> wrote:
On 13.07.2020 16:02, ryan embgrets wrote:
>
> So, I set a branch flag on those registrations before calling the save
> function, and then try to use async sleep in the branch route after
> lookup.
>
> But I see sleep applies on the whole call(all branches are sent with
> delay) no matter if it was called on a single branch.

Hey, Ryan!

Did you solve your problem in the meantime?  I think you are confusing
parallel forking with serial forking.  Implicitly, the OpenSIPS request
branching engine performs **parallel** forking.  In other words, no
matter how you prepare your branches (be it using append_branch(),
lookup(), mid_registrar_lookup(), etc.), they will all be sent out
concurrently, hence the effect you are noticing ("the sleep applies on
the whole call").

To change the behavior to a **serial** forking one, try calling
serialize_branches() [1] after building your branch set.  IIRC, there's
a caveat in there, which also requires you to call next_branches()
afterwards.  Just read the docs carefully and you should be fine.

Best regards,

[1]: 
https://opensips.org/Documentation/Script-CoreFunctions-3-2#toc44

--
Liviu Chircu
www.twitter.com/liviuchircu | 
www.opensips-solutions.com
OpenSIPS Summit 2020 Distributed
   www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to delay a branch

2020-07-24 Thread ryan embgrets
Hi,

Thanks for coming back to me on this query. I did not want to do serial
forking.  Let me try to explain my query in better detail.

So, i have desktop phones and mobile phones registered to same AOR, what i
wanted to do was,

If we have mobile phone devices registered we send invites to them
instantly but desktop devices need to be rung after some delay from phone
devices.
But if no phone device was registered, we simply do parallel forking to
desktop devices.

Ryan.

On Fri, 24 Jul 2020 at 15:14, Liviu Chircu  wrote:

> On 13.07.2020 16:02, ryan embgrets wrote:
> >
> > So, I set a branch flag on those registrations before calling the save
> > function, and then try to use async sleep in the branch route after
> > lookup.
> >
> > But I see sleep applies on the whole call(all branches are sent with
> > delay) no matter if it was called on a single branch.
>
> Hey, Ryan!
>
> Did you solve your problem in the meantime?  I think you are confusing
> parallel forking with serial forking.  Implicitly, the OpenSIPS request
> branching engine performs **parallel** forking.  In other words, no
> matter how you prepare your branches (be it using append_branch(),
> lookup(), mid_registrar_lookup(), etc.), they will all be sent out
> concurrently, hence the effect you are noticing ("the sleep applies on
> the whole call").
>
> To change the behavior to a **serial** forking one, try calling
> serialize_branches() [1] after building your branch set.  IIRC, there's
> a caveat in there, which also requires you to call next_branches()
> afterwards.  Just read the docs carefully and you should be fine.
>
> Best regards,
>
> [1]: https://opensips.org/Documentation/Script-CoreFunctions-3-2#toc44
>
> --
> Liviu Chircu
> www.twitter.com/liviuchircu | www.opensips-solutions.com
> OpenSIPS Summit 2020 Distributed
>www.opensips.org/events
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to delay a branch

2020-07-24 Thread Liviu Chircu

On 13.07.2020 16:02, ryan embgrets wrote:


So, I set a branch flag on those registrations before calling the save 
function, and then try to use async sleep in the branch route after 
lookup.


But I see sleep applies on the whole call(all branches are sent with 
delay) no matter if it was called on a single branch.


Hey, Ryan!

Did you solve your problem in the meantime?  I think you are confusing 
parallel forking with serial forking.  Implicitly, the OpenSIPS request 
branching engine performs **parallel** forking.  In other words, no 
matter how you prepare your branches (be it using append_branch(), 
lookup(), mid_registrar_lookup(), etc.), they will all be sent out 
concurrently, hence the effect you are noticing ("the sleep applies on 
the whole call").


To change the behavior to a **serial** forking one, try calling 
serialize_branches() [1] after building your branch set.  IIRC, there's 
a caveat in there, which also requires you to call next_branches() 
afterwards.  Just read the docs carefully and you should be fine.


Best regards,

[1]: https://opensips.org/Documentation/Script-CoreFunctions-3-2#toc44

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2020 Distributed
  www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users