Scheduled forwarding BT feature line

Hi guys,

I’m looking for a way to enable call forwarding on a BT feature line connected to our PBX. To enable the forwarding on the line I need to send *#21#(forward number)#.

I would like to do this automatically at say 17:00.

Any tips on best way to set this up? I had a quick look today but as I was pushed for time and it’s been a while since I played with asterisk/freepbx thought it best to ask some experts first :wink:

Don’t think you can do it from within the GUI, but you may be able to work something out at the Linux level. Google “asterisk .call file”. This might give you some ideas.

BF

Thanks Bill,

I couldn’t see anything obvious in the GUI either but wasn’t sure if anyone had perhaps developed a module for sending dtmf on schedules, I would think it could be quite handy…

Oh well I’ll see if I can do something with a call file

The Wakeup Call module will almost do what you need. You can use it to schedule a call to the required code. It will save a .call file in the /outgoing folder which you can use as a basis for your own custom file. Then create a cron job that copies this file as required to enable/disable call forwarding.

Thanks lgaetz, the wakeup call module did help a little when experimenting.

In the end I have 2 call files using the sendDTMF application. I have set-up cron jobs to copy the call files to the outgoing spool in the evening to enable forwarding and again in the morning to disable it.

Enable, called at night

channel: Local/[email protected]
maxretries: 3
retrytime: 60
waittime: 60
callerid: Enable Forwarding
application: sendDTMF
data: ww*#21#90123456789#

Disable, called in morning

channel: Local/[email protected]
maxretries: 3
retrytime: 60
waittime: 60
callerid: Disable Forwarding
application: sendDTMF
data: ww*#21#

Ah, I should have noted earlier. The proper way to create a .call file is to write/copy the file to a temporary folder, “touch” the file to set the time the call will be placed and then move it to the /outgoing folder. By writing/copying the file directly into /outgoing, it is possible for Asterisk to attempt to execute the file mid write with unpredictable results.

Thanks for the tip,

I had started that way, with bash script to set file times and copy so I could have a single cron job each day, I didn’t consider a mid-write execute a possibility, I’ll fix it up tomorrow :wink:

For completeness this is the little script I’m using, called by cron (each day at 06:50 for me). hopefully it’ll help someone else in the future :wink:

#!/bin/bash #Simple script to move the enable and disable call files to the asterisk outgoing #spool after setting the modified date to a specfic time with the touch command

#Make a copy of the original files
cp enable.call e1.call
cp disable.call d1.call

#Touch the files with the required call time
touch -d “7:00 today” d1.call # at 7am disable forwarding
touch -d “17:00 today” e1.call # at 5pm enable forwarding

#Move the files to the asterisk spool
mv e1.call /var/spool/asterisk/outgoing/
mv d1.call /var/spool/asterisk/outgoing/

Also for completeness, you can safely cp call.files touched in the future.