我正试图从用户那里获取DTMF,如果它等于零,那么将调用转移到一个分机,否则挂断。我已经写了以下的,但它直接播放无效的条目,并挂断了我的电话。希望能在这件事上提供帮助。
$wheretorec = $agi->exec("AGI","googletts.agi,\"To speak to an operator press zero.\",en");
$whereto = $agi->get_data($wheretorec, 10000, 1);
$dtmf = $whereto['result'];
if (is_numeric($dtmf ['0']))
{
$agi->exec("AGI","googletts.agi,\"Your call is now being transferred\",en");
$agi->exec('transfer',"SIP/123@12.345.678.901:5080");
$agi->hangup();
}
else
{
$agi->exec("AGI","googletts.agi,\"Invalid entry. Please try again later.\",en");
$agi->hangup();
}
}发布于 2014-07-05 02:39:49
就像这样
$dtmf = $whereto['result'];
if ($dtmf=="0")请阅读完整的phpagi文档和示例。
发布于 2014-07-05 18:10:38
$dtmfTemp = $agi->get_data("File_name_you_want_to_play", 6000, 1);
$dtmf = $dtmfTemp['result'];
if($dtmf=="0"){
//Do your stuff
}
else{
//Do your other stuff
}发布于 2014-07-07 09:10:42
这是对我有用的密码。如果我尝试什么,而不是‘沉默/1’或‘哔“,那么它会给我一个错误信息,无效的条目!
$press1 = $agi->get_data('silence/1',50000, 1);
$press1dtmf = $press1['result'];https://stackoverflow.com/questions/24581353
复制相似问题