IVR does not work in macro

Hi peeps,

I have this macro:

[macro-extern7]
exten => s,1,GotoIfTime(,,1,jan?afterhours)
exten => s,n,NoOp(${CALLERID(num)})
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Background(winkel_kilomeet_welkom)
exten => s,n,Hangup()

exten => s,n(afterhours),Answer()
exten => s,n,Playback(winkel_kilomeet_outofoffice)
exten => s,n,Wait(1)
exten => s,n,Hangup()

exten => 1,1,Wait(1)
exten => 1,n,Playback(dispatching_welkom)
exten => 1,n,Dial(${RINGROUP1},60,tm)
exten => 1,n,Hangup()

exten => 2,1,Wait(1)
exten => 2,n,Dial(SIP/3900,30,t)
exten => 2,n,Dial(SIP/0499511255,60,t)
exten => 2,n,Hangup()

The “1” or “2” extensions are not being recognized (“Invalid extension”). It does work when I put the lines for the 1 and 2 extension outside of the macro, but then I can only use 1 IVR.

Why is the IVR in the macro not working?

Cheers,

BC

Macros have been deprecated for the best part of a decade! You shouldn’t be using them in new designs. They will result in many warnings being logged.

Background and WaitExten are rather special in that, internally, they effectively restart the PBX as though the number was received from a device whose context= setting was the current context. The context allocated to a device is never a macro (Asterisk may or may not check this, but I’m sure it would break if it isn’t explicitly faulted).

I’m not sure, but you may find that, in your case, the PBX restart is in the most recent normal context on the call stack.

Basically totally unsupported usage.

Although Asterisk Module Deprecations - Asterisk Project - Asterisk Project Wiki says they were deprecated in Asterisk 16, I think that really reflects a formalisation of the deprecation records, as I believe it was actually first deprecated in 1.6. Also note that it is planned to completely remove them in the next but one release.

Hi David,

I’m aware there is a replacement for macros but throughout the years I basically kept on using the same dialplan skeleton as it catered to my every need.
The error message points indeed to a context where I refer to my macros. I can put the IVR there for the time being and as soon there is the need for a second IVR, migrate to the macro replacement technology.

Thanks for your insight!

BC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.