[VoIP] Asterisk start on boot with Debian Linux

Donald Froula dfroula at sbcglobal.net
Sat Sep 15 16:54:51 CDT 2007


One odd thing I discovered is that outgoing and
incoming SIP calls to my VOIP provider would not work
when starting Asterisk as a daemon at boot. I was
registered with my VOIP provider, according to "sip
show registry", but incoming or outgoing calls would
not complete. A manual "reload" from the console fixed
it. Not good!

I found a few other references to this issue on the
web.

I fixed this by adding a "sleep 10" command in the
start case of the asterisk startup script, before
asterisk is started. This forces the startup script to
wait 10 seconds before starting Asterisk. This fixed
the problem, apparently by waiting until the
networking got its DHCP ip address and stabilized.
Weird.

Don

--- John Novack <jnovack at stromberg-carlson.org> wrote:

> 
> 
> Donald Froula wrote:
> > >From what I read, Debian does things quite
> differently
> > from most other Linux distributions.
> >   
> And for something even more different, try DSL
> Damn Small Linux
> I have installed it on a thin client HP 5515, and
> have found 
> documentation for DSL wanting. It looks as if I live
> long enough to get 
> it configured, It will run Asterisk, possibly better
> than the router 
> setup. It has the right USB ports, an 800 Mhz
> processor, and if you find 
> the correct one one PCI slot.
> I believe any of the HP thin clients, not just the
> Linux one, can work.
> 
> Anyone done anything with DSL?
> 
> John Novack
> 
> > The Debian solution also will restart Asterisk if
> the
> > process dies. The script must be written properly
> for
> > this to work. The sample script provided with
> Asterisk
> > does support restarts. I tested this by killing
> off
> > the Asterisk process.
> >
> > Don
> >
> > --- Greg Blakely <greg at vyger.net> wrote:
> >
> >   
> >> I also have my asterisk start at boot-up
> (Fedora),
> >> but I do it through
> >> /etc/inittab.
> >>
> >> That way, if it dies, it will restart.
> >>
> >> Here's what it looks like, a line by itself, all
> the
> >> way at the bottom
> >> of the file:
> >>
> >> # Start Asterisk
> >> ax:2345:respawn:/usr/sbin/asterisk -cq
> >>
> >>
> >>  
> >>
> >>     
> >>> -----Original Message-----
> >>> From: voip-bounces at ckts.info
> >>>       
> >> [mailto:voip-bounces at ckts.info] 
> >>     
> >>> On Behalf Of Donald Froula
> >>> Sent: Friday, September 14, 2007 11:48 AM
> >>> To: voip at ckts.info
> >>> Subject: [VoIP] Asterisk start on boot with
> Debian
> >>>       
> >> Linux
> >>     
> >>> I figured out how to run Asterisk at boot up,
> but
> >>>       
> >> only after 
> >>     
> >>> lots of false starts.
> >>>
> >>> Debian requires a startup script to be placed in
> >>>       
> >> the 
> >>     
> >>> directory /etc/init.d. The Asterisk source
> >>>       
> >> distribution comes 
> >>     
> >>> with a working script in the "contrib/init.d"
> >>>       
> >> sub-directory, 
> >>     
> >>> called rc.debian.asterisk. I copied this to
> >>>       
> >> /etc/init.d and 
> >>     
> >>> edited it to modprobe my zaptel drivers and run
> >>>       
> >> ztcfg to 
> >>     
> >>> bring up the interfaces.
> >>>
> >>> Debian then requires you to run the command
> >>>       
> >> "update-rc.d" to 
> >>     
> >>> set up the rules for running the script in the
> >>>       
> >> various run levels.
> >>     
> >>> I used the following command:
> >>>
> >>> "update-rc.d rc.debian.asterisk start 99 2 3 4 5
> .
> >>>       
> >> 1 0
> >>     
> >>> 1 6 ."
> >>>
> >>> This sets up the script to run Asterisk as the
> >>>       
> >> last process 
> >>     
> >>> when booting in runlevels 2 3 4 and 5, the
> normal
> >>>       
> >> run levels. 
> >>     
> >>> It also tells Debian to kill off Asterisk the
> >>>       
> >> first thing 
> >>     
> >>> when switching to runlevels 0, 1 and 6. 0 and 6
> >>>       
> >> are for 
> >>     
> >>> system halt and shutdown.
> >>> Level 1 is single-user "safe" mode.
> >>>
> >>> The problem I had was that I had been running
> >>>       
> >> Asterisk in 
> >>     
> >>> single-user "safe" mode. I did this to avoid
> >>>       
> >> launching the 
> >>     
> >>> GUI when booting up. This will never work, as
> >>>       
> >> Debian kills 
> >>     
> >>> all daemons in single-user, runlevel 1.
> >>>
> >>> To set things right, I entered the following
> >>>       
> >> command to 
> >>     
> >>> inhibit running the GUI at boot in the normal
> run
> >>>       
> >> levels.
> >>     
> >>> "update-rc.d -f GDM remove"
> >>>
> >>> I then changed the /boot/grub/menu.lst to
> default
> >>>       
> >> back to 
> >>     
> >>> normal mode at boot (I had the order of the menu
> >>>       
> >> items 
> >>     
> >>> swapped to default to single-user mode).
> >>>
> >>> Now, Asterisk starts up as a daemon at boot
> time.
> >>>       
> >> If your 
> >>     
> >>> BIOS supports reboot on power-failure, it makes
> a
> >>>       
> >> very robust setup.
> >>     
> >>> Note that this is all specific to Debian Linux.
> >>>
> >>> Hope this helps someone.
> >>>
> >>> Best,
> >>>
> >>> Don
> >>>
> >>>
> >>> --- Donald Froula <dfroula at sbcglobal.net> wrote:
> >>>
> >>>       
> >>>> I'm still trying to figure how to load all the
> >>>>         
> >> zaptel 
> >>     
> >>> drivers, start 
> 
=== message truncated ===



More information about the VoIP mailing list