[Asterisk-Dev] hunt --- beta

John Harragin jharragi at mw.k12.ny.us
Mon Mar 31 12:29:50 MST 2003


Jeremy,

Why didn't you just specify a group in zapta.conf and use   Dial,Zap/g1 ?

Because you have no control over who gets dialed.

> Or am I really missing what this app does?

This allows you to hunt through a series of extensions in a particular
order.

For example if you are not at your phone, hunt might try the main
receptionist 1st, office clerk 2nd, then the exec assistant before moving on
to whatever the next priority is - maybe voicemail. If you were one of the
devices in the hunt (and defined as skipdev) it would skip over your device
but may dial you first if you call it with a timeout. Anyway, hunt can be
used to build up a rather sophisticated dial plan with minimal typing (and
confusion). Used in conjunction with macros, a compact and easy to
understand extensions.conf can represent a fairly tricky to understand dial
plan.
Here is a very small example. These 3 lines equal the following 8,

[globals]
HUNT_GROUP_OFFICE=Zap/1,Zap/2,Zap/3,Zap/4&Zap/5

exten => _1114,1,hunt(HUNT_GROUP_OFFICE,Zap/2,20)
exten => _1115,1,hunt(HUNT_GROUP_OFFICE,Zap/3,20)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


exten => _1114,1,dial(Zap/2,20)
exten => _1114,2,dial(Zap/1,10)
exten => _1114,3,dial(Zap/3,10)
exten => _1114,4,dial(Zap/4&Zap/5,10)
exten => _1115,1,dial(Zap/3,20)
exten => _1115,2,dial(Zap/2,10)
exten => _1115,3,dial(Zap/3,10)
exten => _1115,4,dial(Zap/4&Zap/5,10)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Also, I found a bug in the posted app_hunt. It shouldn't be any problem
unless you have a lot of hunt elements (although in general would not want
to many more than 4). I'm not putting up a new version until making it
easier to read and putting in a few more tweaks.

John


>>>>End of new message...


Jeremy McNamara

John Harragin wrote:

I have been working on a new app to get the hang of the * environment. I
have more pressing things going on for the next week, so I figure announcing
it will make duplication of effort less likely. It should be regarded as in
development and not run in a production environment (in case dial adversely
alters the channel structure for subsequent dials - tips welcome here) - but
if anyone wants to try it now, make sure to LOOK AT THE EXAMPLE regarding
pipes and commas.

Hunt(HUNT_VARIABLE_name,SkipDev,opt1...): Executes a hunt pattern using the
current priority. One argument must be passed - HUNT_VARIABLE_name. A second
argument skipdev (generally, the calling resource) will be skipped over - or
if a timeout (or any additional dial options) are defined it will be dialed
first then be skipped if it is uniquely defined in HUNT_VARIABLE_name. (1)

* HUNT_VARIABLE_name must be passed naked - that is with no $ or{}.
* The HUNT_VARIABLE currently must be defined as a global variable.

By default, a timeout of 10 seconds (compiled in as DFT_HUNT_TaO) with no
additional options are passed to dial. These options remain in effect until
new options are encountered in any HUNT_VARIABLE element. These will in turn
become the new persistent values.

HUNT_VARIABLE Example (note the use of pipes to delimit options and commas
to delimit elements):
[globals]
HUNT_GROUP1=Zap/2,Zap/3|8|tm,Zap/10|9,Zap/4

Incantation Example:
exten => _1114,2,hunt(HUNT_GROUP1,Zap/10) ----------- Skips Zap/10
Dials Zap/2|10 > Zap/3|8|tm > Zap/4|9

Incantation Example:
exten => _1114,1,hunt(HUNT_GROUP1,Zap/10,20) -------- Dials Zap/10 first -
then skips it
Dials Zap/10|20 > Zap/2|10 > Zap/3|8|tm > Zap/4|9



Notes:
(1) The default skip behavior can be altered by compiling in #define
DFT_HUNT_TaO 40|tm = 40 sec music & then transferable just like dial. Skip
behavior can be restored by SkipDev with a trailing pipe (|) -
hunt(HUNT_GROUP1,Zap/10|).




This e-mail was scanned and found clean by Monroe-Woodbury CSD Antivirus.




More information about the asterisk-dev mailing list