Hunt for open line

I have two zap lines and I when calling out I would like asterisk to find an open line. I currently use:

exten => _1NXXNXXXXXX,1,ChanIsAvail(${LINES},s)
exten => _1NXXNXXXXXX,3,Congestion( )
exten => _1NXXNXXXXXX,103,Congestion( )

Where LINES is a global variable and defined as:
LINES => Zap/3&Zap/4

Currently if Zap/3 is being used then it will dial using zap/4. If there is no line connected to zap/3 it still attempts to use it. The problem is that I do not know if there will be a line connected to zap/3. How do I have asterisk determine if the line is useable?

Easy fix, in your zaptel.conf add group=0 and then dial ZAP/g0 instead of Zap/3. Basically your telling it to use one of the channels in group 0. Asterisk will find the open channel and use it.


I tried adding group=0, but when I run ztcfg I get an error stating that “group” is not a valid statement. Here is my zaptel.conf.


What am I doing wrong?

The “group” keyword has to be put in zapata.conf, you find it the asterisk configuration directory, not in the zaptel.conf file.


Marco Bruni

Oops, my bad. He is right zapata.conf, not zaptel.conf.