Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-15 Thread Bruce Ferrell

On 6/14/20 4:52 PM, Antony Stone wrote:

On Monday 15 June 2020 at 00:41:14, Bruce Ferrell wrote:


Way back in the mists of time, I built my asterisk installation with SNMP
support.

Heh... I never even knew that was possible :)


That said, I actually prefer ARA/ARI to flat file configuration of endpoints
and dialplans.  Changes are more or less instantaneous and easily shared
between instances.

Agreed - ARA is a great system, and I really like that it can be combined with
flatfile configs on a single server.


The ODBC way is a pain, so I tend to just use the native MySQL method

Oh?

What makes you say ODBC is a pain?  I have two files (/etc/odbc.ini and
/etc/idbcinst.ini, which are 8 lines and 3 lines in size respectively) and I
had to install one file /usr/local/lib/libmaodbc.so to make it work with
MariaDB.


ODBC can get fussy about language definitions between the DB and ODBC.  ODBC make's it so you can use ANY db, but try Informix or Oracle... Just LOADS of fun getting the language 
code page settings right (Yes, I actually had a customer want Informix - SHUDDER).


The MySQL connection has it's own configuration fuss, but I understand it and 
HATE trying to debug ODBC configs.



What's easier about the native MySQL method?


for ARA configuration as well as CDR collection.  CDR reports are just a SQL
query away.

Yes:

a) efficient

b) can be done on a machien remote from the call processing

c) is realtime - call ends, CDRs are immediately available for analysis

d) can even include triggers on DB updates, for example to raise anti-fraud
alerts.


YES!  and most non-MySQL/Marias type don't realize that those triggers and 
stored procedures can actually execute routines external to the DB... At least 
in MySQL/MariaDB



Regards,


Antony.





--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Antony Stone
On Monday 15 June 2020 at 00:41:14, Bruce Ferrell wrote:

> Way back in the mists of time, I built my asterisk installation with SNMP
> support.

Heh... I never even knew that was possible :)

> That said, I actually prefer ARA/ARI to flat file configuration of endpoints
> and dialplans.  Changes are more or less instantaneous and easily shared
> between instances.

Agreed - ARA is a great system, and I really like that it can be combined with 
flatfile configs on a single server.

> The ODBC way is a pain, so I tend to just use the native MySQL method

Oh?

What makes you say ODBC is a pain?  I have two files (/etc/odbc.ini and 
/etc/idbcinst.ini, which are 8 lines and 3 lines in size respectively) and I 
had to install one file /usr/local/lib/libmaodbc.so to make it work with 
MariaDB.

What's easier about the native MySQL method?

> for ARA configuration as well as CDR collection.  CDR reports are just a SQL
> query away.

Yes:

a) efficient

b) can be done on a machien remote from the call processing

c) is realtime - call ends, CDRs are immediately available for analysis

d) can even include triggers on DB updates, for example to raise anti-fraud 
alerts.


Regards,


Antony.

-- 
Python is executable pseudocode.
Perl is executable line noise.

   Please reply to the list;
 please *don't* CC me.

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Bruce Ferrell

Way back in the mists of time, I built my asterisk installation with SNMP 
support.

It's a bit tedious to get the sub-agent for snmpd set up but once you have it you can poll the OID for the asterisk sub-agent and it will tell you how many calls are up at that 
moment in time.


That said, I actually prefer ARA/ARI to flat file configuration of endpoints and dialplans.  Changes are more or less instantaneous and easily shared between instances. The ODBC 
way is a pain, so I tend to just use the native MySQL method for ARA configuration as well as CDR collection.  CDR reports are just a SQL query away.


Only problem is all of the web ui's for Asterisk seem to be PHP that presumes 
the flatfiles.



On 6/14/20 2:55 PM, Telium Technical Support wrote:


Just run ‘core show calls’ as a command  from the AMI, and parse the results.  
I don’t think there is an equivalent pure AMI command.

