Readme 070 » History » Version 2
Jörg Ebeling, 02/10/2020 04:41 PM
1 | 1 | Jörg Ebeling | # LDAP-2-CardDAV Phone Book Gateway (l2cpbg) |
---|---|---|---|
2 | |||
3 | An LDAP to CardDav (1 way read) Phone Book Gateway. |
||
4 | |||
5 | ## Use case |
||
6 | |||
7 | Most modern (business) voice phones have the capability to do comfortable LDAP directory look-up like: |
||
8 | |||
9 | - Directory search by alphabet letters |
||
10 | - Reverse lookup for inbound calls |
||
11 | - Reverse lookup by entering parts or the phone number |
||
12 | |||
13 | Unfortunately, most of the 'smaller' companies (i guess companies beyond 100 employee) don't have an 'enterprise' LDAP directory, much less than private persons. |
||
14 | |||
15 | Most of such companies do have something like a cloud address book, often based on WebDAV / CardDAV (i.e. Nextcloud, Ownlcoud, ...). |
||
16 | |||
17 | This is, where this Gateway might make your live easier (hopefully). |
||
18 | |||
19 | If this program get started on some kind of hardware (Windows, Mac, Linux, ???), it will do the following: |
||
20 | |||
21 | 1. Answer on LDAP requests from your voice phone(s) |
||
22 | 2. Ask your CardDAV (Nextcloud, Owncloud, ...) Server for the LDAP requested phone book entry |
||
23 | 3. Return the CardDAV query results, back as LDAP results to your phone. |
||
24 | |||
25 | ## Features |
||
26 | |||
27 | - Query your CardDAV address book(s) by entering the alphabetic letters (or parts of the telephone number) in your (LDAP capable) phone (and dial one of the matching numbers). |
||
28 | - Reverse lookup inbound calls and display matching contact informations on the phone. |
||
29 | - Work with human formatted (non- E.164) CardDAV entered phone numbers like: '040-123456' or '001 807 1234567' as well as '+49 (0)40 1234567-8'. |
||
30 | 2 | Jörg Ebeling | - Reverse lookup of phone numbers, depend on a tiny caching layer and thus there's a (configurable) sync interval/delay. |
31 | 1 | Jörg Ebeling | |
32 | ## Usage |
||
33 | |||
34 | 2 | Jörg Ebeling | You need some kind of 24/7 machine where this gateway live. Windows, Linux, Mac, (ARMx might come later if someone is interested). |
35 | 1 | Jörg Ebeling | |
36 | 2 | Jörg Ebeling | In this early 'beta' version, it runs in foreground. So, if you require to log off out of your machine, run it i.e. via 'screen'. |
37 | 1 | Jörg Ebeling | |
38 | No installation required. Only a simple executable. Place it wherever your like. But I advice to start it as normal (non-root, non-administrative) user. |
||
39 | |||
40 | It will look for a configuration file in the following places (in the given order): |
||
41 | |||
42 | 1. ./.l2cpbgrc (or in it's parents) |
||
43 | 2. $HOME/.l2cpbgrc |
||
44 | 3. $HOME/.config/l2cpbg |
||
45 | 4. /etc/l2cpbgrc |
||
46 | 5. and some more uncommon places |
||
47 | |||
48 | 2 | Jörg Ebeling | ## Configfile syntax |
49 | 1 | Jörg Ebeling | |
50 | 2 | Jörg Ebeling | The config file syntax is 'ini' based. Following a quick minimal sample: |
51 | 1 | Jörg Ebeling | |
52 | 2 | Jörg Ebeling | ``` |
53 | 1 | Jörg Ebeling | ; Comments get started with a semicolon |
54 | ; |
||
55 | ; The Gateway will act/listen as LDAP Server with the following settings |
||
56 | 2 | Jörg Ebeling | ; |
57 | 1 | Jörg Ebeling | [ldap] |
58 | host = 0.0.0.0 |
||
59 | ;port = 1389 |
||
60 | base = dc=example, dc=com |
||
61 | |||
62 | [ldap.bind] |
||
63 | dn = cn=pbx |
||
64 | pass = your-password |
||
65 | |||
66 | [dav] |
||
67 | server = https://cloudserver.example.com/remote.php/dav |
||
68 | user = cloud-login-name |
||
69 | pass = cloud-login-password |
||
70 | ;addressbooks = regular-expression-of-lookup-adressbook |
||
71 | syncinterval = 5 ; Minutes |
||
72 | |||
73 | ;[dav.map] |
||
74 | ; tel = TEL |
||
75 | |||
76 | [location] |
||
77 | int = 1 |
||
78 | area = 807 |
||
79 | maxarealength = 7 |
||
80 | language = en |
||
81 | |||
82 | [log] |
||
83 | conslevel = verbose ; Console log level. Might be one of silly, debug, verbose, info, warn or error |
||
84 | ;filename = ./l2cpbg.log |
||
85 | ;filelevel = info ; File log level. Might be one of silly, debug, verbose, info, warn or error |
||
86 | ``` |
||
87 | |||
88 | ### Config file description |
||
89 | |||
90 | 2 | Jörg Ebeling | #### \[ldap\] = LDAP Server settings |
91 | 1 | Jörg Ebeling | |
92 | 2 | Jörg Ebeling | `host` : Which IP to listen for LDAP requests. Defaults to '127.0.0.1' (=localhost). '0.0.0.0' means: 'Listen on all interfaces'. You've to point your LDAP phone settings to this machines IP/hostname. |
93 | 1 | Jörg Ebeling | `port` : Port to listen for LDAP requests. Defaults to port 1389. You normally don't need to change this. |
94 | `base` : This LDAP's 'base DN'. Choose whatever you want, but use the same settings within your phone's LDAP settings. Defaults to 'dc=example, dc=com'. |
||
95 | |||
96 | 2 | Jörg Ebeling | #### \[ldap.bind\] = LDAP auth settings |
97 | 1 | Jörg Ebeling | |
98 | `dn` : Distinguish name. Name, how the phone has to log into/authorize to the gateway. |
||
99 | `pass` : Related 'dn' password, a phone has to use when logging in/authorize to the gateway. |
||
100 | |||
101 | 2 | Jörg Ebeling | #### \[dav\] = WebDav/CardDav server settings |
102 | 1 | Jörg Ebeling | |
103 | `server` : Your WebDAV/CardDAV server address/URL. Please see 'Limitations'! |
||
104 | `user` : WebDav username with read access to the relevant addressbook which shall be requested for phone book lookups. Might also be a 'shared' address book. |
||
105 | `pass` : Related user password. |
||
106 | 2 | Jörg Ebeling | `addressbooks` : Optional regular expression of matchable addressbook(s) used for phone book lookups. If unsure, enter something. l2cpbg will log all found address books of the logged in CardDav user during startup and log them as 'Non-matching' or 'Matching' address book(s). |
107 | 1 | Jörg Ebeling | |
108 | 2 | Jörg Ebeling | #### \[dav.map\] = CardDav mapping |
109 | 1 | Jörg Ebeling | |
110 | 2 | Jörg Ebeling | `tel` : CardDAV attribute which contain the phone numbers. Normally (and by default) 'TEL'. |
111 | 1 | Jörg Ebeling | |
112 | 2 | Jörg Ebeling | #### \[location\] = Local area settings |
113 | 1 | Jörg Ebeling | |
114 | `int` : International area code (1 = North America, ..., 44 = United Kingdom, 49 = Germany, ...) of your location. |
||
115 | `area` : Local area code without leading 0 (20 = London (UK), 40 = Hamburg (DE), ...). |
||
116 | `maxarealength` : Longest possible length of a telephone number within your local area. If a found or received number is shorter or equal, it's identified as a number without local area prefix. |
||
117 | `country` : Two-letter [ISO 3166-1 alpha-2](https://wikipedia.org/wiki/ISO_3166-1\_alpha-2) country code (i.e. US, GB, DE, ...). |
||
118 | |||
119 | 2 | Jörg Ebeling | #### \[log\] = Screen & file logging |
120 | 1 | Jörg Ebeling | |
121 | `conslevel` : Console log level. Might be one of silly, debug, verbose, info, warn or error. Defaults to verbose. |
||
122 | `filename` : Log messages to this file. Might contain '%DATE%' with will be replaced by YYYYMMDD. Defaults to empty = no log file. |
||
123 | `filelevel` : File log level. Might be one of silly, debug, verbose, info, warn or error. Defaults to info |
||
124 | |||
125 | The log levels are organized as follows: |
||
126 | |||
127 | `silly` : This is the most verbose log level. It logs simply everything. Never use it in production environment as it might produce an awful amount of log entries! |
||
128 | `debug` : Logs a lot internal stuff, probably interesting when searching a solution for an issue. Should not be used in production environment as it produce also a lot log entries! |
||
129 | `verbose` : Logs everything which might be interesting during use. Not only results, also when something get started, detailed results and such things. |
||
130 | `info` : This is the most usual log level. Logs only stuff which is relevant. |
||
131 | `warn` : Logs stuff which doesn't behave as expected. Not critical (generic functionality should be okay) but should be noticed/checked. |
||
132 | `error` : Something essential/critical happened. Functionality is limited or aborted at all. |
||
133 | |||
134 | 2 | Jörg Ebeling | #### \[ldap.map...\] = LDAP/CardDav mapping |
135 | |||
136 | Every LDAP attribute which is used within a phone(s) filter or response, need to have a corresponding CardDav mapping. |
||
137 | This get done as follows: |
||
138 | First you need to defined a separate block for the LDAP attribute in the following syntax: |
||
139 | |||
140 | ``` |
||
141 | [ldap.map.<ldap attribute name>] |
||
142 | ``` |
||
143 | |||
144 | |||
145 | Within such a LDAP mapping block you have to define: |
||
146 | |||
147 | `dav` : Corresponding CardDav field/attribute name. |
||
148 | |||
149 | and may defined the following optional settings: |
||
150 | |||
151 | `types` : Regular expression of relevant CardDav types. |
||
152 | `index` : Zero based index in the case of a multi-value CardDav field. |
||
153 | |||
154 | For an overview of the predefined/default LDAP/CardDav mappings, take a look into the 'config.sample' file. |
||
155 | |||
156 | 1 | Jörg Ebeling | ## Phone configuration |
157 | |||
158 | 2 | Jörg Ebeling | ### Gigaset |
159 | |||
160 | Here's a configuration sample of a Gigaset N510 IP PRO: |
||
161 | ![Gigaset N510 IP PRO settings sample for L2CPBG 0.7.0](https://projects.shbe.net/attachments/download/19/config_gigaset-n510-ip-pro_v070_de.jpg "Gigaset N510 IP PRO settings sample for L2CPBG 0.7.0") |
||
162 | Take attention that <span style="color: #d97a3a;">Server Address</span> point to the machine where this gateway lives, as well as <span style="color: #d97a3a;">Serverport</span>, <span style="color: #d97a3a;">BaseDN</span>, <span style="color: #d97a3a;">Common User Name</span> and <span style="color: #d97a3a;">Common Password</span> get filled with the same values as defined in your L2CPG config file. |
||
163 | |||
164 | ### Yealink |
||
165 | |||
166 | Another configuration sample of a Yealink SIP-T52S: |
||
167 | ![Yealink SIP-T52S settings sample for L2CPBG 0.7.0](https://projects.shbe.net/attachments/download/18/config_yealink-t52s_fw7084_v070_en.jpg "Yealink SIP-T52S settings sample for L2CPBG 0.7.0") |
||
168 | 1 | Jörg Ebeling | Take attention that <span style="color: #d97a3a;">Server Address</span> point to the machine where this gateway lives, as well as <span style="color: #d97a3a;">Port</span>, <span style="color: #d97a3a;">Base</span>, <span style="color: #d97a3a;">User Name</span> and <span style="color: #d97a3a;">Password</span> get filled with the same values as defined in your L2CPG config file. |
169 | |||
170 | ## Compatibility |
||
171 | |||
172 | This early version is currently only tested (working) with: |
||
173 | |||
174 | - CardDAV Server: |
||
175 | 2 | Jörg Ebeling | - [Nextcloud](https://nextcloud.com/) version 13, 15 & 16 |
176 | 1 | Jörg Ebeling | - Phone Extensions: |
177 | 2 | Jörg Ebeling | - [Gigaset](https://www.gigasetpro.com/) N510 IP PRO |
178 | 1 | Jörg Ebeling | - [Yealink](https://www.yealink.com/) SIP-T52S, SIP-T54S, SIP-T54W |
179 | - Gateway Host OS: |
||
180 | 2 | Jörg Ebeling | - [Debian](https://www.debian.org/) Stretch 9.x, Buster 10.x |
181 | 1 | Jörg Ebeling | - [macOS](https://www.apple.com/macos/) ™ Sierra 10.12.6 |
182 | |||
183 | ## Limitations and Known Issues |
||
184 | |||
185 | There are already some known issues!!! Not sure which will get fixed, might depend on how much people are interested in. |
||
186 | |||
187 | 2 | Jörg Ebeling | - The LDAP Server doesn't support LDAPS (encrypted LDAP communication) at the moment. Therefore <span style="color: #f00;">it should not be used in an untrusted network!</span> |
188 | 1 | Jörg Ebeling | - The CardDAV Server [HTTP-Authentication](https://de.wikipedia.org/wiki/HTTP-Authentifizierung) is currently restricted to 'Basic Authentication'. No 'Digest Access Authentication' like required i.e. for [Daylite](https://www.marketcircle.com). |
189 | - 'Basic Authentication' over 'HTTPS' will work (for sure), but without detailed certificate checking. |
||
190 | 2 | Jörg Ebeling | - In this first 0.7.0 version, there's no cacheing layer anymore (as in the previous versions). This might result in LDAP timeouts if your CardDav server is to slow or laggy. If you get hit by this limitation, drop me a short note, so that I'll give it priority. |
191 | 1 | Jörg Ebeling | |
192 | ## To-Do |
||
193 | |||
194 | I already have a couple of To-Do's on my list. Following a (priority ordered) list. Feel free to drop me your wishes [[#support]]. |
||
195 | |||
196 | 2 | Jörg Ebeling | 1. Implement Apple's addressbook extension for Apple specific telephone number X-Attributes |
197 | 2. Implement a new cacheing layer for quicker LDAP lookups |
||
198 | 3. Daemonize (run in background/as service) |
||
199 | 1 | Jörg Ebeling | |
200 | ## Support & getting help |
||
201 | |||
202 | For getting help or discussing l2cpbg, please browse the [L2CPBG Forum](https://projects.shbe.net/projects/l2cpbg/boards) or check/open the [Tickets](https://projects.shbe.net/projects/l2cpbg/issues) area. |