<html><body><font style="" color="#000000"><font size="2"><font style="font-family: verdana,geneva;" face="verdana,geneva"><font style="" color="#000000"><font style="font-family: verdana,geneva;" face="verdana,geneva">thanks! this definitely helps. </font></font></font></font></font>now, i'm trying to think of a way to make this happen on multiple asterisk nodes at once. <br><br>i really wish realtime would simply read new contexts from the db. i know that the dialplan is core to the system, but i think this core aspect should be ultimately configurable from a database using realtime. sigh.....<br><br><br>todd <br><br>
<blockquote webmail="1" style="border-left: 2px solid blue; margin-left: 8px; padding-left: 8px;">
-------- Original Message --------<br>
Subject: Re: [asterisk-users] asterisk realtime and creating "new"<br>
contexts<br>
From: Mike Clark <mike@infoanywhere.com><br>
Date: Fri, August 15, 2008 4:49 am<br>
To: Asterisk Users Mailing List - Non-Commercial Discussion<br>
<asterisk-users@lists.digium.com><br>
<br>
<br>
Todd Fulton wrote:<br>
> Hi,<br>
><br>
> I'm trying to create a multi-tennant asterisk installation .... where <br>
> each of my customers has its own context. Well, I've got asterisk <br>
> realtime working, and I can add/update extensions to existing contexts <br>
> in extensions.conf without a problem. However, when I attempt to <br>
> create database entries with a context that is NOT in extensions.conf, <br>
> I get an error "invalid extension".<br>
><br>
> I've found several posts around the net asking this question, but no <br>
> answers. Has anyone out there dealt with this problem?<br>
><br>
> Any help would be great!<br>
><br>
><br>
> Todd<br>
><br>
Todd:<br>
<br>
Unfortunately, new contexts don't seem to show up in "real time". I <br>
solved this in RAGUI by putting #exec statements in the extensions.cong <br>
file that scan the extensions table and generate the proper contexts. <br>
However, you still have to do a reload to get the contexts to be <br>
available in Asterisk.<br>
<br>
Here is an example:<br>
<br>
in extensions.conf<br>
<br>
#exec /opt/pointcall/asterisk/scripts/load_extensions.rb<br>
<br>
I used Ruby, but it could be Perl , PHP or whatever<br>
<br>
load_extensions.rb<br>
<br>
#!/usr/local/bin/ruby<br>
#<br>
<br>
require 'mysql'<br>
<br>
hostname = "host"<br>
username = "user"<br>
password = "pass"<br>
database = "rtdb"<br>
<br>
my = Mysql.new(hostname, username, password, database)<br>
<br>
res = my.query("SELECT DISTINCT context FROM extensions ORDER by context")<br>
#<br>
res.each do |row|<br>
context = row[0]<br>
print "\n"<br>
print '[' + context + "]\n"<br>
print "Switch => Realtime/" + context + "\n"<br>
end<br>
<br>
<br>
Thanks,<br>
<br>
Mike<br>
<br>
_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank" mce_href="http://www.api-digital.com">http://www.api-digital.com</a> --<br>
<br>
AstriCon 2008 - September 22 - 25 Phoenix, Arizona<br>
Register Now: <a href="http://www.astricon.net" target="_blank" mce_href="http://www.astricon.net">http://www.astricon.net</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" mce_href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote></body></html>