[Asterisk-Users] How to make groups of extensions ???

C F shmaltz at gmail.com
Tue Mar 21 20:19:49 MST 2006


On 3/21/06, Andrew Kohlsmith <akohlsmith-asterisk at benshaw.com> wrote:
> On Tuesday 21 March 2006 12:14, C F wrote:
> > Of course contexts are for outgoing as well, how else is he going to
> > make sure that device a only dials out using channel/group x?

What you said before about everything being *incoming* from asterisks
point of view is true, however that just shows that we were saying the
same thing, since for the context (not asterisk DP context) of this
post we are looking at the point of view of the user device and NOT
asterisk. Therefore, consider the follwoing setup:
PSTN/ZAP <> Asterisk <> User Deivce.
When User Device has an incoming call from PSTN/ZAP becuase asterisk
uses app_dial to ring User Device, we got an incoming call, which the
context of PSTN/ZAP will make sure that according to the arguments to
app_dial User Device rings.
When User Device makes an outgoing call from User Device to PSTN/ZAP
then the context of User Device will decide thru the arguments of
app_dial what channel on PSTN/ZAP is used. Using group settings in
PSTN/ZAP it just makes it easier to specify more than one channel for
that call if the one with the highest priority in the group is
busy/congested. But is NOT the group that makes it possible, since
using the status varialbes from app_dial we can do the next channel on
our own, and we don't realy need groups to make it work.

>
> No, the dialplan determines what you do.  I.e. you get to an appropriate
> Dial() command which specifies the appropriate group.
>

Yeah, dialplan here means the context in the dialplan. Otherwise how
will device/xyz know only to use g1 or g2 from zap.

> There's absolutely nothing stopping someone from writing this:
>
> [context-1]
> exten => 123,Dial(Zap/g1/${EXTEN})
> exten => _X.,1,Goto(context-2,${EXTEN},1)
>
> [context-2]
> exten => _X.,1,Dial(Zap/g2/${EXTEN})
>
> Your contexts didn't determine a thing; the Zap group determined it for your
> outgoing call.

Not true, I had in that context g1 or g2, which determined which group to use.

>
> (I *do* see what you're saying, but honestly the context has absolutely
> nothing to do with it short of dumping the extension into the correct part of
> the dialplan.  It's the group configuration that does the "only dial out
> through line 4,5,6".)

That is not true, look at the following macro (taken from a real life
example, and could be used for LCR):

[macro-dialoutbound]
;arg1 number
;arg2 callerid
;arg3 device in form of: devicecount-device/resource/-device/resource/
as many as matching devicecount
;when busy it will play busy
;when all channels come back with channelunavail, it will play congestion
exten => s,1,Noop()
exten => s,2,Noop()
exten => s,3,Noop()
exten => s,4,GotoIf($[${LEN(${CALLERID(num)})} > 7]?100);if we got cid
longer than 7 then it's an outside number so we retain that CID
exten => s,5,Set(CALLERID(num)=${ARG2})
exten => s,6,Goto(10)
exten => s,10,Noop()
exten => s,11,Noop(Weare starting to cut)
exten => s,12,Set(DCNT=${CUT(ARG3,,1)})
exten => s,13,Set(CNT=2)
exten => s,14,Goto(50);thats where we assign the DVC var
exten => s,50,Noop(We start assigning devices)
exten => s,51,Noop()
exten => s,52,Set(TCNT=$[${CNT} - 2])
exten => s,53,GotoIf($[${TCNT} = ${DCNT}]?800);congestion
exten => s,54,Set(DVC=${CUT(ARG3,-,${CNT})})
exten => s,55,Set(TCNT=${CNT})
exten => s,56,Set(CNT=$[${TCNT} + 1]);here we increment it
exten => s,57,Goto(callme,1)
exten => s,100,Noop(not setting CID, since we got one)
exten => s,101,Noop()
exten => s,102,Goto(10)
exten => s,800,Noop()
exten => s,801,Congestion()
exten => s,802,Hangup()
exten => callme,1,Noop(we are going to call)
exten => callme,2,Dial(${DVC}${ARG1},,T)
exten => callme,3,Goto(${DIALSTATUS},1)
exten => callme,103,Goto(3)
exten => CHANUNAVAIL,1,Noop()
exten => CHANUNAVAIL,2,Noop()
exten => CHANUNAVAIL,3,Goto(s,50)
exten => CONGESTION,1,Goto(CHANUNAVAIL,1)
exten => NOANSWER,1,Goto(s,800)
exten => BUSY,1,Noop()
exten => BUSY,2,Noop()
exten => BUSY,3,Playtones(busy)
exten => BUSY,4,Busy()

If you define the following context/extension it should dial out using
zap channel 4, and if in use then 5, and if in use then 6 from that
context, without using groups:
[context1]
exten => 18005558355,1,Macro(dialoutbound,${EXTEN},,3-ZAP/4/-ZAP/5/-ZAP/6/)
however the following context/extension will use for the same number
just channel 1:
exten => 18005558355,1,Macro(dialoutbound,${EXTEN},,1-ZAP/1/)


>
> -A.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list