<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2>Ralph</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2>Morning - no, what I meant was that *I* was kind of new to * and I'm
learning AGI while working thru my first AGI script too</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>Let me
see if I can explain my point better this time, it was a pretty weak attempt
below. </FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>The
key point is that the $argv[] array variables are only available at the initial
AGI script startup. The first time you call the AGI script from the
dialplan any params passed in would be exposed in $argv[].
</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>In the
script snippet that I found and included with the email that I sent below it
appeared to me that you did the following:</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>from
the dialplan call the AGI script and pass in a variable</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>from
within the AGI script you <did some stuff></FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>while
within the AGI script you did this:</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007>fwrite(STDOUT,"exec Read
my_var|/sound_to_play|5|||15 \n");</SPAN></DIV>
<DIV><SPAN class=545322815-12012007></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2>since:</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>1 -
this command from the AGI is being passed back in to * while the AGI script is
running in a manner akin to a shell or child process (I don't think that is
actually a child, but conceptually it might help to think of it this way for the
purpose of this example)</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>2 -
the script does not stop and then restart</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>3 -
$argv can only be populated at script startup</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>4 -
$argv cannot be populated with a new value in this way since there is no
restart</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>in the
dialplan snippet above my_var can only come back in thru
$argv[]</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>This
is my theory only, I have not tested this</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff size=2>Others
have made mention that the phpAGI class might be helpful to achieve your goal,
while I have not looked into phpAGI I'd think that it would too. Native
php AGI scripting seems to be pretty primitive (but its great to have it
there). </FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2>md</FONT></SPAN></DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007></SPAN> </DIV>
<DIV><SPAN class=545322815-12012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV></DIV>
<DIV><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <B>On Behalf Of </B>Ralph
Liebessohn<BR><B>Sent:</B> Friday, January 12, 2007 2:13 AM<BR><B>To:</B>
Asterisk Users Mailing List - Non-Commercial Discussion<BR><B>Subject:</B> Re:
FW: [asterisk-users] Get dialed numbers in AGI<BR><BR></DIV></FONT>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">On 1/11/07, <B
class=gmail_sendername>Mike D'Ambrogia</B> <<A
href="mailto:miked@jamagination.com">miked@jamagination.com</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN>Ralph</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN>Kind of new to asterisk,
and really new to AGI but it looks like you were trying to have the AGI
script tell asterisk to read and lay the results into my_var and then regain
control in the AGI script, is that correct?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN>If so I don't think that
will work since the dialplan variables are only exposed/visible when you
start the AGI script, since you are still within the AGI script you'll
probably never see my_var if called this way</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff
size=2><SPAN>md</SPAN></FONT></DIV></DIV></BLOCKQUOTE></DIV><BR>Mike,<BR><BR>that's
my first agi. Easy to see, ahm?<BR>What I'm thinking to do is, play a sound,
get the numbers dialed, see on a db what to do using the dialed numbers, get
back to dialplan (go to a queue or something else). <BR>The way started to
work is that you said, send dialed as parameter to agi and get it with
$argv[1]. And I was trying to get it from stdin.<BR>Things I do not understand
well and the documentations I've read are not so clear are the way agi work
with some things like: <BR>- How can I fix this agi to work?<BR><BR><FONT
size=1>AGI Rx << exec read
my_var|sound-file|5|||15<BR> -- AGI Script Executing
Application: (read) Options: (my_var|sound-file|5|||15) <BR>
-- Accepting a maximum of 5 digits.<BR> -- Playing
'</FONT><FONT size=1>sound-file</FONT><FONT size=1>' (language
'en')<BR> -- User entered '85214'<BR>AGI Tx >> 200
result=0 <BR>AGI Rx << get variable my_var<BR>AGI Tx >> 200
result=1 (85214)<BR>AGI Rx << exec saydigits <SPAN
style="FONT-WEIGHT: bold">Resource id #1 </SPAN>// (this is the result
of my_var)</FONT><BR clear=all><BR>All the variables here was my_var, it
worked for GET VARIABLE but didn't for SAYDIGITS and odbc connection. How can
I SAYDIGITS of my_var or insert my_var value into a db?<BR><BR>- What I need
more to use WAIT FOR DIGIT? Because it didn't stop to wait for digits. <BR>-
STDIN shoudn't get the result of READ or GET VARIABLE? Where these values
go?<BR><BR>-- <BR>Ralph Liebessohn<BR>ICQ: 74835911<BR>Skype: liebessohn
</BLOCKQUOTE></BODY></HTML>