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, 18 de enero de 2017

fixing freepbx fail2ban


version  13

yum --disablerepo="*" --enablerepo="sng-pkgs" install fail2ban


systemctl start fail2ban

disable freepbx firewall   restart ipables and enabled   asterisk security logs


-------------------------------
version 12
yum remove fail2ban

yum --disablerepo="*" --enablerepo="schmooze-commercial" install fail2ban




nano /etc/fail2ban/jail.local


[asterisk-udp]

enabled  = true
filter   = asterisk
port     = 5060,5061
protocol = udp
#logpath  = /var/log/asterisk/full
logpath  = /var/log/asterisk/fail2ban2
action   = iptables-allports[name=recidive, protocol=all]








nano /etc/asterisk/logger_logfiles_custom.conf


fail2ban2 => security,notice,warning,error


core reload

service fail2ban restart



sábado, 14 de enero de 2017

CDR


cat ./contrib/realtime/mysql/mysql_cdr.sql

root@PBXSERVER:/usr/src/asterisk-13.13.1/cdr# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 107
Server version: 5.7.16-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| dialer             |
| mysql              |
| performance_schema |
| phpmyadmin         |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

mysql> create database asterisk;
Query OK, 1 row affected (0.00 sec)

mysql> use asterisk;
Database changed
mysql> CREATE TABLE cdr (
    ->     accountcode VARCHAR(20),
    ->     src VARCHAR(80),
    ->     dst VARCHAR(80),
    ->     dcontext VARCHAR(80),
    ->     clid VARCHAR(80),
    ->     channel VARCHAR(80),
    ->     dstchannel VARCHAR(80),
    ->     lastapp VARCHAR(80),
    ->     lastdata VARCHAR(80),
    ->     start DATETIME,
    ->     answer DATETIME,
    ->     end DATETIME,
    ->     duration INTEGER,
    ->     billsec INTEGER,
    ->     disposition VARCHAR(45),
    ->     amaflags VARCHAR(45),
    ->     userfield VARCHAR(256),
    ->     uniqueid VARCHAR(150),
    ->     linkedid VARCHAR(150),
    ->     peeraccount VARCHAR(20),
    ->     sequence INTEGER
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;
+--------------------+
| Tables_in_asterisk |
+--------------------+
| cdr                |
+--------------------+
1 row in set (0.00 sec)

mysql> describe cdr;
+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| accountcode | varchar(20)  | YES  |     | NULL    |       |
| src         | varchar(80)  | YES  |     | NULL    |       |
| dst         | varchar(80)  | YES  |     | NULL    |       |
| dcontext    | varchar(80)  | YES  |     | NULL    |       |
| clid        | varchar(80)  | YES  |     | NULL    |       |
| channel     | varchar(80)  | YES  |     | NULL    |       |
| dstchannel  | varchar(80)  | YES  |     | NULL    |       |
| lastapp     | varchar(80)  | YES  |     | NULL    |       |
| lastdata    | varchar(80)  | YES  |     | NULL    |       |
| start       | datetime     | YES  |     | NULL    |       |
| answer      | datetime     | YES  |     | NULL    |       |
| end         | datetime     | YES  |     | NULL    |       |
| duration    | int(11)      | YES  |     | NULL    |       |
| billsec     | int(11)      | YES  |     | NULL    |       |
| disposition | varchar(45)  | YES  |     | NULL    |       |
| amaflags    | varchar(45)  | YES  |     | NULL    |       |
| userfield   | varchar(256) | YES  |     | NULL    |       |
| uniqueid    | varchar(150) | YES  |     | NULL    |       |
| linkedid    | varchar(150) | YES  |     | NULL    |       |
| peeraccount | varchar(20)  | YES  |     | NULL    |       |
| sequence    | int(11)      | YES  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
21 rows in set (0.00 sec)

mysql>

miércoles, 11 de enero de 2017

Asterisk 13 on Ubuntu 16 LTS

  1.       apt-get update && apt-get upgrade -y
  2.       reboot
  3.       apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev
  4.      cd /usr/src/
  5.      wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
  6.      tar zxvf asterisk*
  7.      cd /usr/src/asterisk*
  8.     
  9.      cd contrib/scripts 
  10.      ./install_prereq install
  11.      ./install_prereq install-unpackaged
  12.         cd..
  13.     ./configure --with-pjproject-bundled --with-jansson-bundled && make menuselect && make && make install && make config && make samples

  14.      ldconfig
  15.     /etc/init.d/asterisk start
  16.      asterisk -rvvvvvvvv


domingo, 8 de enero de 2017

Detailed ISDN Cause Codes




.
Cause No. l - Unallocated (unassigned) number [Q.850] 
This cause indicates that the called party cannot be reached recluses although the called party number is in a valid format. It is not currently allocated (assigned).Cause No. 2 - No route to specified transit network (national use) [Q.850] 
This cause indicates that the equipment sending this cause has received a request to route the call through a particular transit network which it does not recognize. The equipment sending this cause does not recognize the transit network either because the transit network does not exist or because that particular transit network. While it does exist. does not serve the equipment which is sending this cause.

viernes, 6 de enero de 2017

Running AMI action from the command line

<?php


$socket = fsockopen("127.0.0.1","5038", $errno, $errstr,10);
      if (!$socket){
        echo "$errstr ($errno)\n";
        }else{
            fputs($socket, "Action: Login\r\n");
            fputs($socket, "UserName: admin\r\n");
            fputs($socket, "Secret: 1456\r\n\r\n");
            fputs($socket, "Action: $argv[1]\r\n");
            fputs($socket, "Action: Logoff\r\n\r\n");

 while(!feof($socket)){
  $result=fread($socket,5000);

echo $result;

}
}
fclose($socket);


?>


ami_action.php QueueSummary

jueves, 5 de enero de 2017

asterisk originate example

asterisk -x "originate Local/18097143489@myoutbound extension s@moh"

asterisk -x "originate Local/103@home extension s@moh"



[myoutbound]
exten=>_x.,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN}@trunk,25) ;trunk to use

exten=>_xxx,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN},25)



[moh]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(/var/www/travel/sounds/welcome)
same=>n,MusicOnHold(default)
same=>n,Hangup()

miércoles, 4 de enero de 2017

listing all active sip channels

<?php

$channel=shell_exec("asterisk -x \" core show channels\" | awk '{print $1}' | awk '/SIP/{print}'");

$channelist=explode("\n",$channel);
foreach($channelist as $key=> $value) {
if (preg_match("/\bSIP\b/i", $value,$match)){

echo "$key : $value\n";
}
}
?>