SipSak

sipsak is a small comand line tool for developers and administrators of SIP applications. It can be used for some simple tests on SIP applications and devices.

Features

  • sending OPTIONS request
  • sending text files (which should contain SIP requests)
  • traceroute (see section 11 in RFC3261)
  • user location test
  • flooding test
  • random character trashed test
  • interpret and react on response
  • authentication with qop supported
  • short notation supported for receiving (not for sending)
  • string replacement in files
  • can simulate calls in usrloc mode
  • uses symmetric signaling and thus should work behind NAT

Available for Linux, BSD & Win32

http://sipsak.org/

Asterisk SNMP

We needed a better way to monitor and track performance of RF.com‘s Asterisk 1.6 boxes.  We learned quickly that the scarce documentation for configuring Asterisk to use Simple Network Management Protocol (SNMP) is conflicting and outdated.  So we decided to share our configuration and hopefully save others a lot of time and head-scratching.

Downloading the Asterisk 1.6 source code

Enabling SNMP support in Asterisk requires a rebuild of Asterisk.

If you already have the Asterisk source code on your Asterisk server, open a terminal session with the Asterisk box and navigate to the Asterisk source code directory, then skip to Installing Net-SNMP.

If you don’t have the Asterisk source code on your Asterisk server, open a terminal session with the Asterisk box and copy these instructions to the command line:

#get asterisk source
# create source dir
mkdir -p /usr/src/digium
cd /usr/src/digium/
wget http://downloads.digium.com/pub/asterisk/asterisk-1.6-current.tar.gz tar xzvf asterisk-1.6-current.tar.gz
cd asterisk-1.6.*

Installing Net-SNMP

Asterisk SNMP support is provided by the res_snmp module.  To build this module, you need to install the following packages:

  • net-snmp
  • net-snmp-devel
  • net-snmp-utils
  • bzip2
  • bzip2-devel
  • lm_sensors
  • lm_sensors-devel
  • newt
  • newt-devel

On a CentOS or Fedora box you can use the following command to install all the packages at once:

yum -y install net-snmp net-snmp-devel net-snmp-utils bzip2-devel newt-devel lm_sensors-devel ; # snmp support – res_snmp

Preparing the Asterisk box

Once the necessary packages are installed, run the following commands from the Asterisk source code directory:

./configure
make menuselect

Running make menuselect will launch a menu that looks something like the image below.

Asterisk Module and Build Options Selection

Select the Resource Modules option from the menu and press the Return key.  Then scroll down to res_snmp, if res_snmp is not selected, press the spacebar to enable res_snmp.  The selection should now look like the image below.

Asterisk resource modules

If you are unable to select res_snmp, it means the Net-SNMP package was not installed properly or the Asterisk configure tool was unable to find the Net-SNMP package. Try running .configure -with-netsnmp from the command line and then re-run make menuselect.

Press x to save your configuration changes.

Now we can build Asterisk with SNMP support and install it by runing the following commands:

make /etc/init.d/asterisk stop ; # make sure asterisk is stopped before installing
make install

Configuring the SNMP daemon

There are three versions of SNMP, but two are insecure and should not be used over an untrusted network.  We chose SNMPv3, which requires authentication and encryption from the asteriskUser when it connects to the server.

To create an SNMPv3 user account and to configure it to require authentication and encryption, run the commands below, replacing change_this_password with your own password.

echo '# Asterisk user
rwuser asteriskUser priv
createUser asteriskUser SHA change_this_password AES
' >> /etc/snmp/snmpd.conf

Asterisk uses AgentX to communicate with the SNMP daemon.  Run the command below to configure the SNMP daemon for AgentX.  If your Asterisk daemon, does not run as a member of the asterisk group, replace asterisk in the agentXPerms command with an asterisk daemon group.

echo '
# Asterisk configuration
master agentx
agentXSocket /var/agentx/master
agentXPerms 0660 0550 nobody asterisk
' >> /etc/snmp/snmpd.conf

The commands below will install the Asterisk and Digium MIB files, configure the snmp daemon to start on boot, and launch the snmp daemon.

# copy asterisk mib files
cp doc/*-mib.txt /usr/share/snmp/mibs/

#start the snmpd daemon
chkconfig snmpd on
/etc/init.d/snmpd start

Let’s verify that the configuration is working so far by verifying that the snmp daemon set the file permissions correctly, run the following command:

ls -al /var/agentx

Your permissions must look like:

total 8
drwxr-xr-x  2 root   root     4096 Jan 31 18:01 .
drwxr-xr-x 20 root   root     4096 Jan 31 14:30 ..
srw-rw----  1 nobody asterisk    0 Jan 31 18:01 master

If the file permissions on /var/agentx and /var/agentx/master don’t allow the asterisk daemon group to write tomaster, Asterisk will not be able to communicate with the SNMP daemon. We had problems with the /var/agentx directory permissions, you may need to run the following command to fix the permissions.

chmod 755 /var/agentx

You can also check the logs to confirm that AgentX is running.

more /var/log/messages | grep snmpd

You should see lines like the following:

Jan 31 14:30:15 domU-12-31-39-00-55-E7 snmpd[27048]: Creating directory: /var/agentx
Jan 31 14:30:15 domU-12-31-39-00-55-E7 snmpd[27048]: Turning on AgentX master support.

Configuring the Asterisk res_snmp module

Now we configure Asterisk to use SNMP by running the following commands:

# configure res_snmp.conf
sed -e ‘s/;\(subagent\)/\1/’ -e ‘s/;\(enabled\)/\1/’ <configs/res_snmp.conf.sample >/etc/asterisk/res_snmp.conf

Start Asterisk from the command line:

asterisk -cvvvvvvvvvv

and look for the following Asterisk console output:

NET-SNMP version 5.4.1 AgentX subagent connected

The line above means that Asterisk is configured correctly and the res_snmp module has loaded.

You can now exit the asterisk console and then launch the Asterisk daemon, with the command below:

/etc/init.d/asterisk start

Final testing

You can now use the snmpwalk command to test that everything is configured correctly.  Replacechange_this_password with the password you created above for the snmp daemon configuration and run the commands below:

export MIBS=+ASTERISK-MIB
snmpwalk -v 3 -u asteriskUser -n “” -l authPriv -a SHA -A change_this_password -x AES -X change_this_password localhost asterisk

You should get a result like:

ASTERISK-MIB::astVersionString.0 = STRING: 1.6.0.5
ASTERISK-MIB::astVersionTag.0 = Gauge32: 10600
ASTERISK-MIB::astConfigUpTime.0 = Timeticks: (60776) 0:10:07.76
ASTERISK-MIB::astConfigReloadTime.0 = Timeticks: (60777) 0:10:07.77
...

Congratulations, you’ve finished and your Asterisk server is now configured to use SNMP.

Asterisk IP PBX ICQ Call Notification

(статью скоро переработаю, т.к. micq уже умер. 891rpm)

(АОН с Asterisk IP PBX на ICQ)

С 22 июня 2005 года работает у нас в службе тех-поддержки ICQ бот под ником Asterisk (UIN не скажу ).Занимается он тем, что по ICQ отправляет техподдержке номер телефона звонящего, дату и время.

Итак.
Имеем настроеный рабочий Asterisk на сервере.
Заходим на сайт http://www.micq.org/download.shtml.en и скачиваем последнюю версию mICQ
(на данный момент это mICQ 0.5.0.4 (released 2005-06-05)). То есть:

[roman@pbx1 log]$ cd ~
[roman@pbx1 ~]$ wget http://www.micq.org/source/micq-0.5.0.4.tgz
---bla-bla-bla---
[roman@pbx1 ~]$ tar -zxvf micq-0.5.0.4.tgz
---bla-bla-bla---
[roman@pbx1 ~]$ cd micq-0.5.0.4
[roman@pbx1 micq-0.5.0.4]$ ./configure --help #Читаем help если надо...
[roman@pbx1 micq-0.5.0.4]$ ./configure
---bla-bla-bla---
[roman@pbx1 micq-0.5.0.4]$ make
---bla-bla-bla---
[roman@pbx1 micq-0.5.0.4]$ su -
Password:
[root@pbx1 ~]# cd /home/roman/micq-0.5.0.4
[root@pbx1 micq-0.5.0.4]# make install
[root@pbx1 micq-0.5.0.4]# exit
[roman@pbx1 micq-0.5.0.4]$ micq

 

При запросе UIN смело набираем ‘0’ (просто ноль, кто не понял ) и жмем Enter. Далее придумываем архисложный пароль, вводим, Enter, вводим его еще раз, Enter, дальше если вы работаете через прокси , вводите его параметры, иначе, как все нормальные люди, смело жмете Enter.
Получаем UIN, регистрируемся на сервере.
Если хотите, в консоли mICQ есть команда ‘help’, а есть еще ‘help ‘, то есть что-то вроде ‘help msg’ даст вам справку по отправке сообщений.
Комманда ‘msg 227702532 Hello Anest!!! How are you today guy?’ спросит ‘Как дела?’ у нашего любимого Anest’а, а ‘msg 320598502 Privet rebyata! Pochemu na zvonki ne otvechaete?’ спросит у нашей техподдержки, что это она так расслабилась.
___________________________________________
# Дополнение от 03.07.2005г.
# В консоли mICQ дайте комманду
mICQ> autoaway 0
Changing status to away/not available after idling 0 seconds.
mICQ> save
Saving preferences to /home/roman/.micq/micqrc.
Your personal settings have been saved!

# Это не даст вашему боту эпизодически пропадать в offline.
___________________________________________
Поиграли, выходим из mICQ командой ‘exit’.
Далее:
[roman@pbx1 micq-0.5.0.4]# nano ~/.micq/micqrc

или другим вашим любимым редактором vi, pico, или просто по F4 в ‘mc’ на этом файле, меняем ‘ # password’ на ‘password <тут ваш пароль>’.
Продолжаем:
[roman@pbx1 micq-0.5.0.4]# screen -d -m micq

# Кто не пользуется и не знает, команда ‘screen’ создает нечто вроде виртуального терминала, от которого можно безболезненно отключаться, при этом программа, что запущена в нем, остается там работать в режиме S+, либо Ss+.
Почитайте ‘man screen’ и Краткое руководство по работе в SCREEN на www.opennet.ru.
# Проверяем, что заработало:
[roman@pbx1 micq-0.5.0.4]# ps ax | grep micq | grep -v grep
16046 ? Ss 0:00 SCREEN -d -m micq
16047 pts/2 Ss+ 0:00 micq

# Проверяем еще раз:
[roman@pbx1 micq-0.5.0.4]# screen -R
# Видим консоль mICQ, нажимаем Ctrl+c, потом отдельно ‘d’ — отключаемся от консоли.

Дальше правим конфиг Asterisk’a extentions.conf
[roman@pbx1 micq-0.5.0.4]# sudo nano /etc/asterisk/extensions.conf
# В нужном extention тепосредственно перед Dial вставляем нечто следующее:
exten => 4,7,System(/bin/echo -e "msg <тут UIN, на который хотим слать оповещение> 'Incoming Call From: ${CALLERIDNUM} To: <ваш номер> Received: ${DATETIME:0:2}/${DATETIME:2:2}/${DATETIME:4:4} at ${DATETIME:9}'" > /home/roman/.micq/scripting)
#Сохраняем файл, перезагружаем конфиги Asterisk’a
[roman@pbx1 micq-0.5.0.4]# su -
Password:
[root@pbx1 ~]# asterisk -r
pbx1*CLI> extensions reload
---bla-bla-bla---
pbx1*CLI> exit
[root@pbx1 ~]# exit
[roman@pbx1 micq-0.5.0.4]#

Все.
___________________________________________
# Дополнение от 19.07.2005г.
# Бот падает в оффлайн, если превышен некоторый лимит количества сообщений за единицу времени.
Слава Богу, обычно он сам поднимается после этого.
___________________________________________
___________________________________________
# Дополнение от 20.07.2005г.
# Дополнение к дополнению от 19.07.2005 🙂
Можно с некоторой периодичностью, например используя cron, скриптом давать боту комманду login.
___________________________________________
___________________________________________
# Дополнение от 16.03.2006г.
# Версия mICQ 0.5.0.4 с русским работала некорректно. Уже следующая работала отлично. На настоящий момент используйте версию 0.5.1.
http://www.micq.org/source/micq-0.5.1.tgz

# Про login
Добавьте в /etc/crontab
*/30 * * * * root echo "login" > /home/roman/.micq/scripting

# Про «зомбиков»
Если процесс micq умирает по какой-то причине (например кто-то сделал killall SCREEN), то в системе появляются подвисшие процессы ‘echo’, звонок не завершается нормальным образом.
Хак:
#!/bin/bash

# for pid in $(ps aux | grep "micq" | grep "scripting" | grep -v grep | awk '{print $2}'); do
for pid in $(ps aux | grep -v grep | awk '/micq|scripting/ {print $2}'); do
echo "Killing micq with PID $pid:"
kill -9 $pid
done
exit

# Дополнение от 02.08.2006г.
Автозапуск micq под пользователем roman.
Прописывается например в /etc/rc.d/rc.local
/bin/su — roman -c «/usr/bin/screen -d -m /usr/bin/micq»

http://asteriskforum.ru/viewtopic.php?p=1127

http://romik-g.livejournal.com/3690.html

Asterisk. Запись телефонных разговоров.

Запись разговоров – довольно удобная вещь. Можно всегда прослушать кто, что кому говорил. Настройка не сложная, достаточно включить в dialplan на обработку этого направления функции Monitor или MixMonitor. Отличие этих функций заключается в том, что Monitor пишет раздельно голос звонившего и голос звонящего, в разные файлы. А MixMonitor создает один файл, который содержит оба направления разговора.

В диалплане это выглядит для Monitor так:

[dial]
exten => _8.,1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten => _8.,2,Monitor(wav,/home/share/monitor/${fname},mb)
exten => _8.,3,Dial(SIP/prov1)

В этом примере первой строчкой, Set(fname и т.д. мы описываем имя файла в котором будет хранится запись разговора. В нашем случае имя файла будет состоять из даты и времени когда происходил звонок, номера звонящего абонента и куда он звонил. Запись как я уже писал будет состоять из двух файлов в конце будут соответственно добавлены цифры 1 и 2 соответственно номерам каналов.

И второй пример – использование MixMonitor, тут все так же просто:

exten => _8.,1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten => _8.,2,MixMonitor(/home/share/monitor/${fname}.wav)
exten => _8.,3,Dial(SIP/prov1)

Тут все то же самое, только меньше флагов в команде MixMonitor, тут вписывается только имя файла с расширением.

hdparm

После смены режима жесткого диска (hda) с UDMA5 на UDMA2 начинает работать ide0:

Странным образом hdparm помогает избавиться от ошибок Asterisk:

[Jul  7 12:46:00] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[Jul  7 12:46:01] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[Jul  7 12:46:01] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[Jul  7 12:46:01] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[Jul  7 12:46:01] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[Jul  7 12:46:01] ERROR[18348]: chan_dahdi.c:8799 dahdi_pri_error: PTP MDL can't handle error of type I
[Jul  7 12:46:01] ERROR[18348]: chan_dahdi.c:8799 dahdi_pri_error: MDL-ERROR (I): T200 = N200 in timer recovery state 8
[Jul  7 12:46:01] NOTICE[18348]: chan_dahdi.c:9099 pri_dchannel: PRI got event: HDLC Bad FCS (8) on Primary D-channel of span 1
[13:27:57] funtik:~ # hdparm -vi /dev/hda

/dev/hda:
 multcount     =  0 (off)
 IO_support    =  0 (default)
 unmaskirq     =  0 (off)
 using_dma     =  1 (on)
 keepsettings  =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 16383/255/63, sectors = 156301488, start = 0

 Model=ST3802110A, FwRev=3.AAE, SerialNo=5LR3YW4N
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=15629937
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

[13:29:31] funtik:~ # hdparm -d 1 -X udma2 -c 3 /dev/hda

/dev/hda:
 setting 32-bit IO_support flag to 3
 setting using_dma to 1 (on)
 setting xfermode to 66 (UltraDMA mode2)
 IO_support    =  0 (default)
 using_dma     =  0 (off)

[13:30:28] funtik:~ # hdparm -vi /dev/hda

/dev/hda:
 multcount     =  0 (off)
 IO_support    =  0 (default)
 unmaskirq     =  0 (off)
 using_dma     =  0 (off)
 keepsettings  =  0 (off)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 16383/255/63, sectors = 156301488, start = 0

 Model=ST3802110A, FwRev=3.AAE, SerialNo=5LR3YW4N
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156299375
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

Asterisk на Linux. Моя версия ))

Пример приводится для 64-битных процессоров. Использовал дешевую E1-карту Digium TE110P. Asterisk собирался из исходников.

Установка и настройка ОС

Устанавливаем и обновляем систему.

Ставим пакеты:

make
gcc
cpp
g++
linux-headers-2.6.26-2-amd64
bison
ncurses-dev
mysql-client
libmysqlclient-dev
libnewt-dev
php-gd

mpg123
sox

Установка и настройка ISDN-карты

Устанавливаем карту.

Качаем драйверы:

http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4.11.tar.gz
http://downloads.asterisk.org/pub/telephony/dahdi-linux/dahdi-linux-2.3.0.1.tar.gz
http://downloads.asterisk.org/pub/telephony/dahdi-tools/dahdi-tools-2.3.0.tar.gz

