everything about machines

December 28, 2008

asterisk 1.2 with realtime ldap driver

Filed under: asterisk, linux, open source, voip — Tags: , , , , — cyrenity @ 1:46 pm

I have created an auto install script based on http://www.cahilig.org/install-asterisk-12-auto-install-script-centos-4-and-centos-5 to install Asterisk 1.2 with ldap realtime driver support (modified original script to enable realtime ldap support).

This script should work almost with any(Redhat, Centos, Mandrake, Debian, Slackware) Linux distro

Before running this script you must install following packages.

For Centos, Redhat:

yum install openldap-devel gcc kernel-devel bison openssl-devel libtermcap-devel ncurses-devel

For Debian, Ubuntu:

apt-get install libldap2-dev build-essential linux-headers-`uname -r` libncurses5-dev libssl-dev

You can download the script from here, simply run the script to start installation process.

download Asterisk schema for OpenLdap here

Installer and installation process is not tested, if you find any problem please let me know.

#!/bin/sh
#Asterisk Download page
ZAPTEL="http://downloads.digium.com/pub/zaptel/releases/zaptel-1.2.9.tar.gz"
ASTERISK="http://downloads.digium.com/pub/asterisk/releases/asterisk-1.2.30.tar.gz"
ASTERISKADDONS="http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-1.2.9.tar.gz"
RTLDAP="http://free.oxymium.net/Asterisk/res_config_ldap.tgz"
RTLDAPPATCH="http://mustafa.pk.googlepages.com/res_config_ldap.c.patch"
CONFIGPATCH="http://mustafa.pk.googlepages.com/config.c.patch"
MAKEFILEPATCH="http://mustafa.pk.googlepages.com/resmkfile.patch"
#Asterisk Package
ZAPPACKAGE="zaptel-1.2.9.tar.gz"
ASTPACKAGE="asterisk-1.2.30.tar.gz"
ASTADDONSPACKAGE="asterisk-addons-1.2.9.tar.gz"
#Asterisk Folder
ZAPFOLDER="zaptel-1.2.9"
ASTFOLDER="asterisk-1.2.30"
ASTADDONSFOLDER="asterisk-addons-1.2.9"
REALTIMEDIRVER="res_config_ldap.tgz"
if [ -f /etc/redhat-release ] ; then
DISTRO="redhat"
elif [ -f /etc/debian_version ] ; then
DISTRO="debian"
elif [ -f /etc/SUSE-release ] ; then
DISTRO="redhat"
elif [ -f /etc/mandrake-release ] ; then
DISTRO="mandrake"
elif [ -f /etc/slackware-release ] ; then
DISTRO="slackware"
elif [ -f /etc/gentoo-release ] ; then
DISTRO="gentoo"
fi

echo "Downloading and extracting zaptel and asterisk source"
cd /usr/local/src/
if [ ! -e $ZAPPACKAGE ]; then
  wget $ZAPTEL
fi
if [ ! -e $ASTPACKAGE ]; then
  wget $ASTERISK
fi
if [ ! -e $ASTADDONSPACKAGE ]; then
  wget $ASTERISKADDONS
fi
tar -zvxf $ZAPPACKAGE
tar -zvxf $ASTPACKAGE
tar -zvxf $ASTADDONSPACKAGE 

echo "Installing zaptel"
cd $ZAPFOLDER
make clean
make
make install
cd ..

echo "Installing asterisk"
cd $ASTFOLDER
echo "Downloading patches"
wget $CONFIGPATCH
wget $MAKEFILEPATCH
patch -p0<resmkfile.patch
patch -p0<config.c.patch
echo "Downloading Realtime Ldap driver"
cd res
wget $RTLDAP
tar -zxvf $REALTIMEDIRVER
wget $RTLDAPPATCH
patch -p0<res_config_ldap.c.patch
cd ../configs
wget http://mustafa.pk.googlepages.com/extconfig.conf.sample
wget http://mustafa.pk.googlepages.com/res_ldap.conf.sample
cd ..
make clean
make
make install
make samples
cp contrib/init.d/rc.$DISTRO.asterisk /etc/init.d/asterisk
cd ..

echo "Installing asterisk-addons"
cd $ASTADDONSFOLDER
make clean
make
make install

echo "Loading ztdummy driver"
modprobe zaptel
modprobe ztdummy

echo "adding rules to /etc/rc.local"

echo "modprobe zaptel
modprobe ztdummy
" >> /etc/rc.local

echo "Downloading open source g729 codec"
cd /usr/lib/asterisk/modules/
wget http://asterisk.hosting.lv/bin12/codec_g729-ast12-gcc4-glibc-pentium4.so

echo "Running Asterisk"
/etc/init.d/asterisk start

echo "***********************************************************************"
echo "*             INSTALLATION SUCCESSFUL                                 *"
echo "***********************************************************************"
echo "* You can test if Asterisk installed successfully using               *"
echo "* asterisk -ncrvvv and start configuring your dial plan               *"
echo "***********************************************************************"
exit

7 Comments »

  1. [...] This cup of tea was served by: everything about machines [...]

    Pingback by asterisk 1.2 with realtime ldap driver | Tea Break — December 28, 2008 @ 5:23 pm

  2. Thanks for this effort , it really minimize my work for asterisk installation

    Thanks again

    Bilal

    Comment by Syed Bilal Masaud — December 31, 2008 @ 2:52 pm

  3. i had succesfully installed asterisk and openldap with real time ldap driver using this tutorial.

    now, i want insert some user to the openldap database based on a howto from redhatmagazine.this tutorial is based on fedora directory project, but i think i can using it.

    and i got this following error:

    [root@dgkvoip ~]# ldapadd -x -D "cn=manager,dc=dgkvoip,dc=net" -W -f /root/user.ldif
    Enter LDAP Password:
    adding new entry "cn=user1,ou=sippeers,dc=dgkvoip,dc=net"
    ldap_add: Internal (implementation specific) error (80)
    additional info: no structuralObjectClass operational attribute

    this is my slapd.conf and user.ldif

    is there any clue for me?

    Comment by dudi — January 6, 2009 @ 12:47 am

  4. sorry, i forgot to mention.

    i put asterisk.schema to the /etc/openldap/schema.

    Comment by dudi — January 6, 2009 @ 1:09 am

  5. dudi: you are missing a structural objectClass in your ldif file, try something like this:

    dn: cn=user1,ou=sippeers,dc=dgkvoip,dc=net
    objectClass: AsteriskSIPUser
    objectClass: inetOrgPerson
    objectClass: top
    cn: user1
    AstAccountCallerID: 2001
    AstAccountHost: dynamic
    AstAccountRealmedPassword: {MD5}d0fb963ff976f9c37fc81fe03c21ea7b
    AstAccountContext: default
    AstAccountType: friend

    Comment by cyrenity — January 10, 2009 @ 5:56 am

  6. #5: cyrenity: thanks a lot. it works for me :) .

    the next scenario is trying to integrating between zimbra account and asterisk.

    Comment by dudi — January 13, 2009 @ 4:23 am

  7. asterisk 1.2 with realtime ldap driver…

    I have created an auto install script based on http://www.cahilig.org/

    Trackback by asterisk 1.2 with realtime ldap driver / LiveFromPakistan — February 2, 2009 @ 7:42 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.