2003-04-29 04:26:41 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2003-04-29 04:26:41 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2003-04-29 04:26:41 +00:00
|
|
|
*
|
2005-03-02 05:17:13 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
2003-04-29 04:26:41 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
2003-04-29 04:26:41 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-08-30 18:32:10 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-03-02 05:17:13 +00:00
|
|
|
/*! \file enum.h
|
|
|
|
\brief DNS and ENUM functions
|
|
|
|
*/
|
|
|
|
|
2003-04-29 04:26:41 +00:00
|
|
|
#ifndef _ASTERISK_ENUM_H
|
|
|
|
#define _ASTERISK_ENUM_H
|
2005-08-30 18:32:10 +00:00
|
|
|
|
2005-04-21 06:02:45 +00:00
|
|
|
#include "asterisk/channel.h"
|
2005-08-30 18:32:10 +00:00
|
|
|
|
2007-05-15 23:05:20 +00:00
|
|
|
struct naptr {
|
|
|
|
unsigned short order;
|
|
|
|
unsigned short pref;
|
2008-11-29 17:57:39 +00:00
|
|
|
} __attribute__((__packed__));
|
2007-05-15 23:05:20 +00:00
|
|
|
|
|
|
|
struct enum_naptr_rr {
|
|
|
|
struct naptr naptr; /*!< order and preference of RR */
|
|
|
|
char *result; /*!< result of naptr parsing,e.g.: tel:+5553 */
|
|
|
|
char *tech; /*!< Technology (from URL scheme) */
|
|
|
|
int sort_pos; /*!< sort position */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct enum_context {
|
|
|
|
char *dst; /*!< Destination part of URL from ENUM */
|
|
|
|
int dstlen; /*!< Length */
|
|
|
|
char *tech; /*!< Technology (from URL scheme) */
|
|
|
|
int techlen; /*!< Length */
|
|
|
|
char *txt; /*!< TXT record in TXT lookup */
|
|
|
|
int txtlen; /*!< Length */
|
|
|
|
char *naptrinput; /*!< The number to lookup */
|
The following patch adds new options and alters the default behavior of the ENUM* functions. The TXCIDNAME lookup function has also gotten a
new paramater. The new options for ENUM* functions include 'u', 's', 'i', and 'd' which return the full uri, trigger isn specific rewriting, look
for branches into an infrastructure enum tree, or do a direct dns lookup of a number respectively. The new paramater for TXCIDNAME adds a
zone-suffix argument for looking up caller id's in DNS that aren't e164.arpa.
This patch is based on the original code from otmar, modified by snuffy, and tested by jtodd, me, and others.
(closes issue #8089)
Reported by: otmar
Patches:
20080508_bug8089-1.diff
- original code by otmar (license 480),
- revised by snuffy (license 35)
Tested by: oej, otmar, jtodd, Corydon76, snuffy, alexnikolov, bbryant
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115584 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-09 19:54:45 +00:00
|
|
|
int position; /*!< specifies position of required RR */
|
|
|
|
int count; /*!< used as counter for RRs */
|
2007-05-15 23:05:20 +00:00
|
|
|
int options; /*!< options , see ENUMLOOKUP_OPTIONS_* defined above */
|
|
|
|
struct enum_naptr_rr *naptr_rrs; /*!< array of parsed NAPTR RRs */
|
|
|
|
int naptr_rrs_count; /*!< Size of array naptr_rrs */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*! \brief Lookup entry in ENUM
|
2005-03-02 05:17:13 +00:00
|
|
|
\param chan Channel
|
2006-03-31 10:29:50 +00:00
|
|
|
\param number E164 number with or without the leading +
|
2005-03-02 05:17:13 +00:00
|
|
|
\param location Number returned (or SIP uri)
|
|
|
|
\param maxloc Max length
|
The following patch adds new options and alters the default behavior of the ENUM* functions. The TXCIDNAME lookup function has also gotten a
new paramater. The new options for ENUM* functions include 'u', 's', 'i', and 'd' which return the full uri, trigger isn specific rewriting, look
for branches into an infrastructure enum tree, or do a direct dns lookup of a number respectively. The new paramater for TXCIDNAME adds a
zone-suffix argument for looking up caller id's in DNS that aren't e164.arpa.
This patch is based on the original code from otmar, modified by snuffy, and tested by jtodd, me, and others.
(closes issue #8089)
Reported by: otmar
Patches:
20080508_bug8089-1.diff
- original code by otmar (license 480),
- revised by snuffy (license 35)
Tested by: oej, otmar, jtodd, Corydon76, snuffy, alexnikolov, bbryant
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115584 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-09 19:54:45 +00:00
|
|
|
\param technology Technology (from url scheme in response)
|
2005-09-14 01:36:15 +00:00
|
|
|
You can set it to get particular answer RR, if there are many techs in DNS response, example: "sip"
|
The following patch adds new options and alters the default behavior of the ENUM* functions. The TXCIDNAME lookup function has also gotten a
new paramater. The new options for ENUM* functions include 'u', 's', 'i', and 'd' which return the full uri, trigger isn specific rewriting, look
for branches into an infrastructure enum tree, or do a direct dns lookup of a number respectively. The new paramater for TXCIDNAME adds a
zone-suffix argument for looking up caller id's in DNS that aren't e164.arpa.
This patch is based on the original code from otmar, modified by snuffy, and tested by jtodd, me, and others.
(closes issue #8089)
Reported by: otmar
Patches:
20080508_bug8089-1.diff
- original code by otmar (license 480),
- revised by snuffy (license 35)
Tested by: oej, otmar, jtodd, Corydon76, snuffy, alexnikolov, bbryant
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115584 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-09 19:54:45 +00:00
|
|
|
If you need any record, then set it to "ALL" string
|
2006-03-31 10:29:50 +00:00
|
|
|
\param maxtech Max length
|
The following patch adds new options and alters the default behavior of the ENUM* functions. The TXCIDNAME lookup function has also gotten a
new paramater. The new options for ENUM* functions include 'u', 's', 'i', and 'd' which return the full uri, trigger isn specific rewriting, look
for branches into an infrastructure enum tree, or do a direct dns lookup of a number respectively. The new paramater for TXCIDNAME adds a
zone-suffix argument for looking up caller id's in DNS that aren't e164.arpa.
This patch is based on the original code from otmar, modified by snuffy, and tested by jtodd, me, and others.
(closes issue #8089)
Reported by: otmar
Patches:
20080508_bug8089-1.diff
- original code by otmar (license 480),
- revised by snuffy (license 35)
Tested by: oej, otmar, jtodd, Corydon76, snuffy, alexnikolov, bbryant
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115584 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-09 19:54:45 +00:00
|
|
|
\param suffix Zone suffix (WARNING: No defaults here any more)
|
|
|
|
\param options Options
|
|
|
|
'c' - Count number of NAPTR RR
|
|
|
|
number - Position of the requested RR in the answer list
|
|
|
|
'u' - Full URI return (does not strip URI scheme)
|
|
|
|
'i' - Infrastructure ENUM lookup
|
|
|
|
's' - ISN based lookup
|
|
|
|
'd' - Direct DNS query
|
2006-10-31 11:01:06 +00:00
|
|
|
\param record The position of required RR in the answer list
|
2007-05-15 23:05:20 +00:00
|
|
|
\param argcontext Argument for caching results into an enum_context pointer (NULL is used for not caching)
|
2007-07-16 02:51:56 +00:00
|
|
|
\retval 1 if found
|
|
|
|
\retval 0 if not found
|
|
|
|
\retval -1 on hangup
|
2005-09-14 01:36:15 +00:00
|
|
|
*/
|
2009-03-09 20:58:17 +00:00
|
|
|
int ast_get_enum(struct ast_channel *chan, const char *number, char *location, int maxloc, char *technology,
|
2007-05-15 23:05:20 +00:00
|
|
|
int maxtech, char* suffix, char* options, unsigned int record, struct enum_context **argcontext);
|
2005-10-24 20:12:06 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*! \brief Lookup DNS TXT record (used by app TXTCIDnum)
|
|
|
|
*
|
|
|
|
* Really has nothing to do with enum, but anyway...
|
|
|
|
* Actually, there is now an internet-draft which describes how callerID should
|
|
|
|
* be stored in ENUM domains: draft-ietf-enum-cnam-04.txt
|
|
|
|
* The algorithm implemented here will thus be obsolete soon.
|
|
|
|
*
|
|
|
|
* \param chan Channel
|
|
|
|
* \param number E164 number with or without the leading +
|
|
|
|
* \param txt Text string (return value)
|
|
|
|
* \param maxtxt Max length of "txt"
|
|
|
|
* \param suffix Zone suffix
|
|
|
|
* \version 1.6.1 new suffix parameter to take into account caller ids that aren't in e164.arpa
|
|
|
|
* \version 1.6.1 removed parameters location, maxloc, technology, maxtech as all the information
|
|
|
|
* is stored the txt string
|
|
|
|
*/
|
The following patch adds new options and alters the default behavior of the ENUM* functions. The TXCIDNAME lookup function has also gotten a
new paramater. The new options for ENUM* functions include 'u', 's', 'i', and 'd' which return the full uri, trigger isn specific rewriting, look
for branches into an infrastructure enum tree, or do a direct dns lookup of a number respectively. The new paramater for TXCIDNAME adds a
zone-suffix argument for looking up caller id's in DNS that aren't e164.arpa.
This patch is based on the original code from otmar, modified by snuffy, and tested by jtodd, me, and others.
(closes issue #8089)
Reported by: otmar
Patches:
20080508_bug8089-1.diff
- original code by otmar (license 480),
- revised by snuffy (license 35)
Tested by: oej, otmar, jtodd, Corydon76, snuffy, alexnikolov, bbryant
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115584 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-09 19:54:45 +00:00
|
|
|
int ast_get_txt(struct ast_channel *chan, const char *number, char *txt, int maxtxt, char *suffix);
|
2003-04-29 04:26:41 +00:00
|
|
|
|
2006-03-31 10:29:50 +00:00
|
|
|
int ast_enum_init(void);
|
|
|
|
int ast_enum_reload(void);
|
2005-08-30 18:32:10 +00:00
|
|
|
|
|
|
|
#endif /* _ASTERISK_ENUM_H */
|