/l3/users/azhun/nt-voip-2014-apr/debian/root :1 :2 :3 :4 :5 :6 :7 :8 |
|
#/usr/local/bin/asterisk-festival.pl
EXEC Playback "/var/lib/asterisk/sounds/tts/tts-d41d8cd98f00b204e9800998ecf8427e" |
#ls -l
total 19792 drwxr-xr-x 2 user user 4096 Apr 22 13:07 Desktop drwxr-xr-x 2 user user 4096 Apr 22 13:07 Documents drwxr-xr-x 2 user user 4096 Apr 22 13:07 Downloads drwx------ 2 user user 4096 Apr 24 13:36 Mail drwxr-xr-x 2 user user 4096 Apr 22 13:07 Music drwxr-xr-x 2 user user 4096 Apr 22 13:07 Pictures drwxr-xr-x 2 user user 4096 Apr 22 13:07 Public drwxr-xr-x 2 user user 4096 Apr 22 13:07 Templates drwxr-xr-x 2 user user 4096 Apr 22 13:07 Videos -rw-r--r-- 1 root root 7077 Apr 24 15:45 belka.txt -rw-r--r-- 1 root root 9441018 Apr 24 15:47 belka.wav -rw-r--r-- 1 root root 8155 Apr 24 15:57 burunduki.txt -rw-r--r-- 1 root root 10766896 Apr 24 15:58 burunduki.wav drwxr-xr-x 2 root root 4096 Apr 24 15:35 test-play |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.28643.28313 2014-04-24 16:22:44.926225059 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 16:26:03.814228425 +0300 @@ -30,7 +30,9 @@ exten => 8100,n(vm),VoiceMailMain() - +exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/belki.txt) | +exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/burunduki.txt) | +exten => 8103,1,AGI(/usr/local/bin/asterisk-festival.pl ; ${VARIABLE:start:length} [macro-outgoingcall] |
#[default]
l3script: vim: command not found |
#vim /etc/asterisk/extensions.conf^C
|
#apt-get install vim
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: vim-runtime Suggested packages: ctags vim-doc vim-scripts The following NEW packages will be installed: vim vim-runtime 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. ... Setting up vim-runtime (2:7.3.547-7) ... Processing /usr/share/vim/addons/doc Setting up vim (2:7.3.547-7) ... update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode |
#vim /etc/asterisk/extensions.conf
|
#nano /etc/asterisk/extensions.conf
|
#[default]
total 19792 drwxr-xr-x 2 user user 4096 Apr 22 13:07 Desktop drwxr-xr-x 2 user user 4096 Apr 22 13:07 Documents drwxr-xr-x 2 user user 4096 Apr 22 13:07 Downloads drwx------ 2 user user 4096 Apr 24 13:36 Mail drwxr-xr-x 2 user user 4096 Apr 22 13:07 Music drwxr-xr-x 2 user user 4096 Apr 22 13:07 Pictures drwxr-xr-x 2 user user 4096 Apr 22 13:07 Public drwxr-xr-x 2 user user 4096 Apr 22 13:07 Templates drwxr-xr-x 2 user user 4096 Apr 22 13:07 Videos -rw-r--r-- 1 root root 7077 Apr 24 15:45 belka.txt -rw-r--r-- 1 root root 9441018 Apr 24 15:47 belka.wav -rw-r--r-- 1 root root 8155 Apr 24 15:57 burunduki.txt -rw-r--r-- 1 root root 10766896 Apr 24 15:58 burunduki.wav drwxr-xr-x 2 root root 4096 Apr 24 15:35 test-play |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.3855.22640 2014-04-24 16:28:35.930230990 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 16:28:59.638231391 +0300 @@ -30,7 +30,7 @@ exten => 8100,n(vm),VoiceMailMain() -exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/belki.txt) | +exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/belka.txt) | exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/burunduki.txt) | ;exten => 8103,1,AGI(/usr/local/bin/asterisk-festival.pl ; ${VARIABLE:start:length} |
#[default]
total 19792 drwxr-xr-x 2 user user 4096 Apr 22 13:07 Desktop drwxr-xr-x 2 user user 4096 Apr 22 13:07 Documents drwxr-xr-x 2 user user 4096 Apr 22 13:07 Downloads drwx------ 2 user user 4096 Apr 24 13:36 Mail drwxr-xr-x 2 user user 4096 Apr 22 13:07 Music drwxr-xr-x 2 user user 4096 Apr 22 13:07 Pictures drwxr-xr-x 2 user user 4096 Apr 22 13:07 Public drwxr-xr-x 2 user user 4096 Apr 22 13:07 Templates drwxr-xr-x 2 user user 4096 Apr 22 13:07 Videos -rw-r--r-- 1 root root 7077 Apr 24 15:45 belka.txt -rw-r--r-- 1 root root 9441018 Apr 24 15:47 belka.wav -rw-r--r-- 1 root root 8155 Apr 24 15:57 burunduki.txt -rw-r--r-- 1 root root 10766896 Apr 24 15:58 burunduki.wav drwxr-xr-x 2 root root 4096 Apr 24 15:35 test-play |
#asterisk -rv
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... -- Time to scan old dialplan and merge leftovers back into the new: 0.000858 sec -- Time to restore hints and swap in new dialplan: 0.000003 sec -- Time to delete the old dialplan: 0.000077 sec -- Total time merge_contexts_delete: 0.000938 sec == Using SIP RTP CoS mark 5 -- Executing [8101@gr1:1] AGI("SIP/3101-0000024e", "/usr/local/bin/asterisk-festival.pl /home/user/belka.txt") in new stack [Apr 24 16:29:32] WARNING[3865]: res_agi.c:1621 launch_script: Failed to execute '/usr/local/bin/asterisk-festival.pl /home/user/belka.txt': File does not exist. -- Auto fallthrough, channel 'SIP/3101-0000024e' status is 'UNKNOWN' debian*CLI> quit Executing last minute cleanups |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.23198.31463 2014-04-24 16:31:39.674234095 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 16:32:00.014234438 +0300 @@ -30,8 +30,8 @@ exten => 8100,n(vm),VoiceMailMain() -exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/belka.txt) | -exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl /home/user/burunduki.txt) | +exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/belka.txt) | +exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/burunduki.txt) | ;exten => 8103,1,AGI(/usr/local/bin/asterisk-festival.pl ; ${VARIABLE:start:length} |
#[default]
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... == Spawn extension (gr1, 8101, 1) exited non-zero on 'SIP/3101-0000024f' == Using SIP RTP CoS mark 5 -- Executing [8102@gr1:1] AGI("SIP/3101-00000250", "/usr/local/bin/asterisk-festival.pl,/home/user/burunduki.txt") in new stack -- Launched AGI Script /usr/local/bin/asterisk-festival.pl -- AGI Script Executing Application: (Playback) Options: (/var/lib/asterisk/sounds/tts/tts-7726ca6e8145e83a1ac38cadb9e05613) -- <SIP/3101-00000250> Playing '/var/lib/asterisk/sounds/tts/tts-7726ca6e8145e83a1ac38cadb9e05613.slin' (language 'en') -- <SIP/3101-00000250>AGI Script /usr/local/bin/asterisk-festival.pl completed, returning 4 == Spawn extension (gr1, 8102, 1) exited non-zero on 'SIP/3101-00000250' debian*CLI> quit Executing last minute cleanups |
#apt-get install libasterisk-agi-perl^C
|
#^C
|
#^C
|
#apt-get instll sendxmpp
E: Invalid operation instll |
#apt-get install sendxmpp
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libauthen-sasl-perl libnet-xmpp-perl libxml-stream-perl Suggested packages: libdigest-hmac-perl libgssapi-perl libnet-dns-perl The following NEW packages will be installed: libauthen-sasl-perl libnet-xmpp-perl libxml-stream-perl sendxmpp 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. ... Unpacking libxml-stream-perl (from .../libxml-stream-perl_1.23-2_all.deb) ... Selecting previously unselected package libnet-xmpp-perl. Unpacking libnet-xmpp-perl (from .../libnet-xmpp-perl_1.02-3_all.deb) ... Selecting previously unselected package sendxmpp. Unpacking sendxmpp (from .../sendxmpp_1.22-1_all.deb) ... Processing triggers for man-db ... Setting up libauthen-sasl-perl (2.1500-1) ... Setting up libxml-stream-perl (1.23-2) ... Setting up libnet-xmpp-perl (1.02-3) ... Setting up sendxmpp (1.22-1) ... |
#echo 'aster7@lab0.xgu.ru password' > /var/lib/asterisk/.sendxmpprc
|
#chmod 600 /var/lib/asterisk/.sendxmpprc
|
#chown +x asterisk:asterisk /var/lib/asterisk/.sendxmpprc
chown: invalid user: `+x' |
#chown asterisk:asterisk /var/lib/asterisk/.sendxmpprc
|
#cat /usr/local/bin/jabber-send
#!/bin/sh # $1 -- JID (Jabber-ID) of recipient # STDIN -- message /usr/bin/sendxmpp -i /var/lib/asterisk/.sendxmpprc "$1" |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.4125.8829 2014-04-24 16:54:34.570257328 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 16:58:34.226261381 +0300 @@ -50,10 +50,18 @@ ; ${ARG1} ; ${ARG2} -exten => s,1,Answer -exten => s,n,Monitor(wav,monitor,m) -exten => s,n,Dial(SIP/${ARG1},4) -exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) +;exten => s,1,Answer +;exten => s,n,Monitor(wav,monitor,m) +;exten => s,n,Dial(SIP/${ARG1},4) +;exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) +;exten => s,n,Goto(s-${DIALSTATUS},1) + +exten => s,1,NoOp(Answering ${MACRO_EXTEN}) | +exten => s,n,System(echo ${CALLERID(num)} is calling | /usr/local/bin/jabber-send user7@lab0.xgu.ru) | +exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) | +exten => s,n,Monitor(wav,${CALLFILENAME},m) | +exten => s,n,Dial(SIP/${ARG1},4) | +exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) | exten => s,n,Goto(s-${DIALSTATUS},1) exten => s-NOANSWER,1,NoOp(No Answer) |
#exten => 8100,n,Goto(vm)
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> quit Executing last minute cleanups |
#chown +x asterisk:asterisk /var/lib/asterisk/.sendxmpprc ^C
|
#^C
|
#nano /etc/asterisk/extensions.conf
|
#{ARG2}
aster7@lab0.xgu.ru password "/var/lib/asterisk/.sendxmpprc" 1L, 28C |
#~
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... -- SIP/3101-00000264 is busy == Everyone is busy/congested at this time (1:1/0/0) -- Executing [s@macro-localcall:6] NoOp("SIP/3101-00000263", "Dial Status: BUSY") in new stack -- Executing [s@macro-localcall:7] Goto("SIP/3101-00000263", "s-BUSY,1") in new stack -- Goto (macro-localcall,s-BUSY,1) -- Executing [s-BUSY@macro-localcall:1] Busy("SIP/3101-00000263", "") in new stack == Spawn extension (macro-localcall, s-BUSY, 1) exited non-zero on 'SIP/3101-00000263' in macro 'localcall' == Spawn extension (gr1, 3101, 1) exited non-zero on 'SIP/3101-00000263' debian*CLI> quit Executing last minute cleanups |
#nano /etc/asterisk/extensions.conf
|
#vim /etc/asterisk/extensions.conf
|
#asterisk -rv
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... == Using SIP RTP CoS mark 5 -- Executing [3101@gr1:1] Macro("SIP/3101-00000265", "localcall,3101") in new stack [Apr 24 17:11:55] WARNING[5978]: app_macro.c:311 _macro_exec: Context 'macro-localcall' for macro 'localcall' lacks 's' extension, priority 1 -- Auto fallthrough, channel 'SIP/3101-00000265' status is 'UNKNOWN' == Using SIP RTP CoS mark 5 -- Executing [3102@gr1:1] Macro("SIP/3101-00000266", "localcall,3102") in new stack [Apr 24 17:12:04] WARNING[5979]: app_macro.c:311 _macro_exec: Context 'macro-localcall' for macro 'localcall' lacks 's' extension, priority 1 -- Auto fallthrough, channel 'SIP/3101-00000266' status is 'UNKNOWN' debian*CLI> quit Executing last minute cleanups |
#vim /etc/asterisk/extensions.conf
|
#asterisk -rv
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... [Apr 24 17:12:32] WARNING[6005]: pbx.c:4466 pbx_extension_helper: No application 'Answer |' for extension (macro-localcall, s, 1) == Spawn extension (macro-localcall, s, 1) exited non-zero on 'SIP/3101-00000267' in macro 'localcall' == Spawn extension (gr1, 3101, 1) exited non-zero on 'SIP/3101-00000267' == Using SIP RTP CoS mark 5 -- Executing [3102@gr1:1] Macro("SIP/3101-00000268", "localcall,3102") in new stack [Apr 24 17:12:40] WARNING[6006]: pbx.c:4466 pbx_extension_helper: No application 'Answer |' for extension (macro-localcall, s, 1) == Spawn extension (macro-localcall, s, 1) exited non-zero on 'SIP/3101-00000268' in macro 'localcall' == Spawn extension (gr1, 3102, 1) exited non-zero on 'SIP/3101-00000268' debian*CLI> quit Executing last minute cleanups |
#vim /etc/asterisk/extensions.conf
|
#nano /etc/asterisk/extensions.conf
|
#[macro-localcall]
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. ========================================================================= Connected to Asterisk 1.8.13.1~dfsg1-3+deb7u3 currently running on debian (pid = 16994) Verbosity is at least 5 debian*CLI> dialplan reload ... -- Recording the message -- x=0, open writing: /var/spool/asterisk/voicemail/default/3102/tmp/CrewX9 format: wav49, 0x7fd09c6a4548 -- x=1, open writing: /var/spool/asterisk/voicemail/default/3102/tmp/CrewX9 format: gsm, 0x170da88 -- x=2, open writing: /var/spool/asterisk/voicemail/default/3102/tmp/CrewX9 format: wav, 0x171ab68 [Apr 24 17:14:28] WARNING[6042]: app.c:855 __ast_play_and_record: No audio available on SIP/3101-00000269?? -- User hung up == Spawn extension (macro-localcall, s-NOANSWER, 2) exited non-zero on 'SIP/3101-00000269' in macro 'localcall' == Spawn extension (gr1, 3102, 1) exited non-zero on 'SIP/3101-00000269' debian*CLI> quit Executing last minute cleanups |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.5252.13245 2014-04-24 17:15:04.722278115 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 17:17:10.074280233 +0300 @@ -30,9 +30,9 @@ exten => 8100,n(vm),VoiceMailMain() -exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/belka.txt) | -exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/burunduki.txt) | -;exten => 8103,1,AGI(/usr/local/bin/asterisk-festival.pl +exten => 8101,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/belka.txt) +exten => 8102,1,AGI(/usr/local/bin/asterisk-festival.pl,/home/user/burunduki.txt) +;exten => 8103,1,AGI(/usr/local/bin/asterisk-festival.pl ; ${VARIABLE:start:length} [macro-outgoingcall] @@ -58,11 +58,11 @@ ;exten => s,1,NoOp(Answering ${MACRO_EXTEN}) exten => s,1,Answer -exten => s,n,System(echo ${CALLERID(num)} is calling | /usr/local/bin/jabber-send user7@lab0.xgu.ru) -exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) | -exten => s,n,Monitor(wav,${CALLFILENAME},m) | -exten => s,n,Dial(SIP/${ARG1},4) | -exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) | +exten => s,n,System(echo ${CALLERID(num)} is calling | /usr/local/bin/jabber-send user7@lab0.xgu.ru) +exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) +exten => s,n,Monitor(wav,${CALLFILENAME},m) +exten => s,n,Dial(SIP/${ARG1},4) +exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s-NOANSWER,1,NoOp(No Answer) |
#{ARG2}
#!/bin/sh # $1 -- JID (Jabber-ID) of recipient # STDIN -- message /usr/bin/sendxmpp -f /var/lib/asterisk/.sendxmpprc "$1" |
#cat /usr/bin/sen
sendxmpp sensible-browser sensible-editor sensible-pager |
#cat /usr/bin/sen
sendxmpp sensible-browser sensible-editor sensible-pager |
#cat /usr/bin/sendxmpp
#!/usr/bin/perl -w eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}' if 0; # not running under some shell # # script to send message using xmpp (aka jabber), # somewhat resembling mail(1) # # Author: Dirk-Jan C. Binnema <djcb AT djcbsoftware.nl> # Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> # Copyright (c) 2004 - 2005 Dirk-Jan C. Binnema ... NOTE: be careful not the overload public jabber services =head1 SEE ALSO Documentation for the L<Net::XMPP> module The jabber homepage: L<http://www.jabber.org/> The sendxmpp homepage: L<http://sendxmpp.platon.sk> =head1 AUTHOR sendxmpp has been written by Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>, and uses the L<Net::XMPP> modules written by Ryan Eatmon. Current maintainer is Lubomir Host 'rajo' <rajo AT platon.sk>, L<http://rajo.platon.sk> =cut |
#cat /usr/local/bin/jabber-send
#!/bin/sh # $1 -- JID (Jabber-ID) of recipient # STDIN -- message /usr/bin/sendxmpp -f /var/lib/asterisk/.sendxmpprc "$1" |
#cat /var/lib/asterisk/.sendxmpprc
aster7@lab0.xgu.ru password |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.31551.6227 2014-04-24 17:25:37.566288810 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 17:27:29.206290693 +0300 @@ -56,9 +56,9 @@ ;exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) ;exten => s,n,Goto(s-${DIALSTATUS},1) -;exten => s,1,NoOp(Answering ${MACRO_EXTEN}) -exten => s,1,Answer -exten => s,n,System(echo ${CALLERID(num)} is calling | /usr/local/bin/jabber-send user7@lab0.xgu.ru) +exten => s,1,NoOp(Answering ${MACRO_EXTEN}) +;exten => s,1,Answer +exten => s,n,System(/usr/local/bin/jabber-send user0@lab0.xgu.ru ${CALLERID(num)} is calling) exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) exten => s,n,Monitor(wav,${CALLFILENAME},m) exten => s,n,Dial(SIP/${ARG1},4) @@ -67,6 +67,7 @@ exten => s-NOANSWER,1,NoOp(No Answer) exten => s-NOANSWER,n,VoiceMail(${MACRO_EXTEN}@default) + exten => s-CONGESTION,1,Dial(SIP/3102) exten => s-ANSWER,1,Hangup exten => s-BUSY,1,Busy |
#{ARG2}
|
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-24351.9015.19157 2014-04-24 17:29:31.346292759 +0300 +++ /etc/asterisk/extensions.conf 2014-04-24 17:29:47.550293033 +0300 @@ -58,7 +58,7 @@ exten => s,1,NoOp(Answering ${MACRO_EXTEN}) ;exten => s,1,Answer -exten => s,n,System(/usr/local/bin/jabber-send user0@lab0.xgu.ru ${CALLERID(num)} is calling) +exten => s,n,System(/usr/local/bin/jabber-send user7@lab0.xgu.ru ${CALLERID(num)} is calling) exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) exten => s,n,Monitor(wav,${CALLFILENAME},m) exten => s,n,Dial(SIP/${ARG1},4) |
#exten => 8100,n,Goto(vm)
you must own /var/lib/asterisk/.sendxmpprc |
#su - asterisk
|
#su -user
su: invalid option -- 'u' Usage: su [options] [LOGIN] Options: -c, --command COMMAND pass COMMAND to the invoked shell -h, --help display this help message and exit -, -l, --login make the shell a login shell -m, -p, --preserve-environment do not reset environment variables, and keep the same shell -s, --shell SHELL use SHELL instead of the default in passwd |
#su - user
l3-agent is already running: pid=19279; pidfile=/home/user/.lilalo/l3-agent.pid user@debian:~$ exit logout |
#su - asterisk
|
#echo hi | /usr/local/bin/jabber-send user7@lab0.xgu.ru
you must own /var/lib/asterisk/.sendxmpprc |
#echo hi | /usr/local/bin/jabber-send user7@lab0.xgu.ru^C
|
#^C
|
#include "/etc/asterisk/extensions.conf.local"
|
#date
Fri Apr 25 09:44:53 EEST 2014 |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-6759.9574.19537 2014-04-25 09:46:10.279282953 +0300 +++ /etc/asterisk/extensions.conf 2014-04-25 09:47:33.679284368 +0300 @@ -59,7 +59,7 @@ exten => s,1,NoOp(Answering ${MACRO_EXTEN}) ;exten => s,1,Answer exten => s,n,System(/usr/local/bin/jabber-send user7@lab0.xgu.ru ${CALLERID(num)} is calling) -exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) +exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${STRFTIME(${EPOCH},Europe/Kiev,"%Y-%m-%d-%H:%M:%S")}) exten => s,n,Monitor(wav,${CALLFILENAME},m) exten => s,n,Dial(SIP/${ARG1},4) exten => s,n,NoOp(Dial Status: ${DIALSTATUS}) |
#exten => 8100,n,Goto(vm)
[default] [internal] exten => _80XX,1,Answer exten => _80XX,n,Record(/var/tmp/asterisk/message${EXTEN:2}:gsm,10) exten => _80XX,n,Playback(/var/tmp/asterisk/message${EXTEN:2}) exten => _80XX,n,Hangup ;exten => 8100,1,VoiceMailMain() exten => 8100,1,Answer exten => 8100,n,Set(COUNTRY=${CALLERID(num):0:1}) exten => 8100,n,NoOp(COUNTRY=${COUNTRY}) ... include => fallback [gr2] include => internal include => local include => national include => fallback [gr3] include => internal include => local include => fallback |
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-6759.256.17899 2014-04-25 09:48:13.207285033 +0300 +++ /etc/asterisk/extensions.conf 2014-04-25 09:49:15.039286076 +0300 @@ -41,7 +41,7 @@ ; EPOCH = seconds since 1.01.1970 exten => s,1,Answer -exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${EPOCH}) +exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${STRFTIME(${EPOCH},Europe/Kiev,"%Y-%m-%d-%H:%M:%S")}) exten => s,n,Monitor(wav,${CALLFILENAME},m) exten => s,n,Dial(${ARG1}) |
#exten => 8100,n,Goto(vm)
|
#nano /etc/^C
|
#nano /etc/asterisk/extensions.conf
|
#include "/etc/asterisk/extensions.conf.local"
dictate/ meetme/ monitor/ outgoing/ system/ tmp/ voicemail/ |
#ls -l /var/spool/asterisk/monitor/
total 5288 -rw-rw---- 1 asterisk asterisk 645484 Apr 25 09:32 1101-3203-1398407502.wav -rw-rw---- 1 asterisk asterisk 118124 Apr 25 09:31 1102-3203-1398407476.wav -rw-rw---- 1 asterisk asterisk 157804 Apr 24 14:46 1202-3201-1398339974.wav -rw-rw---- 1 asterisk asterisk 129004 Apr 24 14:58 2201-3201-1398340724.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:06 3101-3101-1398348372.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:10 3101-3101-1398348629.wav -rw-rw---- 1 asterisk asterisk 33324 Apr 24 17:00 3101-3102-1398348026.wav -rw-rw---- 1 asterisk asterisk 117484 Apr 24 17:01 3101-3102-1398348049.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:38 3101-3102-1398350313.wav ... -rw-rw---- 1 asterisk asterisk 194604 Apr 24 10:52 3201-3101-1398325951.wav -rw-rw---- 1 asterisk asterisk 305964 Apr 24 13:29 3201-3101-1398335354.wav -rw-rw---- 1 asterisk asterisk 208044 Apr 24 17:05 3201-3101-1398348293.wav -rw-rw---- 1 asterisk asterisk 41004 Apr 24 17:38 3201-3101-1398350278.wav -rw-rw---- 1 asterisk asterisk 110124 Apr 25 09:50 3201-3101-2014-04-25-09:50:22.wav -rw-rw---- 1 asterisk asterisk 137004 Apr 24 14:47 3201-3301-1398340066.wav -rw-rw---- 1 asterisk asterisk 228844 Apr 24 14:48 3201-3301-1398340089.wav -rw-rw---- 1 asterisk asterisk 39724 Apr 24 13:29 3301-3201-1398335396.wav -rw-rw---- 1 asterisk asterisk 141484 Apr 24 14:53 3301-3201-1398340407.wav -rw-rw---- 1 asterisk asterisk 280684 Apr 24 14:53 monitor.wav |
#nano /etc/asterisk/extensions.conf
|
#exten => 8100,n,Goto(vm)
total 5712 -rw-rw---- 1 asterisk asterisk 645484 Apr 25 09:32 1101-3203-1398407502.wav -rw-rw---- 1 asterisk asterisk 118124 Apr 25 09:31 1102-3203-1398407476.wav -rw-rw---- 1 asterisk asterisk 157804 Apr 24 14:46 1202-3201-1398339974.wav -rw-rw---- 1 asterisk asterisk 129004 Apr 24 14:58 2201-3201-1398340724.wav -rw-rw---- 1 asterisk asterisk 220204 Apr 25 09:51 2201-3201-2014-04-25-09:51:35.wav -rw-rw---- 1 asterisk asterisk 212204 Apr 25 09:54 2201-3201-2014-04-25-09:54:01.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:06 3101-3101-1398348372.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:10 3101-3101-1398348629.wav -rw-rw---- 1 asterisk asterisk 33324 Apr 24 17:00 3101-3102-1398348026.wav ... -rw-rw---- 1 asterisk asterisk 194604 Apr 24 10:52 3201-3101-1398325951.wav -rw-rw---- 1 asterisk asterisk 305964 Apr 24 13:29 3201-3101-1398335354.wav -rw-rw---- 1 asterisk asterisk 208044 Apr 24 17:05 3201-3101-1398348293.wav -rw-rw---- 1 asterisk asterisk 41004 Apr 24 17:38 3201-3101-1398350278.wav -rw-rw---- 1 asterisk asterisk 110124 Apr 25 09:50 3201-3101-2014-04-25-09:50:22.wav -rw-rw---- 1 asterisk asterisk 137004 Apr 24 14:47 3201-3301-1398340066.wav -rw-rw---- 1 asterisk asterisk 228844 Apr 24 14:48 3201-3301-1398340089.wav -rw-rw---- 1 asterisk asterisk 39724 Apr 24 13:29 3301-3201-1398335396.wav -rw-rw---- 1 asterisk asterisk 141484 Apr 24 14:53 3301-3201-1398340407.wav -rw-rw---- 1 asterisk asterisk 280684 Apr 24 14:53 monitor.wav |
#ls -l /var/spool/asterisk/monitor/
total 5924 -rw-rw---- 1 asterisk asterisk 645484 Apr 25 09:32 1101-3203-1398407502.wav -rw-rw---- 1 asterisk asterisk 118124 Apr 25 09:31 1102-3203-1398407476.wav -rw-rw---- 1 asterisk asterisk 157804 Apr 24 14:46 1202-3201-1398339974.wav -rw-rw---- 1 asterisk asterisk 129004 Apr 24 14:58 2201-3201-1398340724.wav -rw-rw---- 1 asterisk asterisk 220204 Apr 25 09:51 2201-3201-2014-04-25-09:51:35.wav -rw-rw---- 1 asterisk asterisk 212204 Apr 25 09:54 2201-3201-2014-04-25-09:54:01.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:06 3101-3101-1398348372.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:10 3101-3101-1398348629.wav -rw-rw---- 1 asterisk asterisk 33324 Apr 24 17:00 3101-3102-1398348026.wav ... -rw-rw---- 1 asterisk asterisk 194604 Apr 24 10:52 3201-3101-1398325951.wav -rw-rw---- 1 asterisk asterisk 305964 Apr 24 13:29 3201-3101-1398335354.wav -rw-rw---- 1 asterisk asterisk 208044 Apr 24 17:05 3201-3101-1398348293.wav -rw-rw---- 1 asterisk asterisk 41004 Apr 24 17:38 3201-3101-1398350278.wav -rw-rw---- 1 asterisk asterisk 110124 Apr 25 09:50 3201-3101-2014-04-25-09:50:22.wav -rw-rw---- 1 asterisk asterisk 137004 Apr 24 14:47 3201-3301-1398340066.wav -rw-rw---- 1 asterisk asterisk 228844 Apr 24 14:48 3201-3301-1398340089.wav -rw-rw---- 1 asterisk asterisk 39724 Apr 24 13:29 3301-3201-1398335396.wav -rw-rw---- 1 asterisk asterisk 141484 Apr 24 14:53 3301-3201-1398340407.wav -rw-rw---- 1 asterisk asterisk 280684 Apr 24 14:53 monitor.wav |
#ls -l /var/spool/asterisk/monitor/
total 6184 -rw-rw---- 1 asterisk asterisk 645484 Apr 25 09:32 1101-3203-1398407502.wav -rw-rw---- 1 asterisk asterisk 118124 Apr 25 09:31 1102-3203-1398407476.wav -rw-rw---- 1 asterisk asterisk 157804 Apr 24 14:46 1202-3201-1398339974.wav -rw-rw---- 1 asterisk asterisk 129004 Apr 24 14:58 2201-3201-1398340724.wav -rw-rw---- 1 asterisk asterisk 220204 Apr 25 09:51 2201-3201-2014-04-25-09:51:35.wav -rw-rw---- 1 asterisk asterisk 212204 Apr 25 09:54 2201-3201-2014-04-25-09:54:01.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:06 3101-3101-1398348372.wav -rw-rw---- 1 asterisk asterisk 44 Apr 24 17:10 3101-3101-1398348629.wav -rw-rw---- 1 asterisk asterisk 33324 Apr 24 17:00 3101-3102-1398348026.wav ... -rw-rw---- 1 asterisk asterisk 208044 Apr 24 17:05 3201-3101-1398348293.wav -rw-rw---- 1 asterisk asterisk 41004 Apr 24 17:38 3201-3101-1398350278.wav -rw-rw---- 1 asterisk asterisk 110124 Apr 25 09:50 3201-3101-2014-04-25-09:50:22.wav -rw-rw---- 1 asterisk asterisk 137004 Apr 24 14:47 3201-3301-1398340066.wav -rw-rw---- 1 asterisk asterisk 228844 Apr 24 14:48 3201-3301-1398340089.wav -rw-rw---- 1 asterisk asterisk 57484 Apr 25 10:02 3301-3101-2014-04-25-10:02:21.wav -rw-rw---- 1 asterisk asterisk 141004 Apr 25 10:02 3301-3101-2014-04-25-10:02:38.wav -rw-rw---- 1 asterisk asterisk 39724 Apr 24 13:29 3301-3201-1398335396.wav -rw-rw---- 1 asterisk asterisk 141484 Apr 24 14:53 3301-3201-1398340407.wav -rw-rw---- 1 asterisk asterisk 280684 Apr 24 14:53 monitor.wav |
#nano /etc/asterisk/extensions.conf
|
#exten => 8100,n,Goto(vm)
Reading package lists... Done Building dependency tree Reading state information... Done sudo is already the newest version. sudo set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. |
#nano /usr/share/
|
#ls /usr/share/
GConf fonts i18n perl GeoIP freetds iagno perl5 ImageMagick-6.7.7 games icedtea-web pixmaps PackageKit gcalctool iceweasel pkgconfig X11 gconf icons plymouth aclocal gcr-3 idl po-debconf acpi-support gdebi images polkit-1 adduser gdict-1.0 info poppler aisleriot gdm initramfs-tools ppp alacarte gedit inkscape pstoedit ... empathy gtksourceview-3.0 netpbm xml-core enchant guile nfs-common xsessions eog gupnp-dlna nm-applet xulrunner-24.0 evince gvfs nmap yelp evolution hal numpy yelp-xsl evolution-data-server-3.4 hamster-applet omf zenity farstream help orca zoneinfo festival hunspell os-prober file hwdata pam file-roller hyphen pam-configs |
#nano /usr/local/bin/restart-samba
--- /dev/null 2014-04-22 13:06:30.798645062 +0300 +++ /usr/local/bin/restart-samba 2014-04-25 10:18:15.623315488 +0300 @@ -0,0 +1,3 @@ +# /bin/sh + +/etc/init.d/samba restart |
#/bin/sh
# See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d [ Wrote 28 lines ] What now? Options are: (e)dit sudoers file again e(x)it without saving changes to sudoers file (Q)uit and save changes to sudoers file (DANGER!) What now? Options are: (e)dit sudoers file again e(x)it without saving changes to sudoers file (Q)uit and save changes to sudoers file (DANGER!) What now? x |
#visudo
# directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL asterisk ALL=(ALL:ALL) ALL /usr/local/bin/restart-samba # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos Use "fg" to return to nano.y ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell [1]+ Stopped visudo |
#visudo
visudo: /etc/sudoers busy, try again later |
#visudo
visudo: /etc/sudoers busy, try again later |
#visudo^C
|
#^C
|
#^C
|
#^C
|
#^C
|
#visudo
visudo: /etc/sudoers busy, try again later |
#pkill visudo
|
#nano visudo
|
#ps aux | grep visudo
root 8703 0.0 0.0 12636 844 pts/3 T 10:19 0:00 visudo root 8864 0.0 0.0 6304 600 pts/3 S+ 10:21 0:00 grep visudo |
#kill -9 8703
Received SIGHUP or SIGTERM Buffer written to /etc/sudoers.tmp.save [1]+ Killed visudo |
#ps aux | grep visudo
root 8881 0.0 0.0 6304 600 pts/3 S+ 10:22 0:00 grep visudo |
#visudo
# Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL asterisk ALL=(ALL:ALL) ALL /usr/local/bin/restart-samba #includedir /etc/sudoers.d [ Wrote 28 lines ] What now? Options are: (e)dit sudoers file again e(x)it without saving changes to sudoers file (Q)uit and save changes to sudoers file (DANGER!) What now? Q |
#vim /etc/sudoers
|
#~
|
#!/bin/sh
|
#nano /etc/asterisk/extensions.conf
--- /tmp/l3-saved-6759.24749.6903 2014-04-25 10:26:26.495323785 +0300 +++ /etc/asterisk/extensions.conf 2014-04-25 10:28:50.683326217 +0300 @@ -58,7 +58,8 @@ exten => s,1,NoOp(Answering ${MACRO_EXTEN}) ;exten => s,1,Answer -exten => s,n,System(/usr/local/bin/jabber-send user7@lab0.xgu.ru ${CALLERID(num)} is calling) +;exten => s,n,System(/usr/local/bin/jabber-send user7@lab0.xgu.ru ${CALLERID(num)} is calling) +exten => s,n,System(/usr/local/bin/restart-samba) exten => s,n,Set(CALLFILENAME=${MACRO_EXTEN}-${CALLERID(num)}-${STRFTIME(${EPOCH},Europe/Kiev,"%Y-%m-%d-%H:%M:%S")}) exten => s,n,Monitor(wav,${CALLFILENAME},m) exten => s,n,Dial(SIP/${ARG1},4) |
#[default]
|
#[default]
# # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL asterisk ALL=(ALL:ALL) ALL /usr/local/bin/restart-samba # See sudoers(5) for more information on "#include" directives: "/etc/sudoers" [readonly] 28L, 725C #includedir /etc/sudoers.d |
#~
|
#chown asterisk:asterisk /usr/local/bin/restart-samba
|
sendxmpp sensible-browser sensible-editor sensible-pager
#!/usr/bin/perl -w eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}' if 0; # not running under some shell # # script to send message using xmpp (aka jabber), # somewhat resembling mail(1) # # Author: Dirk-Jan C. Binnema <djcb AT djcbsoftware.nl> # Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> # Copyright (c) 2004 - 2005 Dirk-Jan C. Binnema # Copyright (c) 2006 - 2009 Lubomir Host 'rajo' # # Homepage: http://sendxmpp.platon.sk # # Released under the terms of the GNU General Public License v2 # # $Platon: sendxmpp/sendxmpp,v 1.22 2010-10-03 19:36:35 rajo Exp $ # $Id: $ use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed use Net::XMPP; use Getopt::Long; use strict; use open ':utf8'; use open ':std'; # subroutines decls sub xmpp_login($$$$$$$$$); sub xmpp_send ($$$$); sub xmpp_send_raw_xml($$); sub xmpp_send_message($$$$$$); sub xmpp_send_chatroom_message($$$$$); sub xmpp_logout($); sub xmpp_check_result; sub parse_cmdline(); sub error_exit; sub debug_print; sub read_config_file($); sub push_hash($$); sub terminate(); sub main(); my # MakeMaker $VERSION = [ q$Revision: 1.22 $ =~ m/(\S+)\s*$/g ]->[0]; my $RESOURCE = 'sendxmpp'; my $VERBOSE = 0; my $DEBUG = 0; # http://tools.ietf.org/html/rfc3921#section-2 section 2.1.1 - Types of Message my @suppported_message_types = qw( chat error groupchat headline ); my $message_type = 'chat'; # default message type # start! &main; # # main: main routine # sub main () { my $cmdline = parse_cmdline(); $| = 1; # no output buffering $DEBUG = 1 if ($$cmdline{'debug'}); $VERBOSE = 1 if ($$cmdline{'verbose'}); my $config = read_config_file ($$cmdline{'file'}) unless ($$cmdline{'jserver'} && $$cmdline{'username'} && $$cmdline{'password'}); # login to xmpp my $cnx = xmpp_login ($$cmdline{'jserver'} || $$config{'jserver'}, $$cmdline{'port'} || $$config{'port'} || ($$cmdline{'ssl'} ? 5223 : 5222), $$cmdline{'username'} || $$config{'username'}, $$cmdline{'password'} || $$config{'password'}, $$cmdline{'component'}|| $$config{'component'}, $$cmdline{'resource'}, $$cmdline{'tls'}, $$cmdline{'ssl'}, $$cmdline{'debug'}) or error_exit("cannot login: $!"); # read message from STDIN or or from -m/--message parameter if (!$$cmdline{interactive}) { # the non-interactive case my $txt; my $message = $$cmdline{'message'}; if ($message) { open (MSG, "<$message") or error_exit ("cannot open message file '$message': $!"); while (<MSG>) { $txt .= $_ }; close(MSG); } else { $txt .= $_ while (<STDIN>); } xmpp_send ($cnx,$cmdline,$config,$txt); } else { # the interactive case, read stdin line by line # deal with TERM $main::CNX = $cnx; $SIG{INT}=\&terminate; # line by line... while (<STDIN>) { chomp; xmpp_send ($cnx,$cmdline,$config,$_); } } xmpp_logout($cnx); exit 0; } # # read_config_file: read the configuration file # input: filename # output: hash with 'user', 'jserver' and 'password' keys # sub read_config_file ($) { # check permissions my $cfg_file = shift; error_exit ("cannot read $cfg_file: $!") unless (-r $cfg_file); my $owner = (stat _ )[4]; error_exit ("you must own $cfg_file") unless ($owner == $>); my $mode = (stat _ )[2] & 07777; error_exit ("$cfg_file must not be accessible by others") if ($mode & 0077); open (CFG,"<$cfg_file") or error_exit("cannot open $cfg_file for reading: $!"); my %config; my $line = 0; while (<CFG>) { ++$line; next if (/^\s*$/); # ignore empty lines next if (/^\s*\#.*/); # ignore comment lines #s/\#.*$//; # ignore comments in lines # Hugo van der Kooij <hvdkooij AT vanderkooij.org> has account with '#' as username if (/([\.\w_#-]+)@([-\.\w:;]+)\s+(\S+)\s*(\S+)?$/) { %config = ( 'username' => $1, 'jserver' => $2, 'port' => 0, 'password' => $3, 'component' => $4, ); } else { close CFG; error_exit ("syntax error in line $line of $cfg_file"); } # account with weird port number if ($config{'jserver'} =~ /(.*):(\d+)/) { $config{'jserver'} = $1; $config{'port'} = $2; } # account with specific connection host if ($config{'jserver'} =~ /(.*);([-\.\w]+)/) { $config{'jserver'} = $2; $config{'username'} .= "\@$1" unless $config{'component'}; } } close CFG; error_exit ("no correct config found in $cfg_file") unless (scalar(%config)); if ($DEBUG || $VERBOSE) { while (my ($key,$val) = each %config) { debug_print ("config: '$key' => '$val'"); } } return \%config; } # # parse_cmdline: parse commandline options # output: hash with commandline options # sub parse_cmdline () { usage() unless (scalar(@ARGV)); my ($subject,$file,$resource,$jserver,$port,$username,$password,$component, $message, $chatroom, $headline, $debug, $tls, $ssl, $interactive, $help, $raw, $verbose); my $res = GetOptions ('subject|s=s' => \$subject, 'file|f=s' => \$file, 'resource|r=s' => \$resource, 'jserver|j=s' => \$jserver, 'component|o=s' => \$component, 'username|u=s' => \$username, 'password|p=s' => \$password, 'message|m=s' => \$message, 'headline|l' => \$headline, 'message-type=s' => \$message_type, 'chatroom|c' => \$chatroom, 'tls|t' => \$tls, 'ssl|e' => \$ssl, 'interactive|i' => \$interactive, 'help|usage|h' => \$help, 'debug|d' => \$debug, 'raw|w' => \$raw, 'verbose|v' => \$verbose); usage () if ($help); my @rcpt = @ARGV; if (defined($raw) && scalar(@rcpt) > 0) { error_exit("You must give a recipient or --raw (but not both)"); } if ($raw && $subject) { error_exit("You cannot specify a subject in raw XML mode"); } if ($raw && $chatroom) { error_exit("The chatroom option is pointless in raw XML mode"); } if ($message && $interactive) { error_exit("Cannot have both -m (--message) and -i (--interactive)"); } if (scalar(grep { $message_type eq $_ } @suppported_message_types) == 0) { error_exit("Unsupported message type '$message_type'"); } if ($ssl && $tls) { error_exit("Connect securely wether using -e (--ssl) or -t (--tls)"); } if ($headline) { # --headline withouth --message-type if ($message_type eq 'message') { $message_type = 'headline' } else { error_exit("Options --headline and --message-type are mutually exclusive"); } } if ($jserver && $jserver =~ /(.*):(\d+)/) { $jserver = $1; $port = $2; } my %dict = ('subject' => ($subject or ''), 'message' => ($message or ''), 'resource' => ($resource or $RESOURCE), 'jserver' => ($jserver or ''), 'component' => ($component or ''), 'port' => ($port or 0), 'username' => ($username or ''), 'password' => ($password or ''), 'chatroom' => ($chatroom or 0), 'message-type' => $message_type, 'interactive' => ($interactive or 0), 'tls' => ($tls or 0), 'ssl' => ($ssl or 0), 'debug' => ($debug or 0), 'verbose' => ($verbose or 0), 'raw' => ($raw or 0), 'file' => ($file or ($ENV{'HOME'}.'/.sendxmpprc')), 'recipient' => \@rcpt); if ($DEBUG || $VERBOSE) { while (my ($key,$val) = each %dict) { debug_print ("cmdline: '$key' => '$val'"); } } return \%dict; } # # xmpp_login: login to the xmpp (jabber) server # input: hostname,port,username,password,resource,tls,ssl,debug # output: an XMPP connection object # sub xmpp_login ($$$$$$$$$) { my ($host, $port, $user, $pw, $comp, $res, $tls, $ssl, $debug) = @_; my $cnx = new Net::XMPP::Client(debuglevel=>($debug?2:0)); error_exit "could not create XMPP client object: $!" unless ($cnx); my @res; my $arghash = { hostname => $host, port => $port, tls => $tls, ssl => $ssl, connectiontype => 'tcpip', componentname => $comp }; delete $arghash->{port} unless $port; if ($arghash->{port}) { @res = $cnx->Connect(%$arghash); error_exit ("Could not connect to '$host' on port $port: $@") unless @res; } else { @res = $cnx->Connect(%$arghash); error_exit ("Could not connect to server '$host': $@") unless @res; } xmpp_check_result("Connect",\@res,$cnx); if ($comp) { my $sid = $cnx->{SESSION}->{id}; $cnx->{STREAM}->{SIDS}->{$sid}->{hostname} = $comp } @res = $cnx->AuthSend(#'hostname' => $host, 'username' => $user, 'password' => $pw, 'resource' => $res); xmpp_check_result('AuthSend',\@res,$cnx); return $cnx; } # # xmmp_send: send the message, determine from cmdline # whether it's to individual or chatroom # sub xmpp_send ($$$$) { my ($cnx, $cmdline, $config, $txt) = @_; unless ($$cmdline{'chatroom'}) { unless ($$cmdline{'raw'}) { map { xmpp_send_message ($cnx, $_, #$$cmdline{'recipient'}, $$cmdline{'component'} || $$config{'component'}, $$cmdline{'subject'}, $$cmdline{'message-type'}, $txt) } @{$$cmdline{'recipient'}}; } else { xmpp_send_raw_xml ($cnx, $txt); } } else { map { xmpp_send_chatroom_message ($cnx, $$cmdline{'resource'}, $$cmdline{'subject'}, $_, # $$cmdline{'recipient'}, $txt) } @{$$cmdline{'recipient'}}; } } # # xmpp_send_raw_xml: send a raw XML packet # input: connection,packet # sub xmpp_send_raw_xml ($$) { my ($cnx,$packet) = @_; # for some reason, Send does not return anything $cnx->Send($packet); xmpp_check_result('Send',0,$cnx); } # # xmpp_send_message: send a message to some xmpp user # input: connection,recipient,subject,msg # sub xmpp_send_message ($$$$$$) { my ($cnx, $rcpt, $comp, $subject, $message_type, $msg) = @_; # for some reason, MessageSend does not return anything # mimeit01@xmpp.hs-esslingen.de: if $comp IS set, AND the rcpt DOESN'T contain an @, then @comp is added $cnx->MessageSend('to' => $rcpt . ( ($comp && index($rcpt, "@") == -1) ? "\@$comp" : '' ), 'type' => $message_type, 'subject' => $subject, 'body' => $msg); xmpp_check_result('MessageSend',0,$cnx); } # # xmpp_send_chatroom_message: send a message to a chatroom # input: connection,resource,subject,recipient,message # sub xmpp_send_chatroom_message ($$$$$) { my ($cnx,$resource,$subject,$rcpt,$msg) = @_; # set the presence my $pres = new Net::XMPP::Presence; my $res = $pres->SetTo("$rcpt/$resource"); $cnx->Send($pres); # create/send the message my $groupmsg = new Net::XMPP::Message; $groupmsg->SetMessage(to => $rcpt, body => $msg, type => 'groupchat'); $res = $cnx->Send($groupmsg); xmpp_check_result ('Send',$res,$cnx); # leave the group $pres->SetPresence (Type=>'unavailable',To=>$rcpt); } # # xmpp_logout: log out from the xmpp server # input: connection # sub xmpp_logout($) { # HACK # messages may not be received if we log out too quickly... sleep 1; my $cnx = shift; $cnx->Disconnect(); xmpp_check_result ('Disconnect',0); # well, nothing to check, really } # # xmpp_check_result: check the return value from some xmpp function execution # input: text, result, [connection] # sub xmpp_check_result { my ($txt, $res, $cnx)=@_; error_exit ("Error '$txt': result undefined") unless (defined $res); # res may be 0 if ($res == 0) { debug_print "$txt"; # result can be true or 'ok' } elsif ((@$res == 1 && $$res[0]) || $$res[0] eq 'ok') { debug_print "$txt: " . $$res[0]; # otherwise, there is some error } else { my $errmsg = $cnx->GetErrorCode() || '?'; error_exit ("Error '$txt': " . join (': ',@$res) . "[$errmsg]", $cnx); } } # # terminate; exit the program upon TERM sig reception # sub terminate () { debug_print "caught TERM"; xmpp_logout($main::CNX); exit 0; } # # debug_print: print the data if defined and DEBUG || VERBOSE is TRUE # input: [array of strings] # sub debug_print { print STDERR "sendxmpp: " . (join ' ', @_) . "\n" if (@_ && ($DEBUG ||$VERBOSE)); } # # error_exit: print error message and exit the program # logs out if there is a connection # input: error, [connection] # sub error_exit { my ($err,$cnx) = @_; print STDERR "$err\n"; xmpp_logout ($cnx) if ($cnx); exit 1; } # # usage: print short usage message and exit # sub usage () { print STDERR "sendxmpp version $VERSION\n" . "Copyright (c) 2004 - 2005 Dirk-Jan C. Binnema\n" . "Copyright (c) 2006 - 2007 Lubomir Host 'rajo'\n" . "usage: sendxmpp [options] <recipient1> [<recipient2> ...]\n" . "or refer to the the sendxmpp manpage\n"; exit 0; } # # the fine manual # =pod =head1 NAME sendxmpp - send xmpp messages from the commandline. =head1 SYNOPSIS sendxmpp [options] <recipient1> [<recipient2> ...] sendxmpp --raw [options] =head1 DESCRIPTION sendxmpp is a program to send XMPP (Jabber) messages from the commandline, not unlike L<mail(1)>. Messages can be sent both to individual recipients and chatrooms. =head1 OPTIONS =over =item B<-f>,B<--file> I<file> Use I<file> configuration file instead of F<~/.sendxmpprc> =item B<-u>,B<--username> I<user> Use I<user> instead of the one in the configuration file =item B<-p>,B<--password> I<password> Use I<password> instead of the one in the configuration file =item B<-j>,B<--jserver> I<server> Use jabber I<server> instead of the one in the configuration file. =item B<-o>,B<--component> I<componentname> Use componentname in connect call. Seems needed for Google talk. =item B<-r>,B<--resource> I<res> Use resource I<res> for the sender [default: 'sendxmpp']; when sending to a chatroom, this determines the 'alias' =item B<-t>,B<--tls> Connect securely, using TLS =item B<-e>,B<--ssl> Connect securely, using SSL =item B<-l>,B<--headline> Backward compatibility option. You should use B<--message-type=headline> instead. Send a headline type message (not stored in offline messages) =item B<--messages-type> Set type of message. Supported types are: B<message chat headline>. Default message type is B<message>. Headline type message can be set also with B<--headline> option, see B<--headline> =item B<-c>,B<--chatroom> Send the message to a chatroom =item B<-s>,B<--subject> I<subject> Set the subject for the message to I<subject> [default: '']; when sending to a chatroom, this will set the subject for the chatroom =item B<-m>,B<--message> I<message> Read the message from I<message> (a file) instead of stdin =item B<-i>,B<--interactive> Work in interactive mode, reading lines from stdin and sending the one-at-time =item B<-w>,B<--raw> Send raw XML message to jabber server =item B<-v>,B<--verbose> Give verbose output about what is happening =item B<-h>,B<--help>,B<--usage> Show a 'Usage' message =item B<-d>,B<--debug> Show debugging info while running. B<WARNING>: This will include passwords etc. so be careful with the output! =back =head1 CONFIGURATION FILE You may define a 'F<~/.sendxmpprc>' file with the necessary data for your xmpp-account, with a line of the format: =over I<user>@I<server> I<password> I<componentname> =back e.g.: # my account alice@jabber.org secret ('#' and newlines are allowed like in shellscripts). You can add a I<host> (or IP address) if it is different from the I<server> part of your JID: # account with specific connection host alice@myjabberserver.com;foo.com secret You can also add a I<port> if it is not the standard XMPP port: # account with weird port number alice@myjabberserver.com:1234 secret Of course, you may also mix the two: # account with a specific host and port alice@myjabberserver.com;foo.com:1234 secret B<NOTE>: for your security, sendxmpp demands that the configuration file is owned by you and readable only to you (permissions 600). =head1 EXAMPLE $ echo "hello bob!" | sendxmpp -s hello someone@jabber.org or to send to a chatroom: $ echo "Dinner Time" | sendxmpp -r TheCook --chatroom test2@conference.jabber.org or to send your system logs somewhere, as new lines appear: $ tail -f /var/log/syslog | sendxmpp -i sysadmin@myjabberserver.com NOTE: be careful not the overload public jabber services =head1 SEE ALSO Documentation for the L<Net::XMPP> module The jabber homepage: L<http://www.jabber.org/> The sendxmpp homepage: L<http://sendxmpp.platon.sk> =head1 AUTHOR sendxmpp has been written by Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>, and uses the L<Net::XMPP> modules written by Ryan Eatmon. Current maintainer is Lubomir Host 'rajo' <rajo AT platon.sk>, L<http://rajo.platon.sk> =cut
#!/bin/sh # $1 -- JID (Jabber-ID) of recipient # STDIN -- message /usr/bin/sendxmpp -f /var/lib/asterisk/.sendxmpprc "$1"
aster7@lab0.xgu.ru password
Время первой команды журнала | 15:20:24 2014- 4-24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Время последней команды журнала | 09:33:50 2014- 4-25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в журнале | 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент команд с ненулевым кодом завершения, % | 12.87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент синтаксически неверно набранных команд, % | 0.99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Суммарное время работы с терминалом *, час | 2.22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в единицу времени, команда/мин | 0.76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ 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 |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1 2 3 4Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008