Журнал лабораторных работ

Содержание

Журнал

Пятница (11/28/14)

/dev/pts/1
13:51:15
#apt-get install asterisk-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  asterisk-mysql
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 658 kB of archives.
After this operation, 783 kB of additional disk space will be used.
Get:1 http://192.168.12.254/debian/ wheezy/main asterisk-mysql amd64 1:1.8.13.1~dfsg1-3+deb7u3 [658 kB]
Fetched 658 kB in 0s (9,743 kB/s)
Selecting previously unselected package asterisk-mysql.
(Reading database ... 145253 files and directories currently installed.)
Unpacking asterisk-mysql (from .../asterisk-mysql_1%3a1.8.13.1~dfsg1-3+deb7u3_amd64.deb) ...
Setting up asterisk-mysql (1:1.8.13.1~dfsg1-3+deb7u3) ...
13:51:29
#dpkg -L asterisk-mysql
/.
/usr
/usr/lib
/usr/lib/asterisk
/usr/lib/asterisk/modules
/usr/lib/asterisk/modules/cdr_mysql.so
/usr/lib/asterisk/modules/app_mysql.so
/usr/lib/asterisk/modules/res_config_mysql.so
/usr/share
/usr/share/doc
/usr/share/doc/asterisk-mysql
/usr/share/doc/asterisk-mysql/NEWS.Debian.gz
/usr/share/doc/asterisk-mysql/changelog.gz
/usr/share/doc/asterisk-mysql/changelog.Debian.gz
/usr/share/doc/asterisk-mysql/copyright
/dev/pts/0
13:51:29
#dpkg -L asterisk-mysql
/.
/usr
/usr/lib
/usr/lib/asterisk
/usr/lib/asterisk/modules
/usr/lib/asterisk/modules/cdr_mysql.so
/usr/lib/asterisk/modules/app_mysql.so
/usr/lib/asterisk/modules/res_config_mysql.so
/usr/share
/usr/share/doc
/usr/share/doc/asterisk-mysql
/usr/share/doc/asterisk-mysql/NEWS.Debian.gz
/usr/share/doc/asterisk-mysql/changelog.gz
/usr/share/doc/asterisk-mysql/changelog.Debian.gz
/usr/share/doc/asterisk-mysql/copyright
/dev/pts/1
13:51:55
#ls -l /tmp/1.sql
ls: cannot access /tmp/1.sql: No such file or directory
/dev/pts/0
13:51:55
#ls -l /tmp/1.sql
ls: cannot access /tmp/1.sql: No such file or directory
/dev/pts/4
13:53:03
#screen -x
/dev/pts/1
13:54:59
#cat /tmp/1.sql
cat: /tmp/1.sql: No such file or directory
/dev/pts/0
13:54:59
#cat /tmp/1.sql
cat: /tmp/1.sql: No such file or directory
/dev/pts/1
13:55:07
#mysql -u root -p < /tmp/1.sql
Enter password:
ERROR 1008 (HY000) at line 2: Can't drop database 'asterisk'; database doesn't exist
/dev/pts/0
13:55:07
#mysql -u root -p < /tmp/1.sql
Enter password:
ERROR 1008 (HY000) at line 2: Can't drop database 'asterisk'; database doesn't exist
/dev/pts/1
13:58:45
#cpall /tmp/1.sql /tmp/
bash: cpall: command not found
/dev/pts/0
13:58:45
#cpall /tmp/1.sql /tmp/
bash: cpall: command not found
/dev/pts/1
14:00:15
#vi /tmp/1.sql
/dev/pts/0
14:00:15
#vi /tmp/1.sql
/dev/pts/1
14:01:51
# ALTER TABLE cdr ADD INDEX ( uniqueid );
 drop database if exists asterisk;
 create database asterisk;
 use asterisk;
 CREATE TABLE cdr (
 calldate datetime NOT NULL default '0000-00-00 00:00:00',
 clid varchar(80) NOT NULL default '',
 src varchar(80) NOT NULL default '',
 dst varchar(80) NOT NULL default '',
 dcontext varchar(80) NOT NULL default '',
 channel varchar(80) NOT NULL default '',
...
 billsec int(11) NOT NULL default '0',
 disposition varchar(45) NOT NULL default '',
 amaflags int(11) NOT NULL default '0',
 accountcode varchar(20) NOT NULL default '',
 userfield varchar(255) NOT NULL default '',
 uniqueid varchar(32) NOT NULL default ''
 );
 ALTER TABLE cdr ADD INDEX ( calldate );
 ALTER TABLE cdr ADD INDEX ( dst );
 ALTER TABLE cdr ADD INDEX ( uniqueid );
