Temporary overwrite of an Extension with own function

I built an function like this:

100 is the Boss
102 is his Secretary
_55 toggles the funktion

When someone except the Secretary calls the boss it is redirected to his Secretary if the function is on.

This function is working fine in extensions_custom. But the moment I try to integrate it with freepbx features, it turns ugly.
I had to bandage fix the voicemail functionality and later I found out that Camp-On is broken as well.

So my question is:
How do I integrate this temporary redirect, so the functions of freepbx work without bandage fixes?

Thank you for your help :slight_smile: .

The most direct solution would be to just assign 9999 to the boss and tell everyone to call 100. but that would not work for long as people are very creative in cutting corners.


exten => 100,1,Macro(CScall,102,herbert)
exten => 101,1,Macro(CScall,105,achim)

include => from-internal
exten => _55,hint,Custom:herbert
exten => _55,1,Macro(CStoggle,herbert)

include => from-internal
exten => _66,hint,Custom:achim
exten => _66,1,Macro(CStoggle,achim)

exten => s,1,GotoIf($[${EXISTS(${DB(CF/${ARG2})}}]?aktiv:sek)
same => n(aktiv),GotoIf($[${CALLERID(num)}=${ARG1}]?sek:nosek)
same => n(nosek),Set(__RINGTIMER=20)
same => n,Macro(exten-vm,${MACRO_EXTEN},${ARG1},0,0,0)
same => n,Set(__PICKUPMARK=)
same => n,Macro(vm,${MACRO_EXTEN},${DIALSTATUS},${IVR_RETUM})
same => n,Goto(skip)
same => n(sek),Set(__RINGTIMER=20)
same => n,Macro(exten-vm,${MACRO_EXTEN},${MACRO_EXTEN},0,0,0)
same => n,Set(__PICKUPMARK=)
same => n,Macro(vm,${MACRO_EXTEN},${DIALSTATUS},${IVR_RETUM})
same => n(skip),Noop()

exten => s,1,Answer()
same => n,GotoIf($[${EXISTS(${DB(CF/${ARG1})}}]?aktiv:inaktiv)
same => n(inaktiv),Set(DB(CF/${ARG1})=1))
same => n,Set(DEVICE_STATE(Custom:${ARG1})=RINGING)
same => n,Hangup()
same => n(aktiv),Noop(${DB_DELETE(CF/${ARG1})})
same => n,Set(DEVICE_STATE(Custom:${ARG1})=NOT_INUSE)
same => n,Hangup()[/code]