mgparser 0.1.9 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +36 -6
 - data/bin/mgparser +16 -2
 - data/lib/call.rb +102 -77
 - data/lib/snmp_gw.rb +2 -0
 - data/lib/version.rb +1 -1
 - data/mgparser.gemspec +0 -1
 - metadata +44 -72
 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -3,19 +3,49 @@ MGParser 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            MGParser (MGP) is a tool which makes analysis of Mediatrix ISDN gateways debug a much simpler task.
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
            Prerequisites
         
     | 
| 
       7 
7 
     | 
    
         
             
            =============
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            - Mediatrix 4400 series media gateway (3000 also should be fine) with firmware version DGW2.0 
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Ruby 1.8.7/1.9.2
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Getting Started
         
     | 
| 
      
 13 
     | 
    
         
            +
            =============
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Before starting mgparser ensure that there is no firewall enabled on your Mediatrix unit or that there is a rule 
         
     | 
| 
      
 16 
     | 
    
         
            +
            which will accept incoming connections on it's SNMP port (default is 161 but you can provide a different one with -s PORT option).
         
     | 
| 
      
 17 
     | 
    
         
            +
            You can find Mediatrix firewall settings in Network-->Local Firewall menu.
         
     | 
| 
      
 18 
     | 
    
         
            +
            You should also check that the syslog level is set to "Warning" or above for all services, if you have factory default settings
         
     | 
| 
      
 19 
     | 
    
         
            +
            this should already be OK.
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Update your rubygems:
         
     | 
| 
      
 22 
     | 
    
         
            +
            <p><code>
         
     | 
| 
      
 23 
     | 
    
         
            +
            	sudo gem update --system
         
     | 
| 
      
 24 
     | 
    
         
            +
            </code></p>
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Install mgparser:
         
     | 
| 
      
 27 
     | 
    
         
            +
            <p><code>
         
     | 
| 
      
 28 
     | 
    
         
            +
            	sudo gem install mgparser
         
     | 
| 
      
 29 
     | 
    
         
            +
            </code></p>
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            To start mgparser just type:
         
     | 
| 
      
 32 
     | 
    
         
            +
            <p><code>
         
     | 
| 
      
 33 
     | 
    
         
            +
            	sudo mgparser -i ip_of_your_Mediatrix_unit
         
     | 
| 
      
 34 
     | 
    
         
            +
            </code></p>
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            If you want to analyze a log file instead of making live debug you can type:
         
     | 
| 
      
 37 
     | 
    
         
            +
            <p><code>
         
     | 
| 
      
 38 
     | 
    
         
            +
            	mgparser -l path/to/your/log/file
         
     | 
| 
      
 39 
     | 
    
         
            +
            </code></p>
         
     | 
| 
      
 40 
     | 
    
         
            +
             
         
     | 
| 
       10 
41 
     | 
    
         
             
            <pre><code>
         
     | 
| 
       11 
     | 
    
         
            -
            Usage:  
     | 
| 
      
 42 
     | 
    
         
            +
            Usage: mgparser [options]
         
     | 
| 
       12 
43 
     | 
    
         | 
| 
       13 
44 
     | 
    
         
             
            Specific options:
         
     | 
| 
       14 
45 
     | 
    
         
             
                -p, --port PORT                  Port number on which receive syslog (default is 514)
         
     | 
| 
       15 
     | 
    
         
            -
                -s, --snmpport PORT              Gateway SNMP port number (default is 161)
         
     | 
| 
       16 
     | 
    
         
            -
                -i, --ipaddr IPADDR              Media Gateway IP
         
     | 
| 
      
 46 
     | 
    
         
            +
                -s, --snmpport PORT              Media Gateway SNMP port number (default is 161)
         
     | 
| 
      
 47 
     | 
    
         
            +
                -i, --ipaddr IPADDR              Media Gateway IP address
         
     | 
| 
       17 
48 
     | 
    
         
             
                -l, --logfile LOGFILE            Log file to analyze
         
     | 
| 
       18 
     | 
    
         
            -
                -v, --[no-]verbose               Run verbosely
         
     | 
| 
       19 
49 
     | 
    
         | 
| 
       20 
50 
     | 
    
         
             
            Common options:
         
     | 
| 
       21 
