JR Richardson
2006-Mar-13 19:11 UTC
[Asterisk-Users] Clustering "NEW THREAD", Almost Working
All, I made some progress, but it seems the further I go with clustering the harder things get. Hmmm, I guess if it were easy, it would be documented...... Anyhow, I have 1 * server as the DUNDi peering master with a ttl=1. The only function of this server is to lookup where other sip peers are registered and forward that info on to the requesting * server. I have 4 * servers accepting registrations from sip users (phones). All the sip phone info is stored in a MySQL database and being accessed through the realtime engine, and it works great. A phone registers to a server and the server checks the database and if an entry is present, the * servers allows the phone to register and dumps the sip phone into sip show peers, works great. I can take the sip entry out of the database and the phone will not resister in realtime. Works great. Now the dial plan setup. All the extension info is also in the MySQL database, I have a switch statement in the [siptest] context pointing to the database for extension logic. This also works great. All servers are pointing to the same data source with all sip extensions in the database starting with exten => 1234,2,Answer and so on exten => 1235,2,Answer and so on notice the priority 2 starting point in the database, very important. This is the good part, in sip.conf, I have regcontext=siptest in the general section (because it doesn't work in the users section), so when a sip phone registers on a server, * dynamically inputs an exten => 1234,1,Noop into the dialplan and immediately the phone is able to be called. This is working pretty damn well also. So at this point I have several phones registered across 4 * servers, all pulling their info from MySQL, the same data source. Now let's say phone 1234 and 1235 are registered to server 1 and phone 1236 and 1237 are registered to server 2, 1234 can call 1235 and vise versa, 1236 can call 1237 and vise versa. Now from phone 1234 on server 1, I call 1236 on server 2 and because 1236 does not have a priority 1 entry on server 1, the call progresses to a DUNDi lookup statement in the diaplan logic and request exten 1236 location from the DUNDi peering master server (these registration servers all are peered with the dundi peering master server with a ttl=2, so the request will get past the peering master server and on to the other registration servers). The request is answered from server 2 and 1234 can now complete a call to 1236. This is great, all is well, life is good, had a big Dallas barbeque lunch to celebrate because all my sip phones are dynamically registering to any one of 4 sip registration servers, and the other three servers know who is registered where through DUNDi lookups. And it only took me 2 weeks to get this far. Now then, let's break it and see what happens, dial any sip phone that is not actively registered and you get an endless DUNDi lookup request from all servers except the one you are dialing from. I only had one other server on at this time and within seconds produced 590+ IAX trunks initiated back into a registration server before I could hang up the line. As far as I can tell, if you make a call from server 1, exten 1234 to exten 1236, but 1236 is not actively registered on any other server, the other server will get the DUNDi lookup request and not know where the phone is so it keeps looking up and calling itself to find an extension that is not there, or something, anyhow it's a bad thing. Now intrinsically knowing that this protocol is smarter than me, I'm guessing that I have incorrect dialplan logic that is allowing this to happen. I'm wondering how I can set up a dialplan flow that will do this:>From Server 1, pick up phone and dial a number (phone)(exten),1. * checks to see if the phone is first registered and on-line on server 1 2. if so, dial it, follow standard dialplan login 3. if not, goto DUNDi switch, lookup where it may be (this is pretty much working good) On Server 2, 1. DUNDi lookup request comes in 2. check to see if extention is active on this server(2), if not, stop, or at least don't continue to look for something within your own dialplan that is not there. I'm very open to suggestions. I feel like I'm so close but also still far away. Thanks JR
Jeremy McNamara
2006-Mar-13 20:34 UTC
[Asterisk-Users] Clustering "NEW THREAD", Almost Working
JR Richardson wrote: > I'm very open to suggestions. I feel like I'm so close but also still far> away.What happens when your DB flakes out or needs to come down for inevitable maintenance? (no, I am not ripping on MySQL here) How much Post Dial Delay do you have as your database gets more and more utilization? (yes, I am ripping on realtime here) What happens if for some reason if a phone gets registered on more than one server? What happens if your single DUNDi server hangs or needs to come down? Jeremy McNamara
Douglas Garstang
2006-Mar-13 22:06 UTC
[Asterisk-Users] Clustering "NEW THREAD", Almost Working
I'm not the person who your replying to, but I'll jump in anyway. We're using MySQL in conjunction with AGI. This gives us the ultimate flexibility (and me the most freekin work). Databases are configured in a HA manner. Not sure exactly what form that will take yet, but will be either replication or clustering with some mechanism hopefully to perform seameless IP address modification upon database failure so that it's transparent to Asterisk. Phones can register on any asterisk server. We have a mechanism for ensuring that every phone is registered on every box. Every phone can therefore reach every other phone through any single Asterisk system. It would have been nice if SIP realtime was working properly (it doesn't support having multiple Asterisk systems talking to a single database for reasons beyond me). So, anyway, for now we're just gonna have to replicate sip.conf between the Asterisk boxes. There's various techniques you can implement on MySQL to achieve maximum performance as well. We have some rather expensive MySQL consultants help with that. :) DUNDi... pfft... forget it. No docs... it's useless. Doug. -----Original Message----- From: Jeremy McNamara [mailto:jj@nufone.net] Sent: Mon 3/13/2006 8:34 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Cc: Subject: Re: [Asterisk-Users] Clustering "NEW THREAD", Almost Working JR Richardson wrote: > I'm very open to suggestions. I feel like I'm so close but also still far > away. What happens when your DB flakes out or needs to come down for inevitable maintenance? (no, I am not ripping on MySQL here) How much Post Dial Delay do you have as your database gets more and more utilization? (yes, I am ripping on realtime here) What happens if for some reason if a phone gets registered on more than one server? What happens if your single DUNDi server hangs or needs to come down? Jeremy McNamara _______________________________________________ --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
Douglas Garstang
2006-Mar-13 22:11 UTC
[Asterisk-Users] Clustering "NEW THREAD", Almost Working
Holy crap. You got SIP realtime working? I've tried it twice before and it failed the same way twice. Do you have multiple Asterisk boxes accessing the same sip info (ie phones) in the same table on the same database? Digium has said numerous times this known not to work, although I cant' work out why as it's just reading from a common table. -----Original Message----- From: JR Richardson [mailto:jr.richardson@cox.net] Sent: Mon 3/13/2006 7:11 PM To: asterisk-users@lists.digium.com Cc: Subject: [Asterisk-Users] Clustering "NEW THREAD", Almost Working All, I made some progress, but it seems the further I go with clustering the harder things get. Hmmm, I guess if it were easy, it would be documented...... Anyhow, I have 1 * server as the DUNDi peering master with a ttl=1. The only function of this server is to lookup where other sip peers are registered and forward that info on to the requesting * server. I have 4 * servers accepting registrations from sip users (phones). All the sip phone info is stored in a MySQL database and being accessed through the realtime engine, and it works great. A phone registers to a server and the server checks the database and if an entry is present, the * servers allows the phone to register and dumps the sip phone into sip show peers, works great. I can take the sip entry out of the database and the phone will not resister in realtime. Works great. Now the dial plan setup. All the extension info is also in the MySQL database, I have a switch statement in the [siptest] context pointing to the database for extension logic. This also works great. All servers are pointing to the same data source with all sip extensions in the database starting with exten => 1234,2,Answer and so on exten => 1235,2,Answer and so on notice the priority 2 starting point in the database, very important. This is the good part, in sip.conf, I have regcontext=siptest in the general section (because it doesn't work in the users section), so when a sip phone registers on a server, * dynamically inputs an exten => 1234,1,Noop into the dialplan and immediately the phone is able to be called. This is working pretty damn well also. So at this point I have several phones registered across 4 * servers, all pulling their info from MySQL, the same data source. Now let's say phone 1234 and 1235 are registered to server 1 and phone 1236 and 1237 are registered to server 2, 1234 can call 1235 and vise versa, 1236 can call 1237 and vise versa. Now from phone 1234 on server 1, I call 1236 on server 2 and because 1236 does not have a priority 1 entry on server 1, the call progresses to a DUNDi lookup statement in the diaplan logic and request exten 1236 location from the DUNDi peering master server (these registration servers all are peered with the dundi peering master server with a ttl=2, so the request will get past the peering master server and on to the other registration servers). The request is answered from server 2 and 1234 can now complete a call to 1236. This is great, all is well, life is good, had a big Dallas barbeque lunch to celebrate because all my sip phones are dynamically registering to any one of 4 sip registration servers, and the other three servers know who is registered where through DUNDi lookups. And it only took me 2 weeks to get this far. Now then, let's break it and see what happens, dial any sip phone that is not actively registered and you get an endless DUNDi lookup request from all servers except the one you are dialing from. I only had one other server on at this time and within seconds produced 590+ IAX trunks initiated back into a registration server before I could hang up the line. As far as I can tell, if you make a call from server 1, exten 1234 to exten 1236, but 1236 is not actively registered on any other server, the other server will get the DUNDi lookup request and not know where the phone is so it keeps looking up and calling itself to find an extension that is not there, or something, anyhow it's a bad thing. Now intrinsically knowing that this protocol is smarter than me, I'm guessing that I have incorrect dialplan logic that is allowing this to happen. I'm wondering how I can set up a dialplan flow that will do this: >From Server 1, pick up phone and dial a number (phone)(exten), 1. * checks to see if the phone is first registered and on-line on server 1 2. if so, dial it, follow standard dialplan login 3. if not, goto DUNDi switch, lookup where it may be (this is pretty much working good) On Server 2, 1. DUNDi lookup request comes in 2. check to see if extention is active on this server(2), if not, stop, or at least don't continue to look for something within your own dialplan that is not there. I'm very open to suggestions. I feel like I'm so close but also still far away. Thanks JR _______________________________________________ --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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/ms-tnef Size: 7658 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060313/4a0ea046/attachment.bin
JR Richardson
2006-Mar-13 22:37 UTC
[Asterisk-Users] Re: Clustering "NEW THREAD", Almost Working
JR Richardson wrote: > I'm very open to suggestions. I feel like I'm so close but also still far> away.What happens when your DB flakes out or needs to come down for inevitable maintenance? (no, I am not ripping on MySQL here) How much Post Dial Delay do you have as your database gets more and more utilization? (yes, I am ripping on realtime here) What happens if for some reason if a phone gets registered on more than one server? What happens if your single DUNDi server hangs or needs to come down? Jeremy McNamara Jeremy, Good questions. I'm in the testing and planning phase of this design, trying to get things ginned up and working properly prior to scaling. MySQL will be in a High Availability arrangement, not a single server but the database will be replicated over several as the read activity from the registration servers increase load. MySQL has some cool load balancing techniques that should eliminate post dial delay as all the data request will be directed across the data cluster, not just one server. I've already experienced a phone being registered on 2 servers at once, this is a product of long registration times and sip peer caching, which I will try and address by reducing the registration time along with pruning sip peers and realtime cache for phones that become unreachable. The single DUNDi Master Peering Server is single for now, just testing, but I have 2 thoughts there. 1. With this server just being used for lookups, this function can be monitored and failed over to a hot standby server, the cache would build back up over time, but call processing would continue with active lookups. 2. I could have an active secondary that also peers with all the registration servers, and all the registration servers peer with the 2 or more peering servers. The hardest thing here is eliminating the routing loops, mostly due to no route summarization, not sure how to get around that just yet. Could use some help if you have any ideas. JR
Now, I know what you guys been talking about. It is like DSN for sip phones, not really clustering. I original thought that you guys want to setup some thing that can fail over to a different sip server if the server running the IVR dies. From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Douglas Garstang Sent: Tuesday, March 14, 2006 12:11 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working Holy crap. You got SIP realtime working? I've tried it twice before and it failed the same way twice. Do you have multiple Asterisk boxes accessing the same sip info (ie phones) in the same table on the same database? Digium has said numerous times this known not to work, although I cant' work out why as it's just reading from a common table. -----Original Message----- From: JR Richardson [mailto:jr.richardson@cox.net] Sent: Mon 3/13/2006 7:11 PM To: asterisk-users@lists.digium.com Cc: Subject: [Asterisk-Users] Clustering "NEW THREAD", Almost Working All, I made some progress, but it seems the further I go with clustering the harder things get. Hmmm, I guess if it were easy, it would be documented...... Anyhow, I have 1 * server as the DUNDi peering master with a ttl=1. The only function of this server is to lookup where other sip peers are registered and forward that info on to the requesting * server. I have 4 * servers accepting registrations from sip users (phones). All the sip phone info is stored in a MySQL database and being accessed through the realtime engine, and it works great. A phone registers to a server and the server checks the database and if an entry is present, the * servers allows the phone to register and dumps the sip phone into sip show peers, works great. I can take the sip entry out of the database and the phone will not resister in realtime. Works great. Now the dial plan setup. All the extension info is also in the MySQL database, I have a switch statement in the [siptest] context pointing to the database for extension logic. This also works great. All servers are pointing to the same data source with all sip extensions in the database starting with exten => 1234,2,Answer and so on exten => 1235,2,Answer and so on notice the priority 2 starting point in the database, very important. This is the good part, in sip.conf, I have regcontext=siptest in the general section (because it doesn't work in the users section), so when a sip phone registers on a server, * dynamically inputs an exten => 1234,1,Noop into the dialplan and immediately the phone is able to be called. This is working pretty damn well also. So at this point I have several phones registered across 4 * servers, all pulling their info from MySQL, the same data source. Now let's say phone 1234 and 1235 are registered to server 1 and phone 1236 and 1237 are registered to server 2, 1234 can call 1235 and vise versa, 1236 can call 1237 and vise versa. Now from phone 1234 on server 1, I call 1236 on server 2 and because 1236 does not have a priority 1 entry on server 1, the call progresses to a DUNDi lookup statement in the diaplan logic and request exten 1236 location from the DUNDi peering master server (these registration servers all are peered with the dundi peering master server with a ttl=2, so the request will get past the peering master server and on to the other registration servers). The request is answered from server 2 and 1234 can now complete a call to 1236. This is great, all is well, life is good, had a big Dallas barbeque lunch to celebrate because all my sip phones are dynamically registering to any one of 4 sip registration servers, and the other three servers know who is registered where through DUNDi lookups. And it only took me 2 weeks to get this far. Now then, let's break it and see what happens, dial any sip phone that is not actively registered and you get an endless DUNDi lookup request from all servers except the one you are dialing from. I only had one other server on at this time and within seconds produced 590+ IAX trunks initiated back into a registration server before I could hang up the line. As far as I can tell, if you make a call from server 1, exten 1234 to exten 1236, but 1236 is not actively registered on any other server, the other server will get the DUNDi lookup request and not know where the phone is so it keeps looking up and calling itself to find an extension that is not there, or something, anyhow it's a bad thing. Now intrinsically knowing that this protocol is smarter than me, I'm guessing that I have incorrect dialplan logic that is allowing this to happen. I'm wondering how I can set up a dialplan flow that will do this: >From Server 1, pick up phone and dial a number (phone)(exten), 1. * checks to see if the phone is first registered and on-line on server 1 2. if so, dial it, follow standard dialplan login 3. if not, goto DUNDi switch, lookup where it may be (this is pretty much working good) On Server 2, 1. DUNDi lookup request comes in 2. check to see if extention is active on this server(2), if not, stop, or at least don't continue to look for something within your own dialplan that is not there. I'm very open to suggestions. I feel like I'm so close but also still far away. Thanks JR _______________________________________________ --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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060314/44fddde3/attachment.htm
JR Richardson
2006-Mar-14 10:57 UTC
[Asterisk-Users] Clustering "NEW THREAD", Almost Working
Yes, SIP realtime is working with multiple * servers all accessing the same MySQL database, add a sip phone in the database and the phone can register with any server without the need to configure any server, just add the phone in the database, petty cool. JR ------------------------------ Message: 21 Date: Tue, 14 Mar 2006 10:18:06 -0500 From: Wai Wu <wwu@Calltrol.com> Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users@lists.digium.com> Message-ID: <B0430B20D208514CB2AFF57E81645C3194CC@k3-1.Calltrol.com> Content-Type: text/plain; charset="us-ascii" Now, I know what you guys been talking about. It is like DSN for sip phones, not really clustering. I original thought that you guys want to setup some thing that can fail over to a different sip server if the server running the IVR dies. From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Douglas Garstang Sent: Tuesday, March 14, 2006 12:11 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working Holy crap. You got SIP realtime working? I've tried it twice before and it failed the same way twice. Do you have multiple Asterisk boxes accessing the same sip info (ie phones) in the same table on the same database? Digium has said numerous times this known not to work, although I cant' work out why as it's just reading from a common table. JR Richardson Engineering for the Masses
That is a show stopper. However, if your clients are in groups behind their respected router, you might be able to give them a little linux app such that this app can PERSONIFY the phones to send a packet to the respected server. -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Benjamin Lawetz Sent: Tuesday, March 14, 2006 1:40 PM To: 'Asterisk Users Mailing List - Non-Commercial Discussion' Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working Had this working also at some point, but had one killer problem... NAT issues! Most of our clients are natted, and depending on the router, they only allow traffic to return from the server that the traffic was sent to. So the invites coming from other servers were being dropped. But besides that worked like a charm. Ben -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of JR Richardson Sent: March 14, 2006 12:57 PM To: asterisk-users@lists.digium.com Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working Yes, SIP realtime is working with multiple * servers all accessing the same MySQL database, add a sip phone in the database and the phone can register with any server without the need to configure any server, just add the phone in the database, petty cool. JR ------------------------------ Message: 21 Date: Tue, 14 Mar 2006 10:18:06 -0500 From: Wai Wu <wwu@Calltrol.com> Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users@lists.digium.com> Message-ID: <B0430B20D208514CB2AFF57E81645C3194CC@k3-1.Calltrol.com> Content-Type: text/plain; charset="us-ascii" Now, I know what you guys been talking about. It is like DSN for sip phones, not really clustering. I original thought that you guys want to setup some thing that can fail over to a different sip server if the server running the IVR dies. From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Douglas Garstang Sent: Tuesday, March 14, 2006 12:11 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] Clustering "NEW THREAD", Almost Working Holy crap. You got SIP realtime working? I've tried it twice before and it failed the same way twice. Do you have multiple Asterisk boxes accessing the same sip info (ie phones) in the same table on the same database? Digium has said numerous times this known not to work, although I cant' work out why as it's just reading from a common table. JR Richardson Engineering for the Masses _______________________________________________ --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 _______________________________________________ --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