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

Содержание

Журнал

Вторник (10/26/10)

/dev/pts/0
09:36:54
#rm /etc/asterisk/.sip.conf.sw*

09:38:09
#vi /etc/asterisk/extensions.conf
--- /tmp/l3-saved-3961.21773.23764	2010-10-26 10:44:46.000000000 +0300
+++ /etc/asterisk/extensions.conf	2010-10-26 10:46:40.000000000 +0300
@@ -554,7 +554,17 @@
 exten =>2299,n,Playback(demo-thanks)
 exten =>2299,n,Hangup
 
+exten => _22XX,1,Dial(SIP/${EXTEN})
+exten => _22XXX,1,Dial(SIP/1${EXTEN:1:4})
+
+exten => _68XX,1,Wait(2)
+exten => _68XX,n,Playback(/tmp/warning1)
+exten => _68XX,n,Dial(SIP/22${EXTEN:2})
+
+
 exten =>2201,1,Dial(SIP/2201)
 exten =>2202,2,DIal(SIP/2202)
 ;exten =>2201,1,Dial(SIP/2201)
 exten =>2298,1,Record(/tmp/warning1:gsm,,3)
+
+
прошла 21 минута
/dev/pts/2
09:59:41
#vi /etc/asterisk/extensions.conf
прошло 10 минут
/dev/pts/4
10:10:02
#ping 192.168.110.1
PING 192.168.110.1 (192.168.110.1) 56(84) bytes of data.
64 bytes from 192.168.110.1: icmp_seq=1 ttl=63 time=0.191 ms
64 bytes from 192.168.110.1: icmp_seq=2 ttl=63 time=0.220 ms
^C
--- 192.168.110.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.191/0.205/0.220/0.020 ms
10:10:12
#ping 192.168.109.1
PING 192.168.109.1 (192.168.109.1) 56(84) bytes of data.
64 bytes from 192.168.109.1: icmp_seq=1 ttl=63 time=0.434 ms
^C
--- 192.168.109.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.434/0.434/0.434/0.000 ms
10:10:16
#namp 192.168.109.1
bash: namp: command not found
10:10:22
#nmap 192.168.109.1
Starting Nmap 4.62 ( http://nmap.org ) at 2010-10-26 11:10 EEST
Interesting ports on 192.168.109.1:
Not shown: 1712 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
111/tcp  open  rpcbind
2000/tcp open  callbook
Nmap done: 1 IP address (1 host up) scanned in 0.077 seconds
10:10:26
#nmap 192.168.110.1
Starting Nmap 4.62 ( http://nmap.org ) at 2010-10-26 11:10 EEST
Interesting ports on 192.168.110.1:
Not shown: 1713 closed ports
PORT     STATE SERVICE
111/tcp  open  rpcbind
2000/tcp open  callbook
Nmap done: 1 IP address (1 host up) scanned in 0.087 seconds
10:10:35
#nmap 192.168.112.1
Starting Nmap 4.62 ( http://nmap.org ) at 2010-10-26 11:10 EEST
Interesting ports on 192.168.112.1:
Not shown: 1712 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
111/tcp  open  rpcbind
2000/tcp open  callbook
Nmap done: 1 IP address (1 host up) scanned in 0.197 seconds
10:10:48
#cat /etc/asterisk/sip.conf
[general]
context=default                 ; Default context for incoming calls
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
register=>mn:1234@192.168.111.1/bb
register=>mn:1234@192.168.110.1/br
register=>mn:1234@192.168.109.1/gm
[authentication]
...
[br]
type=friend
secret=1234
host=dynamic
username=mn
[gm]
type=friend
secret=1234
host=dynamic
username=mn
10:15:32
#vi /etc/asterisk/sip.conf
10:17:43
#asterisk -rx "sip reload"

/dev/pts/6
10:18:36
#asterisk -rcvvvv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
    -- Executing [2202@default:2] Dial("SIP/2203-095c0140", "SIP/2202") in new stack
    -- Called 2202
    -- SIP/2202-095c8030 is ringing
    -- Got SIP response 486 "Busy Here" back from 192.168.112.2
    -- SIP/2202-095c8030 is busy
  == Everyone is busy/congested at this time (1:1/0/0)
  == Auto fallthrough, channel 'SIP/2203-095c0140' status is 'BUSY'
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
10:24:10
#vi /etc/asterisk/sip.conf
--- /tmp/l3-saved-4784.12021.31995	2010-10-26 11:24:23.000000000 +0300
+++ /etc/asterisk/sip.conf	2010-10-26 11:25:45.000000000 +0300
@@ -26,6 +26,10 @@
 secret=1234
 host=dynamic
 
+[2204]
+type=friend
+secret=1234
+host=dynamic
 
 [bb]
 type=friend
10:25:45
#asterisk -rcv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
    -- Added extension '_68XX' priority 3 to default
    -- Added extension '2201' priority 1 to default
    -- Added extension '2202' priority 2 to default
    -- Added extension '2203' priority 3 to default
    -- Added extension '2204' priority 4 to default
    -- Added extension '2298' priority 1 to default
  == Parsing '/etc/asterisk/users.conf': Found
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
/dev/pts/0
10:33:15
#asterisk -rcv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
[Oct 26 11:34:36] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #3)
[Oct 26 11:34:56] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #4)
[Oct 26 11:35:16] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #5)
[Oct 26 11:35:36] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #6)
[Oct 26 11:35:56] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #7)
[Oct 26 11:36:16] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #8)
[Oct 26 11:36:36] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #9)
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
10:36:46
#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1b:fc:7d:bb:37
          inet addr:192.168.112.1  Bcast:192.168.112.255  Mask:255.255.255.0
          inet6 addr: fe80::21b:fcff:fe7d:bb37/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18668 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14422 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:3574640 (3.4 MiB)  TX bytes:2151137 (2.0 MiB)
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3488 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3488 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:166174 (162.2 KiB)  TX bytes:166174 (162.2 KiB)
10:36:50
#asterisk -rcv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
[Oct 26 11:38:15] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #1)
[Oct 26 11:38:35] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #2)
[Oct 26 11:38:55] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #3)
[Oct 26 11:39:09] NOTICE[2616]: chan_sip.c:15642 handle_request_register: Registration from 'sip:test@192.168.112.1' failed for '192.168.112.11' - No matching peer found
[Oct 26 11:39:15] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #4)
[Oct 26 11:39:35] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #5)
[Oct 26 11:39:55] NOTICE[2616]: chan_sip.c:7515 sip_reg_timeout:    -- Registration for 'mn@192.168.110.1' timed out, trying again (Attempt #6)
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
10:40:08
#ping 192.168.110.254
PING 192.168.110.254 (192.168.110.254) 56(84) bytes of data.
64 bytes from 192.168.110.254: icmp_seq=1 ttl=64 time=0.609 ms
64 bytes from 192.168.110.254: icmp_seq=2 ttl=64 time=0.591 ms
^C
--- 192.168.110.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 0.591/0.600/0.609/0.009 ms
10:40:18
#cat /etc/asterisk/sip.conf
[general]
context=default                 ; Default context for incoming calls
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
register=>mn:1234@192.168.111.1/bb
register=>mn:1234@192.168.110.1/br
register=>mn:1234@192.168.109.1/gm
[authentication]
...
[br]
type=friend
secret=1234
host=dynamic
username=mn
[gm]
type=friend
secret=1234
host=dynamic
username=mn
10:42:16
#asterisk -rcvv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
br/mn                      (Unspecified)    D          0        Unmonitored
bb/mn                      192.168.111.1    D          5060     Unmonitored
2204/2204                  192.168.112.11   D          5060     Unmonitored
2203/2203                  192.168.112.2    D          5060     Unmonitored
2202/2202                  192.168.112.2    D          1193     Unmonitored
2201/2201                  (Unspecified)    D          0        Unmonitored
7 sip peers [Monitored: 0 online, 0 offline Unmonitored: 5 online, 2 offline]
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
/dev/pts/0
10:46:22
#asterisk -rcv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
7 sip peers [Monitored: 0 online, 0 offline Unmonitored: 5 online, 2 offline]
    -- Executing [2204@default:1] Dial("SIP/2202-095b1150", "SIP/2204") in new stack
    -- Called 2204
    -- SIP/2204-095b52c0 is ringing
    -- SIP/2204-095b52c0 answered SIP/2202-095b1150
    -- Native bridging SIP/2202-095b1150 and SIP/2204-095b52c0
  == Spawn extension (default, 2204, 1) exited non-zero on 'SIP/2202-095b1150'
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
10:47:54
#vi /etc/asterisk/extensions.conf
--- /tmp/l3-saved-5131.9892.22288	2010-10-26 11:48:03.000000000 +0300
+++ /etc/asterisk/extensions.conf	2010-10-26 11:50:53.000000000 +0300
@@ -569,4 +569,7 @@
 ;exten =>2201,1,Dial(SIP/2201)
 exten =>2298,1,Record(/tmp/warning1:gsm,,3)
 
+exten =>_19XX,1,Dial,(SIP/ptr/${EXTEN})
+exten =>_20XX,1,Dial,(SIP/ptr/${EXTEN})
+exten =>_21XX,1,Dial,(SIP/ptr/${EXTEN})
 
10:50:53
#asterisk -rcv
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 - 2008 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.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
...
br/mn                      192.168.110.1    D          5060     Unmonitored
bb/mn                      192.168.111.1    D          5060     Unmonitored
2204/2204                  192.168.112.11   D          5060     Unmonitored
2203/2203                  192.168.112.2    D          5060     Unmonitored
2202/2202                  192.168.112.2    D          1193     Unmonitored
2201/2201                  (Unspecified)    D          0        Unmonitored
7 sip peers [Monitored: 0 online, 0 offline Unmonitored: 6 online, 1 offline]
linux12*CLI> quit
Executing last minute cleanups
Asterisk cleanly ending (0).
10:52:10
#vi /etc/asterisk/extensions.conf
--- /tmp/l3-saved-5131.2986.9744	2010-10-26 11:52:13.000000000 +0300
+++ /etc/asterisk/extensions.conf	2010-10-26 11:56:49.000000000 +0300
@@ -568,8 +568,12 @@
 exten =>2204,4,DIal(SIP/2204)
 ;exten =>2201,1,Dial(SIP/2201)
 exten =>2298,1,Record(/tmp/warning1:gsm,,3)
+;in Belorussia
+exten =>_19XX,1,Dial(SIP/ptr/${EXTEN})
+exten =>_20XX,1,Dial(SIP/ptr/${EXTEN})
+exten =>_21XX,1,Dial(SIP/ptr/${EXTEN})
+;in other locations
+exten =>_21XX,1,Dial(SIP/ptr/${EXTEN})
+exten =>_XXXX,1,Dial(SIP/ptr/${EXTEN})
 
-exten =>_19XX,1,Dial,(SIP/ptr/${EXTEN})
-exten =>_20XX,1,Dial,(SIP/ptr/${EXTEN})
-exten =>_21XX,1,Dial,(SIP/ptr/${EXTEN})
 
10:56:49