[asterisk-users] Counting calls in progress from AMI

SamyGo govoiper at gmail.com
Thu Oct 18 10:36:47 CDT 2012


Hi,

Though I've moved this functionality to freeSWITCH but here is the logic.

*AMI approach:*
Use perl POE and when received Bridged event increment the counter, and
similarly on Hangup decrement the counter.  Since I see that there are some
issues mentioned by OP so I assume using plain Answer/bridge and hangup
events aren't working perfectly.


*Dialplan approach:*
*
*
The other alternative simple and effective way is use Dial() command with U
or M argument. U command triggers a Subroutine and M executes a Macro Just
before connecting/Bridging the call between A&B party.

There in Macro/Subroutine execute a system() with perl script in it say
increment.pl

That perl script connects to redis(memcache) and increments the callcounter
KVP - thats all.

Next on hangup execute the same system() application with perl script in it
say decrement.pl - this script in terms decrement the callcounter KVP in
redis.

Any other applications which needs the call-count should now interface to
Redis and fetch the callcounter.

I hope I made some sense :)

Thanks,
Sammy



On Thu, Oct 18, 2012 at 8:22 PM, Danny Nicholas <danny at debsinc.com> wrote:

> The AMI Command function issues CLI commands, but carry on.****
>
> ** **
>
> *From:* asterisk-users-bounces at lists.digium.com [mailto:
> asterisk-users-bounces at lists.digium.com] *On Behalf Of *Michelle Dupuis
> *Sent:* Thursday, October 18, 2012 10:20 AM
>
> *To:* Asterisk Users List
> *Subject:* Re: [asterisk-users] Counting calls in progress from AMI****
>
> ** **
>
> I need to do this from the AMI (not the CLI)...I don't *think* a
> comparable command exists from the AMI.****
>
>  ****
>
> As well, I don't want to poll the system for calls so I'm hoping to trap a
> call bridged,unbridged type event.****
>
>  ****
> ------------------------------
>
> *From:* asterisk-users-bounces at lists.digium.com [
> asterisk-users-bounces at lists.digium.com] On Behalf Of Danny Nicholas [
> danny at debsinc.com]
> *Sent:* Thursday, October 18, 2012 10:59 AM
> *To:* Asterisk Users List
> *Subject:* Re: [asterisk-users] Counting calls in progress from AMI****
>
> The simplest way to accurately do this would be to issue command “core
> show channels verbose”****
>
>  ****
>
> *From:* asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com] *On Behalf Of *Michelle
> Dupuis
> *Sent:* Thursday, October 18, 2012 9:58 AM
> *To:* Asterisk Users List
> *Subject:* [asterisk-users] Counting calls in progress from AMI****
>
>  ****
>
> I want to track the number of calls up at any given time, through the
> AMI.  I found the Link and Unlink commands as the most likely candidates -
> is that the right way?****
>
>  ****
>
> Also, a comment on the wiki suggests that Link may be called several times
> for a single bridge if transcoding is required.  That blows up accuracy of
> my count of course...****
>
>  ****
>
> Ideas?****
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20121018/718e49c3/attachment.htm>


More information about the asterisk-users mailing list