[asterisk-users] Limit total length of calls to a specifig SIP peer

Laurent CARON lcaron at lncsa.com
Tue Jun 8 09:10:30 CDT 2010


On 08/06/2010 15:21, Danny Nicholas wrote:
> My .02 - I would set up a context for dialing with this provider that counts
> minutes and stops the dial with a message once you get to 1321 minutes (22
> hours).
>
> Exten =>  _8X.,1,noop(call using Cheap sip)
> Exten =>  _8X.,2,macro(call_out,${EXTEN:1})
> Exten =>  _8X.,3,hangup
>
> [macro-call_out]
> Exten =>  s,1,Gotoif($[${GLOBAL(SECUSED)}<  79200]?4)
> Exten =>  s,n,playback(out-of-minutes)
> Exten =>  s,n,hangup
> Exten =>  s,n,dial(SIP/${ARG1}...)
> Exten =>  s,n,Set(GLOBAL(SECUSED)=${GLOBAL(SECUSED)} + ${DIALEDTIME})
> Exten =>  s,n,hangup
> Exten =>  h,1,Set(GLOBAL(SECUSED)=${GLOBAL(SECUSED)} + ${DIALEDTIME})
>
> By using DIALEDTIME instead of ANSWEREDTIME, you reduce the possibility of
> going over on your minutes, but you could squeeze in an extra 2-20 seconds
> per call using AT vs DT.


I'm using the following:

exten => 0145381068,1,NoOp()
exten => 0145381068,2,Gotoif($[${GLOBAL(SECUSED)}<10]?4)
exten => 0145381068,3,hangup
exten => 0145381068,4,Dial(SIP/1111 at sipoperator)
exten => 0145381068,5,Set(GLOBAL(SECUSED)=${GLOBAL(SECUSED)} + 
${DIALEDTIME})
exten => 0145381068,6,hangup


I place a test call of 20 secs, hangup, and I can place another call 
again through the same provider.



More information about the asterisk-users mailing list