*From:*asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] *On 
Behalf Of *Jonathan H
*Sent:* Sunday, June 14, 2020 5:45 PM
*To:* Asterisk Users Mailing List - Non-Commercial Discussion 

*Subject:* Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show 
calls"?

Wow! I've been *-ing for about 6 years and had literally no idea about that!

I can see a way I could put it to a different use, but it seems to be a bit of a sledgehammer to crack the walnut of "how many current callers" compared to one line of (albeit 
hacky) dialplan.


That's making me sound ungrateful. I don't mean to be!

On Sun, 14 Jun 2020, 22:39 Steve Edwards, mailto:asterisk@sedwards.com>> wrote:

On Sun, 14 Jun 2020, Jonathan H wrote:

> Thank you... but "just update the database" - hmm, what database?

I used MySQL.

> Did you mean ARI? I still can't find the command! The asterisk wiki is
> somewhat, um... spread around!

ARA as in Asterisk RealTime Architecture

https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
https://www.voip-info.org/asterisk-realtime/

As I recall (back from 2015), you tell Asterisk which 'configuration file'
you want to read from MySQL like this:

# /etc/asterisk/extconfig.conf

[settings]
         musiconhold.conf                = mysql,vchat,static
;       musiconhold.conf                = mysql,vchat,musiconhold

I have no idea if this will help, but here are the tables as I defined them 
back in 2015.

         create  table   if not exists   static
                 (
                   id                    int(11) not null auto_increment
                 , cat_metric            int(11) not null default '0'
                 , var_metric            int(11) not null default '0'
                 , commented             int(11) not null default '0'
                 , filename              varchar(128) not null default ''
                 , category              varchar(128) not null default 
'default'
                 , var_name              varchar(128) not null default ''
                 , var_val               varchar(128) not null default ''
                 , primary key           (id)
                 )
                 ;

-- defaults
         set @CAT_METRIC                 = 0;
         set @FILENAME                   = 'musiconhold.conf';
         set @VAR_METRIC                 = 0;

-- Funk Dance
         set @COMMENTED                  = 0;
         set @NAME                       = 'Funk Dance';
         insert into static set
                   cat_metric            = @CAT_METRIC
                 , category              = @NAME
                 , commented             = @COMMENTED
                 , filename              = @FILENAME
                 , var_metric            = @VAR_METRIC
                 , var_name              = 'directory'
                 , var_val               = 
concat('/source/src/tmp/T2/moh/', @NAME, '/')
                 ;
         insert into static set
                   cat_metric            = @CAT_METRIC
                 , category              = @NAME
                 , commented             = @COMMENTED
                 , filename              = @FILENAME
                 , var_metric            = @VAR_METRIC
                 , var_name              = 'mode'
                 , var_val               = 'files'
                 ;
         insert into static set
                   cat_metric            = @CAT_METRIC
                 , category              = @NAME
                 , commented             = @COMMENTED
                 , filename              = @FILENAME
  

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Telium Technical Support
Just run ‘core show calls’ as a command  from the AMI, and parse the results.  
I don’t think there is an equivalent pure AMI command.

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of Jonathan H
Sent: Sunday, June 14, 2020 5:45 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion 

Subject: Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show 
calls"?

 

Wow! I've been *-ing for about 6 years and had literally no idea about that! 

 

I can see a way I could put it to a different use, but it seems to be a bit of 
a sledgehammer to crack the walnut of "how many current callers" compared to 
one line of (albeit hacky) dialplan. 

 

That's making me sound ungrateful. I don't mean to be!

 

On Sun, 14 Jun 2020, 22:39 Steve Edwards, mailto:asterisk@sedwards.com> > wrote:

On Sun, 14 Jun 2020, Jonathan H wrote:

> Thank you... but "just update the database" - hmm, what database?

I used MySQL.

> Did you mean ARI? I still can't find the command! The asterisk wiki is 
> somewhat, um... spread around!

ARA as in Asterisk RealTime Architecture

https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
https://www.voip-info.org/asterisk-realtime/

