Ronald Wiplinger
2005-Mar-14 08:25 UTC
[Asterisk-Users] Has anybody experience with SetGroup / CheckGroup commands?
I am checking on the SetGroup / CheckGroup commands, but I have some troubles to undestand the examples. SetGroup(moh) can be moh anything as I like? Usually moh stands for "music on hold" CheckGroup(1) checks if somebody in in group "moh". Does it mean I can only have one SetGroup(xxx) ?? When I look at example 2 than I see two SetGroup commands and one CheckGroup command. I don't understand it!!! Can anybody explain it for me, please? I want to understand it, so that I can figure out how to setup what I need: dial with astcc a number via gateway-1 if gateway-1 is used already 1 time, than use gateway-2, .... and so forth, ... bye Ronald
Matt Riddell
2005-Mar-14 13:17 UTC
[Asterisk-Users] Has anybody experience with SetGroup / CheckGroup commands?
Ronald Wiplinger wrote:> SetGroup(moh) can be moh anything as I like? Usually moh stands for > "music on hold" > CheckGroup(1) checks if somebody in in group "moh". Does it mean I can > only have one SetGroup(xxx) ??The idea is that when you do setgroup you are putting this caller into a group. I.E. you could have exten => s,1,SetGroup(People_With_Short_Hair) That would put anyone who visits this extension into the People_With_Short_Hair group. then if you do: exten => s,2,CheckGroup(678) You can make sure that there are not more than 678 people already in the People_With_Short_Hair group. If there are more than 678 people in the group then the application will go to the priority x+101 where x is the current priority. See the ,2, on the checkgroup line? That's the current priority. So, 2+101=103. So you could have a line exten => s,103,Playback(more_than_678_short_hair) which would only be played if there are more than 678 people in the group. If however there are less than or equal to the number inside the brackets for checkgroup (say for example there are 500 people who have short hair), then it will continue to the next priority. As above, the current priority is 2 when you do the checkgroup, so the next priority is 3. This means that you can have the line: exten => s,3,Playback(less_than 678_short_hair) Now, if we put them all together you'd end up with: exten => s,1,SetGroup(People_With_Short_Hair) exten => s,2,CheckGroup(678) exten => s,3,Playback(less_than_or_equal_to_678_short_hair) exten => s,103,Playback(more_than_678_short_hair) Hope this helps! -- Cheers, Matt Riddell _______________________________________________ http://www.sineapps.com/news.php (Daily Asterisk News - html) http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)
Matt Riddell
2005-Mar-14 17:21 UTC
[Asterisk-Users] Has anybody experience with SetGroup / CheckGroup commands?
Ronald Wiplinger wrote:> Example 2 > > *Problem*: How to limit incoming calls to SIP channels using the > SetGroup & Checkgroup command. I don't want any call waiting on SIP > channels! > *Approach*: One solution is to increment the GROUPCOUNT for both the > caller and callee, to ensure the callee doesn't get a 2nd call while on > the phone. >[sip-phones] ; increment GROUPCOUNT for the calling exten exten => 602,1,SetGroup(${CALLERIDNUM}) The idea of this line is to put one person into the say 601 group (if the caller has a caller ID number of 601). This means if anyone else goes into the 601 group, there will be too many. ; increment GROUPCOUNT for exten you are calling exten => 602,2,SetGroup(${EXTEN}) This will then add one person to the 602 group (the extension at the beginning of the line is 602). ; ensure this is the 1st call to this exten exten => 602,3,CheckGroup(1) This line checks to make sure that there is not more than one person in the 602 group (the last setGroup was 602). That way we can tell if 602 is already on the phone. ; dial if we make it this far exten => 602,4,Dial(SIP/602) ; CheckGroup jumped here, 602 is on the phone exten => 602,104,Busy So if you were calling from callerIDNum 601 you would have: [sip-phones] exten => 602,1,SetGroup(601) exten => 602,2,SetGroup(602) exten => 602,3,CheckGroup(1) exten => 602,4,Dial(SIP/602) exten => 602,104,Busy Or if you were dialling from 603: [sip-phones] exten => 602,1,SetGroup(603) exten => 602,2,SetGroup(602) exten => 602,3,CheckGroup(1) exten => 602,4,Dial(SIP/602) exten => 602,104,Busy So in effect you end up with groups 603 and 602 having one person inside. If someone tried to call either of these, they would get a busy signal. more likely than the above you'd have something like: [sip-phones] exten => _6XX,1,SetGroup(${CALLERIDNUM}) exten => _6XX,2,SetGroup(${EXTEN}) exten => _6XX,3,CheckGroup(1) exten => _6XX,4,Dial(SIP/${EXTEN}) exten => _6XX,104,Busy That way you'd only need to have it once and it would take care of 100 phones.> You will also want to ensure you SetGroup(${CALLERIDNUM}) before dialing > any outgoing numbers as well (to PSTN,etc). ie: > > [outbound-local] > exten => _9NXXXXXX,1,SetGroup(${CALLERIDNUM})This makes sure that if you dial an external line, one person will be added to the group 601 (if that's your caller ID Number). Also, you'd need to do the same thing for applications. I.E. if you have voicemailMain at say 800, you want to make sure that no one can dial you while you're listening to voicemail. You would do that the same: exten => 800,1,SetGroup(${CALLERIDNUM}) exten => 800,2,VoicemailMain() So that way it adds one person to the group [Your_Caller_ID_Number]. i.e. if you have a callerid number in sip.conf defined as 601 then when you dial voicemail it will be doing setgroup(601). This means that if someone tried to call you with the 6XX thing, when it gets to the 2 priority it would do setGroup(601). This would mean that there are now 2 people in the group 601, so the next line (checkgroup) would jump to x+101. Make sense? -- Cheers, Matt Riddell _______________________________________________ http://www.sineapps.com/news.php (Daily Asterisk News - html) http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)