Top Banner

of 21

Procedimiento Para Instalar Asterisk VoIP en Ubuntu Server

Oct 16, 2015

Download

Documents

Jose Sanchez
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Procedimiento para Instalar Asterisk VoIP en Ubuntu Server 13Password root sudo passwd root[sudo] password for curso:Enter new UNIX password:Retype new UNIX password:080027252911Configuramos red nano /etc/network/interfaces Iface eth0 inet static address 192.168.1.215 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 dns-nameservers 192.168.1.254

Actualizar repositorios sudo apt-get update

Probar que el servicio ssh est corriendo ssh 127.0.0.1

Instalar libreras para acceso va SSH sudo apt-get install openssh-server

Libreras de compilacin de software, sirve para compilar Asterisk sudo apt-get install -y build-essential apt-get install linux-headers-$(uname r) libxml2-dev libsqlite3-dev sudo apt-get install gcc make g++ apt-get install libxml2-dev ncurses-dev apt-get install libsqlite3-dev sqlite3

Descargar e instalar DAHDI cd /usr/src //directorio de descarga sudo wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz tar zxf dahdi-linux-complete-2.9.1.1+2.9.1 cd /usr/src/dahdi-linux-complete-2.9.1.1+2.9.1 sudo make all && sudo make install && sudo make config sudo service dahdi start

Descargar e instalar Asterisk wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-1.8.15-current.tar.gz sudo wget http://downloads.asterisk.org/pub/telephony/asterisk-gui/asterisk-gui-2.1.0-rc1.tar.gz sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-1.6.2.4.tar.gz sudo tar xvfz certified-asterisk-1.8.15-current.tar.gz apt-get build-dep asterisk tar xvzf certified-asterisk-1.8.15-current.tar.gz cd /usr/src/certified-asterisk-1.8.15-cert5 ./configure make make install

make menuselectMenuselect Antes de pasar al siguiente comando, debemos escoger que es lo que queremos compilar y que es lo que no. Haremos los siguientes cambios:

Add-ons: Desactivamos todo lo que aparece bajo deprecated Call Detail Recording: Desactivamos todo lo que aparece bajo extended Channel Event Logging: Desactivamos todo Channel Drivers: Desactivamos todo lo que aparece debajo de extended PBX Modules: Desactivamos todo lo que aaparece bajo extended, excepto pbx_ael y pbx_realtime. Resource Modules: Desactivamos todo lo que aparece bajo extended, excepto res_ael_share Compiler Flags: activamos DONT_OPTIMIZE, desactivamos BUILD_NATIVE Core Sound Packages: Cambiamos lo EN-WAV por EN-GSM Music On Hold File Packages: Cambiamos lo WAV por GSM Extras Sound Packages: Seleccionamos EN-GSM

Estos cambios son solamente para mquinas virtuales. Para una instalacin en un equipo real se debe dejar como estn.

make config make samples sudo make install-logrotateArrancamos Asterisk como servicio en segundo plano /etc/init.d/asterisk start Conectarse a la consola de Asterisk desde el CLI de Linux asterisk r

Creacin de usuarios SIP. Objetivos

Aprender a crear y configurar usuarios SIP Aprender a trabajar con archivo de configuracin adicionales Procedimiento En el CLI de Linux, editar el archivo sip.conf y al final agregar una referencia hacia un nuevo archivo sip_additional.conf

cd /etc/asterisk/ nano sip.conf

Colocar esta lnea al final del archivo sip.conf

#include sip_additional.conf

Guardamos los cambios Ctrl-O (guardar) y luego con Ctrl-X (salir). Crear el archivo sip_additional.conf para configurar 2 usuarios SIP (usuario1 y usuario2)

cd /etc/asterisk/ o nano sip_additional.conf[usuario1] type=friendcontext=micontextohost=dynamicsecret=abcde12345

[usuario2]type=friendcontext=micontextohost=dynamicsecret=fghij67890

[Xperia]type=friendcontext=micontextohost=dynamicsecret=0630

Entramos al CLI de Asterisk y cargamos nuevamente la configuracin asterisk r *CLI> sip reload *CLI> sip show peers

Plan de llamadas bsicoEntrar al CLI de Linux cd /etc/asterisk/ Editar el archivo extensions.conf, ir a la ltima lnea de cdigo y e incluir un nuevo archivo. nano extensions.conf #include extensions_additional.conf Editar el archivo extensions_additional.conf y crear el contexto [micontexto] cd /etc/asterisk/ nano extensions_additional.conf

[micontexto] exten => 100,1,Noop(Llamando a usuario1) same => n,Dial(SIP/usuario1) same => n,Hangup

