[asterisk-users] load balancing SIP extensions

2008-02-22 Thread Vieri
What I would like to do is have two identical *
servers which accept registrations of sip extensions
4000-4999. 

If I define a rrDNS or LinuxHA then I should have
load-balanced registrations. 

However, say ext. 4001 is registered on *1 and 4002 is
registered on *2, if 4001 tries to call 4002 then I
would like to do something like:
- lookup 4002 on *1, try to establish a call if it's
REGISTERED here
- if it's not registered here then try to look it up
on *2 and establish the call there

I tried to use DUNDi on my local servers but I can't
seem to make it work. Most howtos out there explain
the use of DUNDi when the extension ranges do not
overlap.
So in my case where both *1 and *2 have the same local
extension range 4XXX, can I go the DUNDi route or
should I stop bashing my head on that and explore
another solution?

If someone has configured a similar system then I'd
greatly appreciate some tips.
I read a few dundi docs like
http://www.voip-info.org/wiki-DUNDi.

Thanks



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Andres Jimenez
On Fri, Feb 22, 2008 at 11:42 AM, Vieri <[EMAIL PROTECTED]> wrote:

>  However, say ext. 4001 is registered on *1 and 4002 is
>  registered on *2, if 4001 tries to call 4002 then I
>  would like to do something like:
>  - lookup 4002 on *1, try to establish a call if it's
>  REGISTERED here
>  - if it's not registered here then try to look it up
>  on *2 and establish the call there

You can do that using the dial plan.

- Create an IAX link between both servers
- DIal plan in both servers:
First priority Dial using SIP/EXTEN
Second priority IAX/EXTEN



Dial IAX/EXTEN

-- 
Andres Jimenez

GPG : http://www.andresin.com/gpg/[EMAIL PROTECTED]

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Yehavi Bourvine +972-8-9489444
> What I would like to do is have two identical *
> servers which accept registrations of sip extensions
> 4000-4999.
>
> If I define a rrDNS or LinuxHA then I should have
> load-balanced registrations.
>
> However, say ext. 4001 is registered on *1 and 4002 is
> registered on *2, if 4001 tries to call 4002 then I
> would like to do something like:
> - lookup 4002 on *1, try to establish a call if it's
> REGISTERED here
> - if it's not registered here then try to look it up
> on *2 and establish the call there
>...

I've tried doing something similar and came with two options. The common to
them is that I use MySQL for realtime extensions, and set "systemname"
parameter to the IP address of the server where the phone registers.

When a call arrives I check whether the REGSERVER coloumn is the same as the
local server or not. If not, then there are two options:

- Pass the call via IAX to the other servers; this makes both server process
  the call and the audio.

- Send a "refer" message to the caller to contact the other server.

I had this working in the lab but not in production yet. If you want the
dialplan code for this then email me.

   __Yehavi:

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Vieri

--- Andres Jimenez <[EMAIL PROTECTED]> wrote:

> On Fri, Feb 22, 2008 at 11:42 AM, Vieri
> <[EMAIL PROTECTED]> wrote:
> 
> >  However, say ext. 4001 is registered on *1 and
> 4002 is
> >  registered on *2, if 4001 tries to call 4002 then
> I
> >  would like to do something like:
> >  - lookup 4002 on *1, try to establish a call if
> it's
> >  REGISTERED here
> >  - if it's not registered here then try to look it
> up
> >  on *2 and establish the call there
> 
> You can do that using the dial plan.
> 
> - Create an IAX link between both servers
> - DIal plan in both servers:
> First priority Dial using SIP/EXTEN
> Second priority IAX/EXTEN Dial IAX/EXTEN

Thanks. I'll try that although I hope it won't go into
an infinite loop between the 2 servers.



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Andres Jimenez
On Fri, Feb 22, 2008 at 5:49 PM, Vieri <[EMAIL PROTECTED]> wrote:
>
>  --- Andres Jimenez <[EMAIL PROTECTED]> wrote:
>
>  > On Fri, Feb 22, 2008 at 11:42 AM, Vieri
>  > <[EMAIL PROTECTED]> wrote:
>  >
>  > >  However, say ext. 4001 is registered on *1 and
>  > 4002 is
>  > >  registered on *2, if 4001 tries to call 4002 then
>  > I
>  > >  would like to do something like:
>  > >  - lookup 4002 on *1, try to establish a call if
>  > it's
>  > >  REGISTERED here
>  > >  - if it's not registered here then try to look it
>  > up
>  > >  on *2 and establish the call there
>  >
>  > You can do that using the dial plan.
>  >
>  > - Create an IAX link between both servers
>  > - DIal plan in both servers:
>  > First priority Dial using SIP/EXTEN
>  > Second priority IAX/EXTEN Dial IAX/EXTEN
>
>  Thanks. I'll try that although I hope it won't go into
>  an infinite loop between the 2 servers.
>
>
>
>
>   
> 
>  Looking for last minute shopping deals?
>  Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
>  ___
>
>
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
>  asterisk-users mailing list
>  To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Andres Jimenez

GPG : http://www.andresin.com/gpg/[EMAIL PROTECTED]

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Andres Jimenez
On Fri, Feb 22, 2008 at 5:49 PM, Vieri <[EMAIL PROTECTED]> wrote:


>  Thanks. I'll try that although I hope it won't go into
>  an infinite loop between the 2 servers.

You are right. That could happen if the phone is not registered anywhere


You can put some security in the dialplan.
 if calls comes from IAX it means that PHONE is not registered in the
other server.
Just create special extensions to take the IAX calls (instead of GoTo):

PHONE  is 101

SERVER 1

exten => 101,1, Dial SIP/101
exten => 101,1, Dial IAX-SERVER2/55101

exten => 55101,1, Dial SIP/101
exten => 55101,1, Hangup

SERVER 2

exten => 101,1, Dial SIP/101
exten => 101,1, Dial IAX-SERVER1/55101

exten => 55101,1, Dial SIP/101
exten => 55101,1, Hangup


I hope it helps,


-- 
Andres Jimenez

GPG : http://www.andresin.com/gpg/[EMAIL PROTECTED]

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-22 Thread Jared Bellows
>
> I tried to use DUNDi on my local servers but I can't
> seem to make it work. Most howtos out there explain
> the use of DUNDi when the extension ranges do not
> overlap.
>

The following doc describes using the same extensions across multiple *
servers. It requires using realtime, but seems to do what you describe.

http://www.astricon.net/files/usa06/Friday-General_Conference/JR_Richardson_Whitepaper.pdf
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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

Re: [asterisk-users] load balancing SIP extensions

2008-02-23 Thread Anthony Francis
Vieri wrote:
> What I would like to do is have two identical *
> servers which accept registrations of sip extensions
> 4000-4999. 
>
> If I define a rrDNS or LinuxHA then I should have
> load-balanced registrations. 
>
> However, say ext. 4001 is registered on *1 and 4002 is
> registered on *2, if 4001 tries to call 4002 then I
> would like to do something like:
> - lookup 4002 on *1, try to establish a call if it's
> REGISTERED here
> - if it's not registered here then try to look it up
> on *2 and establish the call there
>
> I tried to use DUNDi on my local servers but I can't
> seem to make it work. Most howtos out there explain
> the use of DUNDi when the extension ranges do not
> overlap.
> So in my case where both *1 and *2 have the same local
> extension range 4XXX, can I go the DUNDi route or
> should I stop bashing my head on that and explore
> another solution?
>
> If someone has configured a similar system then I'd
> greatly appreciate some tips.
> I read a few dundi docs like
> http://www.voip-info.org/wiki-DUNDi.
>
> Thanks
>
>
>
>   
> 
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
> ___
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
>   
Have you tried placing the sip registrations in a db using realtime?

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] load balancing SIP extensions

2008-02-23 Thread Raj Jain
On Fri, 22 Feb 2008 19:44 +0200, Yehavi Bourvine +972-8-9489444 <
[EMAIL PROTECTED]> wrote:

> When a call arrives I check whether the REGSERVER coloumn is the same as
> the
> local server or not. If not, then there are two options:
>
> - Pass the call via IAX to the other servers; this makes both server
> process
>  the call and the audio.
>
> - Send a "refer" message to the caller to contact the other server.
>

You may actually want to use a "redirect" message for this (e.g SIP 302
response). In any case, traversing only one server in the signaling/media
path as opposed to two would generally seem more efficient.

-- 
Raj Jain

mailto:rj2807 at gmail dot com
sip:rjain at iptel dot org
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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

Re: [asterisk-users] load balancing SIP extensions

2008-02-23 Thread Vieri

--- Anthony Francis <[EMAIL PROTECTED]> wrote:

> Have you tried placing the sip registrations in a db
> using realtime?

I'm not that sure I want to use realtime because I
would then depend on the sql service never failing (I
could use clustered active-active MySQL but that
sounds overkill, or maybe not).

I'll take a look at the pdf link of the previous post.

Thanks



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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


Re: [asterisk-users] Load balancing SIP extensions.

2008-02-24 Thread Yehavi Bourvine +972-8-9489444
Hello,

  Here is how I do this. The prerequisits are:

- MySQL to hold the extensions realtime database. MySQL is synchronized
  among all servers using the Master/slave replication model.

- The phones are spread by some external algorithm over the Asterisk servers
  (statefull load balancer, statically defined in the config file of the
  phone, etc.).

The idea is to locate on which server the destination phone is registered and
redirect the call to it. For this:
/etc/asterisk/asterisk.conf has the parameter "sysname" set to its IP address
   (you can use also a DNS name, but I want to be independent of name
   resolution). This causes the server to set the field "regserver" to be
   saved in the MySQL database to the IP address of the server.

/etc/asterisk/extensions: The logic to check whether the value of "regsever"
   is different from "sysname" and if so - redirect the call. The code
   fragments are (I am using AEL):

   To get the regserver from the database:

 MYSQL(Query resID ${connid} SELECT regserver from sip_users where
name='${EXTEN}');
 MYSQL(Fetch FetchId ${resID} RegServer);
 MYSQL(Clear ${resID});

   so now RegServer contains the server where the phone is registered. Next:

if(("${DEVSTATE(SIP/${EXTEN})}" == "UNAVAILABLE") ||
   ("${DEVSTATE(SIP/${EXTEN})}" == "INVALID")) {
if("${SYSTEMNAME}" != "${RegServer}") {
Transfer(SIP/[EMAIL PROTECTED]);
return;
 };
};

I check for the device state so in case the phone has double registration
(primary and backup server) it will be processed localy.

Regards, __Yehavi:

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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