The simplest way IMO is using agi scripts. Check these pages:
http://phpagi.sourceforge.net/http://www.voip-info.org/wiki/view/Asterisk+AGI+phpI'm copying from the 2nd page:
Asterisk always sends a bunch of info each time agi is called as follows:
agi_request: test.php
agi_channel: Zap/1-1
agi_language: en
agi_type: Zap
agi_callerid:
agi_dnid:
agi_context: default
agi_extension: 1000
agi_priority: 1
.
Save the info with this function (or the example below):
while (!feof($stdin)) {
$temp = fgets($stdin);
$temp = str_replace("\n","",$temp)
;
$s = explode(":",$temp);
$agivar[$s[0]] = trim($s[1]);
if $temp == "") {
break;
}
}
This will leave you will an array variable called $agivar. The available options are..
* agi_request - The agi filename
* agi_channel - The originating channel (Your phone)
* agi_language - Typically "en"
* agi_type - The originateing channel type eg "sip" or "zap"
* agi_uniqueid - A unique ID for the call
* agi_callerid - The caller ID eg Joe Soap <1234>
* agi_context - Origin context
* agi_extension - The called number
* agi_priority - The priority it was executed as in the dial plan
* agi_accountcode - Account code of the origin channel eg joesoap1
To use simply call the variable and the key.. eg If you want the called number simply use the variable $agivar[agi_extension] in your PHP code..