exten => 200,1,Noop(Llamando a usuario2) same => n,Dial(SIP/usuario2) same => n,Hangup

Salvamos y desde el CLIasterisk r dialplan reload

Seguridad Generar las llaves

mkdir /etc/asterisk/certs cd /usr/src/certified-asterisk-1.8.15-cert5/contrib/scripts

./ast_tls_cert C 192.168.1.215 -O KRCVU2EAJOSE -d /etc/asterisk/certs/ -d /etc/asterisk/certs/

./ast_tls_cert -m client -c /etc/asterisk/certs/ca.crt -k /etc/asterisk/certs/ca.key -C 192.168.1.215 -O "KRCVU2EAJOSE" -d /etc/asterisk/certs -o usuario1 ./ast_tls_cert -m client -c /etc/asterisk/certs/ca.crt -k /etc/asterisk/certs/ca.key -C voip.iprouteth0.org -O "iprouteth0 VoIP" -d /etc/asterisk/certs -o usuario1

Configuramos TLS nano /etc/asterisk/sip.conftlsenable=yestlsbindaddr=192.168.1.215tlscertfile=/etc/asterisk/certs/asterisk.pemtlscafile=/etc/asterisk/certss/ca.crttlscipher=ALLtlsclientmethod=tlsv1

[usuario1] type=friendcontext=micontextohost=dynamicsecret=abcde12345disallow=alltransport=tlssrtpcapable=yesplan de llamadas[micontexto] exten => 100,1,Noop(Llamando a usuario1) set(_SIP_SRTP_SDES=optional)

same => n,Dial(SIP/usuario1) same => n,Hangup

[usuario2]type=friendcontext=micontextohost=dynamicsecret=fghij67890disallow=alltransport=tls

[Xperia]type=friendcontext=micontextohost=dynamicsecret=0630disallow=alltransport=tls

Descargar la librera libSRTP Entrar al CLI de Linux y acceder al directorio /usr/src cd /usr/src Ejecutar el comando wget http://srtp.sourceforge.net/srtp-1.4.2.tgz tar xvzf srtp-1.4.2.tgz cd /usr/src/srtp ./configure make make runtest ls la /usr/src/srtp/test/rtpw make install cd /usr/src/certified-asterisk-1.8.15-cert5 ./configure make menuselectMenuselectHaremos los siguientes cambios:

Seleccionar el res_srtp dentro del Resource Modules, guardar y salir.

make make install

Entrar al directorio srtp y ejecutar las instrucciones siguientes: cd /srtp/test editar el archivo rtpw_test.sh y modificar la lnea RTPW=/rtpw por RTPW=/usr/src/srtp/test/rtpw nano rtpw_test.shDespus teclear cd /usr/src/srtp Ejecutar ./configure make make runtestIncluir los siguientes parmetros: o tlsenable=yes tlsbindaddr=192.168.1.215tlscertfile=/etc/asterisk/certs/asterisk.pem tlscafile=/etc/asterisk/certs/ca.crt tlsdontverifyserver=no tlscipher=ALL tlsclientmethod=tlsv1transport=tls

nano /etc/asterisk/sip_additional.conf

CLI COMMANDS. Asterisk 1.4.0 CLI commands

Introduction

Asterisk CLI supports large variety of commands which can be used for testing, configuration and monitoring. In this tutorial we will describe all commands available at the standard Asterisk version 1.4.0. We will divide this tutorial into few sections in order to facilitate the reading.

General CLI commands

! - Execute a shell commandabort halt - Cancel a running haltcdr status - Display the CDR statusfeature show - Lists configured featuresfeature show channels - List status of feature channelsfile convert - Convert audio filegroup show channels - Display active channels with group(s)help - Display help list, or specific help on a commandindication add - Add the given indication to the countryindication remove - Remove the given indication from the countryindication show - Display a list of all countries/indicationskeys init - Initialize RSA key passcodeskeys show - Displays RSA key informationlocal show channels - List status of local channelslogger mute - Toggle logging output to a consolelogger reload - Reopens the log fileslogger rotate - Rotates and reopens the log fileslogger show channels - List configured log channelsmeetme - Execute a command on a conference or confereemixmonitor - Execute a MixMonitor command.

