Problems with phpAGI

I’ ve made this simple script to originate a call and send the called in a defined context;


#!/usr/bin/php -q

<?php require('phpagi.php'); $agi = new AGI(); $errno=0 ; $errstr=0 ; $fp = fsockopen ("localhost", 5038, &$errno, &$errstr, 20); fputs ($fp, "Action: login\r\n"); fputs ($fp, "Username: phpagi\r\n"); fputs ($fp, "Secret: phpagi\r\n"); fputs ($fp, "Events: off\r\n\r\n"); sleep(1) ; fputs ($fp, "Action: Originate\r\n"); fputs ($fp, "Channel: sip/200\r\n"); fputs ($fp, "Context: invite\r\n"); fputs ($fp, "Extension: s\r\n"); fputs ($fp, "Priority: 1\r\n\r\n"); sleep(2) ; fclose ($fp); ?>

and in my extensions.conf I have

exten => inv,1,AGI(invite.php)

This is working for me. But suppose I want to do this:

fputs ($fp, “Channel: sip/$number\r\n”);

where $number is promptetd from my keypad after I’ve dialed inv;
So I need a function that gets the number from I prompt;
I’ve tried with get_data but with no success;
Can you tell what can I do?
Thanks in advance for helping me.

So you’re trying to make a script, which would read some dtmf tones and call somebody? It should be something like this:

[code]#!/usr/bin/php -q

<?php require('phpagi.php'); $agi = new AGI(); $ret = $agi->get_data('', 10000, 10); $agi->exec('dial', "SIP/user:pass@host/$ret[result]"); [/code] You can also check out the ping example in the phpAGI documentation.

Thank you very much for your HELP!