Member
Last active 11 years ago
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?