Permalink
Browse files

fix bulk calls

  • Loading branch information...
1 parent 4b376da commit 5a6fad29a9b4028127bef1efa88247307bb7b156 @tamiel tamiel committed May 19, 2011
Showing with 12 additions and 4 deletions.
  1. +7 −3 src/plivo/rest/freeswitch/inbound_socket.py
  2. +5 −1 src/plivo/rest/freeswitch/rest_api.py
@@ -189,7 +189,7 @@ def spawn_originate(self, request_uuid):
job_uuid = bg_api_response.get_job_uuid()
self.bk_jobs[job_uuid] = request_uuid
if not job_uuid:
- self.log.error("Calls Failed -- JobUUID not received"
+ self.log.error("Call Failed -- JobUUID not received"
% dial_str)
# Reduce one from the call request param lists each time
if gw_retry_list:
@@ -206,9 +206,13 @@ def spawn_originate(self, request_uuid):
def bulk_originate(self, request_uuid_list):
if request_uuid_list:
+ self.log.info("Bulk Calls for RequestUUIDs %s" % str(request_uuid_list))
job_pool = pool.Pool(len(request_uuid_list))
- [job_pool.spawn(self.spawn_originate, request_uuid)
- for request_uuid in request_uuid_list]
+ [ job_pool.spawn(self.spawn_originate, request_uuid)
+ for request_uuid in request_uuid_list ]
+ return True
+ self.log.error("Bulk Calls Failed -- No RequestUUID !")
+ return False
def transfer_call(self, new_xml_url, call_uuid):
self.set_var("plivo_transfer_url", new_xml_url, uuid=call_uuid)
@@ -361,9 +361,13 @@ def bulk_calls(self):
i += 1
request_uuid_list.append(request_uuid)
- self._rest_inbound_socket.bulk_originate(request_uuid_list)
+ # now do the calls !
+ if self._rest_inbound_socket.bulk_originate(request_uuid_list):
msg = "Bulk Call Requests Executed"
result = True
+ else:
+ msg = "Bulk Call Requests Failed"
+ request_uuid_list = []
return flask.jsonify(Success=result, Message=msg,
RequestUUID=str(request_uuid_list))

0 comments on commit 5a6fad2

Please sign in to comment.