aboutsummaryrefslogtreecommitdiffstats
path: root/hlr_mgmt/templates/scripts.mako
blob: 6d76daf56b2e62bc4fbcb4754cc2a56a36df2548 (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# -*- coding: utf-8 -*-
<%inherit file="layout.mako"/>

  <div class="page-header">
  <h2>Management Scripts</h2>
  </div>

  <h3>Register IMSI through IMEI Lookup</h3>
  <h4>This script will lookup the phone with the IMEI provided and authorize its active IMSI (SIM Card) for access</h4>
  <form action="javascript:authorize_imei();" id="imei_form">
    <fieldset>
    <span class="help-block">Dial *#06# on the Target Phone to obtain its IMEI. Then enter the IMEI below.</span>
    <div class="span7">
    <input type="text" placeholder="15 digit IMEI..." name="imei">
    <button type="submit" class="btn btn-info pull-right">Queue Authorization</button>
    </div>
    </fieldset>
  </form>
  <div class="alert alert-error" hidden></div>
  <div class="alert alert-success" hidden></div>
  <br/><br/>
  <h3>Running Services</h3>
  <table class="table table-bordered table-hover" id="scripts_table">
  <thead>
    <tr><th> Service </th>
        <th> Status </th>
	<th> Actions </th>
    </tr>
  </thead>
  <tbody>
     <tr><td>LCR <div class="pull-right">(Local GSM Call Routing)</div></td>
    % if service_status['lcr']:
      % if service_status['lcr'].find("running")>0:
        <td><span class="label label-success">Running</span></td>
      % else:
        <td><span class="label label-important">Stopped</span></td>
      % endif
    % else:
      <td><span class="label label-warning">ERROR</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='lcr', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='lcr', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='lcr', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
    <tr><td>Asterisk <div class="pull-right">(External Call Routing)</div></td>
    % if service_status['asterisk']:
      % if service_status['asterisk'].find("failed")<0:
        <td><span class="label label-success">Running</span></td>
      % else:
        <td><span class="label label-important">Stopped</span></td>
      % endif
    % else:
      <td><span class="label label-warning">ERROR</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='asterisk', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='asterisk', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='asterisk', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
    <tr><td>GGSN <div class="pull-right">(Data Gateway)</div></td>
    % if service_status['ggsn']:
      % if service_status['ggsn'].find("failed")<0:
        <td><span class="label label-success">Running</span></td>
      % else:
        <td><span class="label label-important">Stopped</span></td>
      % endif
    % else:
      <td><span class="label label-warning">ERROR</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='ggsn', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='ggsn', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='ggsn', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
    <tr><td>OpenBSC <div class="pull-right">(Controls GSM Access)</div></td>
    % if service_status['nitb']:
      % if service_status['nitb'].find("failed")<0:
        <td><span class="label label-success">Running</span></td>
      % else:
        <td><span class="label label-important">Stopped</span></td>
      % endif
    % else:
      <td><span class="label label-warning">ERROR</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='nitb', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='nitb', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='nitb', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
    <tr><td>OsmoSGSN <div class="pull-right">(GPRS Data Interface)</div></td>
    % if service_status['sgsn']:
      % if service_status['sgsn'].find("failed")<0:
        <td><span class="label label-success">Running</span></td>
      % else:
        <td><span class="label label-important">Stopped</span></td>
      % endif
    % else:
      <td><span class="label label-warning">ERROR</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='sgsn', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='sgsn', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='sgsn', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
    <tr><td><strong><em>SubscriberMonitor</em></strong> <div class="pull-right">(Greets users with SMS)</div></td>
    % if service_status['subMonitor']:
      <td><span class="label label-success">Running</span></td>
    % else:
      <td><span class="label label-important">Stopped</span></td>
    % endif
    <td>
      <start><a href="${request.route_url('manage_service', service='subMonitor', action=1)}"><span class="badge badge-success"><i class="icon-play icon-white"></i></span></a></start>
      <reload><a href="${request.route_url('manage_service', service='subMonitor', action=2)}"><span class="badge badge-info"><i class="icon-repeat icon-white"></i></span></a></reload>
      <stop><a href="${request.route_url('manage_service', service='subMonitor', action=3)}"><span class="badge badge-important"><i class="icon-pause icon-white"></i></span></a></stop>
    </td></tr>
  </tbody>
  </table>

<script>
function authorize_imei()
{
	url = "${request.route_url('authorize_imei',imei='000000000000000')}";
	form_input = $('#imei_form :input');
	imei = form_input.val()
	url = url.replace("000000000000000",imei)
	$.ajax({
		url: url,
		success: function(data){
			switch(data.success)
			{
				case 1:
					$(".alert-success").append("<strong>SUCCESS:</strong> Registration of SIM card in device with IMEI:" + imei + " queued!<br/>");
					$(".alert-success").show();
					break;
				case 0:
					$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect FORMAT<br/>");
				case -1:
					$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect LENGTH<br/>");
				case -2:
					$(".alert-error").append("<strong>Invalid IMEI:</strong> IMEI:" + imei + " has incorrect CHECKSUM DIGIT<br/>");
					$(".alert-error").show();
				default:
					break;
			}
			setTimeout("close_alerts()",5000);
		}
	})
}

$("#scripts_table start").tooltip({
	title: 'Click to Start',
	placement: 'right'
});
$("#scripts_table stop").tooltip({
        title: 'Click to Stop',
        placement: 'right'
});
$("#scripts_table reload").tooltip({
        title: 'Click to Reload',
        placement: 'right'
});
</script>