From fd66a33f6f0b56ae5d61fb977ff54130ab335484 Mon Sep 17 00:00:00 2001 From: Shiv K Sah Date: Tue, 5 Sep 2017 17:38:32 +0530 Subject: [PATCH] broadcast - imsi network validate --- cloud/endagaweb/views/dashboard.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cloud/endagaweb/views/dashboard.py b/cloud/endagaweb/views/dashboard.py index a603c35f..8b4337c0 100644 --- a/cloud/endagaweb/views/dashboard.py +++ b/cloud/endagaweb/views/dashboard.py @@ -946,13 +946,9 @@ def post(self, request): if (sendto == 'tower' and not tower_id) or sendto == 'network': # Lookup for BTS inbound_url. bts_list = BTS.objects.filter(network=network_id) - level = 'network' - level_id = network_id else: # Lookup for BTS inbound_url. bts_list = BTS.objects.filter(id=tower_id) - level = 'tower' - level_id = tower_id for bts in bts_list: # Fire off an async task request to send the SMS. @@ -960,9 +956,7 @@ def post(self, request): 'to': '*', 'sender': '0000', 'text': message, - 'msgid': str(uuid.uuid4()), - 'level_id': level_id, - 'level': level + 'msgid': str(uuid.uuid4()) } url = bts.inbound_url + "/endaga_sms" tasks.async_post.delay(url, params) @@ -972,7 +966,7 @@ def post(self, request): subscribers = [] for imsi in imsi_list: try: - sub = Subscriber.objects.get(imsi=imsi) + sub = Subscriber.objects.get(imsi=imsi,network=network_id) subscribers.append(sub) except Subscriber.DoesNotExist: invalid_imsi.append(imsi) @@ -999,9 +993,7 @@ def post(self, request): 'to': num.number, 'sender': '0000', 'text': message, - 'msgid': str(uuid.uuid4()), - 'level_id': 123, - 'level': 89 + 'msgid': str(uuid.uuid4()) } url = subscriber.bts.inbound_url + "/endaga_sms" tasks.async_post.delay(url, params) @@ -1013,4 +1005,4 @@ def post(self, request): response['status'] = 'ok' response['messages'].append(message) return HttpResponse(json.dumps(response), - content_type="application/json") \ No newline at end of file + content_type="application/json")