Thanks For The replies. I have tried piecing the samples together. Just for testing purposes i have created the following.<br><br>[test]<br>exten => _X.,1,GotoIf(${SET(DB(avoics/route)=$[!0${DB(avoics/route)}])}?route1:route2)<br>
exten => _X.,n(route1),Set(DB(avoics/route)=1)<br>exten => _X.,n,SayNumber(1)<br>exten => _X.,n,Hangup()<br>exten => _X.,n(route2),Set(DB(avoics/route)=0)<br>exten => _X.,n,SayNumber(2)<br>exten => _X.,n,Hangup()<br>
<br>The idea is if I continue dialing any number into this context I should hear 1 2 1 2 1 2<br><br>Currently it is skipping to 2 as it should be since my database shows: /avoics/route : 1<br><br>It appears there is something wrong with my set command?<br>
<br><br><br><br><br><div class="gmail_quote">On Thu, Oct 28, 2010 at 2:15 PM, Tilghman Lesher <span dir="ltr"><<a href="mailto:tlesher@digium.com">tlesher@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Thursday 28 October 2010 13:06:00 Gordon Henderson wrote:<br>
> On Thu, 28 Oct 2010, Tim King wrote:<br>
> > On Thu, Oct 28, 2010 at 11:24 AM, Roger Burton West<br>
<<a href="mailto:roger@firedrake.org">roger@firedrake.org</a>>wrote:<br>
> >> On Thu, Oct 28, 2010 at 11:08:12AM -0400, Tim King wrote:<br>
> >>> I have a very simple setup with two SIP routes to my carrier. I need<br>
> >>> to<br>
> >><br>
> >> have<br>
> >><br>
> >>> every other phone call placed to that carrier go to a different<br>
> >>> address.<br>
> >><br>
> >> I think what you need to do here is check/set a variable in the<br>
> >> astdb.<br>
> >><br>
> >> (If the variable is 1, set it to 2 and route via A; otherwise, set it<br>
> >> to 1 and route via B.)<br>
> >><br>
> >> Translation of this to dialplan logic is left as an exercise for the<br>
> >> student.<br>
> ><br>
> > Sorry for the confusion, but the last sentence throws me off.<br>
> > "Translation of this to dialplan logic is left as an exercise for the<br>
> > student." Is this example from some sort of book or is this a way of<br>
> > saying I am left to figure the rest out??<br>
> ><br>
> > I was hoping to find a simple example of how this works.<br>
><br>
> It's a way of leafing you to figure the rest out.<br>
><br>
> It's a bastardised version of a quote from many textbooks - along the<br>
> lines of "implementation is left as an excercise to the student" - ie.<br>
> this is the method in general terms, you write nuts & bolts of the code.<br>
><br>
> One reference to it might be:<br>
><br>
> <a href="http://catb.org/jargon/html/E/exercise--left-as-an.html" target="_blank">http://catb.org/jargon/html/E/exercise--left-as-an.html</a><br>
><br>
> Roger has told you how to do it - use a variable kept in the astdb and<br>
> alternate it<br>
><br>
> In pseudo code:<br>
><br>
> if (switch == 1)<br>
> Dial (SIP/provider1/number)<br>
> switch = 0<br>
> else<br>
> Dial (SIP/provider2/number<br>
> switch = 1<br>
> endif<br>
><br>
> Now your task is write the actual dialplan. Or you can pay me or Roger<br>
> to do it for you if you like, but really, it's only a few lines of<br>
> dialplan.<br>
<br>
</div></div>GotoIf(${SET(DB(sw/provider)=$[!0${DB(sw/provider)}])}?provider1:provider2)<br>
<font color="#888888"><br>
--<br>
Tilghman Lesher<br>
Digium, Inc. | Senior Software Developer<br>
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)<br>
Check us out at: <a href="http://www.digium.com" target="_blank">www.digium.com</a> & <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a><br>
</font><div><div></div><div class="h5"><br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br>