Asterisk IP PBX Learning Tutorials - Part 3
Ready for the next video? Here it is: Asterisk Video Tutorials - Running Asterisk
Running asterisk:
In this video I will show you how to run asterisk and where asterisk’s files are located.
There are 2 ways to run asterisk, in foreground and in background. Running in background is how asterisk runs almost all the time, while running in foreground is mainly used to debug some startup problems. Lets start with foreground mode.
In order to run asterisk in foreground mode you have to type asterisk -vc. As you can see asterisk is starting now, showing what modules it is loading and what configuration files are read. In order to stop asterisk you have to type “stop now” command. We have used 2 switches for asterisk when starting, that is -v which stands for verbose and -c which is for “console”, meaning you will be connected to asterisk console as soon as asterisk will run. You can use any number of -v’s to get even more verbose. Lets try to start asterisk with 3 -v’s
Ok, the second way to run asterisk is in background – as I have said this is more common way to run it. In order to start asterisk in that mode you simply have to type asterisk at command line. Lets check if asterisk has started, and to connect to running asterisk instance you have to type asterisk -r, where -r stands for “remote”. As you can see here “Connected to asterisk 1.4.19 currently running on asterisk (that is computer name) and process id number, the same as we have seen.
Asterisk command line is a very powerful way to control it. There are a huge number of commands here, type question mark and you will be presented with all available commands. Be aware that most of commands consist of few words, so in order to get full command you have to type first word and then hit question mark again. For example, “sip show”, and hitting question mark will present you with all available commands for “sip show”. The most important commands we will use in next videos are “reload” that makes asterisk to re-read configuration files, “core show channels” this will present you with current calls that go through your asterisk, “stop now” we have used before to stop asterisk. You can get help for any command in asterisk by simply typing “help” and then command you are interested in, for example “help stop” shows you that there are 3 subcommands for stop with small explanation for each of them. Or you can type just “help” to see all commands and subcommands along with explanation.
Ok, in order to detach from asterisk’s console you have to type “quit”. Remember that if you type “stop now”, it will stop asterisk from running and it will not be able to connect any calls.
Asterisk has 3 main directories where its files are stored. The most used one is /etc/asterisk, this is where all configuration files are placed. Each asterisk’s module has got its own configuration file, for example SIP channels module has got sip.conf and IAX channels module – iax.conf. So, in order to configure a part of asterisk you will have to edit its configuration file.
The /usr/lib/asterisk/modules is the place where all the modules are placed, as you can see here is chan_sip for SIP channels and so on.
The last place you have to know about is /var/lib/asterisk. Here you can find a number of directories which are used for different purposes. For example agi-bin is used for scripting purposes, “sounds” is the place where all asterisk’s sounds are stored and so on. I will return to those directories with more details in next few videos.
Related posts:
Discussion Area - Leave a Comment
You must be logged in to post a comment.