Asterisk 11 在宏中匹配目标扩展
Asterisk 11 match destination extension in macro
长话短说:Fanvil phone不允许您更改微型phone音量(太低)。
我创建了这个自定义宏,但无法匹配 phone(分机 131)正在接听电话的情况,它仅在拨打电话时有效:
[macro-fanvil]
exten => s,1,NoOp(catch: callerid: ${CALLERID(num)} - exten ${EXTEN}- ${CHANNEL})
;exten => _131,n,Goto(receive)
exten => s,n,GotoIf($[${EXTEN} = 131]?receive)
exten => s,n,GotoIf($[${CALLERID(num)} = 131]?:iscalling)
exten => s,n(iscalling),NoOp(alzachiamante: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Set(VOLUME(RX)=10)
exten => s,n,MacroExit
exten => s,n(receive),NoOp(alzaricevente: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Answer()
exten => s,n,Set(VOLUME(TX)=10)
exten => s,n,MacroExit
这是来自控制台:
-- Executing [s@macro-fanvil:1] NoOp("SIP/195-00000096", "macro-fanvil: callerid: 195 - exten s- SIP/195-00000096") in new stack
-- Executing [s@macro-fanvil:2] GotoIf("SIP/195-00000096", "0?receive") in new stack
-- Executing [s@macro-fanvil:3] GotoIf("SIP/195-00000096", "0?:iscalling") in new stack
-- Goto (macro-fanvil,s,4)
Executing [s@macro-fanvil:4] NoOp("SIP/195-00000096", "alzachiamante: 195 - SIP/195-00000096") in new stack
-- Executing [s@macro-fanvil:5] Set("SIP/195-00000096", "VOLUME(RX)=10") in new stack
-- Executing [s@macro-fanvil:6] MacroExit("SIP/195-00000096", "") in new stack
似乎 ${EXTEN} 总是那个正在调用的,我怎样才能捕捉到 131 是调用目的地的事件?
如您所见,宏中的 ${EXTEN}
始终是 s
。
-- Executing [s@macro-fanvil:1] NoOp("SIP/195-00000096", "macro-fanvil: callerid: 195 - exten s- SIP/195-00000096") in new stack
调用时必须告诉宏${EXTEN}
。
这通常是通过...
https://wiki.asterisk.org/wiki/display/AST/Macros
...在...
正在调用带参数的宏
...调用 Channel/Context 的参数输出在:Verbose()
长话短说:您必须更改宏以检查参数
[macro-fanvil]
exten => s,1,NoOp(catch: callerid: ${CALLERID(num)} - exten ${ARG1}- ${CHANNEL})
;exten => _131,n,Goto(receive)
exten => s,n,GotoIf($[${ARG1} = 131]?receive)
exten => s,n,GotoIf($[${CALLERID(num)} = 131]?:iscalling)
exten => s,n(iscalling),NoOp(alzachiamante: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Set(VOLUME(RX)=10)
exten => s,n,MacroExit
exten => s,n(receive),NoOp(alzaricevente: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Answer()
exten => s,n,Set(VOLUME(TX)=10)
exten => s,n,MacroExit
...并用参数调用它:Macro(fanvil,s,1,(${EXTEN}))
长话短说:Fanvil phone不允许您更改微型phone音量(太低)。
我创建了这个自定义宏,但无法匹配 phone(分机 131)正在接听电话的情况,它仅在拨打电话时有效:
[macro-fanvil]
exten => s,1,NoOp(catch: callerid: ${CALLERID(num)} - exten ${EXTEN}- ${CHANNEL})
;exten => _131,n,Goto(receive)
exten => s,n,GotoIf($[${EXTEN} = 131]?receive)
exten => s,n,GotoIf($[${CALLERID(num)} = 131]?:iscalling)
exten => s,n(iscalling),NoOp(alzachiamante: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Set(VOLUME(RX)=10)
exten => s,n,MacroExit
exten => s,n(receive),NoOp(alzaricevente: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Answer()
exten => s,n,Set(VOLUME(TX)=10)
exten => s,n,MacroExit
这是来自控制台:
-- Executing [s@macro-fanvil:1] NoOp("SIP/195-00000096", "macro-fanvil: callerid: 195 - exten s- SIP/195-00000096") in new stack
-- Executing [s@macro-fanvil:2] GotoIf("SIP/195-00000096", "0?receive") in new stack
-- Executing [s@macro-fanvil:3] GotoIf("SIP/195-00000096", "0?:iscalling") in new stack
-- Goto (macro-fanvil,s,4)
Executing [s@macro-fanvil:4] NoOp("SIP/195-00000096", "alzachiamante: 195 - SIP/195-00000096") in new stack
-- Executing [s@macro-fanvil:5] Set("SIP/195-00000096", "VOLUME(RX)=10") in new stack
-- Executing [s@macro-fanvil:6] MacroExit("SIP/195-00000096", "") in new stack
似乎 ${EXTEN} 总是那个正在调用的,我怎样才能捕捉到 131 是调用目的地的事件?
如您所见,宏中的 ${EXTEN}
始终是 s
。
-- Executing [s@macro-fanvil:1] NoOp("SIP/195-00000096", "macro-fanvil: callerid: 195 - exten s- SIP/195-00000096") in new stack
调用时必须告诉宏${EXTEN}
。
这通常是通过...
https://wiki.asterisk.org/wiki/display/AST/Macros
...在...
正在调用带参数的宏
...调用 Channel/Context 的参数输出在:Verbose()
长话短说:您必须更改宏以检查参数
[macro-fanvil]
exten => s,1,NoOp(catch: callerid: ${CALLERID(num)} - exten ${ARG1}- ${CHANNEL})
;exten => _131,n,Goto(receive)
exten => s,n,GotoIf($[${ARG1} = 131]?receive)
exten => s,n,GotoIf($[${CALLERID(num)} = 131]?:iscalling)
exten => s,n(iscalling),NoOp(alzachiamante: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Set(VOLUME(RX)=10)
exten => s,n,MacroExit
exten => s,n(receive),NoOp(alzaricevente: ${CALLERID(num)} - ${CHANNEL})
exten => s,n,Answer()
exten => s,n,Set(VOLUME(TX)=10)
exten => s,n,MacroExit
...并用参数调用它:Macro(fanvil,s,1,(${EXTEN}))