Thanks For The replies. I have tried piecing the samples together. Just for
testing purposes i have created the following.

[test]
exten =>
_X.,1,GotoIf(${SET(DB(avoics/route)=$[!0${DB(avoics/route)}])}?route1:route2)
exten => _X.,n(route1),Set(DB(avoics/route)=1)
exten => _X.,n,SayNumber(1)
exten => _X.,n,Hangup()
exten => _X.,n(route2),Set(DB(avoics/route)=0)
exten => _X.,n,SayNumber(2)
exten => _X.,n,Hangup()

The idea is if I continue dialing any number into this context I should hear
1 2 1 2 1 2

Currently it is skipping to 2 as it should be since my database shows:
/avoics/route  : 1

It appears there is something wrong with my set command?





On Thu, Oct 28, 2010 at 2:15 PM, Tilghman Lesher <tles...@digium.com> wrote:

> On Thursday 28 October 2010 13:06:00 Gordon Henderson wrote:
> > On Thu, 28 Oct 2010, Tim King wrote:
> > > On Thu, Oct 28, 2010 at 11:24 AM, Roger Burton West
> <ro...@firedrake.org>wrote:
> > >> On Thu, Oct 28, 2010 at 11:08:12AM -0400, Tim King wrote:
> > >>> I have a very simple setup with two SIP routes to my carrier. I need
> > >>> to
> > >>
> > >> have
> > >>
> > >>> every other phone call placed to that carrier go to a different
> > >>> address.
> > >>
> > >> I think what you need to do here is check/set a variable in the
> > >> astdb.
> > >>
> > >> (If the variable is 1, set it to 2 and route via A; otherwise, set it
> > >> to 1 and route via B.)
> > >>
> > >> Translation of this to dialplan logic is left as an exercise for the
> > >> student.
> > >
> > > Sorry for the confusion, but the last sentence throws me off.
> > > "Translation of this to dialplan logic is left as an exercise for the
> > > student." Is this example from some sort of book or is this a way of
> > > saying I am left to figure the rest out??
> > >
> > > I was hoping to find a simple example of how this works.
> >
> > It's a way of leafing you to figure the rest out.
> >
> > It's a bastardised version of a quote from many textbooks - along the
> > lines of "implementation is left as an excercise to the student" - ie.
> > this is the method in general terms, you write nuts & bolts of the code.
> >
> > One reference to it might be:
> >
> >    http://catb.org/jargon/html/E/exercise--left-as-an.html
> >
> > Roger has told you how to do it - use a variable kept in the astdb and
> > alternate it
> >
> > In pseudo code:
> >
> >    if (switch == 1)
> >      Dial (SIP/provider1/number)
> >      switch = 0
> >    else
> >     Dial (SIP/provider2/number
> >     switch = 1
> >    endif
> >
> > Now your task is write the actual dialplan. Or you can pay me or Roger
> > to do it for you if you like, but really, it's only a few lines of
> > dialplan.
>
> GotoIf(${SET(DB(sw/provider)=$[!0${DB(sw/provider)}])}?provider1:provider2)
>
> --
> Tilghman Lesher
> Digium, Inc. | Senior Software Developer
> twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
> Check us out at: www.digium.com & www.asterisk.org
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

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

Reply via email to