moh reload - Music On Holdmoh show classes - List MOH classesmoh show files - List MOH file-based classesno debug channel (null)originate - Originate a callrealtime load - Used to print out RealTime variables.realtime update - Used to update RealTime variables.restart gracefully - Restart Asterisk gracefullyrestart now - Restart Asterisk immediatelyrestart when convenient - Restart Asterisk at empty call volumesla show - Show status of Shared Line Appearancessoft hangup - Request a hangup on a given channelstop gracefully - Gracefully shut down Asteriskstop now - Shut down Asterisk immediatelystop when convenient - Shut down Asterisk at empty call volumestun debug - Enable STUN debuggingstun debug off - Disable STUN debuggingudptl debug - Enable UDPTL debuggingudptl debug ip - Enable UDPTL debugging on IPudptl debug off - Disable UDPTL debugging

AEL commands

ael debug contexts - Enable AEL contexts debug (does nothing)ael debug macros - Enable AEL macros debug (does nothing)ael debug read - Enable AEL read debug (does nothing)ael debug tokens - Enable AEL tokens debug (does nothing)ael nodebug - Disable AEL debug messagesael reload - Reload AEL configuration

Agents commands

agent logoff - Sets an agent offlineagent show - Show status of agentsagent show online - Show all online agents

AGI commands

agi debug - Enable AGI debuggingagi debug off - Disable AGI debuggingagi dumphtml - Dumps a list of agi commands in html formatagi show- List AGI commands or specific helpdnsmgr reload - Reloads the DNS manager configurationdnsmgr status - Display the DNS manager statushttp show status - Display HTTP server status

Console commands

console active - Sets/displays active consoleconsole answer - Answer an incoming console callconsole autoanswer - Sets/displays autoanswerconsole boost - Sets/displays mic boost in dBconsole dial - Dial an extension on the consoleconsole flash - Flash a call on the consoleconsole hangup - Hangup a call on the consoleconsole mute - Disable mic inputconsole send text - Send text to the remote deviceconsole transfer - Transfer a call to a different extensionconsole unmute - Enable mic input

Core related commands

core clear profile - Clear profiling infocore set debug channel - Enable/disable debugging on a channelcore set debug - Set level of debug chattinesscore set debug off - Turns off debug chattinesscore set global - Set global dialplan variablecore set verbose - Set level of verbosenesscore show applications - Shows registered dialplan applicationscore show application - Describe a specific dialplan applicationcore show audio codecs - Displays a list of audio codecscore show channels - Display information on channelscore show channel - Display information on a specific channelcore show channeltypes - List available channel typescore show channeltype - Give more details on that channel typecore show codecs - Displays a list of codecscore show codec - Shows a specific codeccore show config mappings - Display config mappings (file names to config engines)core show file formats - Displays file formatscore show file version - List versions of files used to build Asteriskcore show functions - Shows registered dialplan functionscore show function - Describe a specific dialplan functioncore show globals - Show global dialplan variablescore show hints - Show dialplan hintscore show image codecs - Displays a list of image codecscore show image formats - Displays image formatscore show license - Show the license(s) for this copy of Asteriskcore show profile - Display profiling infocore show switches - Show alternative switchescore show threads - Show running threadscore show translation - Display translation matrixcore show uptime - Show uptime informationcore show version - Display version infocore show video codecs - Displays a list of video codecscore show warranty - Show the warranty (if any) for this copy of Asterisk

Database commands

database del - Removes database key/valuedatabase deltree - Removes database keytree/valuesdatabase get - Gets database valuedatabase put - Adds/updates database valuedatabase show - Shows database contentsdatabase showkey - Shows database contents

Dialplan commands

dialplan add extension - Add new extension into contextdialplan add ignorepat - Add new ignore patterndialplan add include - Include context in other contextdialplan reload - Reload extensions and *only* extensionsdialplan remove extension - Remove a specified extensiondialplan remove ignorepat - Remove ignore pattern from contextdialplan remove include - Remove a specified include from contextdialplan save - Save dialplandialplan show - Show dialplan

DUNDI commands

dundi debug - Enable DUNDi debuggingdundi flush - Flush DUNDi cachedundi lookup - Lookup a number in DUNDidundi no debug - Disable DUNDi debuggingdundi no store history - Disable DUNDi historic recordsdundi precache - Precache a number in DUNDidundi query - Query a DUNDi EIDdundi show entityid - Display Global Entity IDdundi show mappings - Show DUNDi mappingsdundi show peers - Show defined DUNDi peersdundi show peer - Show info on a specific DUNDi peerdundi show precache - Show DUNDi precachedundi show requests - Show DUNDi requestsdundi show trans - Show active DUNDi transactionsdundi store history - Enable DUNDi historic records

GTalk & Jabber commands

