Call Forwarding using web button

Hello, Forum:

I`d like to develop a special button in my company´s groupware (web based) to enable / disable call forward (*72 / *73) on the user´s extension. I know the UCP has this ability, but I´d like to provide the same functionality from inside the groupware. Any pointers or tips about where I should begin to look?

Thanks a lot!

Looking into the source code, I´ve found the “setNumberByExtension” function from callforward/Callforward.class.php.

So I´m guessing this is a matter of inserting the configuration into the database:

return $this->astman->database_put($cf_type, $extension, $number);

It is possible to achieve the same result via command line, for example?


Another way is to set it using the ASTDB values.

Something like “rasterisk ‘database put $extension/CFW’” would work, and you can use a PHP “system()” function to make it happen. The database key is wrong, but logging into the server (using the console or SSH) and running ‘asterisk -vr’ will get you to the command line and you can use help and tab-completion to get and set the specific data keys you are looking for.

@lgaetz also wrote some code and dropped it on GitHub (IIRC) that allows you to do a lot of this from a webpage.

1 Like

Thanks a lot @cynjut!

In case anyone is wondering, this is in fact really direct and easy to do.

Here are some examples.

For unconditional call forwarding:

22 is the extension
55 is the destination extension
CF means Call Forward (unconditional)

Get the current value:

asterisk -rx "database get CF 22"

(Returns “Database entry not found.” if not set)

Set unconditional forward:

asterisk -rx "database put CF 22 55"

Reset / Remove the forward:

asterisk -rx "database del CF 22"

If you want to list all the unconditional forwards:

asterisk -rx "database show CF"

If you want to list all the families and values in the database:

asterisk -rx "database show"

PS: CFU is the family (or “group”) for call forward when unavailable and CFB call forward when busy.

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