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)

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

Reply via email to