[Asterisk-Dev] Multi asterisk installation

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue May 3 03:18:59 MST 2005


On Tue, May 03, 2005 at 11:47:49AM +0200, Andy wrote:
> 
> On 03/05/2005 at 11:31 Marcin wrote:
> 
> >project I design needs 2 running asterisks with different configurations
> >running on one machine, binded too different ports of course. Have anyone
> >tried this before ? Any ideas how to do it ?
> >
> >The sipmle problem I've ,,meet is that already running asterisk does not
> >let the second one to start. so the simple solution using 2x asterisk -C
> ><config file> is not working.
> >Alsoe start_daemon is not helpfull.
> >
> 
> The first problem you'll probably encounter is in /var/run - asterisk creates:
> 
> asterisk.ctl
> asterisk.pid
> 
> You could modify the code to pick up what it uses for those from a config.
> 
> asterisk/asterisk.c:                      snprintf((char *)ast_config_AST_SOCKET,sizeof(ast_config_AST_SOCKET),"%s/%s",v->value,"asterisk.ctl");
> asterisk/asterisk.h:#define AST_SOCKET    ASTVARRUNDIR "/asterisk.ctl"
> 
> asterisk/asterisk.c:                      snprintf((char *)ast_config_AST_PID,sizeof(ast_config_AST_PID),"%s/%s",v->value,"asterisk.pid");
> asterisk/asterisk.h:#define AST_PID               ASTVARRUNDIR "/asterisk.pid"

What's wrong with those?

Just give each Asterisk instance its own directory.

If you want to run it as non-root, you'd probably want to create the pid
file and the socket in a separate subdirectory under /var/run . 

Here is asterisk.conf from debian:

  [global]
	astetcdir => /etc/asterisk
	astmoddir => /usr/lib/asterisk/modules
	astvarlibdir => /var/lib/asterisk
	; in debian software lives under /usr 
	astagidir => /usr/share/asterisk/agi-bin
	astspooldir => /var/spool/asterisk
	astrundir => /var/run/asterisk
	astlogdir => /var/log/asterisk

Replace each /asterisk$ in that file with a custom directory for your
instance, owned by the user of that instance.

-- 
Tzafrir Cohen     icq#16849755  +972-50-7952406
tzafrir.cohen at xorcom.com  http://www.xorcom.com



More information about the asterisk-dev mailing list