/dev/pts/0
14:01:51
# ALTER TABLE cdr ADD INDEX ( uniqueid );
 drop database if exists asterisk;
 create database asterisk;
 use asterisk;
 CREATE TABLE cdr (
 calldate datetime NOT NULL default '0000-00-00 00:00:00',
 clid varchar(80) NOT NULL default '',
 src varchar(80) NOT NULL default '',
 dst varchar(80) NOT NULL default '',
 dcontext varchar(80) NOT NULL default '',
 channel varchar(80) NOT NULL default '',
...
 billsec int(11) NOT NULL default '0',
 disposition varchar(45) NOT NULL default '',
 amaflags int(11) NOT NULL default '0',
 accountcode varchar(20) NOT NULL default '',
 userfield varchar(255) NOT NULL default '',
 uniqueid varchar(32) NOT NULL default ''
 );
 ALTER TABLE cdr ADD INDEX ( calldate );
 ALTER TABLE cdr ADD INDEX ( dst );
 ALTER TABLE cdr ADD INDEX ( uniqueid );
/dev/pts/1
14:02:20
#mysql -u root -p < /tmp/1.sql
Enter password:
/dev/pts/0
14:02:20
#mysql -u root -p < /tmp/1.sql
Enter password:
/dev/pts/1
14:02:59
#cpall /tmp/1.sql /tmp/
bash: cpall: command not found
/dev/pts/0
14:02:59
#cpall /tmp/1.sql /tmp/
bash: cpall: command not found
/dev/pts/1
14:03:15
#mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
/dev/pts/0
14:03:15
#mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
/dev/pts/1
14:04:37
#mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk;
...
    -> to 'asterisk'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
Query OK, 0 rows affected (0.00 sec)
mysql> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
mysql> Bye
    -> BYE
    ->
    -> ^CCtrl-C -- exit!
Aborted
/dev/pts/0
14:04:37
#mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk;
...
    -> to 'asterisk'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
Query OK, 0 rows affected (0.00 sec)
mysql> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
mysql> Bye
    -> BYE
    ->
    -> ^CCtrl-C -- exit!
Aborted
прошло 10 минут
/dev/pts/1
14:15:33
#mysql -u asterisk -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk;
...
    -> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
    -> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Bye
SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password')' at line 1
mysql> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
Query OK, 0 rows affected (0.00 sec)
mysql> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
mysql> Bye
    -> ^CCtrl-C -- exit!
Aborted
/dev/pts/0
14:15:33
#mysql -u asterisk -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk;
...
    -> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
    -> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Bye
SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password')' at line 1
mysql> SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
Query OK, 0 rows affected (0.00 sec)
mysql> #SET PASSWORD FOR 'asterisk'@'localhost' = PASSWORD('password');
mysql> Bye
    -> ^CCtrl-C -- exit!
Aborted
/dev/pts/1
14:18:59
#ls -l /etc/asterisk/cdr_mysql.conf
-rw-r----- 1 asterisk asterisk 2231 Jan  4  2014 /etc/asterisk/cdr_mysql.conf
/dev/pts/0
14:18:59
#ls -l /etc/asterisk/cdr_mysql.conf
-rw-r----- 1 asterisk asterisk 2231 Jan  4  2014 /etc/asterisk/cdr_mysql.conf
/dev/pts/1
14:19:34
#vim /etc/asterisk/cdr_mysql.conf
--- /tmp/l3-saved-3627.24368.26881	2014-11-28 15:19:43.343328551 +0200
+++ /etc/asterisk/cdr_mysql.conf	2014-11-28 15:21:34.003329853 +0200
@@ -12,10 +12,10 @@
 ;
 ;[global]
 ;hostname=database.host.name
