【问题标题】:Custom cdr fields for outgoing calls using asterisk使用星号的拨出呼叫的自定义 cdr 字段
【发布时间】:2014-06-07 19:39:07
【问题描述】:

我正在尝试使用自定义字段来利用 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)。但在它上面你可以看到拨号方案的出站部分,我一直被难倒在我如何能够告诉拨号方案哪个 agent_id 进行出站呼叫。

我的问题:如何获取 agent_id=[11] & agent_id=[12] 和 agent_id=[13] 和 agent_id=[14] 等,并将其用作 cdr 出站呼叫的自定义字段?

【问题讨论】:

  • 服务器配置问题与Stack Overflow 无关。你应该问Server Fault
  • 那么为什么会有专门为星号 Mike 指定的标签?
  • 这个问题不是关于管理我的星号系统所在的服务器,而是专门关于对拨号方案进行编程......与服务器无关?恐怕它比 serverfault 更适合 stackoverflow...
  • 我不同意,但为了清楚了解这应该去哪里,我在Meta Stack Overflow 上发布了this question
  • 我想说这比 StackOverflow 上的大多数 Asterisk 问题更合适。如果这被关闭为“离题”,您也可以关闭 90% 的其他 Asterisk 相关问题。

标签: mysql asterisk


【解决方案1】:

您应该可以使用CALLERID function 来完成此操作。尝试在您的拨号计划中对此进行编码作为测试:

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。相反,在您阅读了自己使用的 callerid 之后,在拨号方案中编写代码。例如:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多