thanks!  this definitely helps.  now, i'm trying to think of a way to make this happen on multiple asterisk nodes at once. 

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


todd

-------- Original Message --------
Subject: Re: [asterisk-users] asterisk realtime and creating "new"
contexts
From: Mike Clark <[EMAIL PROTECTED]>
Date: Fri, August 15, 2008 4:49 am
To: Asterisk Users Mailing List - Non-Commercial Discussion
<[email protected]>


Todd Fulton wrote:
> Hi,
>
> I'm trying to create a multi-tennant asterisk installation .... where
> each of my customers has its own context. Well, I've got asterisk
> realtime working, and I can add/update extensions to existing contexts
> in extensions.conf without a problem. However, when I attempt to
> create database entries with a context that is NOT in extensions.conf,
> I get an error "invalid extension".
>
> I've found several posts around the net asking this question, but no
> answers. Has anyone out there dealt with this problem?
>
> Any help would be great!
>
>
> Todd
>
Todd:

Unfortunately, new contexts don't seem to show up in "real time". I
solved this in RAGUI by putting #exec statements in the extensions.cong
file that scan the extensions table and generate the proper contexts.
However, you still have to do a reload to get the contexts to be
available in Asterisk.

Here is an example:

in extensions.conf

#exec /opt/pointcall/asterisk/scripts/load_extensions.rb

I used Ruby, but it could be Perl , PHP or whatever

load_extensions.rb

#!/usr/local/bin/ruby
#

require 'mysql'

hostname = "host"
username = "user"
password = "pass"
database = "rtdb"

my = Mysql.new(hostname, username, password, database)

res = my.query("SELECT DISTINCT context FROM extensions ORDER by context")
#
res.each do |row|
context = row[0]
print "\n"
print '[' + context + "]\n"
print "Switch => Realtime/" + context + "\n"
end


Thanks,

Mike

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

AstriCon 2008 - September 22 - 25 Phoenix, Arizona
Register Now: http://www.astricon.net

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

AstriCon 2008 - September 22 - 25 Phoenix, Arizona
Register Now: http://www.astricon.net

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

Reply via email to