Synology Contact / Grandstream / multiple numbers per Contact
Added by Olaf Thyssen 12 days ago
Hallo Jörg,
awesome work with L2CPBG and I like the docker release, especially when Synology Contacts is already used.
Architecture: Synology Docker (l2cpbg-docker.zip)
Voice phone: Grandstream WP825
CardDAV Server: Synology Contacts
(ReadMe 0100 has been read)
Usually I have either homePhone or mobile but sometimes both entries for contacts in Synology Contacts
On the Grandstream I receive always only one number for the contact and mobile wins over homePhone if both are present
Do I need to set some kind of merge LDAP attributes or mapping in the config file or is it the behavior of the Grandstream ?
Any hints how I get an alphabetical ordered LDAP address book on the Grandstream with
sn, givenName ???
"LDAP Display Name" with %cn shows the full name but not really ordered by first name.
Some manuals for some Grandstream desk phones are using gn for givenName , but it seems the WP825 neither honors gn nor givenName .
If I set
- %sn %gn
- %sn %givenName
Kind regards
Olaf
Replies (8)
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Olaf Thyssen 12 days ago
well, upgrading the Grandstream from 1.0.11. 57 (recently purchased device with firmware from 2024 ?!?!) to 1.0.11. 78 introduced the sort in the LDAP config
... and I have more than one number behind each contact.
Even the sort is happening by surname the displayname is a bit confusing with leading givenName.
Haven't found how to display "sn, givenName" in contacts on Grandstream
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Jörg Ebeling 11 days ago
Hi Olaf,
glad to hear that L2CPBG and the docker container is usefull for you
Having multiple phone numbers per contact, is a fully normal usecase.
But if I understand correctly, most is solved now after the firmware update?
Probably worth to test:
L2CPBG sort the LDAP response automatically based on the requested attributes.
So, if you set i.e. "LDAP Display Name = %sn %givenName", then L2CPBG will sort the result first by the surname, and equal surnames afterwards by given name.
L2CPBG does this with a "Natural string comparison" similar sort algorithm.
But yes, for this you need to find out how this get supported by Grandstream
"LDAP Display Name" sounds pretty correct and nearly all desk-phones I do know, support that, but some are limited in that way, that you can only use those field in "LDAP Display Name" which get also used within the "name filter"!
Also please keep in mind that L2CPBG's sorted results will only work as expected if the phone don't sort it again
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Olaf Thyssen 8 days ago
Hi Jörg,
the Grandstream doesn't honor your L2CPBG sort.
LDAP Name Attributes = sn givenName company cn
LDAP Display Name = %sn %givenName %company
I already played around with it, but I must explicitly set "Sort Results" to "Yes" in the phone.
It even doesn't matter if I use filters or not
LDAP Number filter = (|(telephoneNumber=%)(mobile=%)(homePhone=%))
LDAP Name filter = (|(sn=%)(givenName=%)(company=%)(cn=%))
The filters I usually don't need as I'm lazy, created dedicated phonebook in Synology Contacts
and filtering it in the config
[dav]
addressbooks = "Phonebook"
Another thing I observed is the missing number "type" behind each contact
When selecting a contact, I just see:
Number
0176xxxxxx
Number
23456
I'm expecting instead of Number something like Mobile or Home
I don't know if it is Synology Contacts or the Grandstream.
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Jörg Ebeling 7 days ago
Hi Olaf!
That sounds somehow strange.
Think we should take a deeper look into what's get requested and what gets out of L2CPBG.
Within your l2cpb.conf, please change the log level to debug:
[log]
level = "debug" # (trace, debug), info, warn, error, fatal or panic
And then restart your l2cpbg.
Now, if you search for any letter, you should get an "ldapsearch" log entry, some quirky looking entries but at the end also an "ldap result" entry in L2CPBGs log.
I'm interested in a letter combination where only a handful of results remain.
The "ldapsearch" log lines should show us also what exactly your Grandstream is requesting,
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Olaf Thyssen 6 days ago
Hi Jörg,
here is the full stack when I search my family with "TH" on the phone
2025/09/13 12:30:53 stderr [INF] 10:30:53 [server] 6 records returned for search request #8: Whole Subtree (|(|(telephoneNumber=TH)(mobile=TH)(homePhone=TH))(|(cn=TH)(sn=TH)(givenName=TH)(company=TH))) @ 'dc=example,dc=com' from a.b.c.d:40950 {8c74d936}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [ card ] LdapCard '{4ee18843-6f22-4f50-ac5d-234c0958cd93 Phonebook}': card.LdapCard{Cid:card.CardId{Uid:"4ee18843-6f22-4f50-ac5d-234c0958cd93", Ou:"Phonebook"}, Attrs:card.LdapAttrs{"cn":"Lxxxxx Thyssen", "givenName":"Lxxxxx", "mobile":"xxx xxxxx", "sn":"Thyssen"}}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [ card ] LdapCard '{cdb1e53f-8370-49a1-b7ba-89c3057ecd14 Phonebook}': card.LdapCard{Cid:card.CardId{Uid:"cdb1e53f-8370-49a1-b7ba-89c3057ecd14", Ou:"Phonebook"}, Attrs:card.LdapAttrs{"cn":"C1xxxx Thyssen", "givenName":"C1xxxx", "mobile":"xxx xxxxx", "sn":"Thyssen"}}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [ card ] LdapCard '{37510f13-a305-4e6a-8d8d-22c9fe1eeca1 Phonebook}': card.LdapCard{Cid:card.CardId{Uid:"37510f13-a305-4e6a-8d8d-22c9fe1eeca1", Ou:"Phonebook"}, Attrs:card.LdapAttrs{"cn":"C2xxxx Thyssen", "givenName":"C2xxxx", "homePhone":"xxxxx", "mobile":"xxx xxxxx", "sn":"Thyssen"}}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [ card ] LdapCard '{c090434e-bbc0-484a-8479-8bfd47de8fce Phonebook}': card.LdapCard{Cid:card.CardId{Uid:"c090434e-bbc0-484a-8479-8bfd47de8fce", Ou:"Phonebook"}, Attrs:card.LdapAttrs{"cn":"Txxxxx Thyssen", "givenName":"Txxxxx", "homePhone":"xxxxx", "mobile":"xxx xxxxx", "sn":"Thyssen"}}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [ card ] LdapCard '{54ac3d61-07b1-40c6-a3ec-15f720e129b0 Phonebook}': card.LdapCard{Cid:card.CardId{Uid:"54ac3d61-07b1-40c6-a3ec-15f720e129b0", Ou:"Phonebook"}, Attrs:card.LdapAttrs{"cn":"Oxxxxx Thyssen", "givenName":"Oxxxxx", "mobile":"xxx xxxxx", "sn":"Thyssen"}}
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Collected CardIds map[{37510f13-a305-4e6a-8d8d-22c9fe1eeca1 Phonebook}:true {4ee18843-6f22-4f50-ac5d-234c0958cd93 Phonebook}:true {54ac3d61-07b1-40c6-a3ec-15f720e129b0 Phonebook}:true {c090434e-bbc0-484a-8479-8bfd47de8fce Phonebook}:true {cdb1e53f-8370-49a1-b7ba-89c3057ecd14 Phonebook}:true]
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lsn.thyssen.cdb1e53f-8370-49a1-b7ba-89c3057ecd14'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lsn.thyssen.c090434e-bbc0-484a-8479-8bfd47de8fce'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lsn.thyssen.54ac3d61-07b1-40c6-a3ec-15f720e129b0'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lsn.thyssen.4ee18843-6f22-4f50-ac5d-234c0958cd93'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lsn.thyssen.37510f13-a305-4e6a-8d8d-22c9fe1eeca1'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lcn.txxxxx thyssen.c090434e-bbc0-484a-8479-8bfd47de8fce'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lcn.oxxxxx thyssen.54ac3d61-07b1-40c6-a3ec-15f720e129b0'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lcn.lxxxxx thyssen.4ee18843-6f22-4f50-ac5d-234c0958cd93'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lcn.c1xxxx thyssen.cdb1e53f-8370-49a1-b7ba-89c3057ecd14'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Regexp matching key 'lcn.c2xxxx thyssen.37510f13-a305-4e6a-8d8d-22c9fe1eeca1'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] s.request.Filter '(|(|(telephoneNumber=TH)(mobile=TH)(homePhone=TH))(|(cn=TH)(sn=TH)(givenName=TH)(company=TH)))'
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Search(searchReq ldap.SearchRequest{BaseDN:"dc=example,dc=com", Scope:2, DerefAliases:0, SizeLimit:100, TimeLimit:4, TypesOnly:false, Filter:"(|(|(telephoneNumber=TH)(mobile=TH)(homePhone=TH))(|(cn=TH)(sn=TH)(givenName=TH)(company=TH)))", Attributes:[]string{"telephoneNumber", "homePhone", "mobile", "sn", "givenName", "company", "cn"}, Controls:[]ldap.Control{}}, ...
2025/09/13 12:30:53 stderr [DBG] 10:30:53 [server] Stats &ldap.Stats{Conns:8, Binds:8, Unbinds:7, Searches:8, statsMutex:sync.Mutex{state:0, sema:0x0}}
2025/09/13 12:30:53 stderr [INF] 10:30:53 [server] Search request #8: (|(|(telephoneNumber=TH)(mobile=TH)(homePhone=TH))(|(cn=TH)(sn=TH)(givenName=TH)(company=TH))) from a.b.c.d:40950 {8c74d936}
The result on the Grandstream with disabled sort is:
- Lxxxx x Thyssen
- C1xxxx Thyssen
- Oxxxxx Thyssen
- C2xxxx Thyssen
- Txxxxx Thyssen
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Jörg Ebeling 6 days ago
Hi Olaf,
your log is really helpful!
Let's try to clarify what happen:
If you search for "TH", your phone normally use the "LDAP Name Filter" which seem to be currently configured in your phone as (|(|(telephoneNumber=%)(mobile=%)(homePhone=%))(|(cn=%)(sn=%)(givenName=%)(company=%)))
First (and further) search attribute is the useless "telephoneNumber" which is also used for the primary search order. So I would guess if you compare the delivered L2CPBG result it, is correct sorted but by telephoneNumber.
Please change your "LDAP Name Filter" to (|(sn=*%*)(givenName=*%*)(company=*%*)(cn=*%*))
.
Might be that you get an error or no result because of the "*" characters, if so please remove them.
Let's see what happen now
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Olaf Thyssen 5 days ago
Hi Jörg,
I already have the filters:
LDAP Number filter = (|(telephoneNumber=%)(mobile=%)(homePhone=%))
LDAP Name filter = (|(sn=%)(givenName=%)(company=%)(cn=%))
It seems that both filters become combined and send over
Here is my Grandstream LDAP UI
RE: Synology Contact / Grandstream / multiple numbers per Contact
-
Added by Jörg Ebeling 4 days ago
This is §&"$%!
Looks to me that they're extra gifted to develop useless solutions
In that case: I'm sorry, but I can't help you.