Michael Hamann
2007-May-02 23:15 UTC
[asterisk-users] Call Limit with multiple SIP extensions
Hello, I?m trying to setup the following function fpr a customer and at the moment I?m pretty stuck... I have an Asterisk (realtime) system with about 50 SIP Phones. 4 of these extensions have two SIP accounts behind them, so I call two SIP Accounts via Dial(SIP/10&SIP/11). So for example I have the extension 20 which rings the SIP Accounts 20 and *20 (callerid is setup to 20) exten => 20,1,Dial(SIP/20&SIP/*20) This works so far. Now I need something like a call-limit function for this "special" extension. When one of the phones (20 or *20) is in use, the complete extension 20 should signal a busy to the next caller. OK, i found the group function in asterisk and I managed to setup the first half of the solution. I use a macro exten => 20,1,Macro(groupdialout,SIP/20&SIP/*20,20) [macro-groupdialout] exten => s,1,Set(GROUP=${ARG2}) exten => s,n,Checkgroup(1) exten => s,n,NoOP(Active Calls: ${GROUP_COUNT()}) exten => s,n,NoOp(${CHECKGROUPSTATUS}) exten => s,n,GotoIf($["${CHECKGROUPSTATUS}" = "OVERMAX"]?100:6) exten => s,n,Dial(${ARG1}) exten => s,100,Hangup(17) to dial my extensions. This works on the incoming direction. But when I dial an extension from one of my two phones the other phone is still ringing. I also want a busy signal in this case. I tried to increase the groupcounter on outgoing calls via: exten => 20,1,Set(GROUP=${CALLERIDNUM}) and (to PSTN) exten => _0X.,1,Set(GROUP=${CALLERIDNUM}) exten => _0X.,n,Dial(SIP/${EXTEN:1}@smartnode) But I think the problem is that group only affects the channel in use - am I right? Maybe someone can give me a hint on how to get this working? Or has somebody did something like that before? Thanks Michael ---- on the Asterisk CLI it looks like this so far: -- Executing Set("SIP/20-08491430", "GROUP=20") in new stack -- Executing Macro("SIP/20-08491430", "groupdialout|SIP/4450|4450") in new stack -- Executing Set("SIP/20-08491430", "GROUP=4450") in new stack -- Executing CheckGroup("SIP/20-08491430", "1") in new stack -- Executing NoOp("SIP/20-08491430", "Active Calls: 1") in new stack -- Executing NoOp("SIP/20-08491430", "OK") in new stack -- Executing GotoIf("SIP/20-08491430", "0?100:6") in new stack -- Goto (macro-groupdialout,s,6) -- Executing Dial("SIP/20-08491430", "SIP/4450") in new stack -- Called 4450 -- SIP/4450-084ab3d0 is ringing Extension Changed 4450 new state Ringing for Notify User 10 -- SIP/4450-084ab3d0 is ringing -- SIP/4450-084ab3d0 is ringing -- SIP/4450-084ab3d0 is ringing -- SIP/4450-084ab3d0 is ringing -- SIP/4450-084ab3d0 answered SIP/20-08491430 -- Attempting native bridge of SIP/20-08491430 and SIP/4450-084ab3d0 Extension Changed 4450 new state InUse for Notify User 10 -- Executing Set("SIP/10-0849d100", "GROUP=20") in new stack -- Executing Macro("SIP/10-0849d100", "groupdialout|SIP/20&SIP/30|20") in new stack -- Executing Set("SIP/10-0849d100", "GROUP=20") in new stack -- Executing CheckGroup("SIP/10-0849d100", "1") in new stack -- Executing NoOp("SIP/10-0849d100", "Active Calls: 1") in new stack -- Executing NoOp("SIP/10-0849d100", "OK") in new stack -- Executing GotoIf("SIP/10-0849d100", "0?100:6") in new stack -- Goto (macro-groupdialout,s,6) -- Executing Dial("SIP/10-0849d100", "SIP/20&SIP/30") in new stack -- Called 20 -- Called 30 -- SIP/30-084bfce0 is ringing -- SIP/20-084b7d30 is ringing So in this case it dows not work. On incoming calls it seems to work... -- Executing Set("SIP/10-08491430", "GROUP=20") in new stack -- Executing Macro("SIP/10-08491430", "groupdialout|SIP/20&SIP/30|20") in new stack -- Executing Set("SIP/10-08491430", "GROUP=20") in new stack -- Executing CheckGroup("SIP/10-08491430", "1") in new stack -- Executing NoOp("SIP/10-08491430", "Active Calls: 1") in new stack -- Executing NoOp("SIP/10-08491430", "OK") in new stack -- Executing GotoIf("SIP/10-08491430", "0?100:6") in new stack -- Goto (macro-groupdialout,s,6) -- Executing Dial("SIP/10-08491430", "SIP/20&SIP/30") in new stack -- Called 20 -- Called 30 -- SIP/30-0849a500 is ringing -- SIP/20-084a7d68 is ringing Extension Changed 20 new state Ringing for Notify User 10 -- SIP/20-084a7d68 is ringing -- SIP/20-084a7d68 is ringing -- SIP/30-0849a500 answered SIP/10-08491430 -- Attempting native bridge of SIP/10-08491430 and SIP/30-0849a500 Extension Changed 20 new state Idle for Notify User 10 Extension Changed 4450 new state InUse for Notify User 10 -- Executing Set("SIP/4450-084baaa0", "GROUP=4450") in new stack -- Executing Macro("SIP/4450-084baaa0", "groupdialout|SIP/20&SIP/30|20") in new stack -- Executing Set("SIP/4450-084baaa0", "GROUP=20") in new stack -- Executing CheckGroup("SIP/4450-084baaa0", "1") in new stack -- Executing NoOp("SIP/4450-084baaa0", "Active Calls: 2") in new stack -- Executing NoOp("SIP/4450-084baaa0", "OVERMAX") in new stack -- Executing GotoIf("SIP/4450-084baaa0", "1?100:6") in new stack -- Goto (macro-groupdialout,s,100) -- Executing Hangup("SIP/4450-084baaa0", "17") in new stack So when I dial 20 and get a connection, the extension is busy for the next caller on extension 20.