Asterisk - The Open Source Telephony Project GIT-master-f36a736
enum.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 *
22 * \brief DNS and ENUM functions
23 */
24
25#ifndef _ASTERISK_ENUM_H
26#define _ASTERISK_ENUM_H
27
28#include "asterisk/channel.h"
29
30struct naptr {
31 unsigned short order;
32 unsigned short pref;
33} __attribute__((__packed__));
34
36 struct naptr naptr; /*!< order and preference of RR */
37 char *result; /*!< result of naptr parsing,e.g.: tel:+5553 */
38 char *tech; /*!< Technology (from URL scheme) */
39 int sort_pos; /*!< sort position */
40};
41
43 char *dst; /*!< Destination part of URL from ENUM */
44 int dstlen; /*!< Length */
45 char *tech; /*!< Technology (from URL scheme) */
46 int techlen; /*!< Length */
47 char *txt; /*!< TXT record in TXT lookup */
48 int txtlen; /*!< Length */
49 char *naptrinput; /*!< The number to lookup */
50 int position; /*!< specifies position of required RR */
51 int count; /*!< used as counter for RRs */
52 int options; /*!< options , see ENUMLOOKUP_OPTIONS_* defined above */
53 struct enum_naptr_rr *naptr_rrs; /*!< array of parsed NAPTR RRs */
54 int naptr_rrs_count; /*!< Size of array naptr_rrs */
55};
56
57
58/*! \brief Lookup entry in ENUM
59 \param chan Channel
60 \param number E164 number with or without the leading +
61 \param location Number returned (or SIP uri)
62 \param maxloc Max length
63 \param technology Technology (from url scheme in response)
64 You can set it to get particular answer RR, if there are many techs in DNS response, example: "sip"
65 If you need any record, then set it to "ALL" string
66 \param maxtech Max length
67 \param suffix Zone suffix (WARNING: No defaults here any more)
68 \param options Options
69 'c' - Count number of NAPTR RR
70 number - Position of the requested RR in the answer list
71 'u' - Full URI return (does not strip URI scheme)
72 'i' - Infrastructure ENUM lookup
73 's' - ISN based lookup
74 'd' - Direct DNS query
75 \param record The position of required RR in the answer list
76 \param argcontext Argument for caching results into an enum_context pointer (NULL is used for not caching)
77 \retval 1 if found
78 \retval 0 if not found
79 \retval -1 on hangup
80*/
81int ast_get_enum(struct ast_channel *chan, const char *number, char *location, int maxloc, char *technology,
82 int maxtech, char* suffix, char* options, unsigned int record, struct enum_context **argcontext);
83
84/*! \brief Lookup DNS TXT record (used by app TXTCIDnum)
85 *
86 * Really has nothing to do with enum, but anyway...
87 * Actually, there is now an internet-draft which describes how callerID should
88 * be stored in ENUM domains: draft-ietf-enum-cnam-04.txt
89 * The algorithm implemented here will thus be obsolete soon.
90 *
91 * \param chan Channel
92 * \param number E164 number with or without the leading +
93 * \param txt Text string (return value)
94 * \param maxtxt Max length of "txt"
95 * \param suffix Zone suffix
96 * \version 1.6.1 new suffix parameter to take into account caller ids that aren't in e164.arpa
97 * \version 1.6.1 removed parameters location, maxloc, technology, maxtech as all the information
98 * is stored the txt string
99 */
100int ast_get_txt(struct ast_channel *chan, const char *number, char *txt, int maxtxt, char *suffix);
101
102#endif /* _ASTERISK_ENUM_H */
General Asterisk PBX channel definitions.
int ast_get_txt(struct ast_channel *chan, const char *number, char *txt, int maxtxt, char *suffix)
Lookup DNS TXT record (used by app TXTCIDnum)
Definition: enum.c:995
int ast_get_enum(struct ast_channel *chan, const char *number, char *location, int maxloc, char *technology, int maxtech, char *suffix, char *options, unsigned int record, struct enum_context **argcontext)
Lookup entry in ENUM.
Definition: enum.c:649
Main Channel structure associated with a channel.
int dstlen
Definition: enum.h:44
int position
Definition: enum.h:50
int txtlen
Definition: enum.h:48
char * naptrinput
Definition: enum.h:49
char * dst
Definition: enum.h:43
int options
Definition: enum.h:52
int techlen
Definition: enum.h:46
int naptr_rrs_count
Definition: enum.h:54
char * txt
Definition: enum.h:47
struct enum_naptr_rr * naptr_rrs
Definition: enum.h:53
int count
Definition: enum.h:51
char * tech
Definition: enum.h:45
char * result
Definition: enum.h:37
char * tech
Definition: enum.h:38
int sort_pos
Definition: enum.h:39
Definition: enum.h:30
unsigned short order
Definition: enum.h:31
unsigned short pref
Definition: enum.h:32
Number structure.
Definition: app_followme.c:154
static struct test_options options