Re: [asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

2008-03-12 Thread Kevin DeGraaf
 I am writing an AGI script that needs to check on the idle/busy status 
 of a number of SIP peers (mostly SPA9xx phones, with a few Polycoms and 
 Snoms thrown in for fun).

I ended up grabbing this info from the manager interface, within an AGI 
script.  A little back-asswards, but it works.

I still would like to know whether it's possible to call Asterisk 
functions from within AGI scripts...

-- 
Kevin DeGraaf

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


Re: [asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

2008-03-12 Thread Steve Edwards
On Wed, 12 Mar 2008, Kevin DeGraaf wrote:

 I am writing an AGI script that needs to check on the idle/busy status
 of a number of SIP peers (mostly SPA9xx phones, with a few Polycoms and
 Snoms thrown in for fun).

 I ended up grabbing this info from the manager interface, within an AGI
 script.  A little back-asswards, but it works.

 I still would like to know whether it's possible to call Asterisk
 functions from within AGI scripts...

The AGI executes as a separate process and does not have full access to 
the Asterisk memory or code. Since the only interface between Asterisk and 
the AGI is through STDIN and STDOUT (and STDERR), you can only execute 
functions defined in the AGI API. For 1.2 this means:

fs show agi
   answer   Answer channel
   channel status   Returns status of the connected channel
 database del   Removes database key/value
 database deltree   Removes database keytree/value
 database get   Gets database value
 database put   Adds/updates database value
 exec   Executes a given Application
 get data   Prompts for DTMF on a channel
get full variable   Evaluates a channel expression
   get option   Stream file, prompt for DTMF, with timeout
 get variable   Gets a channel variable
   hangup   Hangup the current channel
 noop   Does nothing
 receive char   Receives one character from channels supporting it
 receive text   Receives text from channels supporting it
  record file   Records to a given file
say alpha   Says a given character string
   say digits   Says a given digit string
   say number   Says a given number
 say phonetic   Says a given character string with phonetics
 say date   Says a given date
 say time   Says a given time
 say datetime   Says a given time as specfied by the format given
   send image   Sends images to channels supporting it
send text   Sends text to channels supporting it
   set autohangup   Autohangup channel in some time
 set callerid   Sets callerid for the current channel
  set context   Sets channel context
set extension   Changes channel extension
set music   Enable/Disable Music on hold generator
 set priority   Set channel dialplan priority
 set variable   Sets a channel variable
  stream file   Sends audio file on channel
  control stream file   Sends audio file on channel and allows the listner to 
control the stream
 tdd mode   Toggles TDD mode (for the deaf)
  verbose   Logs a message to the asterisk verbose log
   wait for digit   Waits for a digit to be pressed

For 1.4 or 1.6, use the obtuse replacement for show agi to see your 
options.

Thanks in advance,

Steve Edwards  [EMAIL PROTECTED]  Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

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


Re: [asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

2008-03-12 Thread David Van Ginneken
Kevin DeGraaf wrote:
 I am writing an AGI script that needs to check on the idle/busy status 
 of a number of SIP peers (mostly SPA9xx phones, with a few Polycoms and 
 Snoms thrown in for fun).
 

 I ended up grabbing this info from the manager interface, within an AGI 
 script.  A little back-asswards, but it works.

 I still would like to know whether it's possible to call Asterisk 
 functions from within AGI scripts...

   
This worked for me on * 1.6 where 1223 is the sip peer I wanted to get 
status from.


#!/usr/bin/perl
use strict;
use Asterisk::AGI;
my $AGI = new Asterisk::AGI;
my %input = $AGI-ReadParse();
my $peer = $AGI-get_variable(SIPPEER(1223,status));
$AGI-verbose(We Received $peer,3);
exit;


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


Re: [asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

2008-03-12 Thread Kevin DeGraaf
 This worked for me on * 1.6 where 1223 is the sip peer I wanted to get 
 status from.

 use Asterisk::AGI;
 my $AGI = new Asterisk::AGI;
 my $peer = $AGI-get_variable(SIPPEER(1223,status));

It didn't work (for me) on 1.4.18.  An empty string was returned, even 
though I gave a it a valid peer number.  Oh, well.  :-)

Thanks.

-- 
Kevin DeGraaf

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


Re: [asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

2008-03-11 Thread Matt Riddell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kevin DeGraaf wrote:
 $AGI-verbose(Test using Set(): $cc[0] $cc[1] $cc[2]);
 $AGI-verbose(Status of 200:  . $AGI-channel_status('SIP/200'));
 $AGI-verbose(Status of 221:  . $AGI-channel_status('SIP/221'));
 $AGI-verbose(Status of 231:  . $AGI-channel_status('SIP/231'));

I may be off base here as I haven't used the channel status via AGI, but
SIP/200 seems like an account to me rather than a channel.

- --
Kind Regards,

Matt Riddell
Director
___

http://www.venturevoip.com (Great new VoIP end to end solution)
http://www.venturevoip.com/news.php (Daily Asterisk News - html)
http://www.venturevoip.com/newrssfeed.php (Daily Asterisk News - rss)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH1ywwDQNt8rg0Kp4RAkYcAJwKBYJOUVgz0ii5Ky2DZtwFWvCtHwCfX/+r
1HFlsDnMHVHKfELEGyZgk/s=
=21xo
-END PGP SIGNATURE-

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