gtalk reload - Enable Jabber debugginggtalk show channels - Show GoogleTalk Channelsjabber debug - Enable Jabber debuggingjabber debug off - Disable Jabber debugjabber reload - Enable Jabber debuggingjabber show connected - Show state of clients and componentsjabber test - Shows roster, but is generally used for mog's debugging.

IAX2 commands

iax2 provision - Provision an IAX deviceiax2 prune realtime - Prune a cached realtime lookupiax2 reload - Reload IAX configurationiax2 set debug - Enable IAX debuggingiax2 set debug jb - Enable IAX jitterbuffer debuggingiax2 set debug jb off - Disable IAX jitterbuffer debuggingiax2 set debug off - Disable IAX debuggingiax2 set debug trunk - Enable IAX trunk debuggingiax2 set debug trunk off - Disable IAX trunk debuggingiax2 show cache - Display IAX cached dialplaniax2 show channels - List active IAX channelsiax2 show firmware - List available IAX firmwaresiax2 show netstats - List active IAX channel netstatsiax2 show peers - List defined IAX peersiax2 show peer - Show details on specific IAX peeriax2 show provisioning - Display iax provisioningiax2 show registry - Display IAX registration statusiax2 show stats - Display IAX statisticsiax2 show threads - Display IAX helper thread infoiax2 show users - List defined IAX usersiax2 test losspct - Set IAX2 incoming frame loss percentage

Manager commands

manager show command - Show a manager interface commandmanager show commands - List manager interface commandsmanager show connected - List connected manager interface usersmanager show eventq - List manager interface queued eventsmanager show users - List configured manager usersmanager show user - Display information on a specific manager user

MGCP commands

mgcp audit endpoint - Audit specified MGCP endpointmgcp reload - Reload MGCP configurationmgcp set debug - Enable MGCP debuggingmgcp set debug off - Disable MGCP debuggingmgcp show endpoints - List defined MGCP endpoints

Module management

module load - Load a module by namemodule reload - Reload configurationmodule show - List modules and infomodule show like - List modules and infomodule unload - Unload a module by name

PRI commands

pri debug span - Enables PRI debugging on a spanpri intense debug span - Enables REALLY INTENSE PRI debuggingpri no debug span - Disables PRI debugging on a spanpri set debug file - Sends PRI debug output to the specified filepri show debug - Displays current PRI debug settingspri show spans - Displays PRI Informationpri show span - Displays PRI Informationpri unset debug file - Ends PRI debug output to file

Queue commands

queue add member - Add a channel to a specified queuequeue remove member - Removes a channel from a specified queuequeue show - Show status of a specified queuertcp debug ip - Enable RTCP debugging on IPrtcp debug - Enable RTCP debuggingrtcp debug off - Disable RTCP debuggingrtcp stats - Enable RTCP statsrtcp stats off - Disable RTCP statsrtp debug ip - Enable RTP debugging on IPrtp debug - Enable RTP debuggingrtp debug off - Disable RTP debuggingsay load - Set/show the say modeshow parkedcalls - Lists parked callsshow queue - Show information for target queueshow queues - Show the queues

SIP commands

sip history - Enable SIP historysip history off - Disable SIP historysip notify - Send a notify packet to a SIP peersip prune realtime - Prune cached Realtime object(s)sip prune realtime peer - Prune cached Realtime peer(s)sip prune realtime user - Prune cached Realtime user(s)sip reload - Reload SIP configurationsip set debug - Enable SIP debuggingsip set debug ip - Enable SIP debugging on IPsip set debug off - Disable SIP debuggingsip set debug peer - Enable SIP debugging on Peernamesip show channels - List active SIP channelssip show channel - Show detailed SIP channel infosip show domains - List our local SIP domains.sip show history - Show SIP dialog historysip show inuse - List all inuse/limitssip show objects - List all SIP object allocationssip show peers - List defined SIP peerssip show peer - Show details on specific SIP peersip show registry - List SIP registration statussip show settings - Show SIP global settingssip show subscriptions - List active SIP subscriptionssip show users - List defined SIP userssip show user - Show details on specific SIP user

Skinny commands

skinny reset - Reset Skinny device(s)skinny set debug - Enable Skinny debuggingskinny set debug off - Disable Skinny debuggingskinny show devices - List defined Skinny devicesskinny show lines - List defined Skinny lines per device

Voicemail commands

voicemail show users - List defined voicemail boxesvoicemail show users for - List defined voicemail boxes for target contextvoicemail show zones - List zone message formats

Zaptel commands

zap destroy channel - Destroys a channelzap restart - Fully restart zaptel channelszap show cadences - List cadenceszap show channels - Show active zapata channelszap show channel - Show information on a channelzap show status - Show all Zaptel cards status