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

Содержание

Журнал

Пятница (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