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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2011-08-09 17:08:33 +00:00
parent 5fe104ddb9
commit c3bd5892a6
3 changed files with 9 additions and 5 deletions

View File

@@ -856,6 +856,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
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 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
} 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) {