简体   繁体   English

使用星号的拨出电话的自定义cdr字段

[英]Custom cdr fields for outgoing calls using asterisk

I am trying to utilize the cdr logging (to mysql) using custom fields. 我试图利用自定义字段使用cdr日志记录(到mysql)。 The problem I am facing is only when an outbound call is placed, during inbound calls the custom field I am able to log no problem. 我所面临的问题仅是在拨出电话时,在拨入电话期间,自定义字段没有问题。

The reason I am having an issue is because the custom cdr field I need is a unique value for each user on the system. 我遇到问题的原因是,我需要的自定义cdr字段是系统上每个用户的唯一值。

sip.conf 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 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()

    ...
    ...

For the inbound section of the dialplan in the above example I am able to insert the custom cdr field (agent_id). 对于上述示例中拨号计划的入站部分,我可以插入自定义cdr字段(agent_id)。 But above it you can see for the Oubound section of the dialplan I have been stumped on how I would be able to tell the dialplan which agent_id is making the outbound call. 但是在其上方,您可以看到Dialplan的Oubound部分,我很困惑如何告诉Di​​alplan哪个agent_id在进行出站呼叫。

My Question: how to take the agent_id=[11] & agent_id=[12] and agent_id=[13] and agent_id=[14] etc and use that as a custom field for cdr on outbound calls? 我的问题:如何获取agent_id = [11]和agent_id = [12]和agent_id = [13]和agent_id = [14]等,并将其用作出站呼叫中cdr的自定义字段?

You should be able to do it with the CALLERID function . 您应该能够使用CALLERID函数 Try coding this in your dialplan as a test: 尝试在拨号方案中对此进行编码以作为测试:

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()

When you call 6599, you should see the number you're calling from displayed on the console, and hear your number played to you. 拨打6599时,您应该在控制台上看到正在呼叫的电话号码,并听到您打过的电话号码。 In which case you should be able to do something like this for your logging: 在这种情况下,您应该可以为日志记录执行以下操作:

same => n,Set(CDR(agent_id)=${CALLERID(num)})


EDIT 编辑

To use this approach, don't use the sip.conf callerid= to set or hide callerid. 要使用这种方法,请不要使用sip.conf callerid=来设置或隐藏callerid。 Instead, code that here in the dialplan, after you've read the callerid for your own use. 相反,请在阅读了自己的呼叫者编号后在拨号计划中编码。 For example: 例如:

 same => n, Set(CALLERID(all)=""<>) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM