Soporte & Consultoria

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

lunes, 27 de febrero de 2017

CDR centos 6.5 Config


/etc/odbc.ini



[asterisk-mysql]
Description           = MySQL connection to 'asterisk' database
Driver                = MySQL
Database              = asteriskcdrdb
Server                = localhost
UserName              = root
Password              = 7891
Port                  = 3306
Socket                = /var/lib/mysql/mysql.sock






/etc/odbcinst.ini



# Example driver definitions

# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description     = ODBC for PostgreSQL
Driver          = /usr/lib/psqlodbc.so
Setup           = /usr/lib/libodbcpsqlS.so
Driver64        = /usr/lib64/psqlodbc.so
Setup64         = /usr/lib64/libodbcpsqlS.so
FileUsage       = 1


# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/libmyodbc5.so
Setup           = /usr/lib/libodbcmyS.so
Driver64        = /usr/lib64/libmyodbc5.so
Setup64         = /usr/lib64/libodbcmyS.so
FileUsage       = 1




/etc/asterisk/res_odbc_custom.conf

[asterisk-mysql]
enabled => yes
dsn => asterisk-mysql
username => root
password => 7891
pre-connect => yes




/etc/asterisk/cdr_adaptive_odbc.conf



[asterisk-mysql]
connection=asterisk-mysql
table=cdr
alias start => calldate




Load  on asterisk

module reload res_odbc.so

Module 'res_odbc.so' reloaded successfully.
    -- Reloading module 'res_odbc.so' (ODBC resource)
  == Parsing '/etc/asterisk/res_odbc.conf': Found
  == Parsing '/etc/asterisk/res_odbc_custom.conf': Found
  == Parsing '/etc/asterisk/res_odbc_additional.conf': Found
[2015-09-04 14:48:27] NOTICE[10623]: res_odbc.c:1528 odbc_obj_connect: Connecting asterisk-mysql
[2015-09-04 14:48:27] NOTICE[10623]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to asterisk-mysql [asterisk-mysql]
[2015-09-04 14:48:27] NOTICE[10623]: res_odbc.c:923 load_odbc_config: Registered ODBC class 'asterisk-mysql' dsn->[asterisk-mysql]
[2015-09-04 14:48:27] NOTICE[10623]: res_odbc.c:1528 odbc_obj_connect: Connecting asteriskcdrdb
[2015-09-04 14:48:27] WARNING[10623]: res_odbc.c:1560 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[2015-09-04 14:48:27] WARNING[10623]: res_odbc.c:1370 _ast_odbc_request_obj2: Failed to connect to asteriskcdrdb
[2015-09-04 14:48:27] NOTICE[10623]: res_odbc.c:923 load_odbc_config: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
ibx2*CLI>






ibx2*CLI> module reload cdr_adaptive_odbc.so


Module 'cdr_adaptive_odbc.so' reloaded successfully.
    -- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
  == Parsing '/etc/asterisk/cdr_adaptive_odbc.conf': Found
    -- Found adaptive CDR table cdr@asterisk-mysql.
    -- Found alias start for column calldate in cdr@asterisk-mysql
       > Found calldate column with type 93 with len 19, octetlen 19, and numlen (0,10)
       > Found clid column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found src column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found dst column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found dcontext column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found channel column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found dstchannel column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found lastapp column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found lastdata column with type 12 with len 80, octetlen 80, and numlen (0,0)
       > Found duration column with type 4 with len 10, octetlen 10, and numlen (0,10)
       > Found billsec column with type 4 with len 10, octetlen 10, and numlen (0,10)
       > Found disposition column with type 12 with len 45, octetlen 45, and numlen (0,0)
       > Found amaflags column with type 4 with len 10, octetlen 10, and numlen (0,10)
       > Found accountcode column with type 12 with len 20, octetlen 20, and numlen (0,0)
       > Found uniqueid column with type 12 with len 32, octetlen 32, and numlen (0,0)
       > Found userfield column with type 12 with len 255, octetlen 255, and numlen (0,0)
       > Found did column with type 12 with len 50, octetlen 50, and numlen (0,0)
       > Found recordingfile column with type 12 with len 255, octetlen 255, and numlen (0,0)
       > Found cnum column with type 12 with len 40, octetlen 40, and numlen (0,0)
       > Found cnam column with type 12 with len 40, octetlen 40, and numlen (0,0)
       > Found outbound_cnum column with type 12 with len 40, octetlen 40, and numlen (0,0)
       > Found outbound_cnam column with type 12 with len 40, octetlen 40, and numlen (0,0)
       > Found dst_cnam column with type 12 with len 40, octetlen 40, and numlen (0,0)
ibx2*CLI>







ibx2*CLI> odbc show all

ODBC DSN Settings
-----------------

  Name:   asterisk-mysql
  DSN:    asterisk-mysql
    Last connection attempt: 1969-12-31 19:00:00
  Pooled: No
  Connected: Yes

  Name:   asteriskcdrdb
  DSN:    MySQL-asteriskcdrdb
    Last connection attempt: 2015-09-04 14:48:27





ibx2*CLI> cdr show status

Call Detail Record (CDR) settings
----------------------------------
  Logging:                    Enabled
  Mode:                       Simple
  Log unanswered calls:       No
  Log congestion:             No

* Registered Backends
  -------------------
    cdr-custom
    Adaptive ODBC


--------------

use asterisk;


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
     );



[HowTo] How to reset a FreePBX administrator password

If you forget your administrator login information for FreePBX, there is a simple way to log in and reset it. You will need your current root password to proceed with this tutorial.
  1. Log into your FreePBX server via SSH as the root user, using a tool such as PuTTY on Windows, or Terminal on Mac.
  2. Next, bring up your FreePBX web interface in a web browser. Once the page has loaded, press Ctrl + A on your keyboard to highlight everything on the page.
  3. Locate the unique session ID on the left side of the screen, and copy this string. It will look something like this: igg56njsp8bi0h4odqnupsq963
  4. In your PuTTY or terminal window, type the following (be sure to replace the unique string with your own, and press enter):
  5. [root@pbx ~]# amportal a u igg56njsp8bi0h4odqnupsq963
    Fetching FreePBX settings with gen_amp_conf.php..
    session unlocked!
    [root@pbx ~]#
  6. In your web browser, refresh the login page and you will be automatically logged in.
  7. Visit Admin -> Administrators and select your user on the right side of the page. At this point you can reset your password.

jueves, 16 de febrero de 2017

Asterisk command from ami

$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: Command\r\n");
              fputs($socket, "Command: $_GET[cmd]\r\n");

            fputs($socket, "Action: Logoff\r\n\r\n");

 while(!feof($socket)){

  $result=fgets($socket);


echo $result."<br>";



  if(stristr($result, '--END COMMAND--') == TRUE) {

exit();

}
}
}
fclose($socket);
exit();

?>


confbridge Hack()

Counting users on a conf
 asterisk -x " confbridge list 5001" | awk '{print $1}' | grep -w SIP |  wc -l


listing channels on a conf

 asterisk -x " confbridge list 5001" | awk '{print $1}' | grep -w SIP

searching all register

cat full* | grep  [9002-9018] | grep -i Registered | grep -i chan_sip >  /var/www/html/register.log