diff --git a/conf/vanilla/autoload_configs/enum.conf.xml b/conf/vanilla/autoload_configs/enum.conf.xml
index 0304d0dacd..6cd198050b 100644
--- a/conf/vanilla/autoload_configs/enum.conf.xml
+++ b/conf/vanilla/autoload_configs/enum.conf.xml
@@ -2,8 +2,15 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c
index c0cf904da2..0abd27b601 100644
--- a/src/mod/applications/mod_enum/mod_enum.c
+++ b/src/mod/applications/mod_enum/mod_enum.c
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II
+ * Jay Binks
*
* mod_enum.c -- ENUM
*
@@ -35,6 +36,8 @@
#endif
#include
+#define ENUM_MAXNAMESERVERS 10 /* max nameservers that will be used */
+
SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown);
SWITCH_MODULE_DEFINITION(mod_enum, mod_enum_load, mod_enum_shutdown, NULL);
@@ -72,6 +75,7 @@ static struct {
int timeout;
int retries;
int random;
+ char *nameserver[ENUM_MAXNAMESERVERS];
} globals;
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root);
@@ -102,6 +106,7 @@ static void add_route(char *service, char *regex, char *replace)
static switch_status_t load_config(void)
{
char *cf = "enum.conf";
+ int inameserver = 0;
switch_xml_t cfg, xml = NULL, param, settings, route, routes;
switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -135,6 +140,11 @@ static switch_status_t load_config(void)
globals.random = switch_true(val);
} else if (!strcasecmp(var, "default-isn-root")) {
set_global_isn_root(val);
+ } else if (!strcasecmp(var, "nameserver")) {
+ if ( inameserver < ENUM_MAXNAMESERVERS ) {
+ globals.nameserver[inameserver] = (char *) val;
+ inameserver++;
+ }
} else if (!strcasecmp(var, "log-level-trace")) {
}
@@ -442,8 +452,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
return;
}
-
-switch_status_t ldns_lookup(const char *number, const char *root, const char *server_name, enum_record_t **results)
+switch_status_t ldns_lookup(const char *number, const char *root, char *server_name[ENUM_MAXNAMESERVERS] , enum_record_t **results)
{
ldns_resolver *res = NULL;
ldns_rdf *domain = NULL;
@@ -454,6 +463,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se
switch_status_t status = SWITCH_STATUS_FALSE;
char *name = NULL;
struct timeval to = { 0, 0};
+ int inameserver = 0;
if (!(name = reverse_number(number, root))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n");
@@ -464,14 +474,20 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se
goto end;
}
- if (!zstr(server_name)) {
+ if (server_name) {
res = ldns_resolver_new();
switch_assert(res);
- if ((serv_rdf = ldns_rdf_new_addr_frm_str(server_name))) {
- s = ldns_resolver_push_nameserver(res, serv_rdf);
- ldns_rdf_deep_free(serv_rdf);
+ for(inameserver=0; inameserverdestination_number);
- if (enum_lookup(dp, caller_profile->destination_number, &results) == SWITCH_STATUS_SUCCESS) {
+ if (enum_lookup(dp, caller_profile->destination_number, &results, channel, session) == SWITCH_STATUS_SUCCESS) {
if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
free_results(&results);
@@ -624,7 +680,7 @@ SWITCH_STANDARD_APP(enum_app_function)
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
dest = argv[0];
root = argv[1];
- if (enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) {
+ if (enum_lookup(root, dest, &results, channel, session) == SWITCH_STATUS_SUCCESS) {
switch_event_t *vars;
if (switch_channel_get_variables(channel, &vars) == SWITCH_STATUS_SUCCESS) {
@@ -692,7 +748,7 @@ SWITCH_STANDARD_API(enum_api)
dest = argv[0];
root = argv[1];
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Looking up %s@%s\n", dest, root);
- if (enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) {
+ if (enum_lookup(root, dest, &results, NULL, session) == SWITCH_STATUS_SUCCESS) {
for (rp = results; rp; rp = rp->next) {
if (!rp->supported) {
continue;
@@ -770,7 +826,7 @@ SWITCH_STANDARD_API(enum_function)
}
- if (!enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) {
+ if (!enum_lookup(root, dest, &results, NULL, session) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "No Match!\n");
return SWITCH_STATUS_SUCCESS;
}