Realtime LDAP error - loading sip.conf

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Realtime LDAP error - loading sip.conf

Postby smbrown » Sun Jun 20, 2010 9:21 pm

Have worked through issues of schema objectClass (auxiliary vs structural) and how to structure the data for sip.conf with appropriate attributes within OpenLDAP... so far so good. Turn on DEBUG and watch sip.conf load after "sip reload", all the appropriate attributes found and correct but then there's an ERROR, one occurrence for each of the 4 parameters currently within sip.conf:

[Jun 20 19:07:57] ERROR[5815] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'

Reviewing the res_config_ldap.c source, there's definitely a reference to var_metric

var_metric is tie-breaker when category and cat_metric are equal; useful for things such as:
[general]
disallow=all
allow=ulaw
allow=alaw

Code: Select all
00996    /* if the metric and the category name is the same, we check the variable metric */
00997    if (as->var_metric < bs->var_metric)
00998       return -1;
00999    else if (as->var_metric > bs->var_metric)
01000       return 1;
01001
01002    return 0;


data structure includes var_metric
Code: Select all
for (vars_count = 0, p = vars; *p; p++) {
01046       struct ast_variable *category = variable_named(*p, "category");
01047       struct ast_variable *cat_metric = variable_named(*p, "cat_metric");
01048       struct ast_variable *var_name = variable_named(*p, "variable_name");
01049       struct ast_variable *var_val = variable_named(*p, "variable_value");
01050       struct ast_variable *var_metric = variable_named(*p, "[b]var_metric[/b]");
01051       struct ast_variable *dn = variable_named(*p, "dn");


validate all necessary fields are populated
Code: Select all
01058       if (!category) {
01059          ast_log(LOG_ERROR,
01060                "No category name in entry '%s'  for file '%s'.\n",
01061                (dn ? dn->value : "?"), file);
01062       } else if (!cat_metric) {
01063          ast_log(LOG_ERROR,
01064                "No category metric in entry '%s'(category: %s) for file '%s'.\n",
01065                (dn ? dn->value : "?"), category->value, file);
01066       } else if (!var_metric) {
01067          ast_log(LOG_ERROR,
01068                "No variable metric in entry '%s'(category: %s) for file '%s'.\n",
01069                (dn ? dn->value : "?"), category->value, file);
01070       } else if (!var_name) {
01071          ast_log(LOG_ERROR,
01072                "No variable name in entry '%s' (category: %s metric: %s) for file '%s'.\n",
01073                (dn ? dn->value : "?"), category->value,
01074                cat_metric->value, file);
01075       } else if (!var_val) {
01076          ast_log(LOG_ERROR,
01077                "No variable value in entry '%s' (category: %s metric: %s variable: %s) for file '%s'.\n",
01078                (dn ? dn->value : "?"), category->value,
01079                cat_metric->value, var_name->value, file);
01080       } else {
01081          categories[vars_count].name = category->value;
01082          categories[vars_count].metric = atoi(cat_metric->value);
01083          categories[vars_count].variable_name = var_name->value;
01084          categories[vars_count].variable_value = var_val->value;
01085          categories[vars_count].var_metric = atoi(var_metric->value);
01086          vars_count++;
01087       }
01088    }


So WHERE is var_metric supposed to be coming from? Using what I believe to be latest Asterisk schema (v.3.1.4), matching res_ldap.conf config file, but nowhere can I find an external reference to var_metric which is clearly causing the sip.conf file load to fail.... where oh where should var_metric be coming from?? Someone save my forehead from further abuse... please!

Asterisk 1.6.2.8
OpenLDAP 2.4.19-r1
Asterisk schema v3.1.4

