Skip to content
This repository has been archived by the owner on Sep 26, 2018. It is now read-only.

Commit

Permalink
broadcast - imsi network validate
Browse files Browse the repository at this point in the history
  • Loading branch information
shivkumarsah committed Sep 5, 2017
1 parent 45a856a commit fd66a33
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions cloud/endagaweb/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,23 +946,17 @@ 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.
params = {
'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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -1013,4 +1005,4 @@ def post(self, request):
response['status'] = 'ok'
response['messages'].append(message)
return HttpResponse(json.dumps(response),
content_type="application/json")
content_type="application/json")

0 comments on commit fd66a33

Please sign in to comment.