| Both sides previous revisionPrevious revision | |
| id_zh:二次开发者指南:接口开发手册_v2.0:通话实时事件获取 [2014/03/16 16:57] – [主要事件参数概述] solo | id_zh:二次开发者指南:接口开发手册_v2.0:通话实时事件获取 [2014/03/16 17:00] (current) – removed solo |
|---|
| ====== 通话实时事件获取 ====== | |
| |
| ===== 例子 ===== | |
| |
| 可参考页面代码 | |
| <code>http://$(ipaddress):$(port)/asterccinterface/astercc_nginx_http_push.html</code> | |
| |
| <note tip>如果要接受整个团队的所有事件,须在团队高级设置中填写“业务接口地址”=>127.0.0.1 | |
| |
| 登录服务器执行命令 | |
| |
| /etc/init.d/asterccd restart</note> | |
| |
| ===== 使用方法 ===== | |
| ==== 第三方页面引用asterCC安装服务器上的js文件==== | |
| |
| <code><script src="http://$(ipaddress):$(port)/asterccinterface/astercc_nginx_http_push.js"></script></code> | |
| 引用文件说明: | |
| 该文件用于实时获取asterCC端的通话事件 | |
| ==== 第三方页面创建JS函数sonAccept(message) ==== | |
| <code> | |
| function sonAccept(message) { | |
| |
| } | |
| </code> | |
| 创建函数说明: | |
| |
| 该函数用于接收实时的asterCC通话事件; | |
| * **sonAccept**:函数名,固定写法 | |
| * **message**:事件内容,字符串类型 | |
| message内容示例: | |
| message="calleridnum=041139735857&didnumber=8008008&activenum=041139735855&source=AGENT&event=ringing&uniqueid=78969&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:21:58&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=Local/015967121144@hosted-dialout-408a;1&from=dialout&"; | |
| |
| 推荐解析message事件字符串的方法: | |
| <code> | |
| var aryMessage = message.split('&'); | |
| var aryEvent = new Array(); | |
| for(i=0;i<aryMessage.length;i++) { | |
| var tmp = aryMessage[i].split('='); | |
| eval("aryEvent['"+tmp[0]+"'] = '"+tmp[1]+"';"); | |
| } | |
| </code> | |
| 这样将事件字符串拆分成数组形式,便于操作。 | |
| |
| ====处理事件==== | |
| 根据事件的不同,辨别通话进行的情况以及业务处理。例如在收到振铃事件时进行业务弹屏等。 | |
| ===== 典型流程 ===== | |
| |
| 下面针对典型的呼入和呼出流程列出asterCC在不同呼叫情况时传出的mseeage: | |
| |
| ====呼出==== | |
| * 坐席振铃: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=AGENT&event=ringing&uniqueid=19866&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:01&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=Local/041139735857@hosted-dialout-408a;1&from=dialout&";</code> | |
| * 坐席应答: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=AGENT&event=answer&uniqueid=19866&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:01&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel= &from=dialout&";</code> | |
| * 客户振铃: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=CALLEE&event=ringing&uniqueid=19867&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:01&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=Local/0138888888888@hosted-dialout-7636;1&from=dialout&";</code> | |
| * 客户应答: | |
| <code>message="calleridnum=041139735857&didnumber=&activenum=041139735857&source=CALLEE&event=answer&uniqueid=19867&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:09&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=&from=dialout&";</code> | |
| * 客户挂断: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=CALLEE&event=hangup&uniqueid=19867&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:47&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=Local/0138888888888@hosted-dialout-7636;1&from=dialout&";</code> | |
| * 坐席挂断: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=AGENT&event=hangup&uniqueid=19866&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:47&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=Local/041139735857@hosted-dialout-408a;1&from=dialout&";</code> | |
| * 通话整体结束事件: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=CONVERSATION&event=hangup&uniqueid=0&sessionid=efeb7b374a3408b0d0954f30a1504d83&eventTime=2010-01-01 08:22:47&AgentTeamId=20&modeltype=Campaign&model_id=10&AgentGroupId=100&calltype=dialout&channel=&from=dialout&";</code> | |
| |
| |
| ====呼入==== | |
| * 客户呼入: | |
| <code>message= "source=CALLER&event=incoming&modeltype=Campaign&uniqueid=1555&model_id=10&from=dialin&sessionid=1f10eab01f5b1b36230b8e91aef34810&channel=Local/0138888888888@hosted-dialin-701a;1";</code> | |
| * 坐席振铃: | |
| <code>message="calleridnum=0138888888888&didnumber=800888&activenum=041139735857&source=AGENT&event=ringing&uniqueid=1556&sessionid=1f10eab01f5b1b36230b8e91aef34810&eventTime=2010-01-01 11:11:07&AgentTeamId=3&modeltype=Campaign&model_id=10&AgentGroupId=100&from=dialin&channel=Local/041139735857@hosted-dialin-531a;1";</code> | |
| * 坐席应答: | |
| <code>message="calleridnum=0138888888888&didnumber=800888&activenum=041139735857&source=AGENT&event=answer&uniqueid=1556&sessionid=1f10eab01f5b1b36230b8e91aef34810&eventTime=2010-01-01 11:11:10&AgentTeamId=3&modeltype=Campaign&model_id=10&AgentGroupId=100&from=dialin&channel=";</code> | |
| * 客户挂断: | |
| <code>message="calleridnum=0138888888888&didnumber=800888&activenum=041139735857&source=CALLER&event=hangup&uniqueid=1555&sessionid=1f10eab01f5b1b36230b8e91aef34810&eventTime=2010-01-01 11:12:54&AgentTeamId=3&modeltype=Campaign&model_id=10&AgentGroupId=100&from=dialin&channel=Local/0138888888888@hosted-dialin-701a;1";</code> | |
| * 坐席挂断: | |
| <code>message="calleridnum=0138888888888&didnumber=800888&activenum=041139735857&source=AGENT&event=hangup&uniqueid=1556&sessionid=1f10eab01f5b1b36230b8e91aef34810&eventTime=2010-01-01 11:12:54&AgentTeamId=3&modeltype=Campaign&model_id=10&AgentGroupId=100&from=dialin&channel=Local/041139735857@hosted-dialin-531a;1";</code> | |
| * 通话整体结束事件: | |
| <code>message="calleridnum=0138888888888&didnumber=&activenum=041139735857&source=CONVERSATION&event=hangup&uniqueid=0&sessionid=1f10eab01f5b1b36230b8e91aef34810&eventTime=2010-01-01 11:12:54&AgentTeamId=3&modeltype=Campaign&model_id=10&AgentGroupId=100&channel=&from=dialin&";</code> | |
| |
| ====主要事件参数概述==== | |
| * **source**: 代表事件来源对象,它的值会是 | |
| * AGENT(坐席) | |
| * CALLER(呼入客户) | |
| * CALLEE(被叫客户) | |
| * CONVERSATION(全部通话) | |
| * CONSULT(第N方) | |
| <note important>source值全部是大写字母</note> | |
| * **event**: 代表发生了什么事件,它的值会是 | |
| * ringing(振铃) | |
| * answer(应答) | |
| * hangup(挂断) | |
| * join(加入) | |
| * incoming(来电) | |
| * onhold(暂停) | |
| * resume(恢复) | |
| <note important>event值全部是小写字母</note> | |
| * **calleridnum**: 代表客户电话,其值为客户的电话号码。 | |
| * **activenum**: 代表当前source的电话号码。 | |
| * **didnumber**: 代表DID号码。 | |
| * **eventTime**: 代表事件实际发生时间,一般用于记录通话记录,避免由于程序延迟而造成时间不准确。 | |
| * **sessionid**: 通话唯一标识,一通通话里所有事件都使用这个唯一标识,并且该唯一标识在系统内是唯一的,不会与其它通话重复。 | |
| * **from**: 用于区分通话是来电(呼入时值为dialin),还是去电(呼出时值为dialout)。 | |
| * **eventid**: 标识当前事件的id,当你发现你收到事件的id小于你记录的最大id,那么说明事件是过去时事件。 | |
| * **uniqueid**: 是source在当前系统中通话的唯一标识,调用系统一些事件功能时,当作参数。 | |
| * **channel**: 是source在当前系统中通话的通道,调用系统一些事件功能时,当作参数。 | |
| * **AgentTeamId**: 当前事件所属团队的ID。 | |
| * **AgentGroupId**: 当前事件所属坐席组的ID。 | |
| * **modeltype**: 标识当前事件应用于哪个模块。Campaign(拨号计划), Virtualcustomer (虚拟用户) | |
| * **model_id**: 根据modeltype 告知你某个计划的ID或某个虚拟用户的ID。 | |