1

Long story short: Fanvil phones don't allow you to change microphone volume (that is too low).

I've created this custom macro, but cannot match the case the phone (exten 131) is receiving a call, it work only when it make a call:

[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

This is from console:

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

It seems that ${EXTEN} is always the one that is calling, how can I catch the event of the 131 is the destination of the call?

asked Sep 30, 2021 at 7:32
1
  • Macro app is deprecated. Use GoSub instead of it, you can put anything in GoSub as dest. Commented Sep 30, 2021 at 17:08

1 Answer 1

0

As you can see ${EXTEN} inside a Macro is always s.
-- Executing [s@macro-fanvil:1] NoOp("SIP/195-00000096", "macro-fanvil: callerid: 195 - exten s- SIP/195-00000096") in new stack

You have to tell the Macro the ${EXTEN} when you calling it.
This is normally done with...
https://wiki.asterisk.org/wiki/display/AST/Macros
...at...
Calling Macro with arguments
...where the Argument from the calling Channel/Context is outputed in: Verbose()

Long story short: You have to change your Macro to check the Argument

[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

...and call it with Argument: Macro(fanvil,s,1,(${EXTEN}))

answered Sep 30, 2021 at 11:30
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.