Speed dial to manage Call Forwarding

I cant seem to find whether or not this is doable - though it seems like something that would be pretty standard.
We have freepbx running in a business environment. After business hours, it auto switches to an IVR. One of the IVR options is to connect to an “On Call Tech”. The “On Call Tech” is just extension 250 that call forwards to a cell phone. This cell phone number changes each Friday based on the tech on call.
When I was hoping is to setup a “Speed Dial” button on the receptions Grandstream phone - one for each tech that would ever be on call, all the receptionist would have to do is click their button on the grandstream phone and that would auto setup the forward. Is this possible?

Bonus points if BLF can be used instead to show which tech is currently active in the forward

There was a period a couple of years ago where we went through “20” different versions of this question, with buttons, BLFs, automation, databases, etc.

Setting a specific button to set the CFW for a specific extensions is trivial, getting a light to light showing which one is which is a little more challenging, but should be doable with some creative context work.

You can also do it from a web page by setting the CFW values in the Asterisk database to the values you want to use.

All in all, most of the ways to skin this cat are both relatively simple and prior art here within the forum.

Can you elaborate? I’ve scanned the forums and cannot seem to find this particular answer.
I’ve tried a speed dial with *72<ext><externalnumber>, *720<ext><externalnumber>, and *93<ext><externalnumber>. None of these seem to call forward the virtual extension to the external number :confused:

The BLF was just a bonus, but id be happy just to get this one touch call forwarding working

  1. Pick a new feature code.
  2. Set up a new context in /etc/asterisk/extensions_custom.conf.
  3. Hook the feature code to the context.
  4. In the new context, set the Call Forward Destination to wherever you want it to go.
  5. Next, set the Hint you want to watch to “InUse”.
  6. Clear the other “phone numbers” in the hints and the destination.

I appreciate your help @cynjut
I’ve actually never used contexts before, or setup custom feature codes. This part is definitely new to me. Did some reading and I came up with this so far

[from-internal-custom]
include => custom-601
include => custom-602

[custom-601]
;dial *601 to call forward ext 250 to tech #1
exten => *601,1,Playback(auth-thankyou)
exten => *601,2,Hangup()
;set blf??
exten => h,1,Hangup()


[custom-602]
;dial *602 to call forward ext 250 to tech #2
exten => *602,1,Playback(auth-thankyou)
exten => *602,2,Hangup()
;set blf??
exten => h,1,Hangup()

I just need to figure out the call forward commands, and setting the BLF hints. But am I on the right track so far? Or am I totally missing the boat on how to use contexts?

That looks pretty close. I haven’t tested it, but you are in the right path.

You need to look at the ASTDB Database Access commands next. “GET” and “PUT” (???) allow you to pull the current value out of the database and set values in the database.

It’s a hierarchical database, so it might take a few minutes to find out which database tuple is the one to use to set the CFW value to the external number. A hint: try setting the CFW for one of your regular extensions and see what Asterisk uses to process the call forward,

After that, you can look at the “hint()” function and figure out how to make the BLF work.

1 Like

@dobrosavljevic had us in support create something very similar which he has asked be shared with the community. You can adapt this to your needs if you want a separate button for each tech, or use as is if you want to re-enter the destination phone number each time.

5 Likes

Thanks @lgaetz, while Im sure its super helpful to most - that one went waaaay over my head…

@cynjut You definitely put me on the right track, learning a lot about ASTDB (probably more then I would want to right now lol!)

I have a super basic working piece that can call forward 2 different techs at the push of a button on the phone (using 601 and 602). The final result will have 6 different techs (all get cycled each Friday). The only piece im stuck with is the BLF, cant seem to get that working yet. Going to keep digging!

[from-internal-custom]
include => custom-601
include => custom-602

[custom-601]
;dial 601 to call forward ext 250 to tech #1
exten => 601,hint,Custom:ONCALL601
exten => 601,1,Set(DB(CF/250)=2045555555)
;set blf
exten => 601,n,Set(DEVICE_STATE(Custom:ONCALL601)=BUSY)
exten => 601,n,Set(DEVICE_STATE(Custom:ONCALL602)=NOT_INUSE)
;playback forwarding number
exten => 601,n,Playback(call-forward&has-been-set-to)
exten => 601,n,SayDigits(2045555555)
exten => 601,n,Hangup()


[custom-602]
;dial 602 to call forward ext 250 to tech #2
exten => 602,hint,Custom:ONCALL602
exten => 602,1,Set(DB(CF/250)=2046666666)
;set blf
exten => 602,n,Set(DEVICE_STATE(Custom:ONCALL601)=NOT_INUSE)
exten => 602,n,Set(DEVICE_STATE(Custom:ONCALL602)=BUSY)
;playback forwarding number
exten => 602,n,Playback(call-forward&has-been-set-to)
exten => 602,n,SayDigits(2046666666)
exten => 602,n,Hangup()


exten => h,n,Hangup()

Nevermind… maybe I spoke too soon? Just tried again and BLF was working! Maybe I got it!

1 Like

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