[asterisk-users] [HOWTO] Priorize one destination over another on a link

Jean-Michel Hiver jhiver at ykoz.net
Fri Feb 27 07:20:53 CST 2009


Hello List,

The list sorted my problem thus I shall contribute back ;-)


PROBLEM:
========

I am posting this example, where I have a "Reunion" link of 30 channels. If
i send all the traffic (proper + mobile) on the link, the less profitable
proper traffic fills the link and leaves no channel for more profitable
mobile traffic. Some kind of priority is needed to always leave space for
mobile trafic: you don't want to be terminating traffic that yields 0.001 /
min of profit when you could be terminating traffic yielding 10x as much
instead.


SOLUTION
========

Use asterisk grouping and conditional fonctions to dynamically limit the
proper traffic in order to always keep a few channels free.

For example, imagine you have 0 channels of mobile : allow proper to use up
to 26 channels
For example, imagine you have 5 channels of mobile : allow proper to use up
to 21 channels
For example, imagine you have 10 channels of mobile : allow proper to use up
to 16 channels
For example, imagine you have 28 channels of mobile : allow proper to use up
to 0 channels

In order to do this, you set the SAME group for both mobile and proper
channels and then you apply a conditional only on the traffic which you want
to limit.

You could also be using the same kind of technique if you had two different
classes of customers: retail and wholesale. You want wholesalers to fill
your pipes of course (with best effort), but you do not want this traffic to
affect your retail service.


IMPLEMENTATION
==============

This is the implementation on my production server, seems to work well, feel
free to modify to suit up your needs.

; Reunion Proper : use a conditional statement to dynamically limit number
of channels
exten => _0262XXXXXX,1,Set(GROUP()=Reunion)
exten => _0262XXXXXX,n,NoOp(This channel is member of group: ${GROUP()})
exten => _0262XXXXXX,n,NoOp(Number of channels is ${GROUP_COUNT(Reunion)})
exten => _0262XXXXXX,n,GotoIf($[${GROUP_COUNT(Reunion)}>26]?500)
exten => _0262XXXXXX,n,Dial(IAX2/dedibox-etang-sale/${EXTEN})
exten => _0262XXXXXX,500,NoOp(Total channels congested, retuning NOCAV)
exten => _0262XXXXXX,501,Congestion()

; Reunion Mobile : always gets through which increments the channel count...
and thus reduces proper capacity
exten => _0692XXXXXX,1,Set(GROUP()=Reunion)
exten => _0692XXXXXX,n,NoOp(This channel is member of group: ${GROUP()})
exten => _0692XXXXXX,n,NoOp(Number of channels is ${GROUP_COUNT(Reunion)})
exten => _0692XXXXXX,n,Dial(IAX2/dedibox-etang-sale/${EXTEN})

exten => _0693XXXXXX,1,Set(GROUP()=Reunion)
exten => _0693XXXXXX,n,NoOp(This channel is member of group: ${GROUP()})
exten => _0693XXXXXX,n,NoOp(Number of channels is ${GROUP_COUNT(Reunion)})
exten => _0693XXXXXX,n,Dial(IAX2/dedibox-etang-sale/${EXTEN})


I hope this piece of information is of use to somebody, some day!

Cheers
Jean-Michel
http://ykoz.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090227/7233f11a/attachment.htm 


More information about the asterisk-users mailing list