Solution for remotely enabling call forwarding via the phone
RonW was able to help me use existing FreePBX code to enable call forwarding remotely by phone.
As I had been searching for a solution, others were looking for the same functionality – an example I saw was:
“A sales guy is stuck in traffic, and is expecting an important call from a client. The sales guy dials into the system, and turns on call forwarding…”
To me – having this functionality is allot like everything else about Asterisk/FreePBX – you don’t need something until a new scenario comes along. Once again, it seems like anything some other phone system does, Asterisk can do as well.
The first part is to put the following code into the extensions_custom.conf:
[from-racf]
exten => 72,1,Answer
exten => 72,n,Wait(1)
exten => 72,n,Macro(user-callerid,)
exten => 72,n,Playback(call-fwd-unconditional)
exten => 72,n,Playback(please-enter-your&extension)
exten => 72,n,Read(fromext,then-press-pound,,,,)
exten => 72,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${AMPUSER}:${fromext})})
exten => 72,n,Wait(1)
exten => 72,n(startread),Playback(ent-target-attendant)
exten => 72,n,Read(toext,then-press-pound,,,,)
exten => 72,n,GotoIf($["foo${toext}"="foo"]?startread)
exten => 72,n,Wait(1)
exten => 72,n,Set(DB(CF/${fromext})=${toext})
exten => 72,n,Playback(call-fwd-unconditional&for&extension)
exten => 72,n,SayDigits(${fromext})
exten => 72,n,Playback(is-set-to)
exten => 72,n,SayDigits(${toext})
exten => 72,n,Macro(hangupcall,)
exten => _72.,1,Answer
exten => _72.,n,Wait(1)
exten => _72.,n,Macro(user-callerid,)
exten => _72.,n,Set(DB(CF/${AMPUSER})=${EXTEN:2})
exten => _72.,n,Playback(call-fwd-unconditional&for&extension)
exten => _72.,n,SayDigits(${AMPUSER})
exten => _72.,n,Playback(is-set-to)
exten => _72.,n,SayDigits(${EXTEN:2})
exten => _72.,n,Macro(hangupcall,)
exten => 73,1,Answer
exten => 73,n,Wait(1)
exten => 73,n,Macro(user-callerid,)
exten => 73,n,dbDel(CF/${AMPUSER})
exten => 73,n,Playback(call-fwd-unconditional&de-activated)
exten => 73,n,Macro(hangupcall,)
exten => _73.,1,Answer
exten => _73.,n,Wait(1)
exten => _73.,n,Set(fromext=${EXTEN:2})
exten => _73.,n,dbDel(CF/${fromext})
exten => _73.,n,Playback(call-fwd-unconditional&for&extension)
exten => _73.,n,SayDigits(${fromext})
exten => _73.,n,Playback(cancelled)
exten => _73.,n,Macro(hangupcall,)
exten => 74,1,Answer
exten => 74,n,Wait(1)
exten => 74,n,Playback(please-enter-your&extension)
exten => 74,n,Read(fromext,then-press-pound,,,,)
exten => 74,n,Wait(1)
exten => 74,n,dbDel(CF/${fromext})
exten => 74,n,Playback(call-fwd-unconditional&for&extension)
exten => 74,n,SayDigits(${fromext})
exten => 74,n,Playback(cancelled)
exten => 74,n,Macro(hangupcall,)
exten => h,1,Hangup
exten => i,1,Hangup
exten => T,1,Hangup
Then put the following in the vm_general .inc
dialout=from-racf
To use the code, the user would call into their voice mail, and then go into advanced options (3), then press 4 which enables the racf code. From there, the user would enter in the following:
72NXXXXX# or 72NXXNXXXXXX# (Sub the N & X for their phone number they want to forward to). If they just want to forward to another extension, they would put in 72XXX#
To turn off call forwarding, they would follow the same procedure - but then dial 73# after they press 4 within advanced options.
Ron also pointed out that instead of putting the dialout=racf in the vm_general.inc, you can limit who gets this functionality by putting dialout=racf in the extension within FreePBX. Scroll down to the Voicemail & Directory section, and in the ‘VM Options’ text field, enter in dialout=racf
I still have some more work to do before implementing – like changing the voice prompts to be more specific for the actual usage, etc – but this does exactly what I want it do as far as functionality.
Thanks again RonW!
Tom