Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

miércoles, 31 de diciembre de 2014

Llamar multiples numeros desde una base de dato


mysql --silent -h localhost  -u root -p198dd -D asterisk<<<'select dst  from cdr where dst="100" limit 0,5' > tmp_results

while read dst

 echo $dst
`asterisk -x "originate SIP/$dst extension 0@internal" `

done < tmp_results

root@asterisk-dominicana:~# ./

domingo, 28 de diciembre de 2014

Asterisk random caller id and rand function


 exten => s,1,Set(junky=${RAND(1,8)});
     - Sets junky to a random number between 1 and 8, inclusive.


if we had few caller ID number want to use it, try this:

exten => _886X.,1,Noop
  same => n,Gosub(pickCallerIDnum,cell${RAND(1,5)},1)
  same => n,Dial(SIP/${EXTEN}@gateway,32,gCX)

exten => cell1,1,Set(CALLERID(num)=09xxxxxxx1)
  same => n,Return
exten => cell2,1,Set(CALLERID(num)=09xxxxxxx2)
  same => n,Return
exten => cell3,1,Set(CALLERID(num)=09xxxxxxx3)
  same => n,Return
exten => cell4,1,Set(CALLERID(num)=09xxxxxxx4)
  same => n,Return
exten => cell5,1,Set(CALLERID(num)=09xxxxxxx5)
  same => n,Return

Asterisk perment calling


#$1=number of calls -1

#2 pause

#3 destination  number
         while [  $COUNTER -lt $1 ]; do
             echo The counter is $COUNTER
sleep  $2

asterisk -x "originate SIP/perment/9990000$3 extension 0@internal"


root@asterisk-dominicana:~# ./ 100 3 14795824808

dial plan

 Otras variantes mandandolo a un local channel para  poder  poner el caller ID


#$1=number of calls -1

#2 pause

#3 destination  number
         while [  $COUNTER -lt $1 ]; do
             echo The counter is $COUNTER
sleep  $2

asterisk -x "originate Local/$3@perment extension 1701@radio"



EJEMPLO DEL ARHICOV calleridlist.conf  del cual el script tomara los caller id


;exten =>_x.,1,Gosub(pickCallerIDnum,cell${RAND(1,5)},1) ; ya no usare el gobsub para el caller id
exten=>_x.,1,Set(callid=${SHELL(shuf -n 1 /root/calleridlist.conf)}) ;tomar un caller id random de un archv
exten =>cell1,1,Set(CALLERID(num)=343444)
same => n,Return

exten => cell2,1,Set(CALLERID(num)=044552)
  same => n,Return

exten => cell3,1,Set(CALLERID(num)=10573)
  same => n,Return

exten => cell4,1,Set(CALLERID(num)=900094)
  same => n,Return

exten => cell5,1,Set(CALLERID(num)=10995)
  same => n,Return

Luego corremos en consola

root@asterisk-dominicana:~# ./ 5 5 18097143489

jueves, 25 de diciembre de 2014

Asterisk Backgroun Music a during a call


exten =>_1923,1,Dial(Local/1924@spy-exten,30,G(internal^0^1))

Remote Party ID

In SIP, the Remote Party ID header field enables popular services as well as some regulatory and public safety requirements.
These services include the following:

calling identity delivery

calling identity delivery blocking

tracing originator of call

jueves, 18 de diciembre de 2014

Sistema de Grabacion de mensaje y envio de mensaje por correo.

