FreePBX and res_config_ldap for SIP devices

Hello All,

I use LDAP for almost all my authentication needs. Makes it super easy to add and remove employee’s from everything all at once. I’m currently attempting to LDAPify the SIP devices on FreePBX/Asterisk.

The Asterisk side of things seems rather straight forward. Install res_config_ldap and tell it to configure the SIP peers from the appropriate LDAP tree.

The FreePBX side I’m not so sure of. I’m trying to figure out where I’d change code to generate the devices page from an LDAP database. Really it doesn’t need the whole page, just the required entries to keep the rest of FreePBX happy. I would still need to add the users extension and figured I’d have the apply settings button refresh the devices.

It looks like most of the device functions are in the core module. This is the part I’m not sure of. Can functions in this module be overridden by another module somehow? Or would I need to patch the core and maintain it?

Maybe if I’m feeling REALLY motivated I’d try to just add a “refresh ldap users” button/cronjob that adds the extensions too. Just figured I’d start with devices and see where it takes me.


I would start by looking at the bulk extensions module. It contains all the hooks and functionality you require. The interaction of modules in FreePBX is very complex and is not particularly well documented.

Leveraging the bulk extensions module code, replacing the CSV parse with an LDAP tool would seem to be extremely low hanging fruit.

Asterisk LDAP is not going to help you as the peer will be unknown to the FreePBX dial plan.

The bulk extensions module does appear like it will make adding the devices almost painless.

As for Asterisk LDAP, if I build the SIP peer identically to how FreePBX does wouldn’t it work the same? Or is there a context issue I’m going to run in to?

It’s more that a context issue, the peer is only one part of the puzzle. FreePBX would not know how to integrate that peer to the dial plan.

A peer is one part of an extension. Dial plan coded is added for each feature on a per extension basis.