[Jun 20 19:07:57] VERBOSE[5815] chan_sip.c: Reloading SIP
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: substituted: string: 'dc=acme,dc=com' => 'dc=acme,dc=com'
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: basedn: 'dc=acme,dc=com' => 'dc=acme,dc=com'
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: Everything seems fine.
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: name='filename' value='sip.conf'
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: name='commented' value='FALSE'
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_name LDAP value: videosupport
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: ou LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_value LDAP value: no
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: filename LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: commented LDAP value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: category LDAP value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cat_metric LDAP value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cn LDAP value: sip-videosupport
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(174) semicolon_count_var: no
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_name LDAP value: realm
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: ou LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_value LDAP value: acme.com
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: filename LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: commented LDAP value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: category LDAP value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cat_metric LDAP value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cn LDAP value: sip-realm
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(174) semicolon_count_var: acme.com
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_name LDAP value: allow
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: ou LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_value LDAP value: all
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: category LDAP value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: filename LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: commented LDAP value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cat_metric LDAP value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cn LDAP value: sip-allow
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(174) semicolon_count_var: all
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: objectClass LDAP value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_name LDAP value: context
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: ou LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: variable_value LDAP value: internal
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: category LDAP value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cat_metric LDAP value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: commented LDAP value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: filename LDAP value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(292) attribute_name: cn LDAP value: sip-context
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(174) semicolon_count_var: internal
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_name value: videosupport
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: ou value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_value value: no
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: filename value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: commented value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: category value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cat_metric value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cn value: sip-videosupport
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(511) Added to vars - videosupport = no
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_name value: realm
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: ou value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_value value: acme.com
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: filename value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: commented value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: category value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cat_metric value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cn value: sip-realm
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(511) Added to vars - realm = acme.com
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_name value: allow
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: ou value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_value value: all
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: category value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: filename value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: commented value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cat_metric value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cn value: sip-allow
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(511) Added to vars - allow = all
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: organizationalUnit
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: top
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: objectClass value: AsteriskConfig
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_name value: context
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: ou value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: variable_value value: internal
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: category value: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cat_metric value: 1
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: commented value: FALSE
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: filename value: sip.conf
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(488) attribute_name: cn value: sip-context
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: LINE(511) Added to vars - context = internal
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: category: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_name: videosupport
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_val: no
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: cat_metric: 1
[Jun 20 19:07:57] ERROR[5815] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'.
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: category: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_name: realm
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_val: acme.com
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: cat_metric: 1
[Jun 20 19:07:57] ERROR[5815] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'.
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: category: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_name: allow
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_val: all
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: cat_metric: 1
[Jun 20 19:07:57] ERROR[5815] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'.
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: category: general
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_name: context
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: var_val: internal
[Jun 20 19:07:57] DEBUG[5815] res_config_ldap.c: cat_metric: 1
[Jun 20 19:07:57] ERROR[5815] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'.
[Jun 20 19:07:57] DEBUG[5815] chan_sip.c: --------------- SIP reload started
[Jun 20 19:07:57] DEBUG[5815] chan_sip.c: --------------- Done destroying registry list
[Jun 20 19:08:07] DEBUG[5815] acl.c: Trying to check A.ROOT-SERVERS.NET and get our IP address for that connection
[Jun 20 19:08:07] DEBUG[5815] acl.c: Found IP address for this socket
[Jun 20 19:08:07] DEBUG[5815] tcptls.c: Nothing changed in SIP TCP server
[Jun 20 19:08:07] DEBUG[5815] chan_sip.c: SIP TCP server started
[Jun 20 19:08:07] VERBOSE[5815] config.c: == Parsing '/etc/asterisk/sip_notify.conf': [Jun 20 19:08:07] DEBUG[5815] config.c: Parsing /etc/asterisk/sip_notify.conf
[Jun 20 19:08:07] VERBOSE[5815] config.c: == Found
[Jun 20 19:08:07] DEBUG[5815] chan_sip.c: SIP reload_config done...Runtime= 10 sec
[Jun 20 19:08:07] DEBUG[5815] sched.c: Asterisk Schedule Dump (0 in Q, 0 Total, 0 Cache, 0 high-water)
[Jun 20 19:08:07] DEBUG[5815] sched.c: =============================================================
[Jun 20 19:08:07] DEBUG[5815] sched.c: |ID Callback Data Time (sec:ms) |
[Jun 20 19:08:07] DEBUG[5815] sched.c: +-----+-----------------+-----------------+-----------------+
[Jun 20 19:08:07] DEBUG[5815] sched.c: =============================================================
[Jun 20 19:08:07] DEBUG[5815] chan_sip.c: --------------- Done destroying pruned peers
[Jun 20 19:08:07] DEBUG[5815] chan_sip.c: do_reload finished. peer poke/prune reg contact time = 0 sec.
[Jun 20 19:08:07] DEBUG[5815] chan_sip.c: --------------- SIP reload done
smbrown
Newsterisk
 
Posts: 15
Joined: Tue Jun 15, 2010 4:28 pm

Re: Realtime LDAP error - loading sip.conf

Postby fhackbart » Fri Oct 26, 2012 10:19 am

Hi, I am running into the same problem I am running asterisk-1.8.17.0-1.1.i586 on openSUSE 12.1 and after configuring sip.conf over LDAP I receive the error on /var/log/asterisk/messages

[Oct 26 16:34:10] ERROR[25671] res_config_ldap.c: No variable metric in entry '?'(category: general) for file 'sip.conf'.

I can see the query to LDAP receiving those entries but inside res_config_ldap.conf

line 1048:
Code: Select all
...
static struct ast_config *config_ldap
...


line 1086:
Code: Select all
...
struct ast_variable *var_metric = variable_named(*p, "var_metric");
...


line 1100:
Code: Select all
...
                } else if (!var_metric) {
                        ast_log(LOG_ERROR, "No variable metric in entry '%s'(category: %s) for file '%s'.\n",
                                        (dn ? dn->value : "?"), category->value, file);
...



The schema asterisk.ldif does not implement a attribute for var_metric like does for cat_metric (AstConfigCategoryMetric), I believe that a new attribute creation is needed.

My configuration files:

extconfig.conf

Code: Select all
...
sip.conf = ldap,"ou=config,dc=xpto,dc=local",config
...


res_ldap.conf

Code: Select all
...
[config]
additionalFilter=(objectClass=AsteriskConfig)
filename = AstConfigFilename
category = AstConfigCategory
variable_name = AstConfigVariableName
variable_value = AstConfigVariableValue
cat_metric = AstConfigCategoryMetric
commented = AstConfigCommented
...
fhackbart
Newsterisk
 
Posts: 1
Joined: Fri Oct 26, 2012 10:10 am

Re: Realtime LDAP error - loading sip.conf

Postby ventor » Mon Jan 18, 2016 5:26 pm

Hi,

How did you solve this problem ?

Thanks.
ventor
Newsterisk
 
Posts: 1
Joined: Tue Jul 21, 2015 5:45 pm


Return to Asterisk Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron