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

Содержание

Журнал

Пятница (04/12/13)

/dev/pts/8
10:50:26
#apt-get install subversion-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package subversion-dev
10:50:32
#apt-get install asterisk-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  mysql-common libmysqlclient16
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  asterisk-dev
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 637 kB of archives.
After this operation, 1,741 kB of additional disk space will be used.
Get:1 http://192.168.15.253/debian/ squeeze/main asterisk-dev all 1:1.6.2.9-2+squeeze10 [637 kB]
Fetched 637 kB in 2s (234 kB/s)
Selecting previously deselected package asterisk-dev.
(Reading database ... 131139 files and directories currently installed.)
Unpacking asterisk-dev (from .../asterisk-dev_1%3a1.6.2.9-2+squeeze10_all.deb) ...
Setting up asterisk-dev (1:1.6.2.9-2+squeeze10) ...
10:51:30
#cd chan-datacard/

10:51:41
#ls
__app.c            __at_read.c      chan_datacard.c  __char_conv.c  COPYRIGHT.txt  LICENSE.txt  __memmem.c      __ringbuffer.h
__at_fifo_queue.c  __at_response.c  chan_datacard.h  __cli.c        etc            Makefile.in  README.txt
__at_parse.c       __at_send.c      __channel.c      configure      __helpers.c    __manager.c  __ringbuffer.c
10:51:42
#less ./configure
10:52:23
#./configure
configure complete, now type 'make'
10:52:25
#make
gcc -Wextra -fPIC -DAST_MODULE=\"chan_datacard\" -D_THREAD_SAFE -I. -I/usr/include -O2 -DICONV_CONST="" -D__DEBUG__ -D__MANAGER__ -D__APP__ -c chan_datacard.c
gcc  -shared -Xlinker -x chan_datacard.o  -o chan_datacard.so
chmod 755 chan_datacard.so
10:52:48
#make install
gcc -Wextra -fPIC -DAST_MODULE=\"chan_datacard\" -D_THREAD_SAFE -I. -I/usr/include -O2 -DICONV_CONST="" -D__DEBUG__ -D__MANAGER__ -D__APP__ -c chan_datacard.c
gcc  -shared -Xlinker -x chan_datacard.o  -o chan_datacard.so
chmod 755 chan_datacard.so
install -d                /usr/lib/asterisk/modules/
install -m 755 chan_datacard.so /usr/lib/asterisk/modules/
10:53:06
#ls etc/
datacard.conf
10:53:18
#cp etc/datacard.conf /etc/asterisk/datacard.conf

10:53:31
#less chan_datacard.c
10:53:50
#grep -r datacard.conf .
./chan_datacard.h:#define CONFIG_FILE           "datacard.conf"
./chan_datacard.h:      char                    id[31];                         /* id from datacard.conf */
./chan_datacard.h:      "  Device   - Id of device from datacard.conf\n"
./chan_datacard.h:      "  Device  - Id of device from datacard.conf\n"
Binary file ./chan_datacard.o matches
./.svn/text-base/chan_datacard.h.svn-base:#define CONFIG_FILE           "datacard.conf"
./.svn/text-base/chan_datacard.h.svn-base:      char                    id[31];                         /* id from datacard.conf */
./.svn/text-base/chan_datacard.h.svn-base:      "  Device   - Id of device from datacard.conf\n"
./.svn/text-base/chan_datacard.h.svn-base:      "  Device  - Id of device from datacard.conf\n"
Binary file ./chan_datacard.so matches
./etc/.svn/entries:datacard.conf
./etc/.svn/all-wcprops:datacard.conf
./etc/.svn/all-wcprops:/svn/!svn/ver/178/trunk/etc/datacard.conf
10:53:50
#vim chan_datacard.h
--- /tmp/l3-saved-4287.24458.26028	2013-04-12 11:54:01.000000000 +0300
+++ chan_datacard.h	2013-04-12 11:54:18.000000000 +0300
@@ -11,7 +11,7 @@
 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
 #endif
 
-#define CONFIG_FILE		"datacard.conf"
+#define CONFIG_FILE		"chan_datacard.conf"
 #define DEF_DISCOVERY_INT	60
 
 #define FRAME_SIZE		320
10:54:18
#grep -r CONFIG_FILE . | grep -v .svn/
./chan_datacard.h:#define CONFIG_FILE           "chan_datacard.conf"
./chan_datacard.c:      if ((cfg = ast_config_load (CONFIG_FILE, config_flags)) == NULL)
./chan_datacard.c:              ast_log (LOG_ERROR, "Errors reading config file " CONFIG_FILE ", Not loading module\n");
10:54:57
#strings /usr/lib/asterisk/modules/chan_datacard.so | grep conf
ast_jb_configure
ast_config_load2
ast_jb_read_conf
ast_config_destroy
chan_datacard.conf
load_config
       Shows the state and config of Datacard device.
Reading configuration for device %s
Errors reading config file chan_datacard.conf, Not loading module
[%s] SMS reception has been disabled in the configuration.
Show Datacard device state and config
  Device   - Id of device from datacard.conf
  Device  - Id of device from datacard.conf
10:56:00
#vim /etc/asterisk/chan_datacard.conf
10:56:33
#dmesg | grep -i ttyUSB
[    5.281567] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[    5.281633] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[    5.281697] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
10:57:04
#dmesg | grep -iC2 ttyUSB
[    5.281278] USB Serial support registered for GSM modem (1-port)
[    5.281333] option 2-1:1.0: GSM modem (1-port) converter detected
[    5.281567] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[    5.281579] option 2-1:1.1: GSM modem (1-port) converter detected
[    5.281633] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[    5.281643] option 2-1:1.2: GSM modem (1-port) converter detected
[    5.281697] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
[    5.281710] usbcore: registered new interface driver option
[    5.281711] option: v0.7.2:USB Driver for GSM modems
10:57:11
#dmesg | grep -iC5 ttyUSB
[    4.940637] wmi: Mapper loaded
[    5.192192] [drm] Initialized drm 1.1.0 20060810
[    5.256414] input: HP WMI hotkeys as /devices/virtual/input/input4
[    5.281278] USB Serial support registered for GSM modem (1-port)
[    5.281333] option 2-1:1.0: GSM modem (1-port) converter detected
[    5.281567] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[    5.281579] option 2-1:1.1: GSM modem (1-port) converter detected
[    5.281633] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[    5.281643] option 2-1:1.2: GSM modem (1-port) converter detected
[    5.281697] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
[    5.281710] usbcore: registered new interface driver option
[    5.281711] option: v0.7.2:USB Driver for GSM modems
[    5.364972] dahdi: Telephony Interface Registered on major 196
[    5.364974] dahdi: Version: 2.6.2
[    5.365061] input: ImPS/2 Logitech Wheel Mouse as /devices/platform/i8042/serio1/input/input5
10:57:14
#vim /etc/asterisk/chan_datacard.conf
--- /tmp/l3-saved-4287.20113.20929	2013-04-12 11:57:33.000000000 +0300
+++ /etc/asterisk/chan_datacard.conf	2013-04-12 11:59:23.000000000 +0300
@@ -51,21 +51,22 @@
 audio=/dev/ttyUSB1		; tty for audio connection
 data=/dev/ttyUSB2		; tty for AT commands
 group=1				; calling group
+context=incoming_ivr
 
 
-[datacard1]
-context=incoming-datacard	; context for incoming calls
-;language=de			; Use German as default language
-audio=/dev/ttyUSB4		; tty port for audio connection
-data=/dev/ttyUSB5		; tty port for AT commands
-group=2				; calling group
-rxgain=10			; increase the incoming volume
-txgain=10			; increase the outgoint volume
-autodeletesms=yes		; auto delete incoming sms
-resetdatacard=yes		; reset datacard during initialization
-u2diag=0			; set U2DIAG parameter (0 = disable everything except modem function)
-usecallingpres=yes		; use the caller ID presentation or not
-callingpres=allowed_passed_screen ; set caller ID presentation
-disablesms=yes			; chan_datacard has currently a bug with SMS reception. When a SMS gets in during a
+;[datacard1]
+;context=incoming-datacard	; context for incoming calls
+;;language=de			; Use German as default language
+;audio=/dev/ttyUSB4		; tty port for audio connection
+;data=/dev/ttyUSB5		; tty port for AT commands
+;group=2				; calling group
+;rxgain=10			; increase the incoming volume
+;txgain=10			; increase the outgoint volume
+;autodeletesms=yes		; auto delete incoming sms
+;resetdatacard=yes		; reset datacard during initialization
+;u2diag=0			; set U2DIAG parameter (0 = disable everything except modem function)
+;usecallingpres=yes		; use the caller ID presentation or not
+;callingpres=allowed_passed_screen ; set caller ID presentation
+;disablesms=yes			; chan_datacard has currently a bug with SMS reception. When a SMS gets in during a
 				; call chan_datacard might crash. Enable this option to disable sms reception.
 				; Default = no
10:59:23
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
10:59:31
#asterisk -rvvvv
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
  == Parsing '/etc/asterisk/asterisk.conf':   == Found
  == Parsing '/etc/asterisk/extconfig.conf':   == Found
Connected to Asterisk 1.6.2.9-2+squeeze10 currently running on linux5 (pid = 4759)
...
    -- Added extension '700' priority 1 to parkedcalls (0x9f8aab0)
    -- Registered extension context 'demo' (0x9f8a338) in local table 0x9efb3b0; registrar: pbx_lua
    -- merging incls/swits/igpats from old(demo) to new(demo) context, registrar = pbx_config
    -- Including switch 'Lua/' in context 'demo'
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000508 sec
    -- Time to restore hints and swap in new dialplan: 0.000001 sec
    -- Time to delete the old dialplan: 0.000074 sec
    -- Total time merge_contexts_delete: 0.000583 sec
linux5*CLI> quit
Executing last minute cleanups
/dev/pts/4
10:59:31
#asterisk -r
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
Connected to Asterisk 1.6.2.9-2+squeeze10 currently running on linux5 (pid = 4759)
Verbosity is at least 4
linux5*CLI> dialplan reload
...
[Apr 12 12:03:38] WARNING[4899]: pbx.c:8871 pbx_builtin_background: ast_streamfile failed on Local/ussd@incoming_ivr-c4fe;1 for /var/tmp/message/05
    -- Executing [s@menu:10] Hangup("Local/ussd@incoming_ivr-c4fe;1", "") in new stack
  == Spawn extension (menu, s, 10) exited non-zero on 'Local/ussd@incoming_ivr-c4fe;1'
linux5*CLI> datacard
ccwa   cmd    reset  show   sms    ussd
    -- Remote UNIX connection
Executing last minute cleanups
  == Destroying musiconhold processes
linux5*CLI> dialplan
Disconnected from Asterisk server
/dev/pts/8
11:01:29
#vim /etc/asterisk/chan_datacard.conf
--- /tmp/l3-saved-4287.31722.17506	2013-04-12 12:01:31.000000000 +0300
+++ /etc/asterisk/chan_datacard.conf	2013-04-12 12:01:42.000000000 +0300
@@ -51,7 +51,7 @@
 audio=/dev/ttyUSB1		; tty for audio connection
 data=/dev/ttyUSB2		; tty for AT commands
 group=1				; calling group
-context=incoming_ivr
+context=incoming_gsm
 
 
 ;[datacard1]
11:01:42
#ls -l
total 496
-rw-r--r-- 1 root root   2996 Apr 12 11:51 __app.c
-rw-r--r-- 1 root root   2816 Apr 12 11:51 __at_fifo_queue.c
-rw-r--r-- 1 root root  14613 Apr 12 11:51 __at_parse.c
-rw-r--r-- 1 root root   7456 Apr 12 11:51 __at_read.c
-rw-r--r-- 1 root root  39050 Apr 12 11:51 __at_response.c
-rw-r--r-- 1 root root  13257 Apr 12 11:51 __at_send.c
-rw-r--r-- 1 root root  16995 Apr 12 11:51 chan_datacard.c
-rw-r--r-- 1 root root  16915 Apr 12 11:54 chan_datacard.h
-rw-r--r-- 1 root root 138424 Apr 12 11:54 chan_datacard.o
...
drwxr-xr-x 3 root root   4096 Apr 12 11:51 etc
-rw-r--r-- 1 root root   1793 Apr 12 11:51 __helpers.c
-rw-r--r-- 1 root root  18671 Apr 12 11:51 LICENSE.txt
-rw-r--r-- 1 root root    656 Apr 12 11:52 Makefile
-rw-r--r-- 1 root root    567 Apr 12 11:51 Makefile.in
-rw-r--r-- 1 root root  11478 Apr 12 11:51 __manager.c
-rw-r--r-- 1 root root   2291 Apr 12 11:51 __memmem.c
-rw-r--r-- 1 root root   2184 Apr 12 11:51 README.txt
-rw-r--r-- 1 root root   6920 Apr 12 11:51 __ringbuffer.c
-rw-r--r-- 1 root root   1187 Apr 12 11:51 __ringbuffer.h
11:01:43
#less README.txt
/dev/pts/6
11:01:57
#include => national
 same =>      n(correct_password),System(sudo eject -t)
exten => _900X,1,AddQueueMember(queue_100${EXTEN:3},SIP/${CALLERID(num)})
 same =>       n,Playback(agent-loginok)
exten => _901X,1,RemoveQueueMember(queue_100${EXTEN:3},SIP/${CALLERID(num)})
 same =>       n,Playback(agent-loggedoff)
exten => _910X,1,RemoveQueueMember(queue_100${EXTEN:3},SIP/${DB(queue_record/${EXTEN:3})})
exten => _910X,n,AddQueueMember(queue_100${EXTEN:3},SIP/${CALLERID(num)})
exten => _910X,n,Set(DB(queue_record/${EXTEN:3})=${CALLERID(num)})
 same =>       n,Playback(agent-loginok)
exten => _1000X,1,Queue(queue_100${EXTEN:4})
...
exten => ussd,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DATACARD}: ${USSD}' >> /var/log/asterisk/ussd..
txt)                                   (                           )                                                   ..
[            ]
exten => ussd,n,Hangup()
                      ()
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${SMS},2)
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DATACARD} - ${CALLERID(num)}: ${SMS}' | mail -ss
['SMS From As]erisk' user)
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DATACARD} - ${CALLERID(num)}: ${SMS}' >> /var/ll
                                                                                                      97,0-1        88%
/dev/pts/8
11:02:51
#asterisk -rx 'datacard ussd datacard0 *101#'

11:03:25
#ls -l /var/log/asterisk/
cdr-csv/    cdr-custom/ event_log   messages    queue_log
11:03:25
##ls -l /var/log/asterisk/

11:03:42
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
11:03:51
#asterisk -rx 'datacard ussd datacard0 *101#'

/dev/pts/4
11:03:51
#asterisk -r
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
Connected to Asterisk 1.6.2.9-2+squeeze10 currently running on linux5 (pid = 4933)
linux5*CLI> dialplan reload
Dialplan reloaded.
...
[Apr 12 13:51:06] WARNING[4978]: chan_datacard.c:108 opentty: Unable to open '/dev/ttyUSB2'
    -- Datacard datacard0 trying to connect on /dev/ttyUSB2...
[Apr 12 13:51:21] WARNING[4978]: chan_datacard.c:108 opentty: Unable to open '/dev/ttyUSB2'
    -- Datacard datacard0 trying to connect on /dev/ttyUSB2...
[Apr 12 13:51:36] WARNING[4978]: chan_datacard.c:108 opentty: Unable to open '/dev/ttyUSB2'
    -- Datacard datacard0 trying to connect on /dev/ttyUSB2...
[Apr 12 13:51:51] WARNING[4978]: chan_datacard.c:108 opentty: Unable to open '/dev/ttyUSB2'
    -- Datacard datacard0 trying to connect on /dev/ttyUSB2...
[Apr 12 13:52:06] WARNING[4978]: chan_datacard.c:108 opentty: Unable to open '/dev/ttyUSB2'
linux5*CLI> exit
/dev/pts/8
11:03:57
#ls -l /var/log/asterisk/
total 228
drwxr-xr-x 2 asterisk asterisk   4096 Apr  8 17:16 cdr-csv
drwxr-xr-x 2 asterisk asterisk   4096 Jan 17 18:44 cdr-custom
-rw-rw---- 1 asterisk asterisk      0 Apr  8 16:17 event_log
-rw-rw---- 1 asterisk asterisk 196791 Apr 12 12:03 messages
-rw-rw---- 1 asterisk asterisk  15400 Apr 12 12:03 queue_log
-rw-rw---- 1 asterisk asterisk    153 Apr 12 12:03 ussd.txt
11:03:59
#tail -f /var/log/asterisk/ussd.txt
2013-04-12 12:03:57 - datacard0: 40.01 UAH, dejstvitelen do 09.10.2013. Tarif - Super MTS 3D Nol 25. * Zvonite na nomera 0-800-XXX BESPLATNO! Detali:111
q^C
11:06:42
#less /etc/asterisk/extensions.conf
11:07:05
#less /etc/asterisk/extensions.conf
11:07:16
#asterisk -rvvvv
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
  == Parsing '/etc/asterisk/asterisk.conf':   == Found
  == Parsing '/etc/asterisk/extconfig.conf':   == Found
Connected to Asterisk 1.6.2.9-2+squeeze10 currently running on linux5 (pid = 4933)
Verbosity was 0 and is now 4
linux5*CLI> datacard
ccwa   cmd    reset  show   sms    ussd
linux5*CLI> datacard show
devices  device
linux5*CLI> datacard show devices
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number
datacard0    1     Free       29   3    3       MTS UKR        E1550      11.608.12.00.143  358705031098900  255013440611353  +380995611353
linux5*CLI> quit
Executing last minute cleanups
11:08:02
#touch /var/log/asterisk/sms.txt

11:08:10
#chown asterisk:asterisk /var/log/asterisk/sms.txt

11:08:16
#tail -f /var/log/asterisk/sms.txt
2013-04-12 12:08:27 - datacard0 - +380959386356: Тестирование
^C
11:15:03
#less /etc/asterisk/extensions.conf
11:16:09
#less /etc/asterisk/extensions.conf
прошло 62 минуты
12:18:49
#nano /etc/asterisk/extensions.conf
прошло 33 минуты
/dev/pts/4
12:52:19
#apt-get install ejabberd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  mysql-common libmysqlclient16
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  erlang-asn1 erlang-base erlang-crypto erlang-inets erlang-mnesia erlang-odbc erlang-public-key erlang-runtime-tools
  erlang-ssl erlang-syntax-tools libsctp1 lksctp-tools
Suggested packages:
...
Setting up erlang-inets (1:14.a-dfsg-3squeeze1) ...
Setting up erlang-odbc (1:14.a-dfsg-3squeeze1) ...
Setting up ejabberd (2.1.5-3+squeeze1) ...
adduser: Warning: The home directory `/var/lib/ejabberd' does not belong to the user you are currently creating.
Generating SSL certificate /etc/ejabberd/ejabberd.pem...
Creating config file /etc/ejabberd/ejabberd.cfg with new version
Starting jabber server: ejabberd.
Setting up libsctp1 (1.0.11+dfsg-1) ...
Setting up lksctp-tools (1.0.11+dfsg-1) ...
Processing triggers for menu ...
12:53:35
#dpkg-reconfigure ejabberd
                     ┌──────────────────────────┤ Configuring ejabberd ├──────────────────────────┐
                     │ Please reenter the password for the administrative user for verification.  │
                     │                                                                            │
                     │ The password for the admin account again for verification:                 │
                     │                                                                            │
                     â”********____________________________________________________________________ │
                     │                                                                            │
                     │                                   <Ok>                                     │
                     │                                                                            │
                     └────────────────────────────────────────────────────────────────────────────┘
Replacing config file /etc/ejabberd/ejabberd.cfg with new version
Starting jabber server: ejabberd.
Waiting for ejabberd to register admin user.
Admin user "admin@linux5.unix.nt" is registered successfully.
12:58:05
#ejabberdctl
Usage: ejabberdctl [--node nodename] [--auth user host password] command [options]
Available commands in this ejabberd node:
  add_rosteritem localuser localserver user server nick group subs    Add an item to a user's roster
  backup file                                                         Store the database to backup file
  ban_account user host reason                                        Ban an account: kick sessions and set random
                                                                      password
  change_password user host newpass                                   Change the password of an account
  check_account user host                                             Check if an acount exists or not
  check_password user host password                                   Check if a password is correct
  check_password_hash user host passwordhash hashmethod               Check if the password hash is correct
...
                                                                      server
  unregister user host                                                Unregister a user
  update module                                                       Update the given module, or use the keyword:
                                                                      all
  update_list                                                         List modified modules that can be updated
  user_resources user host                                            List user's connected resources
  user_sessions_info user host                                        Get information about all sessions of a user
Examples:
  ejabberdctl restart
  ejabberdctl --node ejabberd@host restart
12:58:59
#netstat -lnp | grep :..80
tcp        0      0 0.0.0.0:5280            0.0.0.0:*               LISTEN      6264/beam
13:00:08
#apt-get install pidgin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  mysql-common libmysqlclient16
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libmeanwhile1 libpurple-bin libpurple0 libsilc-1.1-2 libsilcclient-1.1-3 libzephyr4 pidgin-data
Suggested packages:
  tk8.4
...
Processing triggers for gconf2 ...
Setting up libmeanwhile1 (1.0.2-3) ...
Setting up pidgin-data (2.7.3-1+squeeze3) ...
Setting up libsilc-1.1-2 (1.1.10-2) ...
Setting up libsilcclient-1.1-3 (1.1.10-2) ...
Setting up libzephyr4 (3.0-1) ...
Setting up libpurple0 (2.7.3-1+squeeze3) ...
Setting up libpurple-bin (2.7.3-1+squeeze3) ...
Setting up pidgin (2.7.3-1+squeeze3) ...
Processing triggers for menu ...
13:04:26
#apt-get install sendxmpp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  mysql-common libmysqlclient16
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libauthen-sasl-perl libdigest-sha1-perl libio-socket-ssl-perl libnet-libidn-perl libnet-ssleay-perl libnet-xmpp-perl
  libxml-stream-perl
Suggested packages:
...
Unpacking sendxmpp (from .../sendxmpp_1.20-1_all.deb) ...
Processing triggers for man-db ...
Setting up libauthen-sasl-perl (2.1500-1) ...
Setting up libdigest-sha1-perl (2.13-1) ...
Setting up libnet-ssleay-perl (1.36-1) ...
Setting up libio-socket-ssl-perl (1.33-1+squeeze1) ...
Setting up libnet-libidn-perl (0.12.ds-1+b1) ...
Setting up libxml-stream-perl (1.23-1) ...
Setting up libnet-xmpp-perl (1.02-1) ...
Setting up sendxmpp (1.20-1) ...
прошло 26 минут
13:30:58
#ejabberdctl register asterisk linux7.unix.nt password
Can't register user asterisk@linux7.unix.nt at node ejabberd@linux5: not_allowed
13:31:43
#ejabberdctl register asterisk linux5.unix.nt password
User asterisk@linux5.unix.nt successfully registered
13:31:55
#echo asterisk@linux5.unix.nt password > /var/lib/asterisk/.sendxmpprc

13:34:02
#chmod 600 /var/lib/asterisk/.sendxmpprc

13:34:10
#chown asterisk:asterisk /var/lib/asterisk/.sendxmpprc

13:34:27
#vim /usr/local/bin/asterisk-jabber-send
--- /dev/null	2013-04-12 09:12:02.896785662 +0300
+++ /usr/local/bin/asterisk-jabber-send	2013-04-12 14:35:41.000000000 +0300
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+JID="$1"
+shift
+echo $* | sendxmpp -f /var/lib/asterisk/.sendxmpprc "$JID"
13:35:44
#chmod +x /usr/local/bin/asterisk-jabber-send

13:39:23
#asterisk -r
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
Connected to Asterisk 1.6.2.9-2+squeeze10 currently running on linux5 (pid = 4933)
Verbosity is at least 4
linux5*CLI> dialplan reload
...
    -- merging incls/swits/igpats from old(ael-trunkint) to new(ael-trunkint) context, registrar = pbx_config
    -- Including context 'ael-dundi-e164-lookup' in context 'ael-trunkint'
    -- Added extension '_9011.' priority 2 to ael-trunkint (0xb67a3688)
    -- Added extension '_9011.' priority 1 to ael-trunkint (0xb67a3688)
    -- Registered extension context 'ael-iaxprovider' (0x9dae778) in local table 0x9da2da0; registrar: pbx_ael
    -- merging incls/swits/igpats from old(ael-iaxprovider) to new(ael-iaxprovider) context, registrar = pbx_config
    -- Registered extension context 'ael-iaxtel700' (0x9da6b10) in local table 0x9da2da0; registrar: pbx_ael
    -- merging incls/swits/igpats from old(ael-iaxtel700) to new(ael-iaxtel700) context, registrar = pbx_config
    -- Added extension '_91700XXXXXXX' priority 1 to ael-iaxtel700 (0x9da6b10)
linux5*CLI> exit
/dev/pts/8
13:47:33
#cp /tmp/
.ICE-unix/                 orbit-user/                tmp.NYeblYZDNQ             .X11-unix/
keyring-SPPdPd/            seahorse-U1GaqN/           tmp.wNyjhLPn3l
l3-saved-2218.29296.16707  ssh-amiFqA1841/            virtual-user.K7AJmb/
orbit-Debian-gdm/          tmp.cqbbLhdz6A             .X0-lock
13:47:33
#cp /var/tmp/
commands/ message/  text/
13:47:33
#cp /var/tmp/
commands/ message/  text/
13:47:33
#mkdir -p /etc/asterisk/other-data

13:48:24
#cp -pR /var/tmp /etc/asterisk/other-data/

13:48:48
#cd /etc/asterisk/other-data/

13:48:54
#ls -l
total 4
drwxrwxrwt 5 root root 4096 Apr 12 12:12 tmp
13:48:55
#cd tmp/

13:48:58
#ls -l
total 12
drwxr-xr-x 2 root     root     4096 Apr 11 11:09 commands
drwxr-xr-x 2 asterisk asterisk 4096 Apr 11 14:52 message
drwxr-xr-x 2 root     root     4096 Apr 11 10:46 text
13:49:00
#cd .

прошло 10 минут
/dev/pts/6
13:59:29
#-- INSERT -- 84,122 45%
"","2101","8000","default","2101","SIP/2101-00000000","","Playback","welcome","2013-04-08 14:16:22","2013-04-08 14:16:22","2013-04-08 14:16:24",2,2,"ANSWERED","DOCUMENTATION","1365430582.0",""
"","2110","8000","default","""Sergey Kuranda"" <2110>","SIP/2110-00000001","","Playback","welcome","2013-04-08 14:17:52","2013-04-08 14:17:52","2013-04-08 14:17:53",1,1,"ANSWERED","DOCUMENTATION","1365430672.1",""
"","2110","8000","default","""Sergey Kuranda"" <2110>","SIP/2110-00000002","","Playback","welcome","2013-04-08 14:18:00","2013-04-08 14:18:00","2013-04-08 14:18:01",1,1,"ANSWERED","DOCUMENTATION","1365430680.2",""
"","2101","8000","default","2101","SIP/2101-00000004","","Playback","demo-congrats","2013-04-08 14:22:33","2013-04-08 14:22:33","2013-04-08 14:22:44",11,11,"ANSWERED","DOCUMENTATION","1365430953.4",""
"","2101","9000","default","2101","SIP/2101-00000005","SIP/192.168.70.101-00000006","Dial","SIP/192.168.70.101","2013-04-08 14:31:00","2013-04-08 14:31:00","2013-04-08 14:31:07",7,7,"NO ANSWER","DOCUMENTATION","1365431460.5",""
"","2101","9000","default","2101","SIP/2101-00000007","SIP/192.168.60.101-00000008","Dial","SIP/192.168.60.101","2013-04-08 14:32:11","2013-04-08 14:32:11","2013-04-08 14:32:14",3,3,"ANSWERED","DOCUMENTATION","1365431531.7",""
"","2101","2110","default","2101","SIP/2101-00000009","SIP/2110-0000000a","Dial","SIP/2110,30","2013-04-08 14:34:10",,"2013-04-08 14:34:11",1,0,"NO ANSWER","DOCUMENTATION","1365431650.9",""
"","2101","2110","default","2101","SIP/2101-0000000b","SIP/2110-0000000c","Dial","SIP/2110,30","2013-04-08 14:35:32",,"2013-04-08 14:35:32",0,0,"NO ANSWER","DOCUMENTATION","1365431732.11",""
"","2101","102110","default","2101","SIP/2101-0000000d","SIP/2110-0000000e","Dial","SIP/2110,30","2013-04-08 14:35:43",,"2013-04-08 14:35:44",1,0,"NO ANSWER","DOCUMENTATION","1365431743.13",""
"","2101","10211010","default","2101","SIP/2101-00000010","SIP/2110-00000011","Dial","SIP/2110,30","2013-04-08 14:37:04",,"2013-04-08 14:37:06",2,0,"NO ANSWER","DOCUMENTATION","1365431824.16",""
...
"","2101","1101","default","2101","SIP/2101-0000000c","SIP/minsk-0000000d","Dial","SIP/minsk/1101","2013-04-09 07:35:43",,"2013-04-09 07:35:43",0,0,"FAILED","DOCUMENTATION","1365492943.12",""
"","2101","1101","default","2101","SIP/2101-0000000e","SIP/minsk-0000000f","Dial","SIP/minsk/1101","2013-04-09 07:36:04",,"2013-04-09 07:36:04",0,0,"BUSY","DOCUMENTATION","1365492964.14",""
"","2101","1201","default","2101","SIP/2101-00000010","SIP/minsk-00000011","Dial","SIP/minsk/1201","2013-04-09 07:36:09",,"2013-04-09 07:36:09",0,0,"BUSY","DOCUMENTATION","1365492969.16",""
"","2101","1301","default","2101","SIP/2101-00000012","SIP/minsk-00000013","Dial","SIP/minsk/1301","2013-04-09 07:36:14",,"2013-04-09 07:36:14",0,0,"BUSY","DOCUMENTATION","1365492974.18",""
"","2101","1401","default","2101","SIP/2101-00000014","SIP/minsk-00000015","Dial","SIP/minsk/1401","2013-04-09 07:36:17",,"2013-04-09 07:36:17",0,0,"BUSY","DOCUMENTATION","1365492977.20",""
"","2101","1401","default","2101","SIP/2101-00000016","SIP/minsk-00000017","Dial","SIP/minsk/1401","2013-04-09 07:36:46",,"2013-04-09 07:36:46",0,0,"BUSY","DOCUMENTATION","1365493006.22",""
"","2101","1401","default","2101","SIP/2101-00000018","SIP/minsk-00000019","Dial","SIP/minsk/1401","2013-04-09 07:37:05",,"2013-04-09 07:37:05",0,0,"FAILED","DOCUMENTATION","1365493025.24",""
"","2101","1201","default","2101","SIP/2101-0000001a","SIP/minsk-0000001b","Dial","SIP/minsk/1201","2013-04-09 07:37:15",,"2013-04-09 07:37:18",3,0,"NO ANSWER","DOCUMENTATION","1365493035.26",""
"","2101","1101","default","2101","SIP/2101-0000001c","SIP/minsk-0000001d","Dial","SIP/minsk/1101","2013-04-09 07:37:29","2013-04-09 07:37:41","2013-04-09 07:37:47",18,6,"ANSWERED","DOCUMENTATION","1365493049.28",""
"","2101","1102","default","2101","SIP/2101-0000001e","SIP/minsk-0000001f","Dial","SIP/minsk/1102","2013-04-09 07:37:52","2013-04-09 07:37:54","2013-04-09 07:38:00",8,6,"ANSWERED","DOCUMENTATION","1365493072.30",""
14:00:53
#atp-get install asterisk-mysql
bash: atp-get: command not found
14:01:01
#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 12 not upgraded.
Need to get 47.4 kB of archives.
After this operation, 176 kB of additional disk space will be used.
Get:1 http://192.168.15.253/debian/ squeeze/main asterisk-mysql i386 1.6.2.1-1 [47.4 kB]
Fetched 47.4 kB in 0s (2,399 kB/s)
Selecting previously deselected package asterisk-mysql.
(Reading database ... 133364 files and directories currently installed.)
Unpacking asterisk-mysql (from .../asterisk-mysql_1.6.2.1-1_i386.deb) ...
Setting up asterisk-mysql (1.6.2.1-1) ...
14:02:37
#vim /tmp/cdr_mysql.txt
--- /tmp/l3-saved-2218.20906.3735	2013-04-12 15:02:42.000000000 +0300
+++ /tmp/cdr_mysql.txt	2013-04-12 15:05:33.000000000 +0300
@@ -1,13 +1,6 @@
-Call Detail Recording for MySQL
-===============================
-
-Usage:
-======
-
-Include the module in your modules.conf.  Change the database hostname, database name, username, and password in cdr_mysql.conf.
-
-Create a table called cdr under the database name you will be using the following schema.
-
+DROP DATABASE 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 '',
@@ -26,5 +19,3 @@
   uniqueid varchar(32) NOT NULL default '',
   userfield varchar(255) NOT NULL default ''
 );
-
-The calls will automatically be logged as long as the module is loaded.
14:05:33
#apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl
  mysql-client-5.1 mysql-server-5.1 mysql-server-core-5.1
Suggested packages:
  libipc-sharedcache-perl libterm-readkey-perl tinyca
The following NEW packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl libplrpc-perl
...
Get:2 http://192.168.15.253/debian/ squeeze/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:3 http://192.168.15.253/debian/ squeeze/main libdbi-perl i386 1.612-1 [879 kB]
Get:4 http://192.168.15.253/debian/ squeeze/main libdbd-mysql-perl i386 4.016-1 [138 kB]
Get:5 http://192.168.15.253/debian/ squeeze/main libhtml-template-perl all 2.9-2 [65.9 kB]
Get:6 http://security.debian.org/ squeeze/updates/main mysql-client-5.1 i386 5.1.66-0+squeeze1 [9,609 kB]
Get:7 http://security.debian.org/ squeeze/updates/main mysql-server-core-5.1 i386 5.1.66-0+squeeze1 [3,952 kB]
Get:8 http://security.debian.org/ squeeze/updates/main mysql-server-5.1 i386 5.1.66-0+squeeze1 [6,540 kB]
Get:9 http://security.debian.org/ squeeze/updates/main mysql-server all 5.1.66-0+squeeze1 [71.8 kB]
Fetched 21.3 MB in 3min 17s (108 kB/s)
Preconfiguring packages ...
14:13:07
#mysql -p < /tmp/cdr_mysql.txt
Enter password:
14:13:17
#mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.66-0+squeeze1 (Debian)
Copyright (c) 2000, 2012, 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 DATABASE LIST
    -> ;
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 'DATABASE LIST' at line 1
mysql> SHOW DATABASE LIST;
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 'DATABASE LIST' at line 1
mysql> SHOW LIST;
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 'LIST' at line 1
mysql> quit
Bye
14:13:54
#mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.1.66-0+squeeze1 (Debian)
Copyright (c) 2000, 2012, 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 tables;
...
Query OK, 0 rows affected (0.00 sec)host' IDENTIFIED BY 'asterpass';                                                                                                                                                                                                                                                                                                                                          't
                                                                                                                                                                                                                                                                                                                                                                                                              's
ERROR 1396 (HY000): Operation CREATE USER failed for 'asterisk'@'localhost'                                                                                                                                                                                                                                                                                                                                   'a
IED BY 'asterpass';                                                                                                                                                                      F;                                                                                                                                                                                                                   ''
mysql> quitT SELECT,UPDATE,INSERT,DELETE,DROP on asterisk.* to 'asterisk'@'localhost' IDENTI;                                                                                                                                                                                                                                                                                                                 '
Query OK, 0 rows affected (0.00 sec)                                                                                                                                                                                                                                                                                                                                   ' IDENTIFIED B
Bye                                                                                                                                                                                                                                                                        ' IDENTIFIED
                                                                                                                                                                               ' IDENTIFIED
                                                                                   ' IDENTIFIE
IED BY 'asterpass';,UPDATE,INSERT,DELETE,DROP on asterisk.* to 'asterisk'@'localhost' IDENTIFI
прошло 33 минуты
14:47:01
#dpkg -L asterisk-mysql | grep cdr_
/usr/lib/asterisk/modules/cdr_addon_mysql.so
/usr/share/doc/asterisk-mysql/cdr_mysql.txt
/usr/share/doc/asterisk-mysql/examples/cdr_mysql.conf.sample
14:52:48
#vim /etc/asterisk/cdr_mysql.conf
--- /tmp/l3-saved-2218.2168.10321	2013-04-12 15:52:55.000000000 +0300
+++ /etc/asterisk/cdr_mysql.conf	2013-04-12 15:54:06.000000000 +0300
@@ -11,13 +11,13 @@
 ; specified by sock or otherwise use the default socket file.
 ;
 ;[global]
-;hostname=database.host.name
-;dbname=asteriskcdrdb
-;table=cdr
-;password=password 
-;user=asteriskcdruser
-;port=3306
-;sock=/tmp/mysql.sock
+hostname=127.0.0.1
+dbname=asterisk
+table=cdr
+password=asterpass
+user=asterisk
+port=3306
+sock=/tmp/mysql.sock
 ;
 ; If you need your CDRs recorded in GMT instead of local time
 ;usegmtime=yes
14:54:06
#vim /etc/asterisk/cdr.conf
--- /tmp/l3-saved-2218.5915.28800	2013-04-12 15:54:35.000000000 +0300
+++ /etc/asterisk/cdr.conf	2013-04-12 15:54:57.000000000 +0300
@@ -11,7 +11,7 @@
 
 ; Define whether or not to use CDR logging.  Setting this to "no" will override
 ; any loading of backend CDR modules.  Default is "yes".
-;enable=yes
+enable=yes
 
 ; Define whether or not to log unanswered calls. Setting this to "yes" will
 ; report every attempt to ring a phone in dialing attempts, when it was not 
14:54:57
#vim /etc/asterisk/cdr_mysql.conf
--- /tmp/l3-saved-2218.27960.7968	2013-04-12 15:55:33.000000000 +0300
+++ /etc/asterisk/cdr_mysql.conf	2013-04-12 15:55:38.000000000 +0300
@@ -10,7 +10,7 @@
 ; "localhost", then cdr_mysql will attempt to connect to the socket file 
 ; specified by sock or otherwise use the default socket file.
 ;
-;[global]
+[global]
 hostname=127.0.0.1
 dbname=asterisk
 table=cdr
/dev/pts/4
14:55:07
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
14:55:12
#asterisk -r
Asterisk 1.6.2.9-2+squeeze10, Copyright (C) 1999 - 2010 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.
=========================================================================
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
14:55:17
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.
/dev/pts/6
14:55:38
#mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.1.66-0+squeeze1 (Debian)
Copyright (c) 2000, 2012, 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;
...
Database changed
mysql> select * from cdr;
+---------------------+------+------+------+-------------+-------------------+------------+-----------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
| calldate            | clid | src  | dst  | dcontext    | channel           | dstchannel | lastapp   | lastdata     | duration | billsec | disposition | amaflags | accountcode | uniqueid     | userfield |
+---------------------+------+------+------+-------------+-------------------+------------+-----------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
| 2013-04-12 15:56:47 |      | 2101 | 2102 | user_group3 | SIP/2101-00000000 |            | VoiceMail | 2102@default |        5 |       5 | ANSWERED    |        3 |             | 1365771407.0 |           |
+---------------------+------+------+------+-------------+-------------------+------------+-----------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
1 row in set (0.00 sec)
mysql> quit
Bye
15:05:01
#cd /~
bash: cd: /~: No such file or directory
15:05:07
#cd ~

15:05:12
#wget –no-check-certificate https://raw.github.com/Star2Billing/cdr-stats/master/install/install-cdr-stats-asterisk.sh -O install-cdr-stats-asterisk.sh
--2013-04-12 16:05:17--  http://%E2%80%93no-check-certificate/
Resolving –no-check-certificate... failed: Name or service not known.
wget: unable to resolve host address “–no-check-certificate”
--2013-04-12 16:05:17--  https://raw.github.com/Star2Billing/cdr-stats/master/install/install-cdr-stats-asterisk.sh
Resolving raw.github.com... 199.27.76.133
Connecting to raw.github.com|199.27.76.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1724 (1.7K) [text/plain]
Saving to: “install-cdr-stats-asterisk.sh”
100%[====================================================================================================================================================================================>] 1,724       --.-K/s   in 0s
2013-04-12 16:05:18 (24.7 MB/s) - “install-cdr-stats-asterisk.sh” saved [1724/1724]
FINISHED --2013-04-12 16:05:18--
Downloaded: 1 files, 1.7K in 0s (24.7 MB/s)
15:05:18
#bash ./install-cdr-stats-asterisk.sh
> > > This is only to be installed on a fresh new installation of CentOS 6.2 or Ubuntu LTS 10.04 / 12.04! < < <
It will install CDR-Stats on your server
Press Enter to continue or CTRL-C to exit
--2013-04-12 16:05:35--  https://raw.github.com/Star2Billing/cdr-stats/master/install/bash-common-functions.sh
Resolving raw.github.com... 199.27.76.133
Connecting to raw.github.com|199.27.76.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5438 (5.3K) [text/plain]
Saving to: “bash-common-functions.sh”
100%[====================================================================================================================================================================================>] 5,438       19.8K/s   in 0.3s
2013-04-12 16:05:36 (19.8 KB/s) - “bash-common-functions.sh” saved [5438/5438]
--2013-04-12 16:05:36--  https://raw.github.com/Star2Billing/cdr-stats/master/install/cdr-stats-functions.sh
Resolving raw.github.com... 199.27.76.133
Connecting to raw.github.com|199.27.76.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31107 (30K) [text/plain]
Saving to: “cdr-stats-functions.sh”
100%[====================================================================================================================================================================================>] 31,107      61.3K/s   in 0.5s
2013-04-12 16:05:37 (61.3 KB/s) - “cdr-stats-functions.sh” saved [31107/31107]
This script is only intended to run on Ubuntu LTS 10.04 / 12.04 or CentOS 6.X
15:05:38
#ls -l
total 6872
-rw-r--r-- 1 root root 2339482 Apr 11 10:29 belki.wav
-rw-r--r-- 1 root root 4186632 Apr 11 10:30 burunduki.wav
-rw-r--r-- 1 root root     330 Apr 11 17:11 call-all.sh
drwxr-xr-x 4 root root    4096 Apr 12 11:54 chan-datacard
-rw-r--r-- 1 root root  189204 Oct 12 13:08 chan_dongle-1.1.r14.tgz
-rw-r--r-- 1 root root    5264 Apr  8 16:41 install
-rw-r--r-- 1 root root    1724 Apr 12 16:05 install-cdr-stats-asterisk.sh
drwxr-xr-x 2 root root    4096 Apr 11 10:46 text
-rw-r--r-- 1 root root  268226 Apr 11 10:25 text1.wav
15:06:17
#vim install-cdr-stats-asterisk.sh
15:06:52
#ls -l
total 6872
-rw-r--r-- 1 root root 2339482 Apr 11 10:29 belki.wav
-rw-r--r-- 1 root root 4186632 Apr 11 10:30 burunduki.wav
-rw-r--r-- 1 root root     330 Apr 11 17:11 call-all.sh
drwxr-xr-x 4 root root    4096 Apr 12 11:54 chan-datacard
-rw-r--r-- 1 root root  189204 Oct 12 13:08 chan_dongle-1.1.r14.tgz
-rw-r--r-- 1 root root    5264 Apr  8 16:41 install
-rw-r--r-- 1 root root    1724 Apr 12 16:05 install-cdr-stats-asterisk.sh
drwxr-xr-x 2 root root    4096 Apr 11 10:46 text
-rw-r--r-- 1 root root  268226 Apr 11 10:25 text1.wav
15:07:15
#mkdir cdr-stats

15:08:01
#cd cdr-stats/

15:08:06
#wget https://github.com/Star2Billing/cdr-stats/zipball/master
--2013-04-12 16:08:07--  https://github.com/Star2Billing/cdr-stats/zipball/master
Resolving github.com... 204.232.175.90
Connecting to github.com|204.232.175.90|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://nodeload.github.com/Star2Billing/cdr-stats/legacy.zip/master [following]
--2013-04-12 16:08:08--  https://nodeload.github.com/Star2Billing/cdr-stats/legacy.zip/master
Resolving nodeload.github.com... 207.97.227.252
Connecting to nodeload.github.com|207.97.227.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4336619 (4.1M) [application/zip]
Saving to: “master”
15:09:45
#ls -l
total 4248
-rw-r--r-- 1 root root 4336619 Apr 12 16:09 master
15:09:52
#cd ..

15:10:04
#cd install
bash: cd: install: Not a directory
15:10:08
#ls -l
total 6876
-rw-r--r-- 1 root root 2339482 Apr 11 10:29 belki.wav
-rw-r--r-- 1 root root 4186632 Apr 11 10:30 burunduki.wav
-rw-r--r-- 1 root root     330 Apr 11 17:11 call-all.sh
drwxr-xr-x 2 root root    4096 Apr 12 16:08 cdr-stats
drwxr-xr-x 4 root root    4096 Apr 12 11:54 chan-datacard
-rw-r--r-- 1 root root  189204 Oct 12 13:08 chan_dongle-1.1.r14.tgz
-rw-r--r-- 1 root root    5264 Apr  8 16:41 install
-rw-r--r-- 1 root root    1724 Apr 12 16:05 install-cdr-stats-asterisk.sh
drwxr-xr-x 2 root root    4096 Apr 11 10:46 text
-rw-r--r-- 1 root root  268226 Apr 11 10:25 text1.wav
15:10:12
#vim install
15:10:37
# else
install                        install-cdr-stats-asterisk.sh
15:10:37
#vim install

Статистика

Время первой команды журнала10:50:26 2013- 4-12
Время последней команды журнала15:10:37 2013- 4-12
Количество командных строк в журнале101
Процент команд с ненулевым кодом завершения, %16.83
Процент синтаксически неверно набранных команд, % 0.99
Суммарное время работы с терминалом *, час 2.18
Количество командных строк в единицу времени, команда/мин 0.77
Частота использования команд
vim12|==========| 10.91%
ls11|==========| 10.00%
cd9|========| 8.18%
asterisk8|=======| 7.27%
grep8|=======| 7.27%
apt-get7|======| 6.36%
less7|======| 6.36%
cp5|====| 4.55%
mysql4|===| 3.64%
/etc/init.d/asterisk4|===| 3.64%
dmesg3|==| 2.73%
ejabberdctl3|==| 2.73%
mkdir2|=| 1.82%
chmod2|=| 1.82%
make2|=| 1.82%
wget2|=| 1.82%
chown2|=| 1.82%
tail2|=| 1.82%
dpkg1|| 0.91%
configure1|| 0.91%
strings1|| 0.91%
dpkg-reconfigure1|| 0.91%
nano1|| 0.91%
echo1|| 0.91%
netstat1|| 0.91%
--1|| 0.91%
.sendxmpprc1|| 0.91%
include1|| 0.91%
touch1|| 0.91%
atp-get1|| 0.91%
#ls1|| 0.91%
else1|| 0.91%
cdr_mysql.txt1|| 0.91%
bash1|| 0.91%
national1|| 0.91%
____
*) Интервалы неактивности длительностью 30 минут и более не учитываются

Справка

Для того чтобы использовать LiLaLo, не нужно знать ничего особенного: всё происходит само собой. Однако, чтобы ведение и последующее использование журналов было как можно более эффективным, желательно иметь в виду следующее:
  1. В журнал автоматически попадают все команды, данные в любом терминале системы.

  2. Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.

  3. Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
    $ l s-l
    bash: l: command not found
    

  4. Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
    $ test 5 -lt 4
    Обратите внимание на то, что код завершения команды может быть отличен от нуля не только в тех случаях, когда команда была выполнена с ошибкой. Многие команды используют код завершения, например, для того чтобы показать результаты проверки

  5. Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
    $ find / -name abc
    find: /home/devi-orig/.gnome2: Keine Berechtigung
    find: /home/devi-orig/.gnome2_private: Keine Berechtigung
    find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung
    find: /home/devi-orig/.metacity: Keine Berechtigung
    find: /home/devi-orig/.inkscape: Keine Berechtigung
    ^C
    

  6. Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
    # id
    uid=0(root) gid=0(root) Gruppen=0(root)
    

  7. Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
    $ vi ~/.bashrc
    2a3,5
    >    if [ -f /usr/local/etc/bash_completion ]; then
    >         . /usr/local/etc/bash_completion
    >        fi
    

  8. Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
    $ patch ~/.bashrc
    В данном случае изменения применяются к файлу ~/.bashrc

  9. Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.

    Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.

  10. Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.

  11. Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора

  12. Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.

  13. Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.

  14. Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:

    $ whoami
    
    user
    
    $ #^ Интересно, кто я?
    
    в журнале это будет выглядеть так:
    $ whoami
    
    user
    
    Интересно, кто я?

  15. Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:

    $ whoami
    
    user
    
    $ cat > /dev/null #^ Интересно, кто я?
    
    Программа whoami выводит имя пользователя, под которым 
    мы зарегистрировались в системе.
    -
    Она не может ответить на вопрос о нашем назначении 
    в этом мире.
    
    В журнале это будет выглядеть так:
    $ whoami
    user
    
    Интересно, кто я?
    Программа whoami выводит имя пользователя, под которым
    мы зарегистрировались в системе.

    Она не может ответить на вопрос о нашем назначении
    в этом мире.
    Для разделения нескольких абзацев между собой используйте символ "-", один в строке.

  16. Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=

  17. Содержимое файла может быть показано в журнале. Для этого его нужно вывести с помощью программы cat. Если вывод команды отметить симоволами #!, содержимое файла будет показано в журнале в специально отведённой для этого секции.
  18. Для того чтобы вставить скриншот интересующего вас окна в журнал, нужно воспользоваться командой l3shot. После того как команда вызвана, нужно с помощью мыши выбрать окно, которое должно быть в журнале.
  19. Команды в журнале расположены в хронологическом порядке. Если две команды давались одна за другой, но на разных терминалах, в журнале они будут рядом, даже если они не имеют друг к другу никакого отношения.
    1
        2
    3   
        4
    
    Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.

О программе

LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008

$Id$