-;dbname=asteriskcdrdb
+;dbname=asterisk
 ;table=cdr
 ;password=password 
-;user=asteriskcdruser
+;user=asterisk
 ;port=3306
 ;sock=/tmp/mysql.sock
 ;timezone=UTC ; Previously called usegmtime
/dev/pts/0
14:19:34
#vim /etc/asterisk/cdr_mysql.conf
14:28:03
#mysql -u asterisk -p
Enter password:
ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES)
/dev/pts/1
14:28:03
#mysql -u asterisk -p
Enter password:
ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES)
14:30:12
#mysql -u asterisk -p
Enter password:
ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES)
/dev/pts/0
14:30:12
#mysql -u asterisk -p
Enter password:
ERROR 1045 (28000): Access denied for user 'asterisk'@'localhost' (using password: YES)
/dev/pts/1
14:31:06
#mysql -u asterisk -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 56
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> exit
Bye
/dev/pts/0
14:31:06
#mysql -u asterisk -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 56
Server version: 5.5.40-0+wheezy1 (Debian)
Copyright (c) 2000, 2014, 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> use asterisk
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> exit
Bye
/dev/pts/1
14:40:01
#vim /etc/asterisk/cdr_mysql.conf
/dev/pts/0
14:40:01
#vim /etc/asterisk/cdr_mysql.conf
/dev/pts/1
14:40:13
#[global]
; Asterisk Call Detail Record engine configuration
;
; CDR is Call Detail Record, which provides logging services via a variety of
; pluggable backend modules.  Detailed call information can be recorded to
[       ]
[ databa]es, files, etc.  Useful for billing, fraud prevention, compliance with
; Sarbanes-Oxley aka The Enron Act, QOS evaluations, and more.
enable=yes
;
s",neral]
...
; redundant, but cannot be helped.
ve an A
; Define whether or not to log unanswered calls. Setting this to "yes" will
illarty. Calls which get offered to an outgoing line, but are unanswered, are stt
; report every attempt to ring a phone in dialing attempts, when it was not
Rs being, and that is the intended behaviour. (It also results in some B side CDD
; answered. For example, if you try to dial 3 extensions, and this option is "yee
ationput, as they have the B side channel as their source channel, and no destinn
; channel.)
"/etc/asterisk/cdr.conf" 165L, 8380C written
/dev/pts/0
14:40:13
#[global]
; Asterisk Call Detail Record engine configuration
;
; CDR is Call Detail Record, which provides logging services via a variety of
; pluggable backend modules.  Detailed call information can be recorded to
[       ]
[ databa]es, files, etc.  Useful for billing, fraud prevention, compliance with
; Sarbanes-Oxley aka The Enron Act, QOS evaluations, and more.
enable=yes
;
s",neral]
...
; redundant, but cannot be helped.
ve an A
; Define whether or not to log unanswered calls. Setting this to "yes" will
illarty. Calls which get offered to an outgoing line, but are unanswered, are stt
; report every attempt to ring a phone in dialing attempts, when it was not
Rs being, and that is the intended behaviour. (It also results in some B side CDD
; answered. For example, if you try to dial 3 extensions, and this option is "yee
ationput, as they have the B side channel as their source channel, and no destinn
; channel.)
"/etc/asterisk/cdr.conf" 165L, 8380C written
/dev/pts/1
14:40:21
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
/dev/pts/0
14:40:21
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
/dev/pts/6
14:40:43
#less /var/log/asterisk/messages
14:41:10
#less /var/log/asterisk/messages
14:41:26
#[Nov 28 15:40:42] NOTICE[10611] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI list
;
; Note - if the database server is hosted on the same machine as the
; asterisk server, you can achieve a local Unix socket connection by
; setting hostname=localhost
;
; port and sock are both optional parameters.  If hostname is specified
; and is not "localhost" (you can use address 127.0.0.1 instead), then
; cdr_mysql will attempt to connect to the port specified or use the
; default port.  If hostname is not specified or if hostname is
; "localhost", then cdr_mysql will attempt to connect to the socket file
...
;alias dstchannel => <a_field_not_named_dstchannel>
;alias lastapp => <a_field_not_named_lastapp>
;alias lastdata => <a_field_not_named_lastdata>
;alias duration => <a_field_not_named_duration>
;alias billsec => <a_field_not_named_billsec>
;alias disposition => <a_field_not_named_disposition>
;alias amaflags => <a_field_not_named_amaflags>
;alias accountcode => <a_field_not_named_accountcode>
;alias userfield => <a_field_not_named_userfield>
;alias uniqueid => <a_field_not_named_uniqueid>
14:41:49
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
14:42:35
#vim /etc/asterisk/cdr_mysql.conf
14:43:13
#[global]
; is "yes".
;safeshutdown=yes
;
;
; CHOOSING A CDR "BACKEND"  (what kind of output to generate)
;
; To choose a backend, you have to make sure either the right category is
; defined in this file, or that the appropriate config file exists, and has the
; proper definitions in it. If there are any problems, usually, the entry will
; silently ignored, and you get no output.
...
; find this information horribly useless. Others find it very valuable. Note, in "yes"
; mode, you will see one CDR, with one of the call targets on one side, and the originating
; channel on the other, and then one CDR for each channel attempted. This may seem
; redundant, but cannot be helped.
;
; In brief, this option controls the reporting of unanswered calls which only have an A
; party. Calls which get offered to an outgoing line, but are unanswered, are still
; logged, and that is the intended behaviour. (It also results in some B side CDRs being
; output, as they have the B side channel as their source channel, and no destination
; channel.)
14:43:31
#;unanswered = no