Очень желательно соблюдать очередность установки драйверов и самого Asterisk’а.

Установка драйверов:

LibPRI

make
make install

DAHDI

make
make install

DAHDI Tools

./configure
make menuselect
make
make install

Установка и настройка Asterisk

Качаем:
http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.4.32-rc1.tar.gz
http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.4.11.tar.gz

Устанавливаем:

*Asterisk

./configure
make menuselect
make
make install

*Asterisk Addons

./configure
make menuselect
make
make install

Перезагружаемся.

Проверяем работу драйвера и ISDN-карты

У нас используется карта [[Digium TE110P]].

Настройки драйвера:

»’cat /etc/dahdi/system.conf»’

span=1,1,0,ccs,hdb3
bchan=1-15,17-31
dchan=16
echocanceller=mg2,1-15,17-31
loadzone=ru
defaultzone=ru

»’cat /etc/asterisk/chan_dahdi.conf»’

[trunkgroups]

[channels]

context=from-fwd
switchtype=euroisdn
signalling=pri_cpe
usecallerid=yes
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes

group=1
callgroup=1
pickupgroup=1
channel => 1-15
channel => 17-31

Проверяем, загрузился ли модуль:

»’lsmod | sort»’

Module                  Size  Used by
...
crc_ccitt               6528  2 dahdi,hisax
dahdi                 204368  74 dahdi_echocan_mg2,wcte11xp
dahdi_echocan_mg2      10248  31
isdn                  127584  1 hisax
slhc                   10240  1 isdn
wcte11xp               28960  31
....

Проверяем, видит ли DAHDI нашу карту ([[Digium TE110P]]):

»’dahdi_cfg -vvvvvvvv»’

DAHDI Tools Version - 2.3.0

DAHDI Version: 2.3.0.1
Echo Canceller(s): MG2
Configuration
======================

SPAN 1: CCS/HDB3 Build-out: 0 db (CSU)/0-133 feet (DSX-1)

Channel map:

Channel 01: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 01)
Channel 02: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 02)
...
Channel 14: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 14)
Channel 15: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 15)
Channel 16: D-channel (Default) (Echo Canceler: none) (Slaves: 16)
Channel 17: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 17)
...
Channel 30: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 30)
Channel 31: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 31)

31 channels to configure.

Setting echocan for channel 1 to mg2
Setting echocan for channel 2 to mg2
...
Setting echocan for channel 14 to mg2
Setting echocan for channel 15 to mg2
Setting echocan for channel 16 to none
Setting echocan for channel 17 to mg2
...
Setting echocan for channel 30 to mg2
Setting echocan for channel 31 to mg2

Проверяем настройки DAHDI:

»’dahdi_scan»’

[1]
active=yes
alarms=OK
description=Digium Wildcard TE110P T1/E1 Card 0
name=WCT1/0
manufacturer=Digium
devicetype=Digium Wildcard TE110P T1/E1
location=PCI Bus 03 Slot 02
basechan=1
totchans=31
irq=19
type=digital-E1
syncsrc=0
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=HDB3
framing_opts=CCS,CRC4
coding=HDB3
framing=CCS

'''dahdi_tool'''
...

Конфигурация Asterisk

Копируем из бэкапа сервера телефонии содержимое папки /etc/asterisk/.

Автозагрузка Asterisk

Обычно Asterisk ставит init-скрипт для загрузки самостоятельно.

Можно использовать для этого стандартный вызов из файла /etc/init.d/rc.local:

/usr/sbin/asterisk -f -vvvg -c

Или лучше:

Скопировать из исходников Asterisk /usr/src/install_asterisk/asterisk-1.4.19/contrib/init.d/rc.debian.asterisk в /etc/init.d/asterisk

chmod 755 /etc/init.d/asterisk
cd /etc/init.d
# для удаления из автозагрузки
update-rc.d -f asterisk remove

# для установки в автозагрузку
update-rc.d asterisk defaults

Доступ к консоли Asterisk

"asterisk -Rvvv"

-r — Подключение к Asterisk на текущей системе
-R — Тоже самое, что и ключ -r, но при разсоединения происходит переподключение
-v — Больше подробностей при выводе (чем больше «v», тем больше подробностей)

Дополнительные пояснения искать тут:

http://itinfusion.ca/2007/05/06/howto-installing-asterisk-on-debian-etch/