我正在通过AGI / PHP脚本开发一个带有数据库集成的每分钟付费呼叫服务。我已经很好地完成了集成部分,但我很困惑如何以不暴露任何一方的个人信息(例如CID信息)的方式连接客户端和提供商。此外,我必须能够跟踪双方的连接时间(准确计费)。
基本上,这是呼叫流程的简要说明:
有任何想法吗?我已经在互联网上搜了好几个小时,甚至没有找到任何例子,甚至远远接近我想做的事情。
我很感激任何人都可以提供任何帮助,或者如果有人有任何例子,并且过去曾做过类似的事情。
编辑:
这是我的拨号计划:
exten => 1,1,Read(acode,enter_acode,6)
same => Set(ACODE = ${acode})
same => n,agi(baba.agi,get_call,${acode})
same => n,GotoIf($["${CALLSTAT}" == "1"]?call-ok:call-bad)
same => n(call-bad),GotoIf($["${CALLSTAT}" == "2"]?ag-unavail:call-not-found)
same => n(call-not-found),Playback(acode_invalid)
same => n,Goto(baba,1,1)
same => n(ag-unavail),Read(opt,ag_unavail,1)
same => n,GotoIf($["${opt}" == "1"]?ag-notify:no-call)
same => n(ag-notify),agi(baba.agi,ag_notify,${ACODE})
same => n,GotoIf($["${NSTAT}" == "1"]?notify-ok:call-error)
same => n(notify-ok),Playback(ag_notify)
same => n,Goto(baba,s,1)
same => n(call-ok),Read(opt,call_ready,1)
same => n,GotoIf($["${opt}" == "1"]?start-call:no-call)
same => n(start-call),Playback(attempt_connect)
HERE IS WHERE I WANT TO CALL ${APHONE}
same => n,Goto(no-call)
same => n(no-call),Playback(no_call)
same => n,Goto(baba,s,1)
same => n(call-error),Playback(error_proc_req)
same => n,Goto(baba,s,1)
这是我的PHP agi的功能:
function get_call()
{
global $db;
log_agi("Retrieving call information for access code: {$this->agi_arg_2}");
$q = "SELECT * FROM `call-user` WHERE `call_code`='%s' AND `call_status`=1 LIMIT 1";
$q = sprintf($q,$this->agi_arg_2);
$res = $db->query($q);
db_error($db,$q);
if ($res->num_rows > 0)
{
$call = $res->fetch_object();
log_agi("Call #{$call->call_id} found! Checking agent availability...");
if ($call->ag_avail)
{
log_agi("Agent is available! User Phone: {$call->user_phone}, Agent Phone: {$call->ag_phone}");
execute_agi("SET VARIABLE CALLSTAT 1");
execute_agi("SET VARIABLE UPHONE {$call->user_phone}");
execute_agi("SET VARIABLE APHONE {$call->ag_phone}");
return true;
}else{
log_agi("Agent [{$call->ag_username}] is unavailable!");
execute_agi("SET VARIABLE CALLSTAT 2");
return false;
}
}else{
log_agi("Call associated with access code #{$this->agi_arg_2} was not found!");
execute_agi("SET VARIABLE CALLSTAT 0");
return false;
}
}
谢谢!
我认为Follow Me应用程序会对您感兴趣。它具有内置功能,可以调用目标,播放消息并让目标按键接受呼叫(默认情况下为1)。
要进行结算,请使用Call Data Records (CDR)。您可以添加自己的字段。