login | register
Sun 06 of Jul, 2008 [07:39 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Samuel, Thu 03 of Jul, 2008 [13:41 UTC]: ok thank you
  • Mats Karlsson, Thu 03 of Jul, 2008 [13:37 UTC]: Nice Samuel, will look forward to rad it.
  • bwl_fernstudent, Thu 03 of Jul, 2008 [09:08 UTC]: Your blog shows some usefull code
  • Samuel, Thu 03 of Jul, 2008 [08:04 UTC]: I'll translate it, for sure
  • Mats Karlsson, Wed 02 of Jul, 2008 [20:46 UTC]: LOL, in french! Translate it to English and I will read it.
  • Samuel, Wed 02 of Jul, 2008 [08:07 UTC]: Hello, i wrote a blog about Asterisk, speaking about installation,programming and more http://sambranche.blogspot.com/
  • Nick Barnes, Tue 01 of Jul, 2008 [17:46 UTC]: Steve - Asterisk doesn't 'fit into linux' - it's an application which runs on top of Linux.
  • Steve, Mon 30 of Jun, 2008 [18:07 UTC]: anyone know where I can find a block diagram of how asterisk fits into linux. my f'ing bosses want me to draw something up.. ugh.
  • akbar, Fri 27 of Jun, 2008 [10:37 UTC]: marley_boyz@yahoo.com how to configure call forward, call back, call pick up using TDM and asterisk 1.2.13... please help me.. thx...
  • Matthew Williams, Tue 24 of Jun, 2008 [22:37 UTC]: We are looking for Tier II VoIP Support Technicians in St Louis. Send resumes to mwilliams AT voxitas DOT com.
Server Stats
  • Execution time: 0.41s
  • Memory usage: 2.58MB
  • Database queries: 33
  • GZIP: Disabled
  • Server load: 0.41

get variable

Usage: GET VARIABLE <variablename>

Does not work* with global variables. Does not work with some variables that are generated by modules.
(* now works for global variables in 1.2.10 - see http://bugs.digium.com/view.php?id=7609 )

'Variable' actually includes functions (but no expression parsing). Tested on 1.2.13.

EXAMPLE:
QUESTION:
GET VARIABLE UNIQUEID
ANSWER:
200 result=1 (1187188485.0)

Returns:
failure or not set: 200 result=0
success: 200 result=1 <value>

PHP example


function __read__() {
  global $in, $debug;
  $input = str_replace("\n", "", fgets($in, 4096));
  if ($debug) echo "VERBOSE \"read: $input\"\n";
  return $input;
}

function __write__($line) {
   global $debug;
   if ($debug) echo "VERBOSE \"write: $line\"\n";
   print $line."\n";
}

 //get the variable and strip of all the extra stuff around it
 __write__("GET VARIABLE MYDIALPLANVAR");
 $res = substr(strrchr(__read__(),"("),1,-1);
 __write__("EXEC NOOP '======??? MYDIALPLANVAR: ".$res." ???======'\n");
 __read__();


Tip

In many earlier versions of Asterisk (typically 1.0.x) the GET VARIABLE command doesn't appear to work at all. You can, however, pass your variables to the script when calling it from the dialplan through AGI(), example:

 exten => 1234,1,AGI(test.agi,${CALLERIDNUM})

and then in PHP, for example, use this with the help of $argv[1].

See also



Go back to Asterisk AGI
Created by pinhole, Last modification by casey0999 on Mon 28 of Apr, 2008 [07:18 UTC]

Comments Filter

global variables

by simon austin on Thursday 27 of July, 2006 [23:47:22 UTC]
Since it can't be done with GET VARIABLE, is there any way to reference global variables from the AGI?

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver