[Asterisk-Users] Hint: how to include dialplan files from remotesystems

Alexander Lopez alex.lopez at opsys.com
Thu Dec 1 20:27:30 MST 2005


Good Idea. I am doing a similar thing but for a different reason:

 I use the system call to bring in mp3 files for music on hold. We make
custom Music on Hold messages and we store them at our DC. I am also
using this to pull mp3 updates for holiday music.

Try doing any of this with any OTHER PBX!!! Betcha can't!!!!


> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com 
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of 
> John Todd
> Sent: Thursday, December 01, 2005 9:52 PM
> To: asterisk-users at lists.digium.com
> Subject: [Asterisk-Users] Hint: how to include dialplan files 
> from remotesystems
> 
> 
> Every once in a while I find a nice, compact little project 
> is good enough to share to the rest of the user community as 
> a single post.  Here's something that I was happy worked as 
> planned.  This is not particularly clever, but uses some 
> infrequently-used tricks of running system commands from 
> within Asterisk in two different ways: System and #exec.  
> File this away under the heading of "Not really clever, but 
> impresses management."
> 
> I've got a user community who doesn't want to log into their 
> Asterisk servers much, but they have general housekeeping 
> tasks they want to perform on their dialplan which is really 
> just mapping usernames to extension (for SIP tasks, so that 
> "jwhorfin" ends up calling "Zap/g1/2939")  This shouldn't 
> involve them doing anything other than updating a file 
> somewhere.  They know how to put files on a webserver, so the 
> trick was how to make them able to edit this file on their 
> "easy-to-use" webserver and make it magically appear on the 
> "somewhat opaque" Asterisk system.  I gave them a template 
> file for them to store on their well-understood and 
> internally accessible webserver, that they can edit with 
> WordPad or other text editors.  This means that they don't 
> have to learn any significant processes to update the list of 
> user-to-number mappings if they know how to publish something 
> on their webserver.  Here's the template example:
> 
> 
> ; -- Start File --
> ; Template for usernames-to-numbers
> ;
> ; Save in the "privatefiles" directory of the public ;  
> webserver, accessible by anyone.
> ;
> ; Comments start with the semi-colon character ; ; After 
> making changes on this list and saving it ;  to the 
> webserver, you must call ext. 2900 to ;  cause the Asterisk 
> system to update itself ;  with the contents of this file.
> ;
> [username-to-numbers]
> exten => jwhorfin,1,Dial(Zap/g1/2939)
> exten => rnevada,1,Dial(Zap/g1/2988)
> ;
> ; -- end file --
> ;
> 
> 
> So, in the dialplan, here's what I do to include this file 
> (note that the "echo" user is just to illustrate that other 
> "names" can be included in the chain of contexts manually):
> 
> ; ...more extensions.conf above here.
> ;
> [from-internet]
> ;
> ; If any calls come in to user "echo", play back an echo test 
> ; exten => echo,1,Set(TIMEOUT(absolute)=500 exten => 
> echo,n,Echo ; ; Now, include any users that have been 
> configured by the client..
> ;
> ; (watch out for accidental line wraps here!  Next two lines 
> start with "#") #exec /usr/bin/curl -s 
> http://webserver.domain.com/privatefiles/username-to-numbers 
> > /etc/asterisk/username-to-numbers #include 
> username-to-numbers include => username-to-numbers ; ; ; more 
> extensions.conf below here...
> ;
> ;
> 
> Now, just as trivially clever is that in a different context 
> (from their PBX) I can allow them to dial a "special" number 
> that allows the administrator to re-load/re-parse this file at will:
> 
> ;
> [from-pbx]
> ;
> exten => 2900,1,System(/usr/sbin/asterisk -rx "extensions reload") ;
> 
> 
> Don't forget to add this set of 2 lines to asterisk.conf to 
> allow the config files to execute commands with "#exec":
> 
> [options]
> execincludes=yes
> 
> Good luck!
> 
> JT
> _______________________________________________
> --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
> 



More information about the asterisk-users mailing list