Howto: Using 'quick dial' numbers with FOP2
I have set up my Asterisk server to allow me to use "short" numbers to quick dial from dumb phones that cannot use a phonebook.
The idea is that I have added a field to the FOP2 (version 2.26) phonebook (or you can use "phone2" if you like) and I enter a short number (in my case, from 8000 to 8999) in that field, while I enter the real phone number in "phone1". Then, when a dumb phone (a simple cordless for example) dials an 8xxx number, Asterisk automatically dials the real number.
This is a quite simple setup, if you have mysql support in Asterisk. I am using asterisk 1.6 in Debian, and mysql support can be added by installing the "asterisk-mysql" package. My setup is a plain asterisk configured by hand, I am not using any specialized distribution.
In my setup, I have added a section in extensions.conf that allows me to dial quick numbers that begin with 8 (and I actually have no lenght limit in quick dial numbers, but I suggest that you keep them short, otherwise they are not "quick" anymore).
This is my extensions.conf snippet. It must be modified to be used in your setup, so you need to have some experience in configuring asterisk to make it work.
You have to modify the Connect statement on the first line (db_user, db_password and db_name have to be set to the proper username, password, and database name) and then you have to modify the Dial statement line to make it work with your outbound channel type and eventually remove the ":1" that means "strip the first character from the number before dialing it".
The idea is that I have added a field to the FOP2 (version 2.26) phonebook (or you can use "phone2" if you like) and I enter a short number (in my case, from 8000 to 8999) in that field, while I enter the real phone number in "phone1". Then, when a dumb phone (a simple cordless for example) dials an 8xxx number, Asterisk automatically dials the real number.
This is a quite simple setup, if you have mysql support in Asterisk. I am using asterisk 1.6 in Debian, and mysql support can be added by installing the "asterisk-mysql" package. My setup is a plain asterisk configured by hand, I am not using any specialized distribution.
In my setup, I have added a section in extensions.conf that allows me to dial quick numbers that begin with 8 (and I actually have no lenght limit in quick dial numbers, but I suggest that you keep them short, otherwise they are not "quick" anymore).
This is my extensions.conf snippet. It must be modified to be used in your setup, so you need to have some experience in configuring asterisk to make it work.
exten => _8.,1,MYSQL(Connect connid localhost db_user db_password db_name)
exten => _8.,n,MYSQL(Query resultid ${connid} SELECT phone1 FROM `visual_phonebook` WHERE `phone2` = '${EXTEN}')
exten => _8.,n,MYSQL(Fetch fetchid ${resultid} number_to_dial)
exten => _8.,n,MYSQL(Clear ${resultid})
exten => _8.,n,MYSQL(Disconnect ${connid})
exten => _8.,n,GotoIf($["${number_to_dial}" = ""]?error)
exten => _8.,n,Dial(SIP/provider/${number_to_dial:1})
exten => _8.,n,Hangup
exten => _8.,n(error),Playback(invalid)
exten => _8.,n(error),Hangup
You have to modify the Connect statement on the first line (db_user, db_password and db_name have to be set to the proper username, password, and database name) and then you have to modify the Dial statement line to make it work with your outbound channel type and eventually remove the ":1" that means "strip the first character from the number before dialing it".
Comments