[asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Michelle Dupuis
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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Danny Nicholas
The simplest way to accurately do this would be to issue command core show
channels verbose

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Michelle Dupuis
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-boun...@lists.digium.com 
[asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas 
[da...@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-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Danny Nicholas
The AMI Command function issues CLI commands, but carry on.

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@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-boun...@lists.digium.com
[asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas
[da...@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-boun...@lists.digium.com
[mailto:asterisk-users-boun...@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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Mitul Limbani
I guess you are looking for event handler, which can be polled
programatically n not via manual command entry?

Mitul
On Oct 18, 2012 8:53 PM, Danny Nicholas da...@debsinc.com wrote:

 The AMI Command function issues CLI commands, but carry on.

 ** **

 *From:* asterisk-users-boun...@lists.digium.com [mailto:
 asterisk-users-boun...@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-boun...@lists.digium.com [
 asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas [
 da...@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-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@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

--
_
-- 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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Julian Lyndon-Smith
core show calls

works for me on asterisk-11

I know it's a poll, but it's a very simple call ;)

On 18 October 2012 16:28, Mitul Limbani mi...@enterux.in wrote:
 I guess you are looking for event handler, which can be polled
 programatically n not via manual command entry?

 Mitul

 On Oct 18, 2012 8:53 PM, Danny Nicholas da...@debsinc.com wrote:

 The AMI Command function issues CLI commands, but carry on.



 From: asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@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-boun...@lists.digium.com
 [asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas
 [da...@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-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@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


 --
 _
 -- 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



-- 
Julian Lyndon-Smith
IT Director, Dot R Limited

I don’t care if it works on your machine!  We are not shipping your machine!”

The kangaroo dances: http://www.youtube.com/watch?v=MAWl5iYOaUg

--
_
-- 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


Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread SamyGo
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 AB 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 da...@debsinc.com wrote:

 The AMI Command function issues CLI commands, but carry on.

 ** **

 *From:* asterisk-users-boun...@lists.digium.com [mailto:
 asterisk-users-boun...@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-boun...@lists.digium.com [
 asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas [
 da...@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-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@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

--
_
-- 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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Aldo Bergamini

On 18 Oct 2012, at 17:19, Michelle Dupuis wrote:

 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.
  


Michelle,

if you do not want to poll Asterisk with an AMI 'Status' event (that returns a 
list of open channels) counting the bridged, unbridged events is possible, but 
not that easy..

There are two gotchas around this:

One is that a single call, depending of what the dialplan is doing, can involve 
several bridged, unbridged events;

The second is that some kind of calls (I call them 'one legged calls': anything 
resembling an IVR or a call to get voicemail) do not get any bridged, unbridged 
events, at all. The same applies for calls that are sent to a MeetMe 
conference: there you see specific MeetMe events for conference rooms.

If you have access to the dialplan (that is if you are in charge of it and you 
can modify it) you could add some user defined events, to mark the 'rising' of 
a call and its connection to the far side. The dialplan can send pretty much 
what you like by using UserEvent.

As an example:

exten = _00.,n,UserEvent(DNIS-Ext,Exten: ${EXTEN},CallerID: 
${CALLERID(num)},DNID: ${CALLERID(dnid)},DisplayID: 
${PersonalID_Num},ChannelID: ${CHANNEL},RDNIS: ${RDNIS})


The first string (DNIS-Ext) is a marker: anything that you want to receive that 
'brands' the user event to your suiting.

The rest is a list of (name, value) pairs, giving the details you might need on 
the AMI processing side.

Beware of any loop in the dialplan: it might be that you will get multiple 
copies of the same event, if the dialplan execution is such that the same 
extension is visited more than once during the processing of a call.


HTH,
Aldo


--
_
-- 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


Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Salman Zafar
Considering this your real question I want to track the number of calls up
at any given time, through the AMI 

Comparable Command Exists !!

You can simply run CLI commands *through *AMI and receive the response.
Command used for this is itself Command in AMI. If you still want to do
it by counting the event stream then POE is the best solution if you know
PERL, but still why wasting resources in counting events.If you have other
plans like billing then it is understandable otherwise go easy way and add
a cron job or have a UI in php or whatever.

Manager Command:

Command  command,all  Execute Asterisk CLI Command



On Thu, Oct 18, 2012 at 8:53 AM, Aldo Bergamini aabe...@gmail.com wrote:


 On 18 Oct 2012, at 17:19, Michelle Dupuis wrote:

  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.
 


 Michelle,

 if you do not want to poll Asterisk with an AMI 'Status' event (that
 returns a list of open channels) counting the bridged, unbridged events is
 possible, but not that easy..

 There are two gotchas around this:

 One is that a single call, depending of what the dialplan is doing, can
 involve several bridged, unbridged events;

 The second is that some kind of calls (I call them 'one legged calls':
 anything resembling an IVR or a call to get voicemail) do not get any
 bridged, unbridged events, at all. The same applies for calls that are sent
 to a MeetMe conference: there you see specific MeetMe events for conference
 rooms.

 If you have access to the dialplan (that is if you are in charge of it and
 you can modify it) you could add some user defined events, to mark the
 'rising' of a call and its connection to the far side. The dialplan can
 send pretty much what you like by using UserEvent.

 As an example:

 exten = _00.,n,UserEvent(DNIS-Ext,Exten: ${EXTEN},CallerID:
 ${CALLERID(num)},DNID: ${CALLERID(dnid)},DisplayID:
 ${PersonalID_Num},ChannelID: ${CHANNEL},RDNIS: ${RDNIS})


 The first string (DNIS-Ext) is a marker: anything that you want to receive
 that 'brands' the user event to your suiting.

 The rest is a list of (name, value) pairs, giving the details you might
 need on the AMI processing side.

 Beware of any loop in the dialplan: it might be that you will get multiple
 copies of the same event, if the dialplan execution is such that the same
 extension is visited more than once during the processing of a call.


 HTH,
 Aldo


 --
 _
 -- 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




-- 
Regards

**
Muhammad Salman
***
--
_
-- 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

Re: [asterisk-users] Counting calls in progress from AMI

2012-10-18 Thread Richard Mudgett
 Considering this your real question  I want to track the number of
 calls up at any given time, through the AMI  
 
 Comparable Command Exists !!
 
 You can simply run CLI commands through AMI and receive the response.
 Command used for this is itself Command in AMI. If you still want
 to do it by counting the event stream then POE is the best solution
 if you know PERL, but still why wasting resources in counting
 events.If you have other plans like billing then it is
 understandable otherwise go easy way and add a cron job or have a UI
 in php or whatever.
 
 Manager Command:
 Command  command,all  Execute Asterisk CLI Command

You should only use the AMI Command action if there is no other AMI action
available to do the job.  For instance, the AMI CoreShowChannels action
is better than using the CLI core show channels command through AMI.

manager show command CoreShowChannels

Richard

--
_
-- 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