Ralph Liebessohn wrote:
Hi Lee,
thanks for the tip. I tried other methods trying to get the variable
value, but no success.
Doing a GET VARIABLE my_var after READ the "get variable" returns the
value I dialed, but doesn't give the exact value to it. I got Resource
ID #1 instead.
Using:
fwrite(STDOUT,"exec read
my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15
\n");
fwrite(STDOUT,"get variable my_var \n");
fflush(STDOUT);
$my_var=STDIN;
fwrite(STDOUT,"exec saydigits $my_var \n");
I got it:
AGI Rx << exec read
my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15
-- AGI Script Executing Application: (read) Options:
(my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15)
-- Accepting a maximum of 5 digits.
-- Playing
'//usr/share/asterisk/sounds/please-wait-connect-oncall-eng' (language 'en')
-- User entered '85214'
AGI Tx >> 200 result=0
AGI Rx << get variable my_var
AGI Tx >> 200 result=1 (85214)
AGI Rx << exec saydigits Resource id #1
-- AGI Script Executing Application: (saydigits) Options: (Resource)
AGI Tx >> 200 result=0
AGI Rx << exec Resource id #1
-- AGI Script Executing Application: (Resource) Options: (id)
Jan 10 17:31:33 WARNING[4867]: res_agi.c:1147 handle_exec: Could not
find application (Resource)
AGI Tx >> 200 result=-2
I also tried:
$my_var=fwrite(STDOUT,"get variable my_var \n");
But always I get 21 as value.
More tries?
Again, I'm not familiar with php, but can you try enclosing your
variable in either single or double quotes? Like this?
fwrite(STDOUT,"exec saydigits \"$my_var\" \n");
...or whatever it is that you guys used to escape literals. I use
pascal mostly and it's strings are encased in single quotes so it's easy ;)
I looks almost like the php interpreter is handing over the literal
pointer to the string instead of the string reference itself. That is
why I suggested the quotes around the string.
As another posted suggested, you should consider using a wrapper
class/object if you're using PHP. They've done all the work for you
already. If I had to write every single little piece of code that I
used to develop software, I'd never get anything done!
Sorry can't help you more. Hopefully someone with real php experience
will see your post and give you a hand.
--
Warm Regards,
Lee
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users