Hi, I'd like to be able to create contexts in real-time when I add new clients to my asterisk box. Currently, I have to create a blank context in extensions.conf and add:- switch => Realtime/@ Is there any way to avoid the step of creating the blank context and simply include all the entries from the database? Thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100815/5a36f88a/attachment.htm
Hi, As nobody has answered it yet, and long time ago I also seeked answer to this exact same question, so I guess there is still no way to do it. What I ended up doing was defining 100 contexts in extensions.conf, all with the switch statements, so I didn't have to do a reload everytime. And then I would add these contexts in the realtime database as per requirement. It was about 3 years ago, and I don't remember more details about it, but just an idea in case it might help you. Zeeshan A Zakaria -- www.ilovetovoip.com On 2010-08-15 2:41 PM, "Dan Journo" <dan at keshercommunications.com> wrote: Hi, I'd like to be able to create contexts in real-time when I add new clients to my asterisk box. Currently, I have to create a blank context in extensions.conf and add:- switch => Realtime/@ Is there any way to avoid the step of creating the blank context and simply include all the entries from the database? Thanks Dan -- _____________________________________________________________________ -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100817/ce00c8b1/attachment.htm
We use a script on a cron which runs from a table/queue that only has an entry placed in it if a new context is added. If that is the case the script writes a new extenions.conf generating all the contexts and switch statements by doing a distinct select of contexts in the table. It also executed the dialplan reload after the new conf file had been generated. If your shell scripting isn't up to much I can give you an example Ish On 15/08/10 19:35, Dan Journo wrote:> > Hi, > > I'd like to be able to create contexts in real-time when I add new > clients to my asterisk box. > > Currently, I have to create a blank context in extensions.conf and add:- > > switch => Realtime/@ > > Is there any way to avoid the step of creating the blank context and > simply include all the entries from the database? > > Thanks > > Dan >-- Ishfaq Malik Software Developer PackNet Ltd Office: 0161 660 3062 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100817/3034dc16/attachment.htm
The whole point of using real-time, as the word 'real' says, is to avoid the reloads. If one is ok with the reloads, then why bother with real-time at all. Zeeshan A Zakaria -- www.ilovetovoip.com On 2010-08-17 10:50 AM, "Ishfaq Malik" <ish at pack-net.co.uk> wrote: We use a script on a cron which runs from a table/queue that only has an entry placed in it if a new context is added. If that is the case the script writes a new extenions.conf generating all the contexts and switch statements by doing a distinct select of contexts in the table. It also executed the dialplan reload after the new conf file had been generated. If your shell scripting isn't up to much I can give you an example Ish On 15/08/10 19:35, Dan Journo wrote:> > Hi, > > > > I'd like to be able to create contexts in r...-- Ishfaq Malik Software Developer PackNet Ltd Office: 0161 660 3062 -- _____________________________________________________________________ -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100817/c28d8cde/attachment.htm
So why you need a reload when you are using the real-time architecture? Are you adding contexts in extensions.conf? If yes then where are you using the real-time? I asked because to me it seems you didn't understand what Dan is asking, and also seems you don't know how real-time works in regards to add contexts without reloading asterisk. On 2010-08-18 4:25 AM, "Ishfaq Malik" <ish at pack-net.co.uk> wrote: Unless I've got some massive misunderstanding, yes we do as described here http://www.voip-info.org/wiki/view/Asterisk+RealTime Why do you ask? On 17/08/10 17:27, Zeeshan Zakaria wrote:> > Ishfaq, do you use the asterisk real-time architectu...-- Ishfaq Malik Software Developer PackNet Ltd Office: 0161 660 3062 -- _____________________________________________________________________ -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100818/5592fde3/attachment.htm
Thanks for the details. I Agreed you know what you are doing. As for doing it more elegantly, it is not possible to do a fruitful discussion without knowing all the details of how your dialplan works, neither is this the goal here. But I offer similar hosted PBX service, just use one context for all the companies, use various logics in the dialplan to differentiate between the tenants, their updates, new inserts etc., and never needed to do any reload. I identify tenant by their account ids and one context works for all. CDRs are perfectly fine, billing is even great and automated. If fact I have developed/programmed three multi-tenant solutions for far, including one for a busy client, and used the same logic. They all work perfectly fine. That was why I wondered why you needed reloads. But you must be doing something which genuinely requires a reload, not saying that you are not doing it right. Zeeshan A Zakaria -- www.ilovetovoip.com On 2010-08-18 6:49 AM, "Ishfaq Malik" <ish at pack-net.co.uk> wrote: Hi I'll give you an example process flow Our customer logs onto our VoIP Portal and orders a SIP Geographic number Geo number is successfully ordered which inserts an entry into our extensions table in MySQL DB in the default context which has a goto command to a newly created specific context for handling the incoming on that number. The customer goes to the dial plan managing section of the portal and sets the number to ring an extension of his followed by going to voicemail. In the back end 2 new inserts are made into the extensions table for the newly created context. Also, an insert is made into a table to say that the extensions table has been updated. A cron runs and sees that the extensions table has been updated. this gets a distinct list of contexts from the extensions table and writes each one to a new extensions.con putting in the realtime switch for each context. The cron then executes a dialplan reload If you can see a more elegant way of doing the above so that no intervention is required by anyone other that the customer, please let me know as I'm always willing to learn better ways of doing things. Also, please bear in mind that we offer a hosted service for customers so we have lots of different companies all working off the same server(s) Ish On 18/08/10 10:37, Zeeshan Zakaria wrote:> > So why you need a reload when you are using the real...-- _____________________________________________________________________ -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100818/0bdf4da1/attachment.htm
Hi Matt, That's somewhat closer to what I do in my dialplan as well. But Dan apparantly wants to add new contexts in his `extensions` table. Zeeshan A Zakaria -- www.ilovetovoip.com On 2010-08-18 6:02 PM, "Matt Riddell" <lists at venturevoip.com> wrote: We don't use a context for that. We set up dialplan code in a non asterisk part of MySQL called "routing types". When a customer selects a DDI number they can choose a routing type to use with it. These routing types allow for variable substitution - i.e. if someone adds the routing type "Direct Routing With Failover", there is a variable with this type called failover routing. The call is then sent to their SIP or IAX2 device (if not on the same machine that has the DDI number it uses DUNDI to find the appropriate machine). If somebody is unavailable on all machines, it sets the account code to the customer and goes to the outbound context for dialling. The difference is that in the routing type we don't use extensions (just applications). When someone adds the routing type to their DDI realtime extensions are created with extension 5551234 (or whatever their DDI number is) and priorities which increase. It makes some things a bit harder, but you can always use labels and the read application. -- Cheers, Matt Riddell _______________________________________________ http://www.venturevoip.com/news.php (Daily Asterisk News) http://www.venturevoip.com/exchange.php (Full ITSP Solution) http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer) -- _____________________________________________________________________ -- Bandwidth and Colocation Pr... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100818/04f925f3/attachment.htm