[Asterisk-Users] behaviour depending on count of used lines

Christophorus Laube bob at semanticedge.de
Mon May 22 00:08:05 MST 2006


Hi there,

I want to set up an extension set that acts different depending on the count 
of used lines. I have a EuroISDN E1 board with mISDN and I only want to offer 
10 lines. Therefore I set up a global variables LINES in the general section 
of extensions.conf and instantiate it with 0. I a call is incoming I check 
the LINES variable wether is 10 or more. If so I make a call transfer. If not 
I increment the variable and direct the call to an internal SIP address. 
After finishing the call I want to decrement the variable again, of course.
My extension set looks like this way:

[general]
static=yes
writeprotect=no
LINES => 0

[E1]
exten => 33006712,1,GotoIf($[${LINES} >= 10]?101:201)

exten => 33006712,101,Dial(mISDN/g:E1/34507725)

exten => 33006712,201,SetGlobalVar(LINES=$[ ${LINES} +1 ])
exten => 33006712,202,Dial(SIP/192.168.0.65:5080&SIP/192.168.0.65:5090)
exten => 33006712-ANSWER,203,Answer()
exten => 33006712-HANGUP,204,SetGlobalVar(LINES=$[ ${LINES} -1])
exten => 33006712,205,SetGlobalVar(LINES=$[ ${LINES} -1 ])
exten => 33006712,206,Hangup()

My problem is that the increment works perfectly, but the decrement is not 
working. I added the last two extensions only because the hangup-extension 
did not work.
Can anyone of you help me, please.

TIA, Christophorus Laube



More information about the asterisk-users mailing list