[asterisk-users] SIP Load Balancing

2010-10-28 Thread Tim King
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.

This is what I need the call flow to look like. I have spent many hours
searching and have not found a working example.
Call1  exten = NXXNX,2,Dial(SIP/${dialedn...@2.4.6.8dialednum...@2.4.6.8
)
Call2  exten = NXXNX,2,Dial(SIP/${dialedn...@1.2.3.4dialednum...@1.2.3.4
)
Call3  exten = NXXNX,2,Dial(SIP/${dialedn...@2.4.6.8dialednum...@2.4.6.8
)
Call4  exten = NXXNX,2,Dial(SIP/${dialedn...@1.2.3.4dialednum...@1.2.3.4
)
Call5  exten = NXXNX,2,Dial(SIP/${dialedn...@2.4.6.8dialednum...@2.4.6.8
)
Call6  exten = NXXNX,2,Dial(SIP/${dialedn...@1.2.3.4dialednum...@1.2.3.4
)
Call7  exten = NXXNX,2,Dial(SIP/${dialedn...@2.4.6.8dialednum...@2.4.6.8
)
Call8  exten = NXXNX,2,Dial(SIP/${dialedn...@1.2.3.4dialednum...@1.2.3.4
)
..
-- 
_
-- 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

Re: [asterisk-users] SIP Load Balancing

2010-10-28 Thread --[ UxBoD ]--

- Original Message -


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. 

This is what I need the call flow to look like. I have spent many hours 
searching and have not found a working example. 
Call1 exten = NXXNX,2,Dial(SIP/${ dialedn...@2.4.6.8 ) 
Call2 exten = NXXNX,2,Dial(SIP/${ dialedn...@1.2.3.4 ) 
Call3 exten = NXXNX,2,Dial(SIP/${ dialedn...@2.4.6.8 ) 
Call4 exten = NXXNX,2,Dial(SIP/${ dialedn...@1.2.3.4 ) 
Call5 exten = NXXNX,2,Dial(SIP/${ dialedn...@2.4.6.8 ) 
Call6 exten = NXXNX,2,Dial(SIP/${ dialedn...@1.2.3.4 ) 
Call7 exten = NXXNX,2,Dial(SIP/${ dialedn...@2.4.6.8 ) 
Call8 exten = NXXNX,2,Dial(SIP/${ dialedn...@1.2.3.4 ) 
.. 


-- 
_ 
-- 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 Your own internal DNS 
and give those IPs a single name ? 
-- 
Thanks, Phil 
-- 
_
-- 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

Re: [asterisk-users] SIP Load Balancing

2010-10-28 Thread Roger Burton West
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.

R

-- 
_
-- 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


Re: [asterisk-users] SIP Load Balancing

2010-10-28 Thread Tim King
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.

On Thu, Oct 28, 2010 at 11:24 AM, Roger Burton West ro...@firedrake.orgwrote:

 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.

 R

 --
 _
 -- 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

Re: [asterisk-users] SIP Load Balancing

2010-10-28 Thread Tim King
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.orgwrote:
   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

Re: [asterisk-users] SIP Load Balancing

2010-10-28 Thread Tim King
It seems that the
GotoIf(${SET(DB(avoics/route)=$[!0${DB(avoics/route)}])}?route1:route2) is
always returning false as if the SET command is not returning a value nor is
it changing the value in the DB.
Will this not work because I am running Asterisk 1.4.25.1??

On Thu, Oct 28, 2010 at 3:15 PM, Tim King t...@compnetwork.net wrote:

 I updated it as follows and I am still only getting the SayNumber(2)

 [tim]

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




 On Thu, Oct 28, 2010 at 3:05 PM, Tilghman Lesher tles...@digium.comwrote:

 On Thursday 28 October 2010 13:32:51 Tim King wrote:
  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:ro
  ute2) 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?

 You can drop your separate Set application.  The SET() dialplan function
 does the alternation for you.

 --
 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