星号拨号方案功能

时间:2013-11-05 22:17:40

标签: asterisk

我想知道是否有人知道使用星号拨号方案是否可以进行以下操作,如果是,我会在哪里找到编程信息。

1)代理拨打分机号码,例如1234

2)代理DND状态打开/关闭 3)MWI改为反映DND状态,如果DND MWI

4)更新MySql DB以记录状态更改的时间

提前致谢

1 个答案:

答案 0 :(得分:0)

我希望我没有误解你的意图,以下代码会给你一些启发

[ext-local-custom]
exten => 1234,1,Answer()
; Ask agent to input action
; 1 - enable DND
; 0 - disable DND
exten => 1234,n(input),Read(digito,enter-toggled-on-off,1)
exten => 1234,n,GotoIf($["foo${digito}"="foo1"]?toggledOn)
exten => 1234,n,GotoIf($["foo${digito}"="foo0"]?toggledOff)
exten => 1234,n,Playback(invalid)
exten => 1234,n,Goto(input)
exten => 1234,n(toggledOn),NoOP(section toggled On)
; Set DND ON
exten => 1234,n,Set(DB(DND/${CALLERID(number)})=YES)
; MySQL record action
exten => 1234,n,MySql(connect connid localhost root  test)
exten => 1234,n,MySql(query resultidr ${connid} INSERT INTO `test`.`togglelog` (`exten`\,`toggle`\,`logtime`)VALUES (\'${CALLERID(number)}\'\,1\,\'${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)}\'))
exten => 1234,n,Goto(end)
exten => 1234,n(toggledOff),NoOP(section toggled Off)
; Set DND Off
exten => 1234,n,DBdel(DND/${CALLERID(number)})
; MySQL record action
exten => 1234,n,MySql(connect connid localhost root  test)
exten => 1234,n,MySql(query resultidr ${connid} INSERT INTO `test`.`togglelog` (`exten`\,`toggle`\,`logtime`)VALUES (\'${CALLERID(number)}\'\,0\,\'${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)}\'))
exten => 1234,n,Goto(end)
exten => 1234,n(end),Hangup()