Zimbra contacts (name+multiple phonenumbers) import to asterisk

hey,

I’m searching for a solution for my intention, to get the name and the phonenumbers (mobile, home, …) shown on my display of my voip phone.
I can add them separate to the asterisk phonebook, but I want to get it automated by a “caller id lookup source”. I can choose mysql for the source type. does anybody tried this yet? is there a script or something which I can use?

Pulling CNAM from a MySQL database is not difficult, tho I have not done it with Zimbra. Caller ID Superfecta has support for multiple specfic databases, and a generic module that permits the user to add their own query. Do you know the SQL query you need to get the name from Zimbra?

I just installed Caller ID Superfecta and don’t really now, where to setup the SQL settings?

With the latest version of Superfecta (2.11.3) you select a Scheme to edit (or start a new one) and enabled the “Database” module. When you click on Database, you will see fields for all the necessaries to connect and query the database.

ah ok, now I found it!
but there could be a problem… in zimbra I’ve saved the number in this format e.g. +49 1234 56789… when I get an incoming call the number is shown like 0123456789… I need this +xx for calls in foreign countries… seems to be a problem?!

You can define multiple “CID Rules” in the Superfecta scheme to correct the CID before you do the lookup. To change number formats
from: 0123456789
to: 49123456789
use rule: 49+0|XXXXXXXXX

You cant use rules to add a ‘+’ character, you will have to modify the SQL to ignore leading characters when doing the lookup, i.e.
… WHERE cid LIKE “%:thenumber”

so which rule do I have to enter in the CID Rule box if I have the following setup:
zimbra contacts saved like:
first name=Bob
name=Test
phonenumber_home=01122 3344
phonenumber_mobile=+49 1234 567890

get an incoming call from bobs’ mobile:
snom 370 telephone shows up the following number: 00491234567890
get an incoming call from bobs’ phone at home:
snom 370 telephone shows up the following number: 01122 3344

so my problems are that

  • the ‘+’ and the blanks have to be removed
  • name is devided to name and first name (should be name_field in the query example of superfecta)

I forgott to say thank you for your past help! :slight_smile:

my example for the incoming call was wrong… it should be:
get an incoming call from bobs’ mobile:
snom 370 telephone shows up the following number: 01234567890 -> because its a call from my country… only if a call from a foreign country is incoming the +xx (e.g. +15) is shown up like 0015… hope I described it understandable :confused:

If you have multiple incoming CID formats, you will need a CID rule for each and every one. Superfecta uses the old standard asterisk dialing rule format, generally speaking this:

[digits_to_be_added]+[digits_to_be_removed]|[digits_to_remain]

with X,N,Z to stand is as unknown digits as appropriate. The rules can accept brackets if you need them as well as a ‘dot’. Each rule goes on a separate new line. Rules are processed top to bottom, so specific rules first and then general rules follow, with the very last rule looking like this:

X.

Which means use the CID as provided with no changes.

Please provide the SQL query you are using for this lookup, and confirm that the forum formatting displays it properly when posted.

it seems like this would not work… another point I forgott to say is, that the zimbra mysql db contacts are saved like this:
name1;number1;number2;number3;
there can be endless numbers per name, so I need to convert every number+name to a new db in each line…
name1;number1;
name1;number2; …
and then I can make that rules for the country code…
I hoped that anybody already has a script for that …