Answer the question
In order to leave comments, you need to log in
How to get the phone number using PHP through the AMI of the asterisk?
Actually, some kind of code example is needed, how to get some information about an incoming call, for example, a phone number, using the AMI asterisk through PHP.
Well, or in extreme cases, how can you interact with an asterisk using PHP at all? any sample code.
Answer the question
In order to leave comments, you need to log in
#!/usr/bin/php -q
<?php
require_once ('phpagi/phpagi.php');
$agi = new AGI();
// Получаем переменные из канала
$channel = $agi->request['agi_channel'];
$uniqueid = $agi->request['agi_uniqueid'];
$callerid = $agi->request['agi_callerid'];
$accountcode = $agi->request['agi_accountcode'];
$extension = $agi->request['agi_extension'];
$language = $agi->request['agi_language'];
?>
telnet localhost 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
UserName: myuser
Secret: mypass
Response: Success
Message: Authentication accepted
Event: Newchannel
Privilege: call,all
Channel: SIP/5062-0003d324
State: Down
CallerIDNum: 79311234567
CallerIDName:
Uniqueid: 1407331114.250660
Event: Newstate
Privilege: call,all
Channel: SIP/5062-0003d324
State: Ring
CallerID: 79311234567
CallerIDName:
Uniqueid: 1407331114.250660
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question