我正在开发通过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;
}
}
谢谢!
答案 0 :(得分:0)
我认为Follow Me应用程序将使您感兴趣。 它具有内置功能,可以呼叫目的地,播放消息并让目的地按一个键来接受呼叫(默认为1)。
要计费,请使用Call Data Records (CDR)。您可以添加自己的字段。