[asterisk-users] asterisk + res_config_ldap = asterisk.core

extropye extropye at gmail.com
Wed Nov 25 06:42:28 CST 2009


Greetings.

Attempting to connect  Asterisk to LDAP database using res_config_ldap
module. While trying to register sip client (Ekiga softphone),
according to slapd.log, asterisk connects to LDAP server, asks for
some attributes to modify (they do exist, and asterisk user has all
permissions to do that,
etc).  And then asterisk application just crashes.

Without ldap (using just static users' declarations in sip.conf)
everything works fine.

--------------------------------------------------------
Software info:
--------------------------------------------------------
amd64
FreeBSD 8.0-RC1.
asterisk16-1.6.0.15, latest from ports.
OpenLDAP.

--------------------------------------------------------
Configs and logs:
--------------------------------------------------------

dummyuzer attributes in LDAP database:
objectClass AsteriskSIPUser
uid dummyuzer
AstAccountCallerID 2001
AstAccountContext domain
AstAccountDefaultUser dummyuzer
AstAccountExpirationTimestamp 1259080333 (and it changes, so this part is ok)
AstAccountHost dynamic
AstAccountIPAddress 10.3.8.104 (and it changes from default random
address, so it's ok too)
AstAccountLastQualifyMilliseconds 0
AstAccountNAT no
AstAccountPort 5060
AstAccountQualify no
AstAccountType friend

--------------------------------------------------------

sip.conf:
[general]
allow=all
bindaddr=0.0.0.0
realm=gw.domain.com

--------------------------------------------------------

extconfig.conf:
[settings]
sipusers => ldap,"ou=users,o=domain",sip
sippeers => ldap,"ou=users,o=domain",sip
extensions => ldap,"o=domain",extensions

--------------------------------------------------------

res_ldap.conf:
[_general]
url=ldap://xx.xx.xx.xx:389
protocol=3
basedn="ou=users,o=domain"
user=uid=asterisk,ou=virtual,o=domain
pass=XXXXXXXXXXXXXXXXX

[config]
additionalFilter=(objectClass=AstConfig)
filename = AstConfigFilename
category = AstConfigCategory
variable_name = AstConfigVariableName
variable_value = AstConfigVariableValue
cat_metric = AstConfigCategoryMetric
commented = AstConfigCommented

[extensions]
context  =  AstContext
exten  =  AstExtension
priority = AstPriority
app = AstApplication
appdata = AstApplicationData
additionalFilter=(objectClass=AsteriskExtension)

[sip]
name = uid
amaflags = AstAccountAMAFlags
callgroup = AstAccountCallGroup
callerid = AstAccountCallerID
canreinvite = AstAccountCanReinvite
context = AstAccountContext
dtmfmode = AstAccountDTMFMode
fromuser = AstAccountFromUser
fromdomain = AstAccountFromDomain
fullcontact = AstAccountFullContact
host = AstAccountHost
ipaddr = AstAccountIPAddress
insecure = AstAccountInsecure
mailbox = AstAccountMailbox
md5secret = AstAccountRealmedPassword
nat = AstAccountNAT
deny = AstAccountDeny
permit = AstAccountPermit
pickupgroup = AstAccountPickupGroup
port = AstAccountPort
qualify = AstAccountQualify
restrictcid = AstAccountRestrictCID
rtptimeout = AstAccountRTPTimeout
rtpholdtimeout = AstAccountRTPHoldTimeout
type = AstAccountType
disallow = AstAccountDisallowedCodec
allow = AstAccountAllowedCodec
MusicOnHold = AstAccountMusicOnHold
regseconds = AstAccountExpirationTimestamp
regcontext = AstAccountRegistrationContext
regexten = AstAccountRegistrationExten
CanCallForward = AstAccountCanCallForward
defaultuser = AstAccountDefaultUser
regserver = AstAccountRegistrationServer
lastms = AstAccountLastQualifyMilliseconds
additionalFilter = (objectClass=AsteriskSIPUser)

--------------------------------------------------------

modules.conf:
[modules]
autoload=yes
preload => func_strings.so
noload => pbx_gtkconsole.so
load => res_musiconhold.so
noload => chan_alsa.so
noload => chan_oss.so
noload => chan_console.so
noload => chan_ooh323.so
noload => chan_skinny.so
noload => chan_h323.so
noload => cdr_odbc.so
noload => res_config_sqlite.so
noload => res_config_odbc.so
noload => res_jabber.so
noload => cdr_pgsql.so
noload => cdr_sqlite.so
noload => res_config_pgsql.so
noload => cdr_sqlite3_custom.so
noload => chan_gtalk.so
noload => chan_jingle.so
noload => res_snmp.so
noload => res_odbc.so
noload => cdr_adaptive_odbc.so
noload => res_smdi.so
noload => res_phoneprov.so
noload => res_musiconhold.so
noload => func_odbc.so
noload => chan_unistim.so
noload => app_minivm.so
noload => chan_agent.so
noload => chan_iax2.so
noload => app_voicemail.so
noload => chan_mgcp.so
noload => pbx_ael.so
noload => res_config_curl.so
noload => cdr_custom.so
noload => cdr_radius.so

--------------------------------------------------------

part of /var/log/asterisk/full (it always same):
[Nov 25 14:39:45] NOTICE[87569] loader.c: 1 modules will be loaded.
[Nov 25 14:39:45] NOTICE[87569] cdr.c: CDR simple logging enabled.
[Nov 25 14:39:45] NOTICE[87569] loader.c: 139 modules will be loaded.
[Nov 25 14:39:45] NOTICE[87569] config.c: Registered Config Engine ldap
[Nov 25 14:39:45] WARNING[87569] translate.c: plc_samples 160 format f
[Nov 25 14:39:45] VERBOSE[87569] logger.c: SIP channel loading...

--------------------------------------------------------

part of slapd.log:
Nov 24 15:12:55 ldap-sandbox slapd[64345]: conn=17 fd=13 ACCEPT from
IP=yy.yy.yy.yy:46770 (IP=0.0.0.0:389)
Nov 24 15:12:55 ldap-sandbox slapd[64345]: conn=17 op=0 BIND
dn="uid=asterisk,ou=virtual,o=domain" method=128
Nov 24 15:12:55 ldap-sandbox slapd[64345]: conn=17 op=0 BIND
dn="uid=asterisk,ou=virtual,o=domain" mech=SIMPLE ssf=0
Nov 24 15:12:55 ldap-sandbox slapd[64345]: conn=17 op=0 RESULT tag=97
err=0 text=
Nov 24 15:16:54 ldap-sandbox slapd[64345]: conn=17 op=3 SRCH
base="ou=users,o=domain" scope=2 deref=0
filter="(&(objectClass=AsteriskSIPUser)(uid=dummyuzer)(AstAccountHost=dynamic))"
Nov 24 15:17:00 ldap-sandbox slapd[64345]: conn=17 op=3 SEARCH RESULT
tag=101 err=0 nentries=1 text=
Nov 24 15:17:01 ldap-sandbox slapd[64345]: conn=17 op=4 SRCH
base="ou=users,o=domain" scope=2 deref=0
filter="(&(objectClass=AsteriskSIPUser)(uid=dummyuzer))"
Nov 24 15:17:08 ldap-sandbox slapd[64345]: conn=17 op=4 SEARCH RESULT
tag=101 err=0 nentries=1 text=
Nov 24 15:17:08 ldap-sandbox slapd[64345]: conn=17 op=5 MOD
dn="uid=dummyuzer,ou=users,o=domain"
Nov 24 15:17:08 ldap-sandbox slapd[64345]: conn=17 op=5 MOD
attr=AstAccountIPAddress AstAccountPort AstAccountExpirationTimestamp
AstAccountDefaultUser
Nov 24 15:17:08 ldap-sandbox slapd[64345]: conn=17 op=5 RESULT tag=103
err=0 text=
Nov 24 15:17:08 ldap-sandbox slapd[64345]: conn=17 op=6 SRCH
base="ou=users,o=domain" scope=2 deref=0
filter="(&(objectClass=AsteriskSIPUser)(uid=dummyuzer))"
Nov 24 15:17:13 ldap-sandbox slapd[64345]: conn=17 op=6 SEARCH RESULT
tag=101 err=0 nentries=1 text=
Nov 24 15:17:14 ldap-sandbox slapd[64345]: conn=17 op=7 MOD
dn="uid=dummyuzer,ou=users,o=domain"
Nov 24 15:17:14 ldap-sandbox slapd[64345]: conn=17 op=7 MOD
attr=AstAccountLastQualifyMilliseconds
Nov 24 15:17:14 ldap-sandbox slapd[64345]: conn=17 op=7 RESULT tag=103
err=0 text=
Nov 24 15:17:14 ldap-sandbox slapd[64345]: conn=17 op=8 SRCH
base="ou=users,o=domain" scope=2 deref=0
filter="(&(objectClass=AsteriskSIPUser)(uid=dummyuzer)(AstAccountHost=dynamic))"
Nov 24 15:17:20 ldap-sandbox slapd[64345]: conn=17 op=8 SEARCH RESULT
tag=101 err=0 nentries=1 text=
Nov 24 15:17:20 ldap-sandbox slapd[64345]: conn=17 op=9 SRCH
base="ou=users,o=domain" scope=2 deref=0
filter="(&(objectClass=AsteriskSIPUser)(uid=dummyuzer))"
Nov 24 15:17:25 ldap-sandbox slapd[64345]: conn=17 op=9 SEARCH RESULT
tag=101 err=0 nentries=1 text=
Nov 24 15:17:26 ldap-sandbox slapd[64345]: conn=17 fd=13 closed
(connection lost)

--------------------------------------------------------

bt full output @ gdb /usr/local/sbin/asterisk asterisk.core:
(gdb) bt full
#0  0x0000000802531386 in strlen () from /lib/libc.so.7
No symbol table info available.
#1  0x0000000801b83889 in ber_put_string () from
/usr/local/lib/liblber-2.4.so.7
No symbol table info available.
#2  0x0000000801b83a51 in ber_printf () from
/usr/local/lib/liblber-2.4.so.7
No symbol table info available.
#3  0x0000000801a52ef8 in ldap_modify_ext () from
/usr/local/lib/libldap-2.4.so.7
No symbol table info available.
#4  0x0000000801a52fb2 in ldap_modify_ext_s () from
/usr/local/lib/libldap-2.4.so.7
No symbol table info available.
#5  0x0000000802b36b7a in update_ldap (basedn=0x7fffff8921a0
"ou=users,o=domain", table_name=0x7fffff8920a0 "sip",
attribute=0x80907bde6 "name", lookup=0x802859a00 "dummyuzer",
ap=0x7fffff892080)
    at res_config_ldap.c:1285
        error = 0
        ldap_entry = (LDAPMessage *) 0x8028bcf80
        ldap_mods = (LDAPMod **) 0x8028d0220
        newparam = 0x0
        newval = 0x802859bd0 "dummyuzer"
        dn = 0x8028d01f0 "uid=dummyuzer,ou=users,o=domain"
        num_entries = 1
        i = 0
        mods_size = 5
        mod_exists = 0
        table_config = (struct ldap_table_config *) 0x80272ea60
        clean_basedn = 0x80284d000 "ou=users,o=domain"
        filter = (struct ast_str *) 0x802851630
        tries = 0
        result = 0
        ldap_result = (LDAPMessage *) 0x8028bcf80
        __PRETTY_FUNCTION__ = "update_ldap"
#6  0x0000000000465a23 in ast_update_realtime (family=0x80907bdaf
"sippeers", keyfield=0x80907bde6 "name", lookup=0x802859a00
"dummyuzer") at config.c:2136
        eng = (struct ast_config_engine *) 0x802c39520
        res = -1
        db = "ou=users,o=domain", '\0' <repeats 237 times>
        table = "sip", '\0' <repeats 252 times>
        ap = {{gp_offset = 48, fp_offset = 48, overflow_arg_area =
0x7fffff8923a0, reg_save_area = 0x7fffff8922b0}}
#7  0x0000000809019822 in realtime_update_peer (peername=0x802859a00
"dummyuzer", sin=0x80285a330, defaultuser=0x802859bd0 "dummyuzer",
fullcontact=0x0, expirey=3600, deprecated_username=0, lastms=0)
    at chan_sip.c:3626
        port = "5060\000\000\000\000@�"
        ipaddr = "10.3.8.104\000\000\000\000\000"
        regseconds = "1259152811\000\000\000\000\000\000�\000\000"
        tablename = 0x80907bdaf "sippeers"
        str_lastms =
