Search Computer Help Please

Tuesday, November 24, 2009

Setting up enumlookup Asterisk 1.4

The enumlookup function can be setup in Asterisk 1.4 simply by editing the extensions.conf file , the enum.conf file does not need to be used and I think its pretty much obsolete now.

First thing you want to do if identify which phones or services will be allowed to perform an enumlookup. e.g include localphones , your local extensions will be able to perform enumlookup's. lot of people forget to include the phone or service for example to add localphones and internal

[enumlookup]
include=> localphones
include=> enumlookup
include=> internal

ensure you include everyone with permission to use this function

The basic enumlookup script for Asterisk 1.4 looks like this

[enumlookup]

include => common

include => internal

include => enumlookup

; This example expects an ${EXTEN} that is an e.164 number (like

; 14102241145 or 437203001721)

; Search through e164.arpa and then also search through e164.org, you can change the e164.org to your own ;enum server or different enum registry

; to see if there are any valid SIP or IAX termination capabilities.

; If none, send call out via Zap channel 1, you could redirect it to a SIP trunk if it fails if you prefer

;

; Start first with e164.arpa zone...

;

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 e164.arpa for ${EXTEN} - checking in e164.org")

;

; ...then also try e164.org, and look for SIP and IAX NAPTRs...

;

exten => _X.,12,Set(sipcount=${ENUMLOOKUP(+${EXTEN},sip,c,,e164.org)}|counter=0)

exten => _X.,13,GotoIf($["${counter}"<"${sipcount}"]?14:17)

exten => _X.,14,Set(counter=$[${counter}+1])

exten => _X.,15,Dial(SIP/${ENUMLOOKUP(+${EXTEN},sip,,${counter},e164.org)})

exten => _X.,16,GotoIf($["${counter}"<"${sipcount}"]?14:17)

;

exten => _X.,17,Set(iaxcount=${ENUMLOOKUP(+${EXTEN},iax2,c,,e164.org)}|counter=0)

exten => _X.,18,GotoIf($["${counter}"<"${iaxcount}"]?19:22)

exten => _X.,19,Set(counter=$[${counter}+1])

exten => _X.,20,Dial(IAX2/${ENUMLOOKUP(+${EXTEN},iax2,,${counter},e164.org)})

exten => _X.,21,GotoIf($["${counter}"<"${iaxcount}"]?19:22)

;

; ...then send out PRI.

;

exten => _X.,22,NoOp("No valid entries in e164.org for ${EXTEN} - sending out via Zap")

exten => _X.,23,Dial(Zap/g1/${EXTEN})

;

; end example 3

Simply pasting this into your extensions.conf will work as long as you have specified who to include at the very beginning.

for the dialing pattern, here we use .X_ which specifies anything starting with the digit 0-9 and anything after that will be matched. So anything really.

that's about it , goodluck

No comments:

Post a Comment