Permalink
Browse files

add plivo_ prefix to custom channel variables to prevent conflicts/co…

…nfusion
  • Loading branch information...
tamiel committed May 19, 2011
1 parent 95399e5 commit 621820559ad90ea23accdd2ced4d47f9609592bb
@@ -70,9 +70,9 @@
"prefix": ""
},
"RecordSession": {
- "filePath": "/usr/local/freeswitch/recordings/",
- "format": "mp3",
- "prefix": ""
+ "filePath": "/usr/local/freeswitch/recordings/",
+ "format": "mp3",
+ "prefix": ""
},
"Redirect": {
"method": "POST"
@@ -208,7 +208,6 @@ def parse_grammar(self, element, uri=None):
self.method = method
def create_number(self, number_instance):
- #TODO what about url ?
num_gw = []
# skip number object without gateway or number
if not number_instance.gateways or not number_instance.number:
@@ -456,7 +455,8 @@ def run(self, outbound_socket):
pass # Ignore invalid nested Grammar
outbound_socket.log.info("GetDigits Started %s" % self.sound_files)
- outbound_socket.log.info("GetDigits Play beep %s " % self.play_beep)
+ if self.play_beep:
+ outbound_socket.log.debug("GetDigits will play a beep")
outbound_socket.play_and_get_digits(max_digits=self.num_digits,
max_tries=self.retries, timeout=self.timeout,
terminators=self.finish_on_key,
@@ -467,7 +467,7 @@ def run(self, outbound_socket):
event = outbound_socket._action_queue.get()
digits = outbound_socket.get_var('pagd_input')
if digits is not None and self.action:
- # Call Parent Class Function
+ # Redirect
params = {'Digits': digits}
self.fetch_rest_xml(self.action, params, self.method)
@@ -108,8 +108,8 @@ class HTTPRequest:
def __init__(self, auth_id='', auth_token=''):
"""initialize a object
- id: Plivo SID/ID
- token: Plivo token
+ auth_id: Plivo SID/ID
+ auth_token: Plivo token
returns a HTTPRequest object
"""
@@ -69,7 +69,7 @@ def on_channel_hangup(self, ev):
"""
Capture Channel Hangup
"""
- request_uuid = ev['variable_request_uuid']
+ request_uuid = ev['variable_plivo_request_uuid']
call_uuid = ev['Unique-ID']
reason = ev['Hangup-Cause']
request_params = self.call_request[request_uuid]
@@ -209,7 +209,7 @@ def bulk_originate(self, request_uuid_list):
for request_uuid in request_uuid_list]
def transfer_call(self, new_xml_url, call_uuid):
- self.set_var("transfer_url", new_xml_url, uuid=call_uuid)
+ self.set_var("plivo_transfer_url", new_xml_url, uuid=call_uuid)
outbound_str = "socket:%s async full" \
% (self.fs_outbound_address)
self.xfer_jobs[call_uuid] = outbound_str
@@ -234,7 +234,7 @@ def hangup_call(self, call_uuid="", request_uuid=""):
args = "NORMAL_CLEARING uuid %s" % call_uuid
else: # Use request uuid
callid = "RequestUUID %s" % request_uuid
- args = "NORMAL_CLEARING request_uuid %s" % request_uuid
+ args = "NORMAL_CLEARING plivo_request_uuid %s" % request_uuid
bg_api_response = self.bgapi("hupall %s" % args)
job_uuid = bg_api_response.get_job_uuid()
if not job_uuid:
@@ -182,9 +182,9 @@ def run(self):
if self.direction == 'outbound':
# Look for variables in channel headers
aleg_uuid = channel.get_header('Caller-Unique-ID')
- aleg_request_uuid = channel.get_header('variable_request_uuid')
- self.target_url = channel.get_header('variable_answer_url')
- sched_hangup_id = channel.get_header('variable_sched_hangup_id')
+ aleg_request_uuid = channel.get_header('variable_plivo_request_uuid')
+ self.target_url = channel.get_header('variable_plivo_answer_url')
+ sched_hangup_id = channel.get_header('variable_plivo_sched_hangup_id')
# Don't post hangup in outbound direction
self.default_hangup_url = None
self.hangup_url = None
@@ -193,15 +193,15 @@ def run(self):
# get transfer_url from channel variable
# get answer_url from channel variable
# get default answer_url
- self.target_url = self.get_var('transfer_url')
+ self.target_url = self.get_var('plivo_transfer_url')
if not self.target_url:
- self.target_url = self.get_var('answer_url')
+ self.target_url = self.get_var('plivo_answer_url')
if not self.target_url:
self.target_url = self.default_answer_url
# Look for a sched_hangup_id
- sched_hangup_id = self.get_var('sched_hangup_id')
+ sched_hangup_id = self.get_var('plivo_sched_hangup_id')
# Look for hangup_url
- self.hangup_url = self.get_var('hangup_url')
+ self.hangup_url = self.get_var('plivo_hangup_url')
if not sched_hangup_id:
sched_hangup_id = ""
@@ -98,8 +98,8 @@ def _prepare_request(self, caller_id, to, extra_dial_string, gw, gw_codecs,
request_uuid = str(uuid.uuid1())
args_list = []
- args_list.append("request_uuid=%s" % request_uuid)
- args_list.append("answer_url=%s" % answer_url)
+ args_list.append("plivo_request_uuid=%s" % request_uuid)
+ args_list.append("plivo_answer_url=%s" % answer_url)
args_list.append("origination_caller_id_number=%s" % caller_id)
if extra_dial_string:
args_list.append(extra_dial_string)
@@ -118,9 +118,9 @@ def _prepare_request(self, caller_id, to, extra_dial_string, gw, gw_codecs,
time_limit = 0
if time_limit > 0:
sched_hangup_id = str(uuid.uuid1())
- args_list.append("api_on_answer='sched_api %s +%d hupall ALLOTTED_TIMEOUT request_uuid %s'" \
+ args_list.append("api_on_answer='sched_api %s +%d hupall ALLOTTED_TIMEOUT plivo_request_uuid %s'" \
% (sched_hangup_id, time_limit, request_uuid))
- args_list.append("sched_hangup_id=%s" % sched_hangup_id)
+ args_list.append("plivo_sched_hangup_id=%s" % sched_hangup_id)
args_str = ','.join(args_list)
originate_str = ''.join(["originate {", args_str])

0 comments on commit 6218205

Please sign in to comment.