"0\000\211��\177\000\000�\033\211��\177\000\000�!\211�"
        sysname = 0x0
        syslabel = 0x0
        nowtime = 1259152811
        fc = 0x0
        realtimeregs = 0
#8  0x000000080901a11d in update_peer (p=0x802859a00, expiry=3600) at
chan_sip.c:3754
        rtcachefriends = 0
#9  0x000000080903dbf2 in register_verify (p=0x802817028,
sin=0x7fffff892a30, req=0x7fffff892a40, uri=0x7fffff892e79
"sip:10.3.8.1") at chan_sip.c:11173
        res = AUTH_SUCCESSFUL
        peer = (struct sip_peer *) 0x802859a00
        tmp = "<sip:dummyuzer\00010.3.8.1\000\000�\213\002\b\000\000\000\020&\211��\177\000\000\000\000\000\000\000\000\000\000
", '\0' <repeats 15 times>, " ", '\0' <repeats 15 times>,
"\227\027\rK\000\000\000\000\034�\000\000\000\000\000\000�\027\rK\000\000\000\000\034�",
'\0' <repeats 142 times>, "4���\f\213|�"
        name = 0x7fffff8925a5 "dummyuzer"
---Type <return> to continue, or q <return> to quit---
        c = 0x0
        domain = 0x7fffff8925af "10.3.8.1"
        __PRETTY_FUNCTION__ = "register_verify"
