Re: [asterisk-users] concurrent call tracking

2011-05-12 Thread Arunas Junevicius
Hi,

this is my first post to mailing list, so sorry in case i'm doing something
wrong.
when i want to count concurent calls from particular user, i dont use any
cron jobs or counters
in dialplan, run query on cdr, something like:

SEELCT dst, calldate, IF(action = 'substract', @count := @count - 1,  @count
:= @count + 1)
 FROM
(SELECT dst,  calldate, 'substract' AS 'action'
FROM  cdr
WHERE calldate between '2011.05.12' AND  '2011.05.13' AND
 src = 500
UNION
SELECT dst,  DATE_ADD(calldate, INTERVAL duration SECOND), 'add'
FROM  cdr
WHERE calldate between '2011.05.12' AND  '2011.05.13' AND
 src = 500)
JOIN   (SELECT @count := 0)
ORDER BY calldate;

- Original Message -
From: Skyler
To: asterisk-users@lists.digium.com
Sent: Wednesday, May 11, 2011 19:57
Subject: [asterisk-users] concurrent call tracking


Hi all,



  I would like to track/store concurrent call usage per user by
day/week/month and get server totals by day/week/month. Google comes up with
mostly info regarding concurrent call limits, though my goal is to calculate
actual concurrent channel usage and add it into reporting. I'm using * 1.6.2
+ mysql - realtime (no gui). Any suggestions / open-source / AGI on where to
start looking into implementing something like this?



 TIA,



 Skyler
--
_
-- 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] concurrent call tracking

2011-05-12 Thread Leif Madsen
On 11-05-11 06:36 PM, Skyler wrote:
 Thanks Dovid, if you don't mind sharing the code and the dial plan side I'd
 like to take a look at it for sure. The dial plan example Leif replied with
 is pretty much what I was thinking, just didn't have a clue how to go about
 it. ;)

You could also look into using LOCK() and UNLOCK() dialplan applications to make
sure each insert happens sequentially.

Leif.

--
_
-- 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] concurrent call tracking

2011-05-12 Thread Skyler
Many thanks to all that replied. I'm going to test out the
suggestions/scenarios and I'll post back with what worked for me.

 

S.

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen
Sent: Thursday, May 12, 2011 6:29 AM
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] concurrent call tracking

 

On 11-05-11 06:36 PM, Skyler wrote:
 Thanks Dovid, if you don't mind sharing the code and the dial plan side
I'd
 like to take a look at it for sure. The dial plan example Leif replied
with
 is pretty much what I was thinking, just didn't have a clue how to go
about
 it. ;)

You could also look into using LOCK() and UNLOCK() dialplan applications to
make
sure each insert happens sequentially.

Leif.

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

  _  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1325 / Virus Database: 1500/3632 - Release Date: 05/11/11

--
_
-- 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] concurrent call tracking

2011-05-11 Thread Leif Madsen
On 11-05-11 12:57 PM, Skyler wrote:
  I would like to track/store concurrent call usage per user by
 day/week/month and get server totals by day/week/month. Google comes up with
 mostly info regarding concurrent call limits, though my goal is to calculate
 actual concurrent channel usage and add it into reporting. I'm using * 1.6.2
 + mysql - realtime (no gui). Any suggestions / open-source / AGI on where to
 start looking into implementing something like this? 

Just use SNMP to get the channel usage. If you don't want to use SNMP, then just
use something like GROUP(), GROUP_COUNT() and func_odbc to write channel usage
to the database. Something like


[Outgoing]
exten = _NXXNXX,1,NoOp()
same = n,GoSub(subTotalCallCounter,start,1(outgoing))

[subTotalCallCounter]
exten = start,1,NoOp()
same = n,Set(GROUP(totalcalls)=${ARG1})
same = n,Set(ODBC_TOTAL_CALLS(${ARG1})=${GROUP_COUNT(${ARG1}@totalcalls)})
same = n,Return()

[Incoming]
exten = 4165551212,1,NoOp()
same = n,GoSub(subTotalCallCounter,start,1(incoming))

[LocalSets]
exten = _1XX,1,NoOp()
same = n,GoSub(subTotalCallCounter,start,1(internal))




func_odbc
-

[TOTAL_CALLS]
dsn=myDatabase
writesql=INSERT INTO totalCalls ('type','callcount') VALUES 
('${VAL1}','${ARG1}')




Something like that. Totally untested and only written in this email :)

Leif.

--
_
-- 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] concurrent call tracking

