[英]Custom cdr fields for outgoing calls using asterisk
我试图利用自定义字段使用cdr日志记录(到mysql)。 我所面临的问题仅是在拨出电话时,在拨入电话期间,自定义字段没有问题。
我遇到问题的原因是,我需要的自定义cdr字段是系统上每个用户的唯一值。
sip.conf
...
...
[sales_department](!)
type=friend
host=dynamic
context=SalesAgents
disallow=all
allow=ulaw
allow=alaw
qualify=yes
qualifyfreq=30
;; company sales agents:
[11](sales_agent)
secret=xxxxxx
callerid="<...>"
[12](sales_agent)
secret=xxxxxx
callerid="<...>"
[13](sales_agent)
secret=xxxxxx
callerid="<...>"
[14](sales_agent)
secret=xxxxxx
callerid="<...>"
extensions.conf文件
[SalesAgents]
include => Services
; Outbound calls
exten=>_1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@myprovider)
; Inbound calls
exten=>100,1,NoOp()
same => n,Set(CDR(agent_id)=11)
same => n,CELGenUserEvent(Custom Event)
same => n,Dial(${11_1},25)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(unavail),VoiceMail(11@asterisk)
same => n,Hangup()
same => n(busy),VoiceMail(11@asterisk)
same => n,Hangup()
exten=>101,1,NoOp()
same => n,Set(CDR(agent_id)=12)
same => n,CELGenUserEvent(Custom Event)
same => n,Dial(${12_1},25)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(unavail),VoiceMail(12@asterisk)
same => n,Hangup()
same => n(busy),VoiceMail(12@asterisk)
same => n,Hangup()
...
...
对于上述示例中拨号计划的入站部分,我可以插入自定义cdr字段(agent_id)。 但是在其上方,您可以看到Dialplan的Oubound部分,我很困惑如何告诉Dialplan哪个agent_id在进行出站呼叫。
我的问题:如何获取agent_id = [11]和agent_id = [12]和agent_id = [13]和agent_id = [14]等,并将其用作出站呼叫中cdr的自定义字段?
您应该能够使用CALLERID函数 。 尝试在拨号方案中对此进行编码以作为测试:
exten=6599,1,Answer()
exten=6599,n,Verbose(Caller id name=${CALLERID(name)})
exten=6599,n,Verbose(Caller id num=${CALLERID(num)})
exten=6599,n,Verbose(Caller id all=${CALLERID(all)})
exten=6599,n,SayNumber(${CALLERID(num)})
exten=6599,n,Hangup()
拨打6599时,您应该在控制台上看到正在呼叫的电话号码,并听到您打过的电话号码。 在这种情况下,您应该可以为日志记录执行以下操作:
same => n,Set(CDR(agent_id)=${CALLERID(num)})
要使用这种方法,请不要使用sip.conf callerid=
来设置或隐藏callerid。 相反,请在阅读了自己的呼叫者编号后在拨号计划中编码。 例如:
same => n, Set(CALLERID(all)=""<>)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.