Add H.323, SIP, IAX/IAX2 to ENUM Lookup (bug #202)
authorMark Spencer <markster@digium.com>
Mon, 1 Sep 2003 15:36:52 +0000 (15:36 +0000)
committerMark Spencer <markster@digium.com>
Mon, 1 Sep 2003 15:36:52 +0000 (15:36 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1452 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_enumlookup.c
enum.c

index 4f132a5..fb09567 100755 (executable)
@@ -73,6 +73,24 @@ static int enumlookup_exec(struct ast_channel *chan, void *data)
                                c += 4;
                        snprintf(tmp, sizeof(tmp), "SIP/%s", c);
                        pbx_builtin_setvar_helper(chan, "ENUM", tmp);
+               } else if (!strcasecmp(tech, "H323")) {
+                       c = dest;
+                       if (!strncmp(c, "h323:", 5))
+                               c += 5;
+                       snprintf(tmp, sizeof(tmp), "H323/%s", c);
+                       pbx_builtin_setvar_helper(chan, "ENUM", tmp);
+               } else if (!strcasecmp(tech, "IAX")) {
+                       c = dest;
+                       if (!strncmp(c, "iax:", 4))
+                               c += 4;
+                       snprintf(tmp, sizeof(tmp), "IAX/%s", c);
+                       pbx_builtin_setvar_helper(chan, "ENUM", tmp);
+               } else if (!strcasecmp(tech, "IAX2")) {
+                       c = dest;
+                       if (!strncmp(c, "iax2:", 5))
+                               c += 5;
+                       snprintf(tmp, sizeof(tmp), "IAX2/%s", c);
+                       pbx_builtin_setvar_helper(chan, "ENUM", tmp);
                } else if (!strcasecmp(tech, "tel")) {
                        c = dest;
                        if (!strncmp(c, "tel:", 4))
diff --git a/enum.c b/enum.c
index b3a0a3c..ef6c19b 100755 (executable)
--- a/enum.c
+++ b/enum.c
@@ -187,11 +187,20 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
        if ((!strncasecmp(services, "e2u+sip", 7)) || 
            (!strncasecmp(services, "sip+e2u", 7))) {
                strncpy(tech, "sip", techsize -1); 
+       } else if ((!strncasecmp(services, "e2u+h323", 7)) || 
+           (!strncasecmp(services, "h323+e2u", 7))) {
+               strncpy(tech, "h323", techsize -1); 
+       } else if ((!strncasecmp(services, "e2u+iax", 7)) || 
+           (!strncasecmp(services, "iax+e2u", 7))) {
+               strncpy(tech, "iax", techsize -1); 
+       } else if ((!strncasecmp(services, "e2u+iax2", 7)) || 
+           (!strncasecmp(services, "iax2+e2u", 7))) {
+               strncpy(tech, "iax2", techsize -1); 
        } else if ((!strncasecmp(services, "e2u+tel", 7)) || 
            (!strncasecmp(services, "tel+e2u", 7))) {
                strncpy(tech, "tel", techsize -1); 
        } else if (strncasecmp(services, "e2u+voice:", 10)) {
-               ast_log(LOG_WARNING, "Services must be e2u+sip, sip+e2u, e2u+tel, tel+e2u or e2u+voice:\n");
+               ast_log(LOG_WARNING, "Services must be e2u+sip, sip+e2u, e2u+h323, h323+e2u, e2u+iax, iax+e2u, e2u+iax2, iax2+e2u, e2u+tel, tel+e2u or e2u+voice:\n");
                return -1;
        }