2011-05-11 Thread Stelios Koroneos

You can use the manager api (interface) and poll that info and then
store it in a MYSQL table etc.
You can do this outside asterisk,even from a different machine using
your preferred  dev language as there are manager libraries/bindings for
most major dev languages

'Actual' is the key word though.
To get the actual concurrent channels you should poll the system, at
least every second, and that means 3600 records per hour or 86.400 per
day. That would end up taking a alot of time to average using mysql
queries.

Alternatively you could do N minutes averages and store them in the db
i.e read every second but save the average of 60 reads which is 1 minute
etc


Stelios


On Wed, 2011-05-11 at 09:57 -0700, Skyler wrote:
 Hi all,
  
  
 
  I would like to track/store concurrent call usage per user by
 day/week/month and get server totals by day/week/month. Google comes
 up with mostly info regarding concurrent call limits, though my goal
 is to calculate actual concurrent channel usage and add it into
 reporting. I’m using * 1.6.2 + mysql – realtime (no gui). Any
 suggestions / open-source / AGI on where to start looking into
 implementing something like this? 
 
  
 
 TIA,
 
  
 
 Skyler
 
  
 
  
 
 
 --
 _
 -- 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] concurrent call tracking

2011-05-11 Thread Dovid Bender
What I do is when ever a call comes in I update a table in MySQL to active = 
(active +1). On hang up I do active = (active -1).

I have a cron that checks once a minute to see how many active and stores it 
along with epoch in db.

I then have a graph that shows channel usage. If you want the code let me know.

  - Original Message - 
  From: Skyler 
  To: asterisk-users@lists.digium.com 
  Sent: Wednesday, May 11, 2011 19:57
  Subject: [asterisk-users] concurrent call tracking


  Hi all,

   

   I would like to track/store concurrent call usage per user by day/week/month 
and get server totals by day/week/month. Google comes up with mostly info 
regarding concurrent call limits, though my goal is to calculate actual 
concurrent channel usage and add it into reporting. I'm using * 1.6.2 + mysql - 
realtime (no gui). Any suggestions / open-source / AGI on where to start 
looking into implementing something like this? 

   

  TIA,

   

  Skyler

   

   



--


  --
  _
  -- 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] concurrent call tracking

2011-05-11 Thread Steve Edwards

On Thu, 12 May 2011, Dovid Bender wrote:

What I do is when ever a call comes in I update a table in MySQL to 
active = (active +1). On hang up I do active = (active -1).


I have a cron that checks once a minute to see how many active and 
stores it along with epoch in db.


I then have a graph that shows channel usage. If you want the code let 
me know.


How do you handle table locking in case more than 1 call arrives 'at the 
same time?'


How do you handle a crash?

Using group() and group_count() with a bit of AMI to retrieve the count 
and stuff it in the database sounds like a 'better practice.'


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline  Fax: +1-760-731-3000

--
_
-- 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] concurrent call tracking

2011-05-11 Thread Skyler
Thanks Dovid, if you don't mind sharing the code and the dial plan side I'd
like to take a look at it for sure. The dial plan example Leif replied with
is pretty much what I was thinking, just didn't have a clue how to go about
it. ;)

 

 Haven't figured out how I'm going to display the usage info either so if
you don't mind sharing the graph/code as well that would be sweet.

 

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Dovid Bender
Sent: Wednesday, May 11, 2011 2:17 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] concurrent call tracking

 

What I do is when ever a call comes in I update a table in MySQL to active =
(active +1). On hang up I do active = (active -1).

 

I have a cron that checks once a minute to see how many active and stores it
along with epoch in db.

 

I then have a graph that shows channel usage. If you want the code let me
know.

 

- Original Message - 

From: Skyler mailto:skchopper...@gmail.com  

To: asterisk-users@lists.digium.com 

Sent: Wednesday, May 11, 2011 19:57

Subject: [asterisk-users] concurrent call tracking

 

Hi all,

 

 I would like to track/store concurrent call usage per user by
day/week/month and get server totals by day/week/month. Google comes up with
mostly info regarding concurrent call limits, though my goal is to calculate
actual concurrent channel usage and add it into reporting. I'm using * 1.6.2
+ mysql - realtime (no gui). Any suggestions / open-source / AGI on where to
start looking into implementing something like this? 

 

TIA,

 

Skyler

 

 


  _  


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

  _  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1325 / Virus Database: 1500/3630 - Release Date: 05/11/11

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