#10 0x0000000809066110 in handle_request_register (p=0x802817028,
req=0x7fffff892a40, sin=0x7fffff892a30, e=0x7fffff892e79
"sip:10.3.8.1") at chan_sip.c:18996
        res = 8
        __PRETTY_FUNCTION__ = "handle_request_register"
#11 0x00000008090670ec in handle_incoming (p=0x802817028,
req=0x7fffff892a40, sin=0x7fffff892a30, recount=0x7fffff8929bc,
nounlock=0x7fffff8929b8) at chan_sip.c:19210
        cmd = 0x7fffff892e70 "REGISTER"
        cseq = 0x7fffff892eb4 "2 REGISTER"
        useragent = 0x7fffff892f27 "Ekiga/3.2.0"
        seqno = 2
        len = 1
        respid = 0
        res = 0
        debug = 0
        e = 0x7fffff892e79 "sip:10.3.8.1"
        error = 0
        __PRETTY_FUNCTION__ = "handle_incoming"
#12 0x0000000809067e4f in handle_request_do (req=0x7fffff892a40,
sin=0x7fffff892a30) at chan_sip.c:19466
        p = (struct sip_pvt *) 0x802817028
        recount = 0
        nounlock = 0
        lockretry = 10
        __PRETTY_FUNCTION__ = "handle_request_do"
