/l3/users/kronas/nt-voip/linux5.unix.nt/root :1 :2 :3 :4 :5 :6 :7 :8 :9 :10 |
|
#apt-get install subversion-dev
![]() Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package subversion-dev |
#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) ... |
#cd chan-datacard/
|
#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 |
#less ./configure
|
#./configure
configure complete, now type 'make' |
#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 |
#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/ |
#ls etc/
datacard.conf |
#cp etc/datacard.conf /etc/asterisk/datacard.conf
|
#less chan_datacard.c
|
#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 |
#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 |
#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"); |
#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 |
#vim /etc/asterisk/chan_datacard.conf
|
#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 |
#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 |
#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 |
#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 |
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk. Starting Asterisk PBX: asterisk. |
#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 |
#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 |
#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] |
#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 |
#less README.txt
|
#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% |
#ls -l /var/log/asterisk/
![]() cdr-csv/ cdr-custom/ event_log messages queue_log |
##ls -l /var/log/asterisk/
|
#/etc/init.d/asterisk restart
Stopping Asterisk PBX: asterisk. Starting Asterisk PBX: asterisk. |
#asterisk -rx 'datacard ussd datacard0 *101#'
|
#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 |
#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 |
#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 |
#less /etc/asterisk/extensions.conf
|
#less /etc/asterisk/extensions.conf
|
#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 |
#touch /var/log/asterisk/sms.txt
|
#chown asterisk:asterisk /var/log/asterisk/sms.txt
|
#tail -f /var/log/asterisk/sms.txt
2013-04-12 12:08:27 - datacard0 - +380959386356: Тестирование ^C |
#less /etc/asterisk/extensions.conf
|