switch from "global variables" to "group funcions". It's much more functional.
Basically, you can set a group for an incoming channel, and count "group instances" across all channels. No necessity to decrement a variable, because group setting is channel dependent, so disappear when given channel is hangup.

Search for GROUP() and GROUP_COUNT() functions on http://www.voip-info.org

It's a thing like this:

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

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

exten => 33006712,201,Set(GROUP()=LINES)
exten => 33006712,202,Dial(SIP/192.168.0.65:5080&SIP/192.168.0.65:5090)

Basically, in priority 201 you set the group named "LINES" for that channel before dialing your sip phone.
In priority 1, instead, you check your "used lines counter" getting the number of active asterisk channels having group set to "LINES".

that's all

2006/5/22, Christophorus Laube <[EMAIL PROTECTED]>:
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
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to