revert change to ENUM functionality (go back to supplying a default zone)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2006-02-22 23:07:34 +00:00
parent 6204abdae2
commit 850397b334
3 changed files with 16 additions and 39 deletions

View File

@@ -47,10 +47,8 @@ Functions:
modules.conf file then you will need to explicitly load the modules that modules.conf file then you will need to explicitly load the modules that
contain the functions you want to use. contain the functions you want to use.
* The ENUMLOOKUP() function no longer supplies a default zone for searching; instead, * The ENUMLOOKUP() function with the 'c' option (for counting the number of records),
it uses the default zone(s) defined in enum.conf. In addition, when the 'c' but the lookup fails to match any records, the returned value will now be "0" instead of blank.
option (for counting the number of records is specified), but the lookup fails
to match any records, the returned value will now be "0" instead of blank.
The SIP channel: The SIP channel:

View File

@@ -64,8 +64,7 @@ options = optional specifiers.
ordinal list starting with 1 (by order first, then priority). ordinal list starting with 1 (by order first, then priority).
The default of <options> is "1" The default of <options> is "1"
zone_suffix = allows customization of the ENUM zone. If no zone_suffix is zone_suffix = allows customization of the ENUM zone. Default is e164.arpa.
given the default zones are taken from enum.conf
EXAMPLE USES: EXAMPLE USES:
@@ -118,7 +117,7 @@ Example 6: Give back the second full URI in the sorted list of all NAPTR URIs:
exten => 100,1,Set(foo=${ENUMLOOKUP(+13015611020,ALL,2,loligo.com)}) exten => 100,1,Set(foo=${ENUMLOOKUP(+13015611020,ALL,2,loligo.com)})
returns: ${foo}="tel:+14155551212" [note the "tel:" prefix in the string] returns: ${foo}="tel:+14155551212" [note the "tel:" prefix in the string]
Example 7: Look up first SIP entry for the number in the default zone(s) from enum.conf Example 7: Look up first SIP entry for the number in the e164.arpa zone (all defaults)
exten => 100,1,Set(foo=${ENUMLOOKUP(+437203001721)}) exten => 100,1,Set(foo=${ENUMLOOKUP(+437203001721)})
returns: ${foo}="enum-test@sip.nemox.net" [note: this result is returns: ${foo}="enum-test@sip.nemox.net" [note: this result is
subject to change as it is "live" DNS and not under my control] subject to change as it is "live" DNS and not under my control]
@@ -196,9 +195,10 @@ Usage notes and subtle features:
a result of your query, the function will RANDOMLY select a single a result of your query, the function will RANDOMLY select a single
NAPTR from those equal results. NAPTR from those equal results.
g) If a zone is given explicitely the function ignores the settings g) Currently, the function ignores the settings in enum.conf as the
in enum.conf as the search zone name is now specified within the function, search zone name is now specified within the function, and the H323
and the H323 driver can be chosen by the user via the dialplan. driver can be chosen by the user via the dialplan. There were no
other values in this file, and so it becomes deprecated.
h) The function will digest and return NAPTRs which use older h) The function will digest and return NAPTRs which use older
(depricated) style, reversed method strings such as "sip+E2U" (depricated) style, reversed method strings such as "sip+E2U"
@@ -225,8 +225,7 @@ Usage notes and subtle features:
==EXAMPLES== ==EXAMPLES==
All examples below except where noted use "e164.arpa" as the All examples below except where noted use "e164.arpa" as the
referenced domain, which is the default domain name for ENUMLOOKUP if referenced domain, which is the default domain name for ENUMLOOKUP.
'search => e164.arpa' is set in enum.conf.
All numbers are assumed to not have a leading "+" as dialed by the All numbers are assumed to not have a leading "+" as dialed by the
inbound channel, so that character is added where necessary during inbound channel, so that character is added where necessary during
ENUMLOOKUP function calls. ENUMLOOKUP function calls.
@@ -271,16 +270,16 @@ exten => _011.,n,Dial(Zap/g1/${EXTEN})
; ;
; Start first with e164.arpa zone... ; Start first with e164.arpa zone...
; ;
exten => _X.,1,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c,e164.arpa)}|counter=0) exten => _X.,1,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c)}|counter=0)
exten => _X.,2,GotoIf($["${counter}"<"${sipcount}"]?3:6) exten => _X.,2,GotoIf($["${counter}"<"${sipcount}"]?3:6)
exten => _X.,3,Set(counter=$[${counter}+1]) exten => _X.,3,Set(counter=$[${counter}+1])
exten => _X.,4,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,${counter},e164.arpa)}) exten => _X.,4,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,${counter})})
exten => _X.,5,GotoIf($["${counter}"<"${sipcount}"]?3:6) exten => _X.,5,GotoIf($["${counter}"<"${sipcount}"]?3:6)
; ;
exten => _X.,6,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c,e164.arpa)}|counter=0) exten => _X.,6,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c)}|counter=0)
exten => _X.,7,GotoIf($["${counter}"<"${iaxcount}"]?8:11) exten => _X.,7,GotoIf($["${counter}"<"${iaxcount}"]?8:11)
exten => _X.,8,Set(counter=$[${counter}+1]) exten => _X.,8,Set(counter=$[${counter}+1])
exten => _X.,9,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,${counter},e164.arpa)}) exten => _X.,9,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,${counter})})
exten => _X.,10,GotoIf($["${counter}"<"${iaxcount}"]?8:11) exten => _X.,10,GotoIf($["${counter}"<"${iaxcount}"]?8:11)
; ;
exten => _X.,11,NoOp("No valid entries in e164.arpa for ${EXTEN} - checking in e164.org") exten => _X.,11,NoOp("No valid entries in e164.arpa for ${EXTEN} - checking in e164.org")
@@ -305,26 +304,3 @@ exten => _X.,22,NoOp("No valid entries in e164.org for ${EXTEN} - sending out vi
exten => _X.,23,Dial(Zap/g1/${EXTEN}) exten => _X.,23,Dial(Zap/g1/${EXTEN})
; ;
; end example 3 ; end example 3
;
;
; An alternative to example 3 would be setting the search zones in enum.conf like
; search => e164.arpa
; search => e164.org
;
; Start start matching the default zones from configuration:
exten => _X.,1,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c)}|counter=0)
exten => _X.,2,GotoIf($["${counter}"<"${sipcount}"]?3:6)
exten => _X.,3,Set(counter=$[${counter}+1])
exten => _X.,4,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,${counter})})
exten => _X.,5,GotoIf($["${counter}"<"${sipcount}"]?3:6)
;
exten => _X.,6,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c)}|counter=0)
exten => _X.,7,GotoIf($["${counter}"<"${iaxcount}"]?8:11)
exten => _X.,8,Set(counter=$[${counter}+1])
exten => _X.,9,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,${counter})})
exten => _X.,10,GotoIf($["${counter}"<"${iaxcount}"]?8:11)
;
exten => _X.,11,NoOp("No valid entries in default zones from enum.conf for ${EXTEN}")
;

View File

@@ -84,6 +84,9 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data,
ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech)); ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech));
if (!args.zone)
args.zone = "e164.arpa";
if (!args.options) if (!args.options)
args.options = "1"; args.options = "1";