[OpenSIPS-Users] Can load balancer show total number of call for a gateway

Muhammad Shahzad shaheryarkh at googlemail.com
Sat Sep 8 14:14:08 CEST 2012


Well, i would recommend as an easy alternative is to use permissions
module. You have two types of calls pass through opensips, so you create
two address permissions group, one for inbound (opensips to gw) and one for
outbound (gw to opensips). The outbound group should match your gw ips,
while inbound should match all except your gw ips. So when a call comes
into opensips, you can match its source address "$si" against permissions
table, which will tell you whether its type is inbound or outbound and then
you can increment appropriate script variable for your reporting purpose
etc.

If you want to get deeper to known call counts at gateway level, e.g. how
many calls each gateway has, then you can subgroup inbound group in
permissions module such that $si would match exactly one gateway and you
can update that gateway count for your reporting purpose.

For outbound group, after calling load_balance function you will have $dd
variable ($dp for port) which specifies the destination gateway where the
call will go, you can use it to update that gateway's call count and so on.

Hope this helps.

Thank you.


On Sat, Sep 8, 2012 at 6:52 AM, SamyGo <govoiper at gmail.com> wrote:

> Hi Ali,
>
> Well first of I felt a bit reluctant to reply after reading your reply to
> Binan...didn't want to hear something like that for anyone on the list
> which I am part of. Neither I wish us to continue this thing further in
> this thread.
>
> Ok coming back to the concern, I only know that dispatcher module has
> something like grp_avp modparam, which after selecting a destination
> gateway sets its group-id in that avp.
>
> If DB query is not required then possible options limit to using the
> memcache/redis for storing contents of Load-balancer table and doing a
> redis based query. Other option is use FIFO/MI_XMLRPC stuff from a perl
> script and have it return to you the group-id of the input gateway address.
> Then call the perl script in your config. That won't be as much of a
> overhead compared to DB query.
>
> BR
> Sammy
>
>
> On Fri, Sep 7, 2012 at 10:14 PM, Ali Pey <alipey at gmail.com> wrote:
>
>> Hi Sammy,
>>
>> Thank you for your response and it is a very good suggestion. I'm sorry
>> if you felt I was criticizing it.
>>
>> I know there is a way to increase the number of active call for the load
>> balancer module:
>>
>> set_dlg_profile("lbXchannel","server_id)");
>>
>> I just don't know how I can get the server_id which is the load_balancer
>> table index without doing a DB query.
>>
>> Thanks again,
>> Ali
>>
>>
>> On Fri, Sep 7, 2012 at 12:56 PM, SamyGo <govoiper at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Didn't understand you clearly.
>>>
>>> When you define a size i.e calls=100 per gateway and you send a call
>>> from opensips to that gateway its load becomes 1, and capacity obviously
>>> becomes calls=99. Now, When you gateway sends call back and you increment
>>> its call count variable $avp(IC_GW1) to 1 AND immediately resize the
>>> capacity like calls = calls - 1; The capacity of your gateway become
>>> calls=98.
>>>
>>> On hangup of that Incoming call from gateway you resize the capacity
>>> back.
>>>
>>> Using Dialog module profiling you can do it easily.
>>>
>>> And as per my understanding of your question this is what you wanted. I
>>> am not sure if there is any clean way of doing this w/o going into the
>>> load_balancer module code and editing it as per your requirement which will
>>> be something like : Link the load_balancer module with the dialog module.
>>> Create a modparam like "gw_incoming_call_monitor"= 1 | 0. if its set to 1,
>>> internally tell dialog module to count the active incoming calls of each
>>> load-balancer gateway and adjust the gateway's "load". I don't think this
>>> is much of a big task.
>>>
>>> Do spare me sir if you didn't like it.
>>>
>>> Thanks,
>>> Sammy
>>>
>>>
>>> On Fri, Sep 7, 2012 at 9:37 PM, Ali Pey <alipey at gmail.com> wrote:
>>>
>>>> Hi Sammy,
>>>>
>>>> I rather to be able to see the through number of active calls on a
>>>> server than re-sizing the capacity of each server twice for each call. That
>>>> will create a mess.
>>>>
>>>> Regards,
>>>> Ali Pey
>>>>
>>>>
>>>> On Fri, Sep 7, 2012 at 12:02 PM, SamyGo <govoiper at gmail.com> wrote:
>>>>
>>>>> Hi Ali,
>>>>>
>>>>> No , I said it dialog based profiling of each gateway's incoming calls
>>>>> to opensips. Store the call counter for each gateway in any variable, I
>>>>> named it $avp(IC_GW1).
>>>>> Next is use this:
>>>>> http://www.opensips.org/html/docs/modules/1.8.x/load_balancer.html#id250348
>>>>> Resize a particular gateway's capacity using simple maths.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Sammy
>>>>>
>>>>>
>>>>> On Fri, Sep 7, 2012 at 8:30 PM, Muhammad Shahzad <
>>>>> shaheryarkh at googlemail.com> wrote:
>>>>>
>>>>>> Can you give more info about your topology, I think everybody is
>>>>>> considering following topology,
>>>>>>
>>>>>> caller -> opensips -> gateway -> opensips -> destination
>>>>>>
>>>>>> Which means call enter opensips twice, once for leg A and once for
>>>>>> leg B. Is that what you have? If yes, then do you want to count leg A and
>>>>>> leg B for each call?
>>>>>>
>>>>>> Thank you.
>>>>>>
>>>>>>
>>>>>> On Fri, Sep 7, 2012 at 5:20 PM, Ali Pey <alipey at gmail.com> wrote:
>>>>>>
>>>>>>> Hi Binan,
>>>>>>>
>>>>>>> Sometimes I wish you would read the question before trying to
>>>>>>> answer. If you don't have an answer, you don't need to come up with one. No
>>>>>>> body is forcing you.
>>>>>>>
>>>>>>> 1- First of all, how is this related to load balancer modules? As
>>>>>>> you can see the title of email is talking about the load balancer module.
>>>>>>> 2- All my GW IP addresses are in the database, I don't want to list
>>>>>>> them in my config file and evey time these is s change I would have to
>>>>>>> change the config file and restart the service.
>>>>>>> 3- I need a solution that would integrate with load balacer module
>>>>>>> and/or the dialog module so I can use the MI commands and it would be
>>>>>>> automatic. What you are saying here doesn't have a real world practice.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Ali
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Sep 7, 2012 at 5:09 AM, Binan AL Halabi <
>>>>>>> binanalhalabi at yahoo.com> wrote:
>>>>>>>
>>>>>>>> Hi,*
>>>>>>>>
>>>>>>>> $si* - reference to IP source address of the message
>>>>>>>>
>>>>>>>>  if ($si==GW1-IP-ADDRESS) {
>>>>>>>>      # Incoming call
>>>>>>>>      # Increment $avp(IC_GW1)
>>>>>>>>
>>>>>>>>  }
>>>>>>>>
>>>>>>>> //Binan
>>>>>>>>
>>>>>>>> --- On *Thu, 9/6/12, SamyGo <govoiper at gmail.com>* wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> From: SamyGo <govoiper at gmail.com>
>>>>>>>> Subject: Re: [OpenSIPS-Users] Can load balancer show total number
>>>>>>>> of call for a gateway
>>>>>>>> To: "OpenSIPS users mailling list" <users at lists.opensips.org>
>>>>>>>> Date: Thursday, September 6, 2012, 10:25 PM
>>>>>>>>
>>>>>>>>
>>>>>>>> Hi Ali,
>>>>>>>>
>>>>>>>> AFAIK you can't do this from Load-balancer, but the possible
>>>>>>>> solution is use variable $avp(IC_GW1) for each gateway to count the
>>>>>>>> incoming calls from particular gateways (Dialogue module based profiling)
>>>>>>>> and then see how many calls a gateway has Incoming/Outgoing from/to a
>>>>>>>> particular gateway.
>>>>>>>>
>>>>>>>> The real deal is to communicate the populated incoming calls
>>>>>>>> variable to the load-balancer module. (Dynamically increment/decrement a
>>>>>>>> g/w capacity based on the $avp(IC_GW1) )
>>>>>>>>
>>>>>>>> BR
>>>>>>>> Sammy
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Sep 7, 2012 at 1:58 AM, Ali Pey <alipey at gmail.com<http://mc/compose?to=alipey@gmail.com>
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> Let's say I have a sip trunk with 100 channels. The calls come in
>>>>>>>> and are distributed to 4 gateways through the load_balancer module. Load
>>>>>>>> balancer module can show all active call going to the gateways but not the
>>>>>>>> call originated from the gateways to a sip trunk.
>>>>>>>>
>>>>>>>> If there are outgoing calls from the gateways to the sip trunks,
>>>>>>>> those will not be accounted for on the load balancer module. Basically load
>>>>>>>> balancer can keep account for number of active calls on one direction.
>>>>>>>>
>>>>>>>> Is there a way that I can see the total number of active calls on a
>>>>>>>> gateway (both incoming and outgoing) through the load balancer module?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Ali Pey
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org<http://mc/compose?to=Users@lists.opensips.org>
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----Inline Attachment Follows-----
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org<http://mc/compose?to=Users@lists.opensips.org>
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opensips.org
>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Muhammad Shahzad
>>>>>> -----------------------------------
>>>>>> CISCO Rich Media Communication Specialist (CRMCS)
>>>>>> CISCO Certified Network Associate (CCNA)
>>>>>> Cell: +92 334 422 40 88
>>>>>> MSN: shari_786pk at hotmail.com
>>>>>> Email: shaheryarkh at googlemail.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +92 334 422 40 88
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120908/d12fbc1f/attachment-0001.htm>


More information about the Users mailing list