[asterisk-users] Using AMI to determine PRI Channels Used
Anthony Francis
anthonyf at rockynet.com
Mon Nov 10 10:58:41 CST 2008
It is easier than that, I have found that the link event watching is
buggy and not very reliable. Here is what I do in my PSTN context:
exten => _X.,1,Wait(1)
exten => _X.,2,NoOp(CIDName: ${CALLERIDNAME} - CIDNum ${CALLERIDNUM} )
exten => _X.,3,Set(GROUP()=ZAP)
exten => _X.,4,UserEvent(ZapCall|${GROUP_COUNT(ZAP)})
exten => _X.,5,Goto(dids,${EXTEN},1)
Then I do the same thing on the PSTN out part. ON my Perl event watcher
I have a callback for this event:
zapcall => {
'Event' => 'UserEventZapCall',
},
Which is handled by:
zapcall => sub {
my $event = $_[ARG0];
my $zc = $event->{content};
I would show you the rest but it doesn't matter, it just sticks the
number in a DB so we can do usage graphs and know when we need to
increase capacity. I also have it alert when all channels on a PSTN box
are used.
The benefit to using a group and a user event is that asterisk does all
the counting for you.
Richard Lyman wrote:
> Godson Gera wrote:
>
>> On Mon, Nov 10, 2008 at 7:41 PM, David Budny <dbudny at visiblecustomer.com>wrote:
>>
>>
>>
>>> What is the AMI command to see how many PRI channels are being used /
>>> available?
>>>
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>> There is no direct command in AMI which will give you used channels number.
>> But you can easily keep track of the active zap channels, by catching the
>> respective events (events Link, Ringing,Hangup,Unlink etc etc ), on zap
>> channels, and storing them in a variable in your program.
>>
>> When you receive a Connecting kind of event like Link,Ringing increase the
>> variable value, and when you receive Hangup or Unlink events decrease the
>> variable value.
>>
>> Happy Hacking,
>> Godson Gera.
>> http://godson.in
>>
>>
> Action: Status (this will show only active channels, parse out the
> Zap ones)
>
> and
>
> Action: ZapShowChannels (this will list all Zaps, parse out what
> you are looking for (PRI ones will have 'Signalling: PRI...'))
>
>
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Thank you and have any kind of day you want,
Anthony Francis
Rockynet VOIP
More information about the asterisk-users
mailing list