1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
%h2= 'Routing Test'
= form_tag('test', :method => "get") do |f|
%p
%strong Routing Table
= label_tag(:routing_table_outbound, "Outbound")
= radio_button_tag(:routing_table, "outbound")
= label_tag(:routing_table_inbound, "Inbound")
= radio_button_tag(:routing_table, "inbound")
= label_tag(:routing_table_prerouting, "Prerouting")
= radio_button_tag(:routing_table, "prerouting")
%p
%strong From
%br
= collection_select(nil, :sip_account_id, SipAccount.all, :id, :to_s, {:include_blank => false, :prompt => 'Select SIP Account'})
= collection_select(nil, :fax_account_id, FaxAccount.all, :id, :to_s, {:include_blank => false, :prompt => 'Select Fax Account'})
= collection_select(nil, :hunt_group_id, HuntGroup.all, :id, :to_s, {:include_blank => false, :prompt => 'Select Hunt Group'})
%p
%strong Number
%br
= text_field_tag(:destination_number)
%p= submit_tag("Test Route")
- if @route_test
- if @route_test['destination']
%h3= 'Destination'
%table.table.table-striped
%thead
%tr
%td= 'number'
%td= 'type'
%td= 'ID'
%tbody{ :id => "destination" }
%tr
%td= @route_test['destination']['number']
%td= @route_test['destination']['type']
%td= @route_test['destination']['id']
-if @route_test['routes'] && @route_test['routes'].count > 0
%h3= 'Routes'
%table.table.table-striped
%thead
%tr
%th
%th= 'ID'
%th= 'destination_number'
%th= 'endpoint'
%tbody{ :id => "route_test" }
- @route_test['routes'].each do |index, route_entry|
%tr
%td= index
%td= route_entry['route_id']
%td= route_entry['destination_number']
%td= "#{route_entry['type']}=#{route_entry['id']}"
-if @route_test['log'] && @route_test['log'].count > 0
%h3= 'Log'
%table.table.table-striped
%thead
%tr
%th
%tbody{ :id => "log" }
- @route_test['log'].each do |index, log_line|
- if log_line =~ /^ROUTE_NO_MATCH/
- entry_class = 'table error'
- elsif log_line =~ /^ELEMENT_NO_MATCH/
- entry_class = 'table warning'
- elsif log_line =~ /^ROUTE \d+ /
- entry_class = 'table success'
- elsif log_line =~ /^[A-Z_]+_MATCH/
- entry_class = 'table info'
- else
- entry_class = nil
%tr{:class => entry_class}
%td= log_line
|