PJSIP & LDAP troubles

I’ve been struggling for weeks trying to set up PJSIP and LDAP (due to lack of examples). I’ve managed to setup an OpenLDAP-server and populate it with a few users and extensions.

However, I seem to be stuck with configuring pjsip.conf. I’ve configured the parameters in res_ldap.conf and extconfig.conf. For example, extconfig:

[settings] sipusers => ldap,"ou=users,ou=asterisk,dc=internal,dc=xx,dc=be",sip sippeers => ldap,"ou=users,ou=asterisk,dc=internal,dc=xx,dc=be",sip extensions => ldap,"ou=extensions,ou=asterisk,dc=internal,dc=xx,dc=be",extensions

And this in extensions.conf:

[internal] switch => Realtime/@
When I try to login with a simple sip client, it fails:
failed for ‘’ (callid: ca85b90d0f34d1bda374fe1a99949aa3@0:0:0:0:0:0:0:0) - No matching endpoint found

When I list the endpoints:

*CLI> pjsip show endpoints Endpoint: default Unknown 0 of inf Transport: transport-udp udp 0 0
as well as another number that I manually configured in pjsip.conf.

Is it possible to populate these numbers from the LDAP? It doesn’t seem to try to fetch them at all…

I have been making some progress.

In /etc/asterisk/sorcery.conf I have the following:

The above makes sure that PJSIP uses extconfig.conf (realtime). In extconfig.conf I’ve tried to configure the consumation of 1 LDAP-record (AOR), most of it uses ODBC for now:

ps_aors => ldap,“ou=users,ou=asterisk,dc=internal,dc=xx,dc=be”,ps_aors
ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk

There exists an user “101” in the database. However, Asterisk reports the following error:
AOR ‘101’ not found for endpoint ‘101’

It seems that it can’t find AOR ‘101’, however, if you comment a crucial variable like ‘maxcontacts’ in res_ldap.conf, it also throws an error:

id = AstAccountName
;max_contacts = AstAccountName

AOR ‘101’ has no configured max_contacts. Endpoint ‘101’ unable to register

So it seems that [ps_aors] is used, but it doesn’t seem to be mapped correctly? Can someone give me a hint here?


For users that are lost like me for this type of setup, I was able to set up PJSIP with LDAP Realtime Driver !

You can take a look to my guide Asterisk : Setting up PJSIP with LDAP Realtime Driver.

Thank’s !