[asterisk-commits] kmoore: trunk r331201 - in /trunk: UPGRADE.txt funcs/func_enum.c main/enum.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 9 12:08:37 CDT 2011
Author: kmoore
Date: Tue Aug 9 12:08:33 2011
New Revision: 331201
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=331201
Log:
Allow ENUM query functions to report lookup errors
The ENUM dialplan functions do not report DNS query errors properly. It is
useful to differentiate between failed query (e.g. non-existent domain) vs. no
data records of the appropriate type. This is required to make overlapped
dialing work.
(closes issue ASTERISK-13769)
Review: https://reviewboard.asterisk.org/r/1355/
Patch-by: Timo Teras
Modified:
trunk/UPGRADE.txt
trunk/funcs/func_enum.c
trunk/main/enum.c
Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=331201&r1=331200&r2=331201
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Tue Aug 9 12:08:33 2011
@@ -22,7 +22,10 @@
From 10 to 12:
-* No significant changes as of yet.
+func_enum:
+ - ENUM query functions now return a count of -1 on lookup error to
+ differentiate between a failed query and a successful query with 0 results
+ matching the specified type.
From 1.8 to 10:
Modified: trunk/funcs/func_enum.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_enum.c?view=diff&rev=331201&r1=331200&r2=331201
==============================================================================
--- trunk/funcs/func_enum.c (original)
+++ trunk/funcs/func_enum.c Tue Aug 9 12:08:33 2011
@@ -82,7 +82,7 @@
<para>The number of the result that you want to retrieve.</para>
<para>Results start at <literal>1</literal>. If this argument is specified
as <literal>getnum</literal>, then it will return the total number of results
- that are available.</para>
+ that are available or -1 on error.</para>
</parameter>
</syntax>
<description>
@@ -105,7 +105,7 @@
<option name="c">
<para>Returns an integer count of the number of NAPTRs of a certain RR type.</para>
<para>Combination of <literal>c</literal> and Method-type of <literal>ALL</literal> will
- return a count of all NAPTRs for the record.</para>
+ return a count of all NAPTRs for the record or -1 on error.</para>
</option>
<option name="u">
<para>Returns the full URI and does not strip off the URI-scheme.</para>
@@ -363,7 +363,7 @@
erds = datastore->data;
if (!strcasecmp(args.resultnum, "getnum")) {
- snprintf(buf, len, "%u", erds->context->naptr_rrs_count);
+ snprintf(buf, len, "%d", erds->context->naptr_rrs_count);
res = 0;
goto finish;
}
Modified: trunk/main/enum.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/enum.c?view=diff&rev=331201&r1=331200&r2=331201
==============================================================================
--- trunk/main/enum.c (original)
+++ trunk/main/enum.c Tue Aug 9 12:08:33 2011
@@ -856,6 +856,7 @@
if (ret < 0) {
ast_debug(1, "No such number found: %s (%s)\n", tmp, strerror(errno));
+ context->naptr_rrs_count = -1;
strcpy(dst, "0");
ret = 0;
}
@@ -896,7 +897,7 @@
} else if (!(context->options & ENUMLOOKUP_OPTIONS_COUNT)) {
context->dst[0] = 0;
} else if ((context->options & ENUMLOOKUP_OPTIONS_COUNT)) {
- snprintf(context->dst, context->dstlen, "%d", context->count);
+ snprintf(context->dst, context->dstlen, "%d", context->naptr_rrs_count + context->count);
}
if (chan) {
More information about the asterisk-commits
mailing list