As I recall (back from 2015), you tell Asterisk which 'configuration file' 
you want to read from MySQL like this:

# /etc/asterisk/extconfig.conf

[settings]
 musiconhold.conf= mysql,vchat,static
;   musiconhold.conf= mysql,vchat,musiconhold

I have no idea if this will help, but here are the tables as I defined them 
back in 2015.

 create  table   if not exists   static
 (
   idint(11) not null auto_increment
 , cat_metricint(11) not null default '0'
 , var_metricint(11) not null default '0'
 , commented int(11) not null default '0'
 , filename  varchar(128) not null default ''
 , category  varchar(128) not null default 'default'
 , var_name  varchar(128) not null default ''
 , var_val   varchar(128) not null default ''
 , primary key   (id)
 )
 ;

-- defaults
 set @CAT_METRIC = 0;
 set @FILENAME   = 'musiconhold.conf';
 set @VAR_METRIC = 0;

-- Funk Dance
 set @COMMENTED  = 0;
 set @NAME   = 'Funk Dance';
 insert into static set
   cat_metric= @CAT_METRIC
 , category  = @NAME
 , commented = @COMMENTED
 , filename  = @FILENAME
 , var_metric= @VAR_METRIC
 , var_name  = 'directory'
 , var_val   = concat('/source/src/tmp/T2/moh/', 
@NAME, '/')
 ;
 insert into static set
   cat_metric= @CAT_METRIC
 , category  = @NAME
 , commented = @COMMENTED
 , filename  = @FILENAME
 , var_metric= @VAR_METRIC
 , var_name  = 'mode'
 , var_val   = 'files'
 ;
 insert into static set
   cat_metric= @CAT_METRIC
 , category  = @NAME
 , commented = @COMMENTED
 , filename  = @FILENAME
 , var_metric= @VAR_METRIC
 , var_name  = 'sort'
 , var_val   = 'random'
 ;
 insert into static set
   cat_metric= @CAT_METRIC
 , category  = @NAME
 , commented = @COMMENTED
 , filename  = @FILENAME
 , var_metric= @VAR_METRIC
 , var_name  = 'type'
 , var_val   = 'preset'
 ;
--  insert into static set
--cat_metric= @CAT_METRIC
--  , category  = @NAME
--  , commented = @COMMENTED
--  , filename  = @FILENAME
--  , var_metric= @VAR_METRIC
--  , var_name  = 'application'

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Jonathan H
Wow! I've been *-ing for about 6 years and had literally no idea about
that!

I can see a way I could put it to a different use, but it seems to be a bit
of a sledgehammer to crack the walnut of "how many current callers"
compared to one line of (albeit hacky) dialplan.

That's making me sound ungrateful. I don't mean to be!

On Sun, 14 Jun 2020, 22:39 Steve Edwards,  wrote:

> On Sun, 14 Jun 2020, Jonathan H wrote:
>
> > Thank you... but "just update the database" - hmm, what database?
>
> I used MySQL.
>
> > Did you mean ARI? I still can't find the command! The asterisk wiki is
> > somewhat, um... spread around!
>
> ARA as in Asterisk RealTime Architecture
>
> https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
> https://www.voip-info.org/asterisk-realtime/
>
> As I recall (back from 2015), you tell Asterisk which 'configuration file'
> you want to read from MySQL like this:
>
> # /etc/asterisk/extconfig.conf
>
> [settings]
>  musiconhold.conf= mysql,vchat,static
> ;   musiconhold.conf= mysql,vchat,musiconhold
>
> I have no idea if this will help, but here are the tables as I defined
> them back in 2015.
>
>  create  table   if not exists   static
>  (
>idint(11) not null auto_increment
>  , cat_metricint(11) not null default '0'
>  , var_metricint(11) not null default '0'
>  , commented int(11) not null default '0'
>  , filename  varchar(128) not null default ''
>  , category  varchar(128) not null default
> 'default'
>  , var_name  varchar(128) not null default ''
>  , var_val   varchar(128) not null default ''
>  , primary key   (id)
>  )
>  ;
>
> -- defaults
>  set @CAT_METRIC = 0;
>  set @FILENAME   = 'musiconhold.conf';
>  set @VAR_METRIC = 0;
>
> -- Funk Dance
>  set @COMMENTED  = 0;
>  set @NAME   = 'Funk Dance';
>  insert into static set
>cat_metric= @CAT_METRIC
>  , category  = @NAME
>  , commented = @COMMENTED
>  , filename  = @FILENAME
>  , var_metric= @VAR_METRIC
>  , var_name  = 'directory'
>  , var_val   =
> concat('/source/src/tmp/T2/moh/', @NAME, '/')
>  ;
>  insert into static set
>cat_metric= @CAT_METRIC
>  , category  = @NAME
>  , commented = @COMMENTED
>  , filename  = @FILENAME
>  , var_metric= @VAR_METRIC
>  , var_name  = 'mode'
>  , var_val   = 'files'
>  ;
>  insert into static set
>cat_metric= @CAT_METRIC
>  , category  = @NAME
>  , commented = @COMMENTED
>  , filename  = @FILENAME
>  , var_metric= @VAR_METRIC
>  , var_name  = 'sort'
>  , var_val   = 'random'
>  ;
>  insert into static set
>cat_metric= @CAT_METRIC
>  , category  = @NAME
>  , commented = @COMMENTED
>  , filename  = @FILENAME
>  , var_metric= @VAR_METRIC
>  , var_name  = 'type'
>  , var_val   = 'preset'
>  ;
> --  insert into static set
> --cat_metric= @CAT_METRIC
> --  , category  = @NAME
> --  , commented = @COMMENTED
> --  , filename  = @FILENAME
> --  , var_metric= @VAR_METRIC
> --  , var_name  = 'application'
> --  , var_val   = '/usr/bin/mpg123 --mono -b 0 -f
> 8192 -q -r 8000 -s -@ http://206.190.136.141:5022/Live'
> --  ;
>
> -- FILES
> --  set @COMMENTED  = 0;
> --  insert into static set
> --cat_metric= @CAT_METRIC
> --  , category  = 'FILES'
> --  , commented = @COMMENTED
> --  , filename  = @FILENAME
> --  , var_metric= @VAR_METRIC
> --  , var_name  = 'directory'
> --  

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Steve Edwards

On Sun, 14 Jun 2020, Jonathan H wrote:


Thank you... but "just update the database" - hmm, what database?


I used MySQL.

Did you mean ARI? I still can't find the command! The asterisk wiki is 
somewhat, um... spread around!


ARA as in Asterisk RealTime Architecture

https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
https://www.voip-info.org/asterisk-realtime/

As I recall (back from 2015), you tell Asterisk which 'configuration file' 
you want to read from MySQL like this:


# /etc/asterisk/extconfig.conf

[settings]
musiconhold.conf= mysql,vchat,static
;   musiconhold.conf= mysql,vchat,musiconhold

I have no idea if this will help, but here are the tables as I defined them 
back in 2015.

create  table   if not exists   static
(
  idint(11) not null auto_increment
, cat_metricint(11) not null default '0'
, var_metricint(11) not null default '0'
, commented int(11) not null default '0'
, filename  varchar(128) not null default ''
, category  varchar(128) not null default 'default'
, var_name  varchar(128) not null default ''
, var_val   varchar(128) not null default ''
, primary key   (id)
)
;

-- defaults
set @CAT_METRIC = 0;
set @FILENAME   = 'musiconhold.conf';
set @VAR_METRIC = 0;

-- Funk Dance
set @COMMENTED  = 0;
set @NAME   = 'Funk Dance';
insert into static set
  cat_metric= @CAT_METRIC
, category  = @NAME
, commented = @COMMENTED
, filename  = @FILENAME
, var_metric= @VAR_METRIC
, var_name  = 'directory'
, var_val   = concat('/source/src/tmp/T2/moh/', 
@NAME, '/')
;
insert into static set
  cat_metric= @CAT_METRIC
, category  = @NAME
, commented = @COMMENTED
, filename  = @FILENAME
, var_metric= @VAR_METRIC
, var_name  = 'mode'
, var_val   = 'files'
;
insert into static set
  cat_metric= @CAT_METRIC
, category  = @NAME
, commented = @COMMENTED
, filename  = @FILENAME
, var_metric= @VAR_METRIC
, var_name  = 'sort'
, var_val   = 'random'
;
insert into static set
  cat_metric= @CAT_METRIC
, category  = @NAME
, commented = @COMMENTED
, filename  = @FILENAME
, var_metric= @VAR_METRIC
, var_name  = 'type'
, var_val   = 'preset'
;
--  insert into static set
--cat_metric= @CAT_METRIC
--  , category  = @NAME
--  , commented = @COMMENTED
--  , filename  = @FILENAME
--  , var_metric= @VAR_METRIC
--  , var_name  = 'application'
--  , var_val   = '/usr/bin/mpg123 --mono -b 0 -f 8192 
-q -r 8000 -s -@ http://206.190.136.141:5022/Live'
--  ;

-- FILES
--  set @COMMENTED  = 0;
--  insert into static set
--cat_metric= @CAT_METRIC
--  , category  = 'FILES'
--  , commented = @COMMENTED
--  , filename  = @FILENAME
--  , var_metric= @VAR_METRIC
--  , var_name  = 'directory'
--  , var_val   = '/var/lib/asterisk/moh/'
--  ;
--  insert into static set
--cat_metric= @CAT_METRIC
--  , category  = 'FILES'
--  , commented = @COMMENTED
--  , filename  = @FILENAME
--  , var_metric= @VAR_METRIC
--  , var_name  = 'mode'
--  , var_val   = 'files'
--  ;

create  table   if not exists   musiconhold
(
  name  varchar(80) not null
   

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-14 Thread Jonathan H
Thank you... but "just update the database" - hmm, what database?

Did you mean ARI? I still can't find the command! The asterisk wiki is
somewhat, um... spread around!


On Sat, 13 Jun 2020 at 16:56, Steve Edwards  wrote:
>
> On Sat, 13 Jun 2020, Jonathan H wrote:
>
> > I need to ensure that a MusicOnHold stream is only running when there's
> > a caller on hold and listening.To do that, I need to rewrite and reload
> > the moh.conf file when the caller hangs up IF there are no other callers
> > (ie there's just 1 active call as the caller hangs up), and then
> > rewrite and reload again when there's a new caller.
>
> How about ARA to configure MOH and then just update the database.
>
> --
> Thanks in advance,
> -
> Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
>  https://www.linkedin.com/in/steve-edwards-4244281--
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> 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 --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-13 Thread Steve Edwards

On Sat, 13 Jun 2020, Jonathan H wrote:

I need to ensure that a MusicOnHold stream is only running when there's 
a caller on hold and listening.To do that, I need to rewrite and reload 
the moh.conf file when the caller hangs up IF there are no other callers 
(ie there's just 1 active call as the caller hangs up), and then  
rewrite and reload again when there's a new caller.


How about ARA to configure MOH and then just update the database.

--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Any api (agi/ari/ami) equivalent of "core show calls"?

2020-06-13 Thread Jonathan H
I'm parsing ` sudo asterisk -rx "core show calls" | grep active | head -c 1
` as an external call from within the Asterisk dialplan then passing it to
agi, but this seems really hacky and ugly.

However, I cannot find any ARI/AGI/AMI function (or global variable I can
get with agi) which shows me this.

Any ideas?!?

In case it helps and you're wondering why...
I need to ensure that a MusicOnHold stream is only running when there's a
caller on hold and listening.
To do that, I need to rewrite and reload the moh.conf file when the caller
hangs up IF there are no other callers (ie there's just 1 active call as
the caller hangs up), and then  rewrite and reload again when there's a new
caller.
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users