exten=>s,1,Verbose(recording calls from the caller ${CALLERID(num)} )
exten=>h,1,System(/usr/bin/mpack -s "Asterisk Dominicana ${FECHA}" /var/www/${FECHA}.wav,

miércoles, 10 de diciembre de 2014

Restringir una extension a solo hacer llamadas internas en Elastix

Creamos un contexto personalizado en extension_custom.conf 

include => ext-local

Luego agregamos la extension a dicho contexto  y listo.

sábado, 6 de diciembre de 2014

VoIP Codec: Payload size

The size of the payload of each encoded voice packet influences two things: lag and bandwidth.
Every encoded packet that is sent incurs fixed bandwidth overheads (due to IP and other headers added to the data in the network). Thus, larger payloads incur a proportionately smaller overhead, thus reducing the nominal bandwidth utilisation. However, by using larger payloads, more audio (ie., a longer period of time) is required to construct a single packet, which in turn increases the amount of time it takes for even the beginning of the packet to reach the other end and be decoded, thus increasing the lag in the conversation. This is a typical trade-off in VoIP.
Most codecs use payload sizes rage from 10 to 40 milliseconds per packet. Default payload and bandwidth consumption by different codecs:

jueves, 4 de diciembre de 2014

Sistema de IVR PHP & Asterisk

same=>n,verbose(value of ${LOOPCOUNT})
;same=>n,verbose(value of ${LOOPCOUNT})


exten =>i,1,Set(CALLERID(num)=${var1})

exten =>1,1,Set(CALLERID(num)=${var1})

;exten=>h,1,System(/bin/echo "this is the ${advnumber} with the ${DIALSTATUS}">/home/postback.conf)
exten=>h,1,System(curl -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?hangup,hang,1)









$extension=array($src); //numeros a llamar si vamos a usar extensions internas debemos  remover la variable trunk  en la linea Channel: SIP/$value@$trunk

 foreach ($extension as $value){

 $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: admin\r\n");     //
 fputs($socket, "Secret: am56\r\n\r\n");  //
              echo $wrets;
              fputs($socket, "Action: Originate\r\n" );
               fputs($socket, "Channel: SIP/$trunk/$value\r\n" );
                #fputs($socket, "Channel: SIP/100\r\n" );
                fputs($socket, "Exten: s\r\n" );
               fputs($socket, "Context: ivr\r\n" );
               fputs($socket, "Priority: 1\r\n" );
               fputs($socket, "CallerID: $dest\r\n" );
                fputs($socket, "Variable: __var1=$src\r\n" );
              fputs($socket, "Variable: __advnumber=$dest\r\n" );
              fputs($socket, "Async: yes\r\n\r\n" );
              fputs($socket, "Action: Logoff\r\n\r\n");
 sleep (1);


sábado, 29 de noviembre de 2014

Actualizando FreePBX modulos desde CLI

Upgrading a FreePBX Module from the CLI

Saltar al final de los metadatos
Ir al inicio de los metadatos Their may be cases that something breaks and you can not get into your FreePBX GUI and you need to perform module updates to fix a GUI problem.  Below is a example on how we would upgrade the framework module from the CLI.

  • SSH into your PBX

Manejanado modulos Freepbx desde CLI

Manage Modules Via CLI

The GUI interface should always be used to manage your PBX, and the "Module Admin" Module should be used within the GUI for adding and removing modules, however it is possible to manage modules directly via the CLI.
As an example to install the "System Admin" module you could issue the following command via the Linux CLI:
amportal a ma install sysadmin
Additional commands and parameters are listed below:
Module Admin Functions

Configuracion de la red en Vicidial/Goautodial Dial

Initial Setup configuration of Goautodial:

After finishing up go autodial installation which is a very quick and requires nothing but clicking next. In fact it is very easy for someone even zero network or system admin skills.
But the daunting task is configuring all the Network Interface Card (NIC) with appropriate linkups and proper IP ADRESSING SCHEME. Here is the pictorial demo to that simple task:
Setup Window on Goautodial
[root@vici ~]# setup

  • Select the Network configuration options , usually you navigate by pressing TAB.
  • Press Enter

lunes, 24 de noviembre de 2014

Script Para consultar una base de dato y marcar al numero devuelto.

A=$(mysql --user=root --password='mypassword' --skip-column-names  asterisk -e 'select dst  from cdr where dst='18097143489' limit 0,1 ' ; )
echo $A
B=`asterisk -x "originate SIP/didlogic/$A extension 0@internal" `

sábado, 22 de noviembre de 2014

Como cambiar el puerto 80 de Freepbx

nano /etc/httpd/conf/httpd.conf

Buscamos la siguiente linea   Listen 80

 Y la cambiamos por el siguiente puerto

Listen  2676

Reinicamos el servicio de apache :

service httpd restart


viernes, 31 de octubre de 2014

Instalando y configurando Asterisk 11 / Fail2ban en Ubuntu Server/Centos

sudo apt-get update
sudo apt-get install fail2ban
rpm -Uvh
yum install fail2ban 

miércoles, 29 de octubre de 2014

Interconectando 2 centrales Asterisk via SIP

Aqui vamos  a Interconectar 2 centrales Asterisk via SIP. La primera central enviara llamadas se  llama cliente esta realizara llamadas  atravez de   una central llamda servidor.

sábado, 18 de octubre de 2014

Instalacion FreePBX 12 & Asterisk 13 en Ubuntu Sever 14.04 LTS

Initial System Setup

When installing the machine, at package selection make sure you pick - at least - OpenSSH Server, and 'LAMP Packages'.  This installs the base packages required.

Configure your root password.

viernes, 17 de octubre de 2014

Configurando Servidores Asterisk detras de NAT

The Asterisk Server is behind NAT
The Asterisk server could be on the LAN (or in a DMZ) with a NAT firewall between it and the Internet. When it communicates with external peers or devices, the network connections have to pass through the local NAT device.

The remote device that is connecting to Asterisk is behind NAT
Suppose that your Asterisk server is connected directly to the Internet. Provided your system is made reasonably secure (e.g. through firewall rules) there can be significant benefits in having it directly connected to the Internet. However, you are unlikely to be able to control the networking environment of the devices that connect to it. If remote users have IP phones that register with your Asterisk server, it is very likely that those phones will be behind a NAT device at the far end.

Como aplicar un parche de Seguridad en Asterisk

Nos movemos al directorio donde estan los archivos de instalacion  de Asterisk


Luego descargamos el parche


Luego aplicamos el parche con el siguiente comando (nota debemos tener el comand patch instalado).

#patch -p0 < asterisk-21108_add_status-v2.diff

Final mente recopilamos Asterisk nuevamente

make install
/etc/initd.d/asterisk restart  o   tambien en centos service asterisk restart

jueves, 9 de octubre de 2014

Asterisk Realizando una llamada telefonica desde Bash scripting

Este es nuestro script

echo " prueba de llamadas  $(date)"

B=`asterisk -x "originate SIP/$1 extension $2@internal" `

root@asterisk-dominicana:/home# ./  100 103

Donde 100  y  103 son las extensiones donde queremos llamar.

sábado, 4 de octubre de 2014

Crear Alerta Popup en nuestra pantalla al recibir una llamada entrante Asterisk/Freepbx/Elastix

Buscar en el archivo /etc/asterisk/extensions_additional.conf  y  cargar el siguiente codigo ejemplo.

exten => s,1,System(mysql --user=root --password='123456' asteriskcdrdb -e 'INSERT INTO `pop`(`ID`, `NUMBER`, `FECHA`) VALUES

Nota este archivo puede ser sobre escrito por la  la GUI

domingo, 21 de septiembre de 2014

Usando el Cisco/Linksys SPA-504G con Asterisk y Freepbx

Using a Cisco/Linksys SPA-504G with Asterisk and FreePBX


Below is a quick start guide for getting a Cisco/Linksys SIP handset up and running with Asterisk/FreePBX.
Both Linksys & Cisco phones have almost identical web admin setup pages but the layout and design differ slightly, setup procedures are identical for both.
Firstly plug the phone into the network via cat5 network cable (If you have 2 switch ports beneath the phone you want to use the port marked “SW”, don’t bother routing through the PC…it wont work well) and connect the power supply and plug in.
The phones get configured via a web interface, to do this you must first know the IP address of the phone. Shown below.
cisco spa504g config button
  •  Then Press “9” for network options
  • See where it says “Current IP” and type it into your web browser

Mejorando la segurirad en tu Freepbx y reseteando la clave de admin


5. Securing your PBX

Securing FreePBX
Work In Progress.  Outline:
Passwords (Generally):  Use Long passwords (30+ characters) for the root password, the FreePBX web interface, all trunks, and all extensions.
Change FreePBX Web Password:  In Admin -> Administrators, create a new user with a name other than "admin" with full privileges.  Delete "admin" user.  This will protect you against robots that are scanning port 80 for FreePBX installations and hacking the "admin" user.

miércoles, 17 de septiembre de 2014

A2Billing v2 Install Guide

The following 2 diagrams illustrate A2billing inbound and outbound call flow.

All commands are assuming you are at run level 3 running in a shell as root.  In other words, not in a Gnome/KDE GUI and not using a limited access account.

domingo, 14 de septiembre de 2014

Instalacion de Asterisk 11 & Freepbx v 2.11 en CENTOS 6.5 64 bit

Instalacion de  Asterisk + Freepbx

Actualizamos el Sistema

yum -y update
yum groupinstall core
yum groupinstall base

Desactivamos el Selinux
setenforce 0



domingo, 31 de agosto de 2014

Instalando y configurando el CDR ODBC en Asterisk

Installing and Configuring ODBC

The ODBC connector is a database abstraction layer that makes it possible for Asterisk to communicate with a wide range of databases without requiring the developers to create a separate database connector for every database Asterisk wants to support. This saves a lot of development effort and code maintenance. There is a slight performance cost, because we are adding another application layer between Asterisk and the database, but this can be mitigated with proper design and is well worth it when you need powerful, flexible database capabilities in your Asterisk system.
Before you install the connector in Asterisk, you have to install ODBC into Linux itself. To install the ODBC drivers, use one of the following commands.
On CentOS:

sábado, 23 de agosto de 2014

CISCO IP Phones 79XX con Asterisk

Recently we had a pack of cisco 7942G phones that we were required to get them up running with Asterisk. The good thing about 79XX series is that they all support SIP besides SCCP. Whereas, the bad thing is that they are by default running on SCCP and you have to upgrade them to SIP first. I spent a great deal of time trying to figure this out, as I were going to use SIP Version 8 and there is no to-the-point documentation (at least not that I could find!)

Here are the steps you need to get this up and running: 

sábado, 16 de agosto de 2014

Desintalando FreePBX

Saltar al final de los metadatos
Ir al inicio de los metadatos

These Steps will completely erase your FreePBX settings. There is NO going back. Please make note of this and make the required backups

sábado, 2 de agosto de 2014

Bash Script para monitoreo de status de una extension o troncal en Asterisk

Estructura del Script

export DISPLAY=:0.0
A=`asterisk -x " sip show peer 1018" | grep -i status | cut -d' ' -f11 `

if [ "$A" != "OK" ]; then

B=`asterisk -x "originate dahdi/g0/18097145874 extension
923@emergency" `

echo "Servidor no disponible  $(date)" >> /root/lg.log

echo "Server up"
# echo $A

sábado, 12 de abril de 2014

SIP Retransmissions

What is the problem with SIP retransmits?

Sometimes you get messages in the console like these:
retrans_pkt: Hanging up call XX77yy  - no reply to our critical packet.
retrans_pkt: Cancelling retransmit of OPTIONs
The SIP protocol is based on requests and replies. Both sides send requests and wait for replies. Some of these requests are important. In a TCP/IP network many things can happen with IP packets. Firewalls, NAT devices, Session Border Controllers and SIP Proxys are in the signalling path and they will affect the call.

jueves, 13 de marzo de 2014

Instalando Asterisk en Raspberry Pi

Asterisk for Raspberry Pi Image

I have installed vanilla Asterisk onto a Raspberry Pi and have created an image for all to use. The Asterisk install is not a bundalled install like raspbx which uses FreePBX. Asterisk is configured with all deafults straight from a new build/compile.

martes, 14 de enero de 2014

Como instalar VICIDIAL en CentOS 6.5 desde cero

Instalación de VICIDIAL en un Servidor CENTOS DESDE CERO.

VICIDIAL is an enterprise class, open source, call center suite in use by many large call centers around the world.
Asterisk is software that turns an ordinary computer into a voice communications server.
Together, you have a full featured predictive dialer. It can also function as an ACD for inbound calls, or closer calls coming from VICIDIAL outbound fronters. It is capable of inbound, outbound, and blended call handling. VICIDIAL even allows you to have agents logged in from remote locations.

jueves, 9 de enero de 2014

Driver should be 'wctdm' but is actually 'netjet'

Blacklist the evil netjet driver.

 doing something like
echo "blacklist netjet" >> /etc/modprobe.d/dahdi.blacklist.conf