we are in process of writing a PHP interface for * conf files. we are parsing the files like INI files but the only prob I have so far is that separate extensions in a context dont have any unique tag that I can capture. This works ok [trunkld] ; ; Long distance context accessed through trunk ; exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:1}) exten => _91NXXNXXXXXX,2,Congestion [international] ; ; Master context for international long distance ; ignorepat => 9 include => longdistance include => trunkint This does not, how do I separate the extensions apart from the [default] context so that PHP can modify them seperatly? [default] ; exten => s,1,Background,radsgreet ;exten => s,2,Setmusiconhold,default ;exten => s,2,Dial,Phone/phone1|20 exten => t,1,Hangup exten => i,1,Playback,invalid exten => i,2,Goto,s|1 ; Dave's Extension exten => 70907,1,Dial,SIP/70907|30 exten => 70907,2,VoiceMail,u70907 exten => 70907,102,VoiceMail,b70907 exten => 70907,103,Hangup ; Andrew's Extension exten => 70902,1,Dial,SIP/70902|30 exten => 70902,2,VoiceMail,u70902 exten => 70902,102,VoiceMail,b70902 exten => 70902,103,Hangup Can we add something like this to * that wont kill older versions? so that I can parse out the extensions to be searched on and modified? {70907} ; Dave's Extension exten => 70907,1,Dial,SIP/70907|30 exten => 70907,2,VoiceMail,u70907 exten => 70907,102,VoiceMail,b70907 exten => 70907,103,Hangup {70902} ; Andrew's Extension exten => 70902,1,Dial,SIP/70902|30 exten => 70902,2,VoiceMail,u70902 exten => 70902,102,VoiceMail,b70902 exten => 70902,103,Hangup Dave Packham
Oh yeah. we'll turn this code in to Mark when its working to get comunity input/mods etc Dave>>> Dave.Packham@utah.edu 5/16/2003 10:51:25 AM >>>we are in process of writing a PHP interface for * conf files. we are parsing the files like INI files but the only prob I have so far is that separate extensions in a context dont have any unique tag that I can capture. This works ok [trunkld] ; ; Long distance context accessed through trunk ; exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:1}) exten => _91NXXNXXXXXX,2,Congestion [international] ; ; Master context for international long distance ; ignorepat => 9 include => longdistance include => trunkint This does not, how do I separate the extensions apart from the [default] context so that PHP can modify them seperatly? [default] ; exten => s,1,Background,radsgreet ;exten => s,2,Setmusiconhold,default ;exten => s,2,Dial,Phone/phone1|20 exten => t,1,Hangup exten => i,1,Playback,invalid exten => i,2,Goto,s|1 ; Dave's Extension exten => 70907,1,Dial,SIP/70907|30 exten => 70907,2,VoiceMail,u70907 exten => 70907,102,VoiceMail,b70907 exten => 70907,103,Hangup ; Andrew's Extension exten => 70902,1,Dial,SIP/70902|30 exten => 70902,2,VoiceMail,u70902 exten => 70902,102,VoiceMail,b70902 exten => 70902,103,Hangup Can we add something like this to * that wont kill older versions? so that I can parse out the extensions to be searched on and modified? {70907} ; Dave's Extension exten => 70907,1,Dial,SIP/70907|30 exten => 70907,2,VoiceMail,u70907 exten => 70907,102,VoiceMail,b70907 exten => 70907,103,Hangup {70902} ; Andrew's Extension exten => 70902,1,Dial,SIP/70902|30 exten => 70902,2,VoiceMail,u70902 exten => 70902,102,VoiceMail,b70902 exten => 70902,103,Hangup Dave Packham _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users
My guess is either you have started to develop with a bad idea of how to represent the data, or you don't understand asterisk that well. Inside the context you have exten => (EXTENSION),(PRIORITY),(APPLICATION) If you followed that, then you should know what to use to tag the extensions. Or worse case scenario, since you are writing a config script that probably will not be able to keep comments in the config after a change is made, why not use that to your benefit by placing tags before each extension block and that way you know when you run across a comment line, it is a tag for your app. On Fri, 2003-05-16 at 11:51, Dave Packham wrote:> we are in process of writing a PHP interface for * conf files. we are parsing the files like INI files but the only prob I have so far is that separate extensions in a context dont have any unique tag that I can capture. > > This works ok > > > [trunkld] > ; > ; Long distance context accessed through trunk > ; > exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:1}) > exten => _91NXXNXXXXXX,2,Congestion > > [international] > ; > ; Master context for international long distance > ; > ignorepat => 9 > include => longdistance > include => trunkint > > > > This does not, how do I separate the extensions apart from the [default] context so that PHP can modify them seperatly? > > [default] > ; > exten => s,1,Background,radsgreet > ;exten => s,2,Setmusiconhold,default > ;exten => s,2,Dial,Phone/phone1|20 > exten => t,1,Hangup > exten => i,1,Playback,invalid > exten => i,2,Goto,s|1 > > ; Dave's Extension > exten => 70907,1,Dial,SIP/70907|30 > exten => 70907,2,VoiceMail,u70907 > exten => 70907,102,VoiceMail,b70907 > exten => 70907,103,Hangup > > ; Andrew's Extension > exten => 70902,1,Dial,SIP/70902|30 > exten => 70902,2,VoiceMail,u70902 > exten => 70902,102,VoiceMail,b70902 > exten => 70902,103,Hangup > > > Can we add something like this to * that wont kill older versions? so that I can parse out the extensions to be searched on and modified? > > {70907} > ; Dave's Extension > exten => 70907,1,Dial,SIP/70907|30 > exten => 70907,2,VoiceMail,u70907 > exten => 70907,102,VoiceMail,b70907 > exten => 70907,103,Hangup > > {70902} > ; Andrew's Extension > exten => 70902,1,Dial,SIP/70902|30 > exten => 70902,2,VoiceMail,u70902 > exten => 70902,102,VoiceMail,b70902 > exten => 70902,103,Hangup > > > Dave Packham > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users-- Steven Critchfield <critch@basesys.com>
The web interface we have now presents you with all the different extension contexts that we have [oncampus] exten => 70901,yada exten => 70902,yada [offcampus] exten => 70903,yada exten => 70904,yada [restricted] exten => 70905,yada exten => 70906,yada etc when you click on "oncampus" you are presented with all the extensions in that context. in this case 70901 and 70902. the page then will show you ALL the text including comments in the that pertain to extension 70901 & 2 I may not see/understand as you put it how I can include all the comments and definitions that should be included with the 70901 if I dont delimit it somehow? how would I group the "dpackham" extension 70901 and keep comments if I have no real deliliter? ;dpackham exten => 70901,yada exten => 70901,yada2 ;this is a comment for 70901 ; ;this is going to stay here for 70902 ;the is for andrew exten => 70902,yada exten => 70902,yada2 exten => 70902,yada3 ;and this too for 70902 exten => 70902,yada4 ; ; I cant think of a statement that will allow me to include/group the comments and extra text with an extension except by defining a start/end pair. <70902> ;this is going to stay here exten => 70902,yada exten => 70902,yada2 exten => 70902,yada3 ;and this too exten => 70902,yada4 </70902> is this any clearer? or an I just loosing it? I thougt I was understanding it pretty clearly. I just want to write a interface that wont trash the conf files by stripping comments and whitespace etc. Dave>>> critch@basesys.com 5/16/2003 12:32:37 PM >>>My guess is either you have started to develop with a bad idea of how to represent the data, or you don't understand asterisk that well. Inside the context you have exten => (EXTENSION),(PRIORITY),(APPLICATION) If you followed that, then you should know what to use to tag the extensions. Or worse case scenario, since you are writing a config script that probably will not be able to keep comments in the config after a change is made, why not use that to your benefit by placing tags before each extension block and that way you know when you run across a comment line, it is a tag for your app. On Fri, 2003-05-16 at 11:51, Dave Packham wrote:> we are in process of writing a PHP interface for * conf files. we are parsing the files like INI files but the only prob I have so far is that separate extensions in a context dont have any unique tag that I can capture. > > This works ok > > > [trunkld] > ; > ; Long distance context accessed through trunk > ; > exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:1}) > exten => _91NXXNXXXXXX,2,Congestion > > [international] > ; > ; Master context for international long distance > ; > ignorepat => 9 > include => longdistance > include => trunkint > > > > This does not, how do I separate the extensions apart from the [default] context so that PHP can modify them seperatly? > > [default] > ; > exten => s,1,Background,radsgreet > ;exten => s,2,Setmusiconhold,default > ;exten => s,2,Dial,Phone/phone1|20 > exten => t,1,Hangup > exten => i,1,Playback,invalid > exten => i,2,Goto,s|1 > > ; Dave's Extension > exten => 70907,1,Dial,SIP/70907|30 > exten => 70907,2,VoiceMail,u70907 > exten => 70907,102,VoiceMail,b70907 > exten => 70907,103,Hangup > > ; Andrew's Extension > exten => 70902,1,Dial,SIP/70902|30 > exten => 70902,2,VoiceMail,u70902 > exten => 70902,102,VoiceMail,b70902 > exten => 70902,103,Hangup > > > Can we add something like this to * that wont kill older versions? so that I can parse out the extensions to be searched on and modified? > > {70907} > ; Dave's Extension > exten => 70907,1,Dial,SIP/70907|30 > exten => 70907,2,VoiceMail,u70907 > exten => 70907,102,VoiceMail,b70907 > exten => 70907,103,Hangup > > {70902} > ; Andrew's Extension > exten => 70902,1,Dial,SIP/70902|30 > exten => 70902,2,VoiceMail,u70902 > exten => 70902,102,VoiceMail,b70902 > exten => 70902,103,Hangup > > > Dave Packham > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users-- Steven Critchfield <critch@basesys.com> _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users
So I guess the real question here is if we follow what you suggested by using>Inside the context you have exten => (EXTENSION),(PRIORITY),(APPLICATION) >If you followed that, then you should know what to use to tag the >extensions.how can I tag a username/userinfo/location to an extension? with out keeping the comments? I am trying to be able to parse and present the demo files that are shipped to help people like me (that got a lot of help from you all) in setting this up. keeping the comments will help dreastically
In automating things with *, I've hit this a few times myself. I typically solved it with headers like ; ###START OF MY STUFF### stuff stuff stuff ; ###END OF MY STUFF### Then I just throw away that chunk and regenerate from scratch (from my other data source, typically a custom configuration file from a custom script). One question, is there a way to include one file from another in our config files? That would be really useful--especially for having a script generate certain settings. There's nothing like just blowing away a completely generated file with a new completely generated file. Includes would allow that without touching the rest of the configuration. Not to mention that extensions.conf can get really long and that would seriously help manage it. Right now, I use a number of python-based scripts to synchronize my naming conventions between voicemail.conf, extensions.conf, and zapata.conf (peoples names matching their extensions). Includes would make them *MUCH* simpler. Ironically, I actually keep a number of my * files in RCS because keeping track of the changes has been so painful. Being able to separate things out into files would really help there. Otherwise, I think the configuration syntax will become a serious problem when we start getting to sizes that compete with the big boys (10,000 extensions over multiple servers). Jayson
Thank you. Ill start looking at the include statement. I just wish I had some more exten type fields to work with. like a comment/username etc. this would help in the future with E911 and all. being able to track location/person behind an extension. maybe even tagging an extension with a billing code for the CDR database etc.. Dave>>> critch@basesys.com 5/16/2003 2:26:40 PM >>>On Fri, 2003-05-16 at 14:53, Dave Packham wrote:> I cant think of a statement that will allow me to include/group the > comments and extra text with an extension except by defining a > start/end pair. > > <70902> > ;this is going to stay here > exten => 70902,yada > exten => 70902,yada2 > exten => 70902,yada3 > ;and this too > exten => 70902,yada4 > </70902> > > is this any clearer? > > or an I just loosing it? > > I thougt I was understanding it pretty clearly. I just want to write > a interface that wont trash the conf files by stripping comments and > whitespace etc.Lets start with the thought that you can modify the starting point of the conf files. If you have to modify the confs to get to a good starting point, then whats the problem. Secondly, why don't you take your psuedo XML tags and just place them after a comment delimiter, and all is happy then. Or instead of XML like tags, use mime style lines ;=============NextPart This will let you split pieces up, and be pretty easy to parse coming in as you know there isn't any embedding, or nesting. Using mimestyle lines let you make the copy paste sections and modify the extenion number easy without worrying about namespace in the psuedo XML. These are just suggestions to help you over the hump. -- Steven Critchfield <critch@basesys.com> _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users