Hi List,
My ser.cfg file has grown quite large now and it's becoming quite hard to manage all the gateways. For example, if we need to change them.
What I'd like to have is a file that contains the hosts, e.g. @GW1@ gateway1.mydomin.com @GW2@ gateway2.mydomin.com
then have a ser.cfg.template script where I'd define the hosts in the forward/reply commands as @GW1@ etc.. and run a shell script/command on that file to generate the master ser.cfg file.
My question is that is there already a program available that would allow me to do this kind of thing?
Regards,
Alan
------------------------------------------------------------------------------------------------------- This email, and any files transmitted with it, is copyright and may contain confidential information. The contents are intended for the use of the addressee(s) only. Unauthorized use may be unlawful. If you receive this email by mistake, please advise sender immediately. The views of the author may not necessarily constitute the views of Telco Electronics Limited. Nothing in this mail shall bind Telco Electronics Limited in any contract or obligation.
Telco Electronics Limited 6-8 Oxford Court Brackley Northants NN13 7XY
Tel 07000 701999 Fax 07000 701777
Alan:
I need this functionality too. I was looking at cobbling together something using exec but if you find a better way I'd like to hear about it.
Thanks,Steve
Alan Litster wrote:
Hi List,
My ser.cfg file has grown quite large now and it's becoming quite hard to manage all the gateways. For example, if we need to change them.
What I'd like to have is a file that contains the hosts, e.g. @GW1@ gateway1.mydomin.com @GW2@ gateway2.mydomin.com
then have a ser.cfg.template script where I'd define the hosts in the forward/reply commands as @GW1@ etc.. and run a shell script/command on that file to generate the master ser.cfg file.
My question is that is there already a program available that would allow me to do this kind of thing?
Regards,
Alan
This email, and any files transmitted with it, is copyright and may contain confidential information. The contents are intended for the use of the addressee(s) only. Unauthorized use may be unlawful. If you receive this email by mistake, please advise sender immediately. The views of the author may not necessarily constitute the views of Telco Electronics Limited. Nothing in this mail shall bind Telco Electronics Limited in any contract or obligation.
Telco Electronics Limited 6-8 Oxford Court Brackley Northants NN13 7XY
Tel 07000 701999 Fax 07000 701777
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
I may have posted this before, if so, I apologize for the duplication.
Our ser.cfg files became unmanageable almost immediately. It was apparent that something had to be done to get a grasp on things. We have dozens of configuration files that must all work together, ports, gateways, etc. We did not want to duplicate code fragments.
We used the standard C preprocessor. #include, #define, etc. Although not perfect, it goes a long way. For example, here is a proxy definition of ours.
------------begin----------------- #include "sercommon.pre" /* customize for this server */ #define DOMAIN voicething.com #define LISTENIP 198.212.169.20 #define NATIP 198.212.169.253 #define VMHOSTPORT vm.voicething.com:5060 #define DBURL "sql://USER@HOST:PORT/DATABASE"
/* this is the top section, common to all ser servers */ #include "sertop.pre"
/* this is the custom proxy server */ /* #include "sergatewaysimple.pre" */ #include "sergatewayob.pre" -----------------end-------------------------
I've got an include directory in /usr/local/lib/ser/include: sergatewayice.pre sermodenuminit.pre README sergatewaynorm.pre sermodgroupinit.pre ser800.pre sergatewayob.pre sermodtminit.pre sercommon.pre sermoduriinit.pre sercontus.pre sermodusrlocinit.pre serdef.pre serinclude.pre serproxy.pre serdef.pre.old serintl.pre serregister.pre serenum.pre serlocal.pre sertop.pre sererror.pre sermodaccinit.pre sergatewaybyip.pre sermodauth_dbinit.pre
Then I have a Makefile, simply:
IDIR=/usr/local/lib/ser/include CPDEF=-I$(IDIR) CPP=cpp CPFLAGS=-w -x c -E -undef CPCMD=$(CPP) $(CPFLAGS) $(CPDEF) SERFILE=ser.cfg
.SUFFIXES: .cfg .pre
.pre.cfg: -rm -f ser.cfg -mv $(SERFILE)=1 $ $(SERFILE)=2 -mv $(SERFILE)=0 $ $(SERFILE)=1 -mv $*.cfg $ $(SERFILE)=0 $(CPCMD) -o - $< | sed 's/\"//g' > $*.cfg ln -s $*.cfg $(SERFILE)
The resulting ser.cfg file is HUGE, but very consistent. I can add a gateway, open another port, change DB permissions, whatever, and those changes are usually isolated to an include file. Testing is easier too. I can include a different gateway file (for instance) and test a ser.cfg production before deploying.
Strings are hard (but not impossible) to work with using the C-preprocessor.
---greg
On Aug 17, 2004, at 6:47 AM, Steve Blair wrote:
Alan:
I need this functionality too. I was looking at cobbling together something using exec but if you find a better way I'd like to hear about it.
Thanks,Steve
Alan Litster wrote:
Hi List,
My ser.cfg file has grown quite large now and it's becoming quite hard to manage all the gateways. For example, if we need to change them.
What I'd like to have is a file that contains the hosts, e.g. @GW1@ gateway1.mydomin.com @GW2@ gateway2.mydomin.com
then have a ser.cfg.template script where I'd define the hosts in the forward/reply commands as @GW1@ etc.. and run a shell script/command on that file to generate the master ser.cfg file.
My question is that is there already a program available that would allow me to do this kind of thing?
Regards,
Alan
This email, and any files transmitted with it, is copyright and may contain confidential information. The contents are intended for the use of the addressee(s) only. Unauthorized use may be unlawful. If you receive this email by mistake, please advise sender immediately. The views of the author may not necessarily constitute the views of Telco Electronics Limited. Nothing in this mail shall bind Telco Electronics Limited in any contract or obligation.
Telco Electronics Limited 6-8 Oxford Court Brackley Northants NN13 7XY
Tel 07000 701999 Fax 07000 701777
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
-- ISC Network Engineering The University of Pennsylvania 3401 Walnut Street, Suite 221A Philadelphia, PA 19104
voice: 215-573-8396 215-746-7903
fax: 215-898-9348 sip:blairs@upenn.edu
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Greg Fausak www.AddaBrand.com (US) 469-546-1265
Assuming you have a file called ser.def containing something like GW1 gateway1.mydomin.com GW2 gateway2.mydomin.com
and your ser config file is called ser.cfg.in and has the host entries as @GW1@, the following will generate ser.cfg based on those two files.
awk '$1 != "" {print "-e s/@"$1"@/"$2"/g"}' ser.def | xargs sed ser.cfg.in > ser.cfg
Regards,
Alan
-----Original Message----- From: Steve Blair [mailto:blairs@isc.upenn.edu] Sent: 17 August 2004 12:48 To: Alan Litster Cc: SER Mailing List Subject: Re: [Serusers] Help on managing ser.cfg
Alan:
I need this functionality too. I was looking at cobbling together something using exec but if you find a better way I'd like to hear about it.
Thanks,Steve
Alan Litster wrote:
Hi List,
My ser.cfg file has grown quite large now and it's becoming quite hard to manage all the gateways. For example, if we need to change them.
What I'd like to have is a file that contains the hosts, e.g. @GW1@ gateway1.mydomin.com @GW2@ gateway2.mydomin.com
then have a ser.cfg.template script where I'd define the hosts in the forward/reply commands as @GW1@ etc.. and run a shell script/command on
that
file to generate the master ser.cfg file.
My question is that is there already a program available that would allow
me
to do this kind of thing?
Regards,
Alan
----------------------------
This email, and any files transmitted with it, is copyright and may contain
confidential information.
The contents are intended for the use of the addressee(s) only. Unauthorized use may be unlawful. If you receive this email by mistake, please advise sender immediately. The views of the author may not necessarily constitute the views of Telco
Electronics Limited.
Nothing in this mail shall bind Telco Electronics Limited in any contract
or obligation.
Telco Electronics Limited 6-8 Oxford Court Brackley Northants NN13 7XY
Tel 07000 701999 Fax 07000 701777
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
--
ISC Network Engineering The University of Pennsylvania 3401 Walnut Street, Suite 221A Philadelphia, PA 19104
voice: 215-573-8396
215-746-7903
fax: 215-898-9348
sip:blairs@upenn.edu
------------------------------------------------------------------------------------------------------- This email, and any files transmitted with it, is copyright and may contain confidential information. The contents are intended for the use of the addressee(s) only. Unauthorized use may be unlawful. If you receive this email by mistake, please advise sender immediately. The views of the author may not necessarily constitute the views of Telco Electronics Limited. Nothing in this mail shall bind Telco Electronics Limited in any contract or obligation.
Telco Electronics Limited 6-8 Oxford Court Brackley Northants NN13 7XY
Tel 07000 701999 Fax 07000 701777