#13 0x0000000809067876 in sipsock_read (id=0x802811184, fd=12,
events=1, ignore=0x0) at chan_sip.c:19372
        req = {rlPart1 = 0x7fffff892e70 "REGISTER", rlPart2 =
0x7fffff892e79 "sip:10.3.8.1", len = 526, headers = 13, method = 2,
lines = 0, sdp_start = 0, sdp_end = 0, debug = 0 '\0', has_to_tag = 0
'\0',
  ignore = 1 '\001', header = {0x7fffff892e70 "REGISTER",
0x7fffff892e8f "Route: <sip:10.3.8.1:5060;lr>", 0x7fffff892eae "CSeq:
2 REGISTER",
    0x7fffff892ec0 "Via: SIP/2.0/UDP
10.3.8.104:5060;branch=z9hG4bK5a11a1de-24d8-de11-8af3-00248cdec25c;rport",
0x7fffff892f1b "User-Agent: Ekiga/3.2.0",
    0x7fffff892f34 "From:
<sip:dummyuzer at 10.3.8.1>;tag=66c4a0de-24d8-de11-8af3-00248cdec25c",
0x7fffff892f7d "Call-ID: 4cb6a0de-24d8-de11-8af3-00248cdec25c at hvost",
    0x7fffff892fb2 "To: <sip:dummyuzer at 10.3.8.1>", 0x7fffff892fd0
"Contact: <sip:dummyuzer at 10.3.8.104>;q=1", 0x7fffff892ff9 "Allow:
INVITE,ACK,OPTIONS,BYE,CANCEL,SUBSCRIBE,NOTIFY,REFER,MESSAGE,INFO,PING",
    0x7fffff893048 "Expires: 3600", 0x7fffff893057 "Content-Length:
0", 0x7fffff89306a "Max-Forwards: 70", 0x7fffff89307c "", 0x0 <repeats
50 times>}, line = {0x7fffff89307e "", 0x0 <repeats 63 times>},
  data = "REGISTER\000sip:10.3.8.1\000SIP/2.0\000\000Route:
<sip:10.3.8.1:5060;lr>\000\000CSeq: 2 REGISTER\000\000Via: SIP/2.0/UDP
10.3.8.104:5060;branch=z9hG4bK5a11a1de-24d8-de11-8af3-00248cdec25c;rport\000\000User-Agent:
Ekiga/3.2.0\000\000From"..., socket = {type = SIP_TRANSPORT_UDP, fd =
-1, port = 50195, tcptls_session = 0x0}, next = {next = 0x0}}
        sin = {sin_len = 16 '\020', sin_family = 2 '\002', sin_port =
50195, sin_addr = {s_addr = 1745355530}, sin_zero =
"\000\000\000\000\000\000\000"}
        res = 526
        len = 16
        __PRETTY_FUNCTION__ = "sipsock_read"
#14 0x0000000000496b9a in ast_io_wait (ioc=0x80279afa0, howlong=1000)
at io.c:288
        res = 1
        x = 0
        origcnt = 1
#15 0x0000000809069046 in do_monitor (data=0x0) at chan_sip.c:19867
        res = 1000
        dialog = (struct sip_pvt *) 0x0
        t = 1259149207
        reloading = 0
        __PRETTY_FUNCTION__ = "do_monitor"
#16 0x0000000000506f79 in dummy_start (data=0x80279acc0) at utils.c:861
        __cleanup_info__ = {pthread_cleanup_pad = {0, 4385328,
34400665216, 0, 0, 0, 0, 0}}
        ret = (void *) 0x802336f4c
        a = {start_routine = 0x809068dd0 <do_monitor>, data = 0x0,
name = 0x802725180 "do_monitor", ' ' <repeats 11 times>, "started at
[19900] chan_sip.c restart_monitor()"}
#17 0x00000008023334b1 in pthread_getprio () from /lib/libthr.so.3
No symbol table info available.
#18 0x0000000000000000 in ?? ()
No symbol table info available.
Cannot access memory at address 0x7fffff894000

--------------------------------------------------------

Thanks in advance.



More information about the asterisk-users mailing list