Receiving digits from the user through php agi script

hi everyone,
I’m coming to the point directly…Actually i’m forwarding the call to another number and before doing that i want to give the options to the caller like 1:to call 2:voicemail and 3:hangup…but i’m not able to get the value from the user.

I’m using asterisk 1.4.24 and phpagi 2.14 and i’m doing all this in a php script. I already used get_data and stream_file functions defined in phpagi but they are not able to get the value given by the user…

please any help or suggestions!!!

thank you for spending your valuable time for me.

me too,my php script doesn’t work as expected (perl script work normally). I don’t know why,Problem with PHP?? ?

Anyone help us please!

Please post the php script and the cli output so we can try to help you.

Cheers.

Marco Bruni
www.marcobruni.net

[quote=“rk”]hi everyone,
I’m coming to the point directly…Actually i’m forwarding the call to another number and before doing that i want to give the options to the caller like 1:to call 2:voicemail and 3:hangup…but i’m not able to get the value from the user.

I’m using asterisk 1.4.24 and phpagi 2.14 and i’m doing all this in a php script. I already used get_data and stream_file functions defined in phpagi but they are not able to get the value given by the user…

please any help or suggestions!!!

thank you for spending your valuable time for me.[/quote]

Hey thanks Macro for ur reply but i got the solution.
I’m using
$val= $agi->exec(“Background $file”);
where $file is any audio file, so while playing that file if caller presses any key it is accepting and i’m storing that in a variable.$val.

$val=$val[‘result’]; will give u the pressed number…

Thankyou very much

[quote=“rk”][quote=“rk”]hi everyone,
I’m coming to the point directly…Actually i’m forwarding the call to another number and before doing that i want to give the options to the caller like 1:to call 2:voicemail and 3:hangup…but i’m not able to get the value from the user.

I’m using asterisk 1.4.24 and phpagi 2.14 and i’m doing all this in a php script. I already used get_data and stream_file functions defined in phpagi but they are not able to get the value given by the user…

please any help or suggestions!!!

thank you for spending your valuable time for me.[/quote]

Hey thanks Macro for ur reply but i got the solution.
I’m using
$val= $agi->exec(“Background $file”);
where $file is any audio file, so while playing that file if caller presses any key it is accepting and i’m storing that in a variable.$val.

$val=$val[‘result’]; will give u the pressed number…

Thankyou very much[/quote]

Ive done that, and if I:
$agi->verbose($val);
I get:
callblast2-program.php|41283|114: Array
callblast2-program.php|41283|114: (
callblast2-program.php|41283|114: [code] => 200
callblast2-program.php|41283|114: [result] => 0
callblast2-program.php|41283|114: [data] =>
callblast2-program.php|41283|114: )
callblast2-program.php|41283|114:

And im pressing 5, not 0.

$keypress = $agi->exec(“Background messagesgsm/176”);
$agi->verbose($keypress);

I couldnt get stream_file to even play the file…i seen it had bugs and suggested using the Playback cmd’s…

$agi->exec(‘Read’, ‘myvar|enter_zip|5||2|10’);
$myvar = $agi->get_variable(myvar);
$agi->verbose($myvar);

Ive tried that also, and it doesnt work. It shows in the cli:
‘User entered 12345’

But i cant call it back…

ok figured it out.

if i do an include(config.php);

and then try to call channel variables it doesnt work

If i do it before include(config.php); it does work…

anyone have any idea why it would be doing that?