From eecfec149849bf80ee33d8bfa15b70f739a1049e Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:10:05 +0530 Subject: [PATCH 1/7] added wait time param in MPC XML flow --- plivo/xml/MultiPartyCallElement.py | 15 +++++++++++++++ plivo/xml/ResponseElement.py | 2 ++ tests/xml/test_responseElement.py | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plivo/xml/MultiPartyCallElement.py b/plivo/xml/MultiPartyCallElement.py index 6104ba0c..fe58a57f 100644 --- a/plivo/xml/MultiPartyCallElement.py +++ b/plivo/xml/MultiPartyCallElement.py @@ -92,6 +92,18 @@ def set_wait_music_method(self, wait_music_method): self.wait_music_method = wait_music_method return self + @property + def wait_time(self): + return self.__wait_time + + @wait_time.setter + def wait_time(self, wait_time): + self.__wait_time = wait_time + + def set_wait_time(self, wait_time): + self.wait_time = wait_time + return self + @property def agent_hold_music_url(self): return self.__agent_hold_music_url @@ -543,6 +555,7 @@ def __init__( record_min_member_count=1, wait_music_url=None, wait_music_method='GET', + wait_time=5, agent_hold_music_url=None, agent_hold_music_method='GET', customer_hold_music_url=None, @@ -585,6 +598,7 @@ def __init__( self.record_min_member_count = record_min_member_count self.wait_music_url = wait_music_url self.wait_music_method = wait_music_method + self.wait_time = wait_time self.agent_hold_music_url = agent_hold_music_url self.agent_hold_music_method = agent_hold_music_method self.customer_hold_music_url = customer_hold_music_url @@ -619,6 +633,7 @@ def to_dict(self): 'recordMinMemberCount': self.record_min_member_count, 'waitMusicUrl': self.wait_music_url, 'waitMusicMethod': self.wait_music_method, + 'waitTime': self.wait_time, 'agentHoldMusicUrl': self.agent_hold_music_url, 'agentHoldMusicMethod': self.agent_hold_music_method, 'customerHoldMusicUrl': self.customer_hold_music_url, diff --git a/plivo/xml/ResponseElement.py b/plivo/xml/ResponseElement.py index 3fc27396..bb40cc3d 100644 --- a/plivo/xml/ResponseElement.py +++ b/plivo/xml/ResponseElement.py @@ -333,6 +333,7 @@ def add_multi_party_call(self, max_participants=10, wait_music_url=None, wait_music_method="GET", + wait_time=5, agent_hold_music_url=None, agent_hold_music_method='GET', customer_hold_music_url=None, @@ -371,6 +372,7 @@ def add_multi_party_call(self, max_participants=max_participants, wait_music_url=wait_music_url, wait_music_method=wait_music_method, + wait_time=wait_time, agent_hold_music_url=agent_hold_music_url, agent_hold_music_method=agent_hold_music_method, customer_hold_music_url=customer_hold_music_url, diff --git a/tests/xml/test_responseElement.py b/tests/xml/test_responseElement.py index 496d77e7..e7efb230 100644 --- a/tests/xml/test_responseElement.py +++ b/tests/xml/test_responseElement.py @@ -120,13 +120,14 @@ def test_add_mpc(self): 'stopRecordingAudio="https://plivo.com/plivoTone.mp3" ' \ 'stopRecordingAudioMethod="GET" ' \ 'waitMusicMethod="POST" ' \ + 'waitTime="5" ' \ 'waitMusicUrl="https://plivo.com/plivoTone.mp3">multi party conference' \ '' elem = plivoxml.ResponseElement().add_multi_party_call(content='multi party conference', role='customer', max_duration=20000, max_participants=7, wait_music_url='https://plivo.com/plivoTone.mp3', - wait_music_method='POST', start_mpc_on_enter=True, + wait_music_method='POST', wait_time=5, start_mpc_on_enter=True, record=True, record_file_format='wav', mute=True, enter_sound='beep:2', exit_sound='beep:1', hold=True, on_exit_action_url='https://plivo.com/exitAction', From 6631b6f4b0766c683826bb42ec2f852cb2b8d511 Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:25:16 +0530 Subject: [PATCH 2/7] added validations --- plivo/xml/MultiPartyCallElement.py | 8 ++++++++ tests/xml/test_MultiPartyCallElement.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plivo/xml/MultiPartyCallElement.py b/plivo/xml/MultiPartyCallElement.py index fe58a57f..3fc05b46 100644 --- a/plivo/xml/MultiPartyCallElement.py +++ b/plivo/xml/MultiPartyCallElement.py @@ -97,6 +97,14 @@ def wait_time(self): return self.__wait_time @wait_time.setter + @validate_args( + wait_time=[ + optional( + of_type_exact(int), + check(lambda wait_time: 0 <= wait_time <= 1800, '0 <= wait_time <= 1800') + ) + ], + ) def wait_time(self, wait_time): self.__wait_time = wait_time diff --git a/tests/xml/test_MultiPartyCallElement.py b/tests/xml/test_MultiPartyCallElement.py index e6084ca6..5563ddec 100644 --- a/tests/xml/test_MultiPartyCallElement.py +++ b/tests/xml/test_MultiPartyCallElement.py @@ -78,12 +78,14 @@ def test_builder_setting(self): 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" stopRecordingAudio="http://plivo.com/api.mp3" ' \ 'stopRecordingAudioMethod="GET" ' \ + 'waitTime="5" ' \ 'waitMusicMethod="GET" recordMinMemberCount="1">Helsinki ' element = plivoxml.MultiPartyCallElement(content='Helsinki', role='customer'). \ set_max_duration(4500).set_max_participants(9).set_end_mpc_on_exit(True). \ set_customer_hold_music_url('http://plivo.com/voice.mp3').set_coach_mode(False). \ set_on_exit_action_url('http://plivo.com/api.mp3').set_on_exit_action_method('GET'). \ set_stop_recording_audio("http://plivo.com/api.mp3"). \ - set_start_recording_audio("http://plivo.com/api.mp3") + set_start_recording_audio("http://plivo.com/api.mp3"). \ + set_wait_time(5) self.assertXmlEqual(expected_xml, element.to_string(False)) From 2177acf01369c946bbc252ca0b83717e1b31cff8 Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:33:13 +0530 Subject: [PATCH 3/7] added versioning --- CHANGELOG.md | 4 ++++ plivo/version.py | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67597ec7..d4bfa587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log + +## [4.48.1](https://github.com/plivo/plivo-python/tree/v4.48.1) (2024-02-23) +**Added new param 'waitTime' for MPC XML + ## [4.48.0](https://github.com/plivo/plivo-python/tree/v4.48.0) (2024-02-12) **Custom Verify OTP - Added new optional param 'otp' for Create Session and made 'otp' param optional for Validate Session** diff --git a/plivo/version.py b/plivo/version.py index 91f3e08e..9f436c9b 100644 --- a/plivo/version.py +++ b/plivo/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '4.48.0' +__version__ = '4.48.1' diff --git a/setup.py b/setup.py index e24bac1b..9840d8c0 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='plivo', - version='4.48.0', + version='4.48.1', description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML', long_description=long_description, url='https://github.com/plivo/plivo-python', From 9d416659fd8fb5bd82fc2918b15807f6436c7265 Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:35:49 +0530 Subject: [PATCH 4/7] Fixed UTs --- tests/xml/test_MultiPartyCallElement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/xml/test_MultiPartyCallElement.py b/tests/xml/test_MultiPartyCallElement.py index 5563ddec..474a4507 100644 --- a/tests/xml/test_MultiPartyCallElement.py +++ b/tests/xml/test_MultiPartyCallElement.py @@ -19,7 +19,7 @@ def test_default_xml(self): 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" ' \ 'stopRecordingAudioMethod="GET" ' \ - 'waitMusicMethod="GET">Nairobi' + 'waitMusicMethod="GET" waitTime="5">Nairobi' element = plivoxml.MultiPartyCallElement(content='Nairobi', role='Agent') self.assertXmlEqual(element.to_string(False), expected_response) @@ -36,7 +36,7 @@ def test_setting_optional_fields(self): 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" ' \ 'stopRecordingAudioMethod="GET" ' \ - 'waitMusicMethod="GET">Tokyo' + 'waitMusicMethod="GET" waitTime="5">Tokyo' element = plivoxml.MultiPartyCallElement(content='Tokyo', role='supervisor', exit_sound='beep:1') self.assertXmlEqual(element.to_string(False), expected_response) From 33e50e64de2f4c47ce931232c6c1e8fa3b02146d Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:45:13 +0530 Subject: [PATCH 5/7] fixed default value --- plivo/xml/MultiPartyCallElement.py | 2 +- tests/xml/test_MultiPartyCallElement.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plivo/xml/MultiPartyCallElement.py b/plivo/xml/MultiPartyCallElement.py index 3fc05b46..d2cd27d1 100644 --- a/plivo/xml/MultiPartyCallElement.py +++ b/plivo/xml/MultiPartyCallElement.py @@ -563,7 +563,7 @@ def __init__( record_min_member_count=1, wait_music_url=None, wait_music_method='GET', - wait_time=5, + wait_time=None, agent_hold_music_url=None, agent_hold_music_method='GET', customer_hold_music_url=None, diff --git a/tests/xml/test_MultiPartyCallElement.py b/tests/xml/test_MultiPartyCallElement.py index 474a4507..5563ddec 100644 --- a/tests/xml/test_MultiPartyCallElement.py +++ b/tests/xml/test_MultiPartyCallElement.py @@ -19,7 +19,7 @@ def test_default_xml(self): 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" ' \ 'stopRecordingAudioMethod="GET" ' \ - 'waitMusicMethod="GET" waitTime="5">Nairobi' + 'waitMusicMethod="GET">Nairobi' element = plivoxml.MultiPartyCallElement(content='Nairobi', role='Agent') self.assertXmlEqual(element.to_string(False), expected_response) @@ -36,7 +36,7 @@ def test_setting_optional_fields(self): 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" ' \ 'stopRecordingAudioMethod="GET" ' \ - 'waitMusicMethod="GET" waitTime="5">Tokyo' + 'waitMusicMethod="GET">Tokyo' element = plivoxml.MultiPartyCallElement(content='Tokyo', role='supervisor', exit_sound='beep:1') self.assertXmlEqual(element.to_string(False), expected_response) From 57f9ce57dfb21a622b12069f5bb3a76b97cc06cc Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Fri, 23 Feb 2024 17:55:27 +0530 Subject: [PATCH 6/7] fixed default value --- plivo/xml/ResponseElement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plivo/xml/ResponseElement.py b/plivo/xml/ResponseElement.py index bb40cc3d..a6679219 100644 --- a/plivo/xml/ResponseElement.py +++ b/plivo/xml/ResponseElement.py @@ -333,7 +333,7 @@ def add_multi_party_call(self, max_participants=10, wait_music_url=None, wait_music_method="GET", - wait_time=5, + wait_time=None, agent_hold_music_url=None, agent_hold_music_method='GET', customer_hold_music_url=None, From 6339128db83e1f0a41121bc765b6819de9a2fa52 Mon Sep 17 00:00:00 2001 From: abinaya-plivo Date: Mon, 26 Feb 2024 10:44:16 +0530 Subject: [PATCH 7/7] modified date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4bfa587..ac1b9742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [4.48.1](https://github.com/plivo/plivo-python/tree/v4.48.1) (2024-02-23) +## [4.48.1](https://github.com/plivo/plivo-python/tree/v4.48.1) (2024-02-26) **Added new param 'waitTime' for MPC XML ## [4.48.0](https://github.com/plivo/plivo-python/tree/v4.48.0) (2024-02-12)