[Asterisk-Users] How to restrict simultaneous phone registrations

Darren Wiebe darren at aleph-com.net
Thu Apr 6 08:07:28 MST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan k. Creasy wrote:
>> I apologize if this information is posted elsewhere. Unfortunately I
>> haven't found it yet if it is. I'm not familiar with the channel
>> counting features could you please explain? Also, how are you tagging
>> the phones to account codes?
>>
> 
> You can limit calls using the set/check group commands. 
> 
> http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+SetGroup
> 
> Account codes are set either by using the Set function or the
> accountcode= property in the SIP/IAX conf files. 
> 
> -Jonathan
Exactly, I'll post a sample dialplan.  This dialplan is for ASTPP but
should give you the idea.
# exten => _1XXXXXXXXXX,1,Set(GROUP()=${ACCOUNTCODE})
# exten => _1XXXXXXXXXX,2,AGI(astpp-authorize.agi,${ACCOUNTCODE},${EXTEN})
# exten => _1XXXXXXXXXX,3,GotoIf($["${CALLSTATUS}" = "0"]?60)  ; Checks
if account has sufficient funds
# exten => _1XXXXXXXXXX,4,GotoIf($["${CALLSTATUS}" = "1"]?70)  ; Checks
if the phone number exists
# exten => _1XXXXXXXXXX,5,GotoIf($["${CALLSTATUS}" = "2"]?80)  ; Check
if account exists
# exten => _1XXXXXXXXXX,6,GotoIf($["${GROUP_COUNT()}" >
"${MAXCHANNELS}"]?90) ; Verify number of outgoing channels
#
      ; assigned to account.
# exten => _1XXXXXXXXXX,7,Set(GROUP(${TRUNK1}-OUTBOUND)=OUTBOUND)
# exten =>
_1XXXXXXXXXX,8,GotoIf($["${GROUP_COUNT(OUTBOUND@${TRUNK1}-OUTBOUND)}" >
"${TRUNK1_MAXCHANNELS}"]?10)
# exten => _1XXXXXXXXXX,9,Dial(${LCRSTRING1}||${TIMELIMIT}|${OPTIONS})
# exten => _1XXXXXXXXXX,110,Busy
# exten => _1XXXXXXXXXX,10,Set(GROUP(${TRUNK2}-OUTBOUND)=OUTBOUND)
# exten =>
_1XXXXXXXXXX,11,GotoIf($["${GROUP_COUNT(OUTBOUND@${TRUNK2}-OUTBOUND)}" >
"${TRUNK2_MAXCHANNELS}"]?13)
# exten => _1XXXXXXXXXX,12,Dial(${LCRSTRING2}||${TIMELIMIT}|${OPTIONS})
# exten => _1XXXXXXXXXX,113,Busy
# exten => _1XXXXXXXXXX,13,Set(GROUP(${TRUNK2}-OUTBOUND)=OUTBOUND)
# exten =>
_1XXXXXXXXXX,14,GotoIf($["${GROUP_COUNT(OUTBOUND@${TRUNK3}-OUTBOUND)}" >
"${TRUNK3_MAXCHANNELS}"]?16)
# exten => _1XXXXXXXXXX,15,Dial(${LCRSTRING3}||${TIMELIMIT}|${OPTIONS})
# exten => _1XXXXXXXXXX,116,Busy
# exten => _1XXXXXXXXXX,16,Set(GROUP(${TRUNK4}-OUTBOUND)=OUTBOUND)
# exten =>
_1XXXXXXXXXX,17,GotoIf($["${GROUP_COUNT(OUTBOUND@${TRUNK4}-OUTBOUND)}" >
"${TRUNK4_MAXCHANNELS}"]?19)
# exten => _1XXXXXXXXXX,18,Dial(${LCRSTRING4}||${TIMELIMIT}|${OPTIONS})
# exten => _1XXXXXXXXXX,119,Busy
# exten => _1XXXXXXXXXX,19,Set(GROUP(${TRUNK5}-OUTBOUND)=OUTBOUND)
# exten =>
_1XXXXXXXXXX,20,GotoIf($["${GROUP_COUNT(OUTBOUND@${TRUNK5})-OUTBOUND}" >
"${TRUNK5_MAXCHANNELS}"]?22)
# exten => _1XXXXXXXXXX,21,Dial(${LCRSTRING5}||${TIMELIMIT}|${OPTIONS})
# exten => _1XXXXXXXXXX,122,Busy
# exten => _1XXXXXXXXXX,22,Goto(100)
# exten => _1XXXXXXXXXX,60,Congestion ; '0' Tells them they do not have
enough money
# exten => _1XXXXXXXXXX,61,Hangup
# exten => _1XXXXXXXXXX,70,Congestion '1' Bad Phone Number
# exten => _1XXXXXXXXXX,71,Hangup
# exten => _1XXXXXXXXXX,80,Congestion
# exten => _1XXXXXXXXXX,81,Hangup
# exten => _1XXXXXXXXXX,90,Congestion    ; Their outgoing channel limit
is full already
# exten => _1XXXXXXXXXX,91,Hangup
# exten => _1XXXXXXXXXX,100,Congestion    ; No Route Available
# exten => _1XXXXXXXXXX,101,Hangup

Some of the group counts are for outgoing trunks.  It's just the first
one that you need.

- --
Darren Wiebe
darren at aleph-com.net
Aleph Communications
ASTPP - Open Source Voip Billing & Calling Cards
www.aleph-com.net/astpp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFENS6w4DADnh+tnOQRAlTmAKCI8x7xV2nUlfhT4n325iqApMmecACcCATV
cpS+R+PdpYV6Rc6Sk7BIrGM=
=hZRr
-----END PGP SIGNATURE-----



More information about the asterisk-users mailing list