Outgoing Call Forwarding Database

I’m trying to set up a way for users to enter a number (A) followed by another number (B) that it will be forwarded to. This would then be stored in a database so that whenever anyone dials A the call will be placed to B.

A real world explanation is I want to prevent users from calling 0845 and 0870 numbers (UK non geographic numbers) as they cost more than calling geographic numbers. When a user dials a 0845 or 0870 number they’ll be told to check a website which lists alternative numbers and then call back with the alternative number. The alternative number would be listed along side the 0845/0870 number in the database. The end result would be that whenever that 0845/0870 number is dialed * would automatically dial the geographic number thus saving money.

I can do this all quite happily with dial plans however I have no great desire to go through the UK phone book listing all the 0845/0870 numbers and their alternatives. Thus I wish to create a system where by users can enter the two numbers either using their phone or a web based application. These numbers would then be stored in a database which * could access through a dial plan.

I come unstuck at the “how-to-get-users-to-do-this” part. I want to make it as easy as possible for the users without having them editing dial plans directly… Does anyone have any ideas as to how I might go about doing this? I’m thinking MySQL (not really experienced in using this) and something to do with AGI scripts possibly (only just started playing with these).

Thanks in advance for any help received!

Chris

Hi This is basicly a system speeddial.

exten => _908.,1, set(spnum=${DB(speed/${EXTEN:1})}) ;sets spnum to be the required bin number exten => _908.,2, Dial(Local/9${spnum}@${CONTEXT}) exten => _908.,3, Congestion
at its simplist

with entries in the astdb such as [quote]speed 08451231234 [/quote]

this would mean when a user dials 908451231234 the system dials 908451231234 in their context.

Ian

Ian,

Thanks for that. I wasn’t aware that you could make db entries in extensions. From that I’ve managed to throw together what I was after.

This is a rough working copy. I still need to fluff it up with a few voice prompts for the users so they know what to do!

exten=_908XXXXX.,1,SetGlobalVar(dial=${EXTEN:1}) exten=_908XXXXX.,2,Set(dialcheck=${DB_EXISTS(cfwd/${dial})}) ;checks to see if there is a db entry for the dialed number exten=_908XXXXX.,3,GotoIf(${dialcheck}=1?4:7) ;DB_EXISTS returns a 1 if the key exists exten=_908XXXXX.,4,Set(dialthis=${DB(cfwd/${dial})}) exten=_908XXXXX.,5,Dial(${SIPOUT}/${dialthis}) exten=_908XXXXX.,6,Hangup() exten=_908XXXXX.,7,SetGlobalVar(numbera=${EXTEN:1}) ;stores the 0845/0870 number to create the db entry exten=_908XXXXX.,8,Hangup() exten=_310[12]ZZZXXXXXX,1,SetGlobalVar(numberb=${EXTEN:2}) ;stores the alternative number to create db entry exten=_310[12]ZZZXXXXXX,2,Set(DB(cfwd/${numbera})=${numberb}) ;creates the db entry which is searched for by DB_EXISTS exten=_310[12]ZZZXXXXXX,3,Hangup()

What happens here is the user dials a 0845/0870 number. * checks it’s db to see if there is an entry for the 0845/0870 number. If there is it sets the result as a variable to be dialed. If there is no record of the number then it is stored in a separate variable. The user then needs to call back with the geographic number prefixing it with 31. The db entry is then created from these two numbers.

An example would:
1 - User dials 0845100100
2 - *db has no entry so stores this number
3 - User dials 31 01234567890 which is the geographic number for step 1
4 - * creates a db entry cfwd/0845100100 = 01234567890

Now whenever a user dials 0845100100 * will place the call to 01234567890.

Hope that makes sense and any comments or improvements are welcome.

Chris

can any one tel me how to forward the caller id on the forwarded call to the pstn.
suppose I have forwarded call from the extension to the moble number
, but it is not passing caller id of the caller on my mobile, so i want to forward caller id of the calling phone to the mobile.

W/R,
sam

Does you carrier allow you to do this ?
Many wont and some will.

Ian

Hi
try this if you want call foward with asterisk databse astdb
[callfwd]

exten => _*72011X.,1,Set(DB(CFIM/${CALLERID(num)})=${EXTEN:6})
exten => _*72011X.,2,Playback(call-forward)
exten => _*72011X.,3,Hangup

supposed usr dailed *72011441234567890 then in datbase file astdb actual number stored is 441234567890
when anybody dail number of user A then its forwarded to number of user B that is 441234567890
for this you have to smartely set out dail call & its context also you have to include this callfwd contex in user extension context. this is one way for call forward using databse astdb you can modify as per your need.

[quote=“amit”]Hi
try this if you want call foward with asterisk databse astdb
[callfwd]

exten => _*72011X.,1,Set(DB(CFIM/${CALLERID(num)})=${EXTEN:6})
exten => _*72011X.,2,Playback(call-forward)
exten => _*72011X.,3,Hangup

supposed usr dailed *72011441234567890 then in datbase file astdb actual number stored is 441234567890
when anybody dail number of user A then its forwarded to number of user B that is 441234567890
for this you have to smartely set out dail call & its context also you have to include this callfwd contex in user extension context. this is one way for call forward using databse astdb you can modify as per your need.[/quote]

Done with the above configurations … but…
can any one tel me how to forward the caller id on the forwarded call to the pstn.
suppose I have forwarded call from the extension to the moble number
, but it is not passing caller id of the caller on my mobile, so i want to forward caller id of the calling phone to the mobile.

W/R,
sam