Thanks, I will modify the code.
I suggest that you include this fix in the next version.
Thanks, I will modify the code.
I suggest that you include this fix in the next version.
2.26, the latest non-beta.
I have FOP2 2.26 installed, and I have entered some data in the phonebook. Fop2 correctly shows (in the notification box that pops up when my phone rings) names for external callers when number is matched in the phonebook, but when an extension (number 34) calls me, the phonebook matches the number (34) to the last two digits of a phone book contact that has a number that ends in 34 (05164455334), and shows me the external contact name, which is clearly wrong.
I think that the number matching should be done using at least 5 or 6 numbers, so that estension numbers do not match phonebook records that end in the same 2 numbers as the extension.
Ideally the minimum lenght of a number to be matched should be configurable, with a sane default of 5 or 6 numbers.
I have added to my Asterisk installation a simple dialplan macro that allows me to show caller name (and company) for any incoming call that matches an entry in the FOP2 phonebook on my SIP (but also ISDN and analog, if the proper caller id protocols are configured) extensions.
This simple macro works with FOP2 2.26, Asterisk 1.6, and requires MYSQL support in Asterisk. It reads CALLERID(number) variable from Asterisk and queries the FOP2 phonebook for a similar (last 8 digits have to match) number in both "phone1" and "phone2" fields, and if it finds one it sets the Asterisk variable CALLERID(name) to a concatenation of the "name", "surname" and "company" fields from the FOP2 phonebook. That variable can then be used in further call processing, and anyway it ends up being sent to the called extension by the Dial command.
I have tested it on Debian 6 (the old stable) and requires the "asterisk-mysql" Debian package.
First, add this macro to your dialplan (extensions.conf).
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)
[macro-Fop2CidLookup]
exten => s,1,MYSQL(Connect connid localhost db_user db_password db_name)
exten => s,n,MYSQL(Query resultid ${connid} SELECT CONCAT(firstname,' ',lastname,' ',company) AS name FROM visual_phonebook WHERE phone1 LIKE CONCAT('%',SUBSTRING('${CALLERID(num)}',-8)) OR phone2 LIKE CONCAT('%',SUBSTRING('${CALLERID(num)}',-8)) ORDER BY LENGTH(CONCAT(phone1,phone2)) LIMIT 1 )
exten => s,n,MYSQL(Fetch fetchid ${resultid} CallerIDName)
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${connid})
exten => s,n,Set(CALLERID(name)=${CallerIDName})
Then, when processing incoming calls, you have to call the macro before doing any internal Dial command. A very simple call processing example is like this:
[from-external]
exten => 5556661234,1,Macro(Fop2CidLookup)
exten => 5556661234,n,Dial(SIP/51,40)
This calls the macro and then dials a SIP extension. The variables set in the macro (specifically the CALLERID(name) variable) is passed to the Dial command autmatically and the phone shows both the number and the name from the FOP2 phonebook. If there is no match for the number, the name is an empty string.
Here is a better Italian translation. I know it could be better, but I still have to understand exactly the meaning of every phrase. I have never set up queues and other features of FOP2, so I cannot understand exactly the context in which every string is shown, and this means that my translation may be wrong.
It is still better than the original one.
var lang = new Object();
lang['incoming_call'] = 'Chiamata entrante';
lang['connecting_server'] = 'Connessione al server, tentativo numero ';
lang['from_queue'] = "Dalla coda:";
lang['number'] = "Numero:";
lang['name'] = "Nome:";
lang['dial'] = 'Componi';
lang['transfer_vmail'] = 'Trasferisci alla Casella Vocale';
lang['attendant_transfer'] = 'Trasferisci';
lang['spy'] = 'Ascolta';
lang['whisper'] = 'Ascolata e Suggerisci';
lang['pickup'] = "Prendi la telefonata";
lang['hangup'] = 'Riaggancia';
lang['filter'] = 'Filtra';
lang['enter_sec_code'] = 'Informazioni di Login';
lang['exten'] = 'Interno:';
lang['password'] = 'Password:';
lang['confirm_hangup'] = 'Conferma Riaggancio';
lang['areyousure'] = 'Sei sicuro?';
lang['yes'] = 'Si';
lang['no'] = 'No';
lang['paused'] = 'In Pausa';
lang['set_information'] = 'Imposta le Informazioni';
lang['member_of'] = 'Membro di ';
lang['not_available'] = 'Sistema non disponibile al momento';
lang['not_connect'] = 'Impossibile connettersi al server';
lang['one_moment'] = 'Un momento per favore';
lang['no_results'] = 'Nessun risultato trovato';
lang['toggle_lock'] = 'Blocca/Sblocca Conferenza';
lang['toggle_muteall'] = 'Attiva o disattiva il microfono per tutti gli utenti';
lang['available'] = 'Disponibile';
lang['phonebook'] = 'Rubrica telefonica';
lang['toggle_mute'] = 'Attiva/disattiva microfono';
lang['kick'] = 'Espelli l'utente';
lang['record'] = 'Registra la chiamata';
lang['presence_noti'] = 'Notifica Presenza';
lang['queues'] = 'Code';
lang['extensions'] = 'Interni';
lang['trunks'] = 'Linee esterne';
lang['conferences'] = 'Conferenze';
lang['other'] = 'Altro';
lang['enter_state'] = 'Inserisci il valore';
lang['parkingslots'] = 'Aree di parcheggio chiamate';
lang['enter_reg_code'] = 'Inserisci il codice di registrazione:';
lang['reg_code'] = 'Codice di registrazione:';
lang['reg_name'] = 'Nome di registrazione:';
lang['remove_member'] = 'Rimuovi un partecipante';
lang['remove_member_from'] = 'Rimuovi un partecipante da ';
lang['pause_member'] = 'Metti in pausa un partecipante';
lang['unpause_member'] = 'Riattiva un partecipante';
lang['add_member'] = 'Aggiungi un partecipante a ';
lang['pickup_call'] = 'Prendi la chiamata';
lang['email_user'] = 'Invia una email al'utente';
lang['chat'] = 'Chat';
lang['notlogged'] = 'Utente non collegato. Messaggio salvato.';
lang['me'] = 'Io';
lang['clearchat'] = 'Pulisci la finestra di chat';
lang['note'] = 'Messaggio';
lang['toggle_sound'] = 'Attiva/disattiva suoni';
lang['says'] = 'dice';
lang['agents'] = 'Agenti:';
lang['calls'] = 'Utenti in attesa:';
lang['call_connected'] = 'E` connesso con';
lang['changeDisplayType'] = 'Cambia visualizzazione';
lang['voicemail'] = 'Casella vocale';
lang['vmail_new'] = 'Nuovi';
lang['vmail_old'] = 'Vecchi';
lang['vmail_work'] = 'Lavoro';
lang['vmail_family'] = 'Famiglia';
lang['vmail_friends'] = 'Amici';
lang['vmail_number'] = 'Numero';
lang['vmail_date'] = 'Data';
lang['vmail_callerid'] = 'CallerID';
lang['vmail_duration'] = 'Durata';
lang['preferences'] = 'Preferenze';
lang['summary'] = 'Riassunto';
lang['detailed'] = 'Dettagliato';
lang['inactive_line'] = 'Linea %d innativa';
lang['inuse'] = '%d linee in uso';
lang['vmail_count'] = 'Nuovi %d, Vecchi %d';
lang['logout'] = 'Logout'
lang['prefSounds'] = 'Suoni di avviso';
lang['prefDisplay'] = 'Visualizzazione';
lang['labelSoundChat'] = 'Suoni della chat';
lang['labelSoundQueue'] = 'Suoni delle code';
lang['labelSoundRing'] = 'Avviso chiamate entranti';
lang['labelDisplayQueue'] = 'Visualizzione della coda:';
lang['labelDisplayDynamicLine'] = 'Visualizzazione dinamica interni:';
lang['labelDisplayNotifyDuration'] = 'Notifica della durata:';
// Internationalization strings DATE
dateFormat.i18n = {
dayNames: [
"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab",
"Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"
],
monthNames: [
"Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic",
"Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"
]
};
It works!
Thank you very much.
You're welcome!
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.
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".
I anwer to this very old post because I am having issues with editing records with more fields in them. While I can create records with extra fields (after having added them to the database table) and I can view them, too, and I see the extra fields, I cannot edit them. When I click on the edit icon I can see (and edit) only default fields. I am running FOP2 2.26.
It works perfectly! Thanks a lot, you have made a phone operator happy (and a sysadmin too).
Do you plan to include this patch in future releases, or do I need to keep this reference to patch future installations?
I'll try soon. Thanks!
Thanks a lot! I will try this out tomorrow!
Thanks for your answer. I am using the latest beta (2.20). I must insist that our operator would really like to be able to dial from the phonebook interface. I understand that this is a matter of personal preference, and I am just suggesting a feature. I hope that you will consider my suggestion. In the meantime, I'll try enlarging the dial results window.
Not exactly. The Dial box in the main page only shows partial information from the phonebook, and when you have a lot of records, and some of them are similar, it's hard to understand who is who from the results.
I think it could be nice to be able to dial numbers from the phonebook interface itself.
-Open the phonebook
-Search (in the phonebook interface, non in the dial box)
-Click on a phone number in the phonebook interface to call that number.
Is it possible to have more fields (ideally even user-configurable ones) in the phonebook?
For example, an address (street, city, ZIP) or some "free form" notes (as little as 1KB of notes should be enough)
I am installing FOP2 at a customer site. If they like it, and they buy it, I will do a proper translation and send it back to you.
I'd like to have a better interface to place calls from phonebook. this interface should show the phonebook, allow for some quick search in it, and allow for a call to be placed to a number in the phonebook by clicking on it or on a button near to it.
This, in my opinion, is far more "friendly" than the current method, expecially for the casual user (that is, not the pbx operator).
Also, it should be taken into account that when dialing a phonebook number it is usually needed to add a "9" or a "0" (or any other prefix) to get to the external line, so I have to save every number in the phonebook with the prefix already prepended. It could be nice to have some configuration parameter that contains the prefix to make external calls. Or you can leave it empty to make it work like it works now.
I have done some tests, and I have found that it seems that the Pickup application on my Asterisk (Debian Lenny package) is broken. If I use "dpickup" application (from bristuff) I can make it work as it should (by hand, not from FOP, because I have not tried to modify FOP to make it call dpickup instead of pickup). Maybe the pickup application should be more configurable in FOP. Is there some way to make it call dpickup instead of pickup?
Sorry, it did not work. I get quite the same error:
== Setting global variable 'PICKUPMARK' to '13'
Extension Changed 11[i] new state Ringing for Notify User 12
> Channel SIP/11-00778aa0 was answered.
Extension Changed 11[i] new state InUse for Notify User 12
> Launching Pickup(13@PICKUPMARK) on SIP/11-00778aa0
-- No channel found 8192.
I assume that 4096 (before) and 8192 (now) are non-casual numbers. That is, isn't it strange that I get exactly two "notorious" powers of 2? Maybe something's wrong in my Asterisk setup and the pickup command does not work?
I have been using PickupChan instead of Pickup in my setup, and it works, like this:
exten => _**XX,1,PickupChan(SIP/${EXTEN:2})
and this method works.
Is there something I can try? How can I trace what FOP is doing when picking up a channel?
I have just installed FOP 2.11 (not registered) and have set up 4 extensions. I run Asterisk 1.4 on Debian Lenny with a home-made configuration (I don't use FreePbx or other pre-packaged installations).
FOP seems to work, but it fails to pick up channels, both ringing or already answered.
When I try to pick up a channel, my phone rings, and when I answer the call (on my phone) drops, and the original call (the one I was trying to pick up) remains where it was.
Looking at the Asterisk console, I get this log:
Extension Changed 11[i] new state Idle for Notify User 12 (queued)
Extension Changed 11[i] new state Idle for Notify User 12
== Setting global variable 'PICKUPMARK' to '12'
Extension Changed 11[i] new state Ringing for Notify User 12
> Channel SIP/11-007b1f20 was answered.
Extension Changed 11[i] new state InUse for Notify User 12
> Launching Pickup(12@PICKUPMARK) on SIP/11-007b1f20
-- No channel found 4096.
Anyone knows what's wrong? As a new FOP user, I don't have any insight on how FOP handles call pickups.