51 
     | 
    
         
             
                -h, --help                       Show this message
         
     | 
    
        data/bin/mgparser
    CHANGED
    
    | 
         @@ -87,7 +87,9 @@ $causes = {"1" => "Unallocated (unassigned) number", 
     | 
|
| 
       87 
87 
     | 
    
         
             
            if $options.list[:logfile]
         
     | 
| 
       88 
88 
     | 
    
         
             
              if FileTest::exist?($options.list[:logfile])
         
     | 
| 
       89 
89 
     | 
    
         
             
                data = IO.readlines($options.list[:logfile])
         
     | 
| 
       90 
     | 
    
         
            -
                 
     | 
| 
      
 90 
     | 
    
         
            +
                @is_file = true
         
     | 
| 
      
 91 
     | 
    
         
            +
                call = Call.new
         
     | 
| 
      
 92 
     | 
    
         
            +
                call.analyze(data,@is_file)
         
     | 
| 
       91 
93 
     | 
    
         
             
              else
         
     | 
| 
       92 
94 
     | 
    
         
             
                puts "File not found"
         
     | 
| 
       93 
95 
     | 
    
         
             
              end
         
     | 
| 
         @@ -100,15 +102,27 @@ else 
     | 
|
| 
       100 
102 
     | 
    
         
             
                end
         
     | 
| 
       101 
103 
     | 
    
         | 
| 
       102 
104 
     | 
    
         
             
                def receive_data(data)
         
     | 
| 
       103 
     | 
    
         
            -
                  @ 
     | 
| 
      
 105 
     | 
    
         
            +
                  @is_file = false
         
     | 
| 
      
 106 
     | 
    
         
            +
                  @call.analyze(data,@is_file)
         
     | 
| 
       104 
107 
     | 
    
         
             
                end
         
     | 
| 
       105 
108 
     | 
    
         
             
              end
         
     | 
| 
       106 
109 
     | 
    
         | 
| 
       107 
110 
     | 
    
         
             
              #We initialize eventmachine
         
     | 
| 
      
 111 
     | 
    
         
            +
              begin
         
     | 
| 
       108 
112 
     | 
    
         
             
              EventMachine::run do
         
     | 
| 
       109 
113 
     | 
    
         
             
                host = UDPSocket.open {|s| s.connect($options.list[:ipaddr],30000); s.addr.last }
         
     | 
| 
       110 
114 
     | 
    
         
             
            	  port = $options.list[:port]
         
     | 
| 
       111 
115 
     | 
    
         
             
            	  snmpgw = SnmpGw.new($options.list[:port],$options.list[:ipaddr],$options.list[:snmp])
         
     | 
| 
      
 116 
     | 
    
         
            +
            	  begin
         
     | 
| 
       112 
117 
     | 
    
         
             
            	  EventMachine::open_datagram_socket host, port, SyslogServer
         
     | 
| 
      
 118 
     | 
    
         
            +
            	  rescue RuntimeError, Interrupt
         
     | 
| 
      
 119 
     | 
    
         
            +
                  puts "Closing..."
         
     | 
| 
      
 120 
     | 
    
         
            +
                  abort ""
         
     | 
| 
      
 121 
     | 
    
         
            +
                end
         
     | 
| 
      
 122 
     | 
    
         
            +
              end
         
     | 
| 
      
 123 
     | 
    
         
            +
              rescue Interrupt
         
     | 
| 
      
 124 
     | 
    
         
            +
                puts "Interrupted"
         
     | 
| 
      
 125 
     | 
    
         
            +
              rescue RunetimeError
         
     | 
| 
      
 126 
     | 
    
         
            +
                puts "Are you root?"
         
     | 
| 
       113 
127 
     | 
    
         
             
              end
         
     | 
| 
       114 
128 
     | 
    
         
             
            end
         
     | 
    
        data/lib/call.rb
    CHANGED
    
    | 
         @@ -1,98 +1,123 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Call
         
     | 
| 
       2 
2 
     | 
    
         
             
            attr_accessor :data
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            def analyze(data)
         
     | 
| 
      
 4 
     | 
    
         
            +
              def analyze(data,is_file)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
                @callprogr_counter = 0
         
     | 
| 
      
 7 
     | 
    
         
            +
                @matched = 0
         
     | 
| 
      
 8 
     | 
    
         
            +
                
         
     | 
| 
      
 9 
     | 
    
         
            +
                if is_file == true
         
     | 
| 
      
 10 
     | 
    
         
            +
                  data.each do |line|
         
     | 
| 
      
 11 
     | 
    
         
            +
                    parse(line)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                else
         
     | 
| 
      
 14 
     | 
    
         
            +
                  parse(data)
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
       10 
16 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  @inbound = true
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
       13 
18 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
       16 
     | 
    
         
            -
                    
         
     | 
| 
       17 
     | 
    
         
            -
                elsif line =~ /CallRouter \[.*\] Dst\d\/2/
         
     | 
| 
       18 
     | 
    
         
            -
                  @called = line.scan(/e164=(\d{1,})/).first
         
     | 
| 
      
 19 
     | 
    
         
            +
              def parse(line)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  if line =~ /Unicast RECV Setup/
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @inbound = true
         
     | 
| 
       19 
22 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
       24 
     | 
    
         
            -
                     
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
                  elsif line =~ /CallRouter \[.*\] Src=/
         
     | 
| 
      
 24 
     | 
    
         
            +
                    @caller = line.scan(/e164=(\d{1,})/).flatten!.first       
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  elsif line =~ /CallRouter \[.*\] Dst\d\/2/
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @called = line.scan(/e164=(\d{1,})/).flatten!.first
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  elsif line =~ /UseNextDestination - Call \d{1,}-\d{1,}/
         
     | 
| 
      
 31 
     | 
    
         
            +
                    id = line.scan(/UseNextDestination - Call \d{1,}-(\d{1,})/).flatten!.first
         
     | 
| 
      
 32 
     | 
    
         
            +
                    if @matched < 1
         
     | 
| 
      
 33 
     | 
    
         
            +
                      if @inbound == true
         
     | 
| 
      
 34 
     | 
    
         
            +
                        @matched += 1
         
     | 
| 
      
 35 
     | 
    
         
            +
                      else
         
     | 
| 
      
 36 
     | 
    
         
            +
                        puts  "Call ID: #{id} - Caller: #{@caller}"
         
     | 
| 
      
 37 
     | 
    
         
            +
                        puts  "Call ID: #{id} - Called: #{@called}"
         
     | 
| 
      
 38 
     | 
    
         
            +
                      end
         
     | 
| 
       26 
39 
     | 
    
         
             
                    else
         
     | 
| 
       27 
40 
     | 
    
         
             
                      puts  "Call ID: #{id} - Caller: #{@caller}"
         
     | 
| 
       28 
41 
     | 
    
         
             
                      puts  "Call ID: #{id} - Called: #{@called}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                      @matched = 0
         
     | 
| 
       29 
43 
     | 
    
         
             
                    end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                     
     | 
| 
       33 
     | 
    
         
            -
                    @ 
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                    
         
     | 
| 
       36 
     | 
    
         
            -
                elsif line =~ /CallManager \[.*\] C\d{1,} - Send CallSetupA/
         
     | 
| 
       37 
     | 
    
         
            -
                  id = line.scan(/C(\d{1,}) -/).first
         
     | 
| 
       38 
     | 
    
         
            -
                  if @inbound == true
         
     | 
| 
       39 
     | 
    
         
            -
                    puts "Call ID: #{id} - <== ISDN setup received"
         
     | 
| 
       40 
     | 
    
         
            -
                  else
         
     | 
| 
       41 
     | 
    
         
            -
                    puts "Call ID: #{id} - ==> ISDN setup sent"
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
                  @inbound = false
         
     | 
| 
       44 
     | 
    
         
            -
                    
         
     | 
| 
       45 
     | 
    
         
            -
                elsif line =~ /"Proceeding Indication" .* for state CallSetup./
         
     | 
| 
       46 
     | 
    
         
            -
                  @progress_indication = true
         
     | 
| 
       47 
     | 
    
         
            -
                    
         
     | 
| 
       48 
     | 
    
         
            -
                elsif line =~ /CallManager \[.*\] C\d{1,} - CallProgressA\(2\)/
         
     | 
| 
       49 
     | 
    
         
            -
                  @callprogr_counter += 1
         
     | 
| 
       50 
     | 
    
         
            -
                  id = line.scan(/C(\d{1,}) -/).first
         
     | 
| 
       51 
     | 
    
         
            -
                    
         
     | 
| 
       52 
     | 
    
         
            -
                    if @progress_indication == true
         
     | 
| 
       53 
     | 
    
         
            -
                      #puts "Call ID: #{id} - <== \"Proceeding indication\" received from operator" 
         
     | 
| 
       54 
     | 
    
         
            -
                      @progress_indication = false
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - Send CallSetupA/
         
     | 
| 
      
 46 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 47 
     | 
    
         
            +
                    if @inbound == true
         
     | 
| 
      
 48 
     | 
    
         
            +
                      puts "Call ID: #{id} - <== ISDN setup received"
         
     | 
| 
       55 
49 
     | 
    
         
             
                    else
         
     | 
| 
       56 
     | 
    
         
            -
                       
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
                      puts "Call ID: #{id} - ==> ISDN setup sent"
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    @inbound = false
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                  elsif line =~ /"Proceeding Indication" .* for state CallSetup./
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @progress_indication = true
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - CallProgressA\(2\)/
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @callprogr_counter += 1
         
     | 
| 
      
 59 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                      if @progress_indication == true
         
     | 
| 
      
 62 
     | 
    
         
            +
                        #puts "Call ID: #{id} - <== \"Proceeding indication\" received from operator" 
         
     | 
| 
      
 63 
     | 
    
         
            +
                        @progress_indication = false
         
     | 
| 
       59 
64 
     | 
    
         
             
                      else
         
     | 
| 
       60 
     | 
    
         
            -
                         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
                        if @callprogr_counter >= 3
         
     | 
| 
      
 66 
     | 
    
         
            +
                          puts "Call ID: #{id} - <== The call will be probably answered by operator\'s voicemail or is being forwarded"
         
     | 
| 
      
 67 
     | 
    
         
            +
                          @callprogr_counter = 0
         
     | 
| 
      
 68 
     | 
    
         
            +
                        else
         
     | 
| 
      
 69 
     | 
    
         
            +
                          puts "Call ID: #{id} - <== \"Call Progress\" received from operator"
         
     | 
| 
      
 70 
     | 
    
         
            +
                        end
         
     | 
| 
      
 71 
     | 
    
         
            +
                      end 
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - CallProgressA\(3\)/
         
     | 
| 
      
 74 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 75 
     | 
    
         
            +
                    puts "Call ID: #{id} - ==> \"Call Progress\" sent to the operator"
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - CallProgressA\(1\)/
         
     | 
| 
      
 79 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 80 
     | 
    
         
            +
                    puts "Call ID: #{id} - <== Destination number is ringing" 
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - CallConnectA/
         
     | 
| 
      
 84 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 85 
     | 
    
         
            +
                    puts "Call ID: #{id} - Call has been answered!" 
         
     | 
| 
       77 
86 
     | 
    
         | 
| 
       78 
87 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - CallMessageA\(2\)/
         
     | 
| 
      
 89 
     | 
    
         
            +
                    id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
      
 90 
     | 
    
         
            +
                    @isdn_inbound_disconnect = true
         
     | 
| 
       82 
91 
     | 
    
         | 
| 
      
 92 
     | 
    
         
            +
                  elsif line =~ /CallManager.* Call is not allowed/
         
     | 
| 
      
 93 
     | 
    
         
            +
                    @resource_unavailable = true
         
     | 
| 
      
 94 
     | 
    
         
            +
                    @resource_unavailable_id = line.scan(/CallManager \[.*\] C\d{1,}-(\d{1,})/).flatten!.first
         
     | 
| 
       83 
95 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 96 
     | 
    
         
            +
                  elsif line =~ /CallTable.* ReleaseCall - Interface isdn.*try to release.* \d{1,}/
         
     | 
| 
      
 97 
     | 
    
         
            +
                    @abnormal_hangup = true
         
     | 
| 
      
 98 
     | 
    
         
            +
                    @abnormal_hangup_id = line.scan(/CallTable.* ReleaseCall - Interface isdn.*try to release.* (\d{1,})/).flatten!.first
         
     | 
| 
       87 
99 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  elsif line =~ /CallManager \[.*\] C\d{1,} - Send CallReleaseA\(\d{1,}\)/
         
     | 
| 
      
 102 
     | 
    
         
            +
                    if @resource_unavailable == true
         
     | 
| 
      
 103 
     | 
    
         
            +
                      id = @resource_unavailable_id
         
     | 
| 
      
 104 
     | 
    
         
            +
                      @resource_unavailable = false
         
     | 
| 
      
 105 
     | 
    
         
            +
                    elsif @abnormal_hangup == true
         
     | 
| 
      
 106 
     | 
    
         
            +
                      id = @abnormal_hangup_id
         
     | 
| 
      
 107 
     | 
    
         
            +
                      @abnormal_hangup = false
         
     | 
| 
       91 
108 
     | 
    
         
             
                    else
         
     | 
| 
       92 
     | 
    
         
            -
                       
     | 
| 
      
 109 
     | 
    
         
            +
                      id = line.scan(/C(\d{1,}) -/).flatten!.first
         
     | 
| 
       93 
110 
     | 
    
         
             
                    end
         
     | 
| 
       94 
     | 
    
         
            -
                    
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 111 
     | 
    
         
            +
                    cause = line.scan(/Send CallReleaseA\((\d{1,})/).flatten!.first
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                      if @isdn_inbound_disconnect == true
         
     | 
| 
      
 114 
     | 
    
         
            +
                        puts "Call ID: #{id} - <== Operator requested hangup with cause: \"#{$causes[cause]}\""
         
     | 
| 
      
 115 
     | 
    
         
            +
                        @isdn_inbound_disconnect = false
         
     | 
| 
      
 116 
     | 
    
         
            +
                      else
         
     | 
| 
      
 117 
     | 
    
         
            +
                        puts "Call ID: #{id} - ==> Gateway sent hangup with cause: \"#{$causes[cause]}\""
         
     | 
| 
      
 118 
     | 
    
         
            +
                      end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  end
         
     | 
| 
      
 121 
     | 
    
         
            +
              end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
       98 
123 
     | 
    
         
             
            end
         
     | 
    
        data/lib/snmp_gw.rb
    CHANGED
    
    | 
         @@ -23,6 +23,8 @@ def initialize(port, ipaddr, snmp) 
     | 
|
| 
       23 
23 
     | 
    
         
             
              rescue SNMP::RequestTimeout
         
     | 
| 
       24 
24 
     | 
    
         
             
                puts "Host is not responding (a firewall can be active or there is no SNMP network service listening on port: #{snmp})"
         
     | 
| 
       25 
25 
     | 
    
         
             
                abort ""
         
     | 
| 
      
 26 
     | 
    
         
            +
              rescue Interrupt
         
     | 
| 
      
 27 
     | 
    
         
            +
                puts "Closing gracefully"
         
     | 
| 
       26 
28 
     | 
    
         
             
              end
         
     | 
| 
       27 
29 
     | 
    
         | 
| 
       28 
30 
     | 
    
         
             
            end
         
     | 
    
        data/lib/version.rb
    CHANGED
    
    
    
        data/mgparser.gemspec
    CHANGED
    
    | 
         @@ -12,7 +12,6 @@ Gem::Specification.new do |s| 
     | 
|
| 
       12 
12 
     | 
    
         
             
              s.description = "MGParser (MGP) is a tool which makes analysis of Mediatrix ISDN gateways debug a much simpler task"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.email = "dawid.pogorzelski@mybushido.com"
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.executables = ["mgparser"]
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
15 
     | 
    
         
             
              s.files = %w{
         
     | 
| 
       17 
16 
     | 
    
         
             
                README.markdown
         
     | 
| 
       18 
17 
     | 
    
         
             
                bin/mgparser
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,75 +1,57 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mgparser
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.12
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
     | 
    
         
            -
              segments: 
         
     | 
| 
       7 
     | 
    
         
            -
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              - 9
         
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1.9
         
     | 
| 
       11 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
     | 
    
         
            -
            authors: 
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
       13 
8 
     | 
    
         
             
            - Dawid Pogorzelski
         
     | 
| 
       14 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2011-04-26 00:00:00.000000000Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
       21 
15 
     | 
    
         
             
              name: bundler
         
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &2157613240 !ruby/object:Gem::Requirement
         
     | 
| 
       24 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       25 
     | 
    
         
            -
                requirements: 
     | 
| 
       26 
     | 
    
         
            -
                - -  
     | 
| 
       27 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       28 
     | 
    
         
            -
                    hash: 3
         
     | 
| 
       29 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       30 
     | 
    
         
            -
                    - 1
         
     | 
| 
       31 
     | 
    
         
            -
                    - 0
         
     | 
| 
       32 
     | 
    
         
            -
                    - 10
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
21 
     | 
    
         
             
                    version: 1.0.10
         
     | 
| 
       34 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: *id001
         
     | 
| 
       36 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       37 
     | 
    
         
            -
              name: eventmachine
         
     | 
| 
       38 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *2157613240
         
     | 
| 
      
 25 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 26 
     | 
    
         
            +
              name: eventmachine
         
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &2157612860 !ruby/object:Gem::Requirement
         
     | 
| 
       40 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       41 
     | 
    
         
            -
                requirements: 
     | 
| 
       42 
     | 
    
         
            -
                - -  
     | 
| 
       43 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       44 
     | 
    
         
            -
                     
     | 
| 
       45 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       46 
     | 
    
         
            -
                    - 0
         
     | 
| 
       47 
     | 
    
         
            -
                    version: "0"
         
     | 
| 
      
 29 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       48 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       49 
     | 
    
         
            -
              version_requirements: *id002
         
     | 
| 
       50 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       51 
     | 
    
         
            -
              name: snmp
         
     | 
| 
       52 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       53 
     | 
    
         
            -
               
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *2157612860
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 37 
     | 
    
         
            +
              name: snmp
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &2157612400 !ruby/object:Gem::Requirement
         
     | 
| 
       54 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       55 
     | 
    
         
            -
                requirements: 
     | 
| 
       56 
     | 
    
         
            -
                - -  
     | 
| 
       57 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
     | 
| 
       58 
     | 
    
         
            -
                     
     | 
| 
       59 
     | 
    
         
            -
                    segments: 
         
     | 
| 
       60 
     | 
    
         
            -
                    - 0
         
     | 
| 
       61 
     | 
    
         
            -
                    version: "0"
         
     | 
| 
      
 40 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 41 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 42 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 43 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       62 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       63 
     | 
    
         
            -
               
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *2157612400
         
     | 
| 
      
 47 
     | 
    
         
            +
            description: MGParser (MGP) is a tool which makes analysis of Mediatrix ISDN gateways
         
     | 
| 
      
 48 
     | 
    
         
            +
              debug a much simpler task
         
     | 
| 
       65 
49 
     | 
    
         
             
            email: dawid.pogorzelski@mybushido.com
         
     | 
| 
       66 
     | 
    
         
            -
            executables: 
     | 
| 
      
 50 
     | 
    
         
            +
            executables:
         
     | 
| 
       67 
51 
     | 
    
         
             
            - mgparser
         
     | 
| 
       68 
52 
     | 
    
         
             
            extensions: []
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
53 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
            files: 
         
     | 
| 
      
 54 
     | 
    
         
            +
            files:
         
     | 
| 
       73 
55 
     | 
    
         
             
            - README.markdown
         
     | 
| 
       74 
56 
     | 
    
         
             
            - bin/mgparser
         
     | 
| 
       75 
57 
     | 
    
         
             
            - mgparser.gemspec
         
     | 
| 
         @@ -81,36 +63,26 @@ files: 
     | 
|
| 
       81 
63 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       82 
64 
     | 
    
         
             
            homepage: https://github.com/dawid999/MGParser
         
     | 
| 
       83 
65 
     | 
    
         
             
            licenses: []
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
66 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       86 
67 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 68 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       89 
69 
     | 
    
         
             
            - lib
         
     | 
| 
       90 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 70 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       91 
71 
     | 
    
         
             
              none: false
         
     | 
| 
       92 
     | 
    
         
            -
              requirements: 
     | 
| 
       93 
     | 
    
         
            -
              - -  
     | 
| 
       94 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       95 
     | 
    
         
            -
                   
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                  - 0
         
     | 
| 
       98 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
       99 
     | 
    
         
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 72 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 74 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       100 
77 
     | 
    
         
             
              none: false
         
     | 
| 
       101 
     | 
    
         
            -
              requirements: 
     | 
| 
       102 
     | 
    
         
            -
              - -  
     | 
| 
       103 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       104 
     | 
    
         
            -
                   
     | 
| 
       105 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       106 
     | 
    
         
            -
                  - 0
         
     | 
| 
       107 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 78 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 79 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 80 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 81 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       108 
82 
     | 
    
         
             
            requirements: []
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
83 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       111 
84 
     | 
    
         
             
            rubygems_version: 1.7.2
         
     | 
| 
       112 
85 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       113 
86 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       114 
87 
     | 
    
         
             
            summary: Mediatrix ISDN gateways debug utility
         
     | 
| 
       115 
88 
     | 
    
         
             
            test_files: []
         
     | 
| 
       116 
     | 
    
         
            -
             
     |