прошло 54 минуты
/dev/pts/1
15:37:45
#asterisk -v
Asterisk 1.8.13.1~dfsg1-3+deb7u3, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.
Asterisk already running on /var/run/asterisk/asterisk.ctl.  Use 'asterisk -r' to connect.
/dev/pts/0
15:37:45
#asterisk -v
Asterisk 1.8.13.1~dfsg1-3+deb7u3, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.
Asterisk already running on /var/run/asterisk/asterisk.ctl.  Use 'asterisk -r' to connect.
/dev/pts/1
15:37:54
#cd /usr/src/

/dev/pts/0
15:37:54
#cd /usr/src/

/dev/pts/1
15:45:01
#cp /usr/share/nginx/www/asterisk-13-current.tar.gz
cp: missing destination file operand after `/usr/share/nginx/www/asterisk-13-current.tar.gz'
Try `cp --help' for more information.
/dev/pts/0
15:45:01
#cp /usr/share/nginx/www/asterisk-13-current.tar.gz
cp: missing destination file operand after `/usr/share/nginx/www/asterisk-13-current.tar.gz'
Try `cp --help' for more information.
/dev/pts/1
15:45:10
#cp /usr/share/nginx/www/asterisk-13-current.tar.gz .
cp: cannot stat `/usr/share/nginx/www/asterisk-13-current.tar.gz': No such file or directory
/dev/pts/0
15:45:10
#cp /usr/share/nginx/www/asterisk-13-current.tar.gz .
cp: cannot stat `/usr/share/nginx/www/asterisk-13-current.tar.gz': No such file or directory
/dev/pts/1
15:45:41
#apt-get install libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libtinfo-dev
Suggested packages:
  ncurses-doc
The following NEW packages will be installed:
  libncurses5-dev libtinfo-dev
0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
...
Get:1 http://192.168.12.254/debian/ wheezy/main libtinfo-dev amd64 5.9-10 [105 kB]
Get:2 http://192.168.12.254/debian/ wheezy/main libncurses5-dev amd64 5.9-10 [223 kB]
Fetched 328 kB in 0s (7,555 kB/s)
Selecting previously unselected package libtinfo-dev:amd64.
(Reading database ... 145261 files and directories currently installed.)
Unpacking libtinfo-dev:amd64 (from .../libtinfo-dev_5.9-10_amd64.deb) ...
Selecting previously unselected package libncurses5-dev.
Unpacking libncurses5-dev (from .../libncurses5-dev_5.9-10_amd64.deb) ...
Setting up libtinfo-dev:amd64 (5.9-10) ...
Setting up libncurses5-dev (5.9-10) ...
/dev/pts/0
15:45:41