Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Here is my solutions for last two bugs I found #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plivo/rest/freeswitch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,8 @@ def schedule_play(self):

[Mix]: 'true'|'false'. Mix with current audio stream (default 'true')

[Delimiter]: The delimiter used in the sounds list (default: ',')

Returns a scheduled task with id SchedPlayId that you can use to cancel play.
"""
self._rest_inbound_socket.log.debug("RESTAPI SchedulePlay with %s" \
Expand All @@ -1902,6 +1904,7 @@ def schedule_play(self):
length = get_post_param(request, 'Length')
loop = get_post_param(request, 'Loop') == 'true'
mix = get_post_param(request, 'Mix')
delimiter = get_post_param(request, 'Delimiter')
if mix == 'false':
mix = False
else:
Expand Down Expand Up @@ -1938,7 +1941,9 @@ def schedule_play(self):
msg = "Length Parameter must be a positive integer"
return self.send_response(Success=result, Message=msg)

sounds_list = sounds.split(',')
if not delimiter: delimiter = ','

sounds_list = sounds.split(delimiter)
if not sounds_list:
msg = "Sounds Parameter is Invalid"
return self.send_response(Success=result, Message=msg)
Expand Down
7 changes: 3 additions & 4 deletions src/plivo/rest/freeswitch/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,7 @@ def _prepare_play_string(self, outbound_socket, remote_url):

def create_number(self, number_instance, outbound_socket):
num_gw = []
# skip number object without gateway or number
if not number_instance.gateways:
outbound_socket.log.error("Gateway not defined on Number object !")
return ''
# skip number object without number
if not number_instance.number:
outbound_socket.log.error("Number not defined on Number object !")
return ''
Expand Down Expand Up @@ -1238,6 +1235,8 @@ def parse_element(self, element, uri=None):
if gateways:
# get list of gateways
self.gateways = gateways.split(',')
else:
self.gateways = [""]
# split gw codecs by , but only outside the ''
if gateway_codecs:
self.gateway_codecs = \
Expand Down