Asterisk unconditional redirect

Dear All,

I am having problems with my Asterisk 1.8 setup. I would like to enable the 21number unconditional redirect feature. So far here is what I have done:
I edited extensions.conf:
exten = 21,1,Set(DB(CFIM/8xx)=number)
exten = 21,2,Hangup

In the trunk configuration I added:
include = CallingRule_redirect

Now if I call the above number I get a “declined” message on my phone, and nothing happens. In the above example I have “hard coded” the extension to redirect and the number to call just to make debugging easier. Of course, in the real enviroment it must be replaced with variables.

Here is the CLI output of the call:

-- Executing [*21*@DLPN_Main:1] Set("SIP/817-00000d6c", "DB(CFIM/817)=06309xxxxxxx") in new stack
-- Auto fallthrough, channel 'SIP/817-00000d6c' status is 'UNKNOWN'

I wanted to see if the system is handling the 21 at all, so I changed the above lines as:
exten = 21,1,Dial(SIP/trunk_5/0630xxxxxxx, 600, A(beeperr))

this works fine.

What steps am I missing for the redirect to work?

Thank you for the help!

When handling the incoming call, read the entry in the AstDB (for the individual extension) and route the call accordingly (one way if CFWD is enabled and a different way if CFWD is disabled).