diff --git a/CHANGELOG.md b/CHANGELOG.md index da2dce03..34c029b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Change Log +## [4.47.0](https://github.com/plivo/plivo-python/tree/v4.47.0) (2023-12-07) +**Minor enhancements and optimizations** + ## [4.46.0](https://github.com/plivo/plivo-python/tree/v4.46.0) (2023-11-06) **Introducing registration_status** - Added registration_status in LIST campaign APIs diff --git a/plivo/resources/multipartycall.py b/plivo/resources/multipartycall.py index 620ea4c3..991e1a28 100644 --- a/plivo/resources/multipartycall.py +++ b/plivo/resources/multipartycall.py @@ -43,6 +43,7 @@ def add_participant(self, on_exit_action_url=None, on_exit_action_method='POST', record=False, + record_participant_track=False, record_file_format='mp3', status_callback_events='mpc-state-changes,participant-state-changes', stay_alone=False, @@ -84,19 +85,28 @@ def resume_recording(self): return self.client.multi_party_calls.resume_recording(uuid=self.id) def start_participant_recording(self, participant_id, file_format=None, recording_callback_url=None, - recording_callback_method=None): + recording_callback_method=None, record_track_type='all'): return self.client.multi_party_calls.start_participant_recording(participant_id=participant_id, uuid=self.id, - **to_param_dict(self.add_participant, + **to_param_dict(self.start_participant_recording, locals())) - def stop_participant_recording(self, participant_id): - return self.client.multi_party_calls.stop_participant_recording(participant_id=participant_id, uuid=self.id) + def stop_participant_recording(self, participant_id, record_track_type='all'): + return self.client.multi_party_calls.stop_participant_recording(participant_id=participant_id, uuid=self.id, + **to_param_dict( + self.stop_participant_recording, + locals())) - def pause_participant_recording(self, participant_id): - return self.client.multi_party_calls.pause_participant_recording(participant_id=participant_id, uuid=self.id) + def pause_participant_recording(self, participant_id, record_track_type='all'): + return self.client.multi_party_calls.pause_participant_recording(participant_id=participant_id, uuid=self.id, + **to_param_dict( + self.pause_participant_recording, + locals())) - def resume_participant_recording(self, participant_id): - return self.client.multi_party_calls.resume_participant_recording(participant_id=participant_id, uuid=self.id) + def resume_participant_recording(self, participant_id, record_track_type='all'): + return self.client.multi_party_calls.resume_participant_recording(participant_id=participant_id, uuid=self.id, + **to_param_dict( + self.resume_participant_recording, + locals())) def get(self): return self.client.multi_party_calls.get(uuid=self.id) @@ -129,20 +139,25 @@ class MultiPartyCallParticipant(SecondaryPlivoResource): _secondary_identifier_string = 'member_id' def start_participant_recording(self, file_format=None, recording_callback_url=None, - recording_callback_method=None): + recording_callback_method=None, record_track_type='all'): return self.client.multi_party_calls.start_participant_recording(participant_id=self.secondary_id, uuid=self.id, - **to_param_dict(self.add_participant, + **to_param_dict(self.start_participant_recording, locals())) - def stop_participant_recording(self): - return self.client.multi_party_calls.stop_participant_recording(participant_id=self.secondary_id, uuid=self.id) + def stop_participant_recording(self, record_track_type='all'): + return self.client.multi_party_calls.stop_participant_recording(participant_id=self.secondary_id, uuid=self.id, + **to_param_dict(self.stop_participant_recording, + locals())) - def pause_participant_recording(self): - return self.client.multi_party_calls.pause_participant_recording(participant_id=self.secondary_id, uuid=self.id) + def pause_participant_recording(self, record_track_type='all'): + return self.client.multi_party_calls.pause_participant_recording(participant_id=self.secondary_id, uuid=self.id, + **to_param_dict(self.pause_participant_recording, + locals())) - def resume_participant_recording(self): - return self.client.multi_party_calls.resume_participant_recording(participant_id=self.secondary_id, - uuid=self.id) + def resume_participant_recording(self, record_track_type='all'): + return self.client.multi_party_calls.resume_participant_recording(participant_id=self.secondary_id, uuid=self.id, + **to_param_dict(self.resume_participant_recording, + locals())) def update(self, coach_mode=None, hold=None, mute=None): return self.client.multi_party_calls.update_participant(participant_id=self.secondary_id, @@ -286,6 +301,7 @@ def get(self, uuid=None, friendly_name=None, callback_url=None, callback_method= on_exit_action_url=[optional(of_type_exact(str), is_url())], on_exit_action_method=[optional(of_type_exact(str), is_in(('GET', 'POST'), case_sensitive=False))], record=[optional(of_type_exact(bool))], + record_participant_track=[optional(of_type_exact(bool))], record_file_format=[optional(of_type_exact(str), is_in(('mp3', 'wav'), case_sensitive=False, case_type='lower'))], status_callback_events=[optional(of_type_exact(str), multi_is_in(('mpc-state-changes', @@ -352,6 +368,7 @@ def add_participant(self, on_exit_action_url=None, on_exit_action_method='POST', record=False, + record_participant_track=False, record_file_format='mp3', status_callback_events='mpc-state-changes,participant-state-changes', stay_alone=False, @@ -552,6 +569,7 @@ def get_participant(self, participant_id, uuid=None, friendly_name=None, uuid=[optional(of_type_exact(str))], file_format=[optional(of_type_exact(str), is_in(('mp3', 'wav'), case_sensitive=False, case_type='lower'))], + record_track_type=[optional(of_type_exact(str))], recording_callback_url=[optional(of_type_exact(str), is_url())], recording_callback_method=[optional(of_type_exact(str), is_in(('GET', 'POST'), case_sensitive=False))], callback_url=[optional(is_url())], @@ -559,10 +577,10 @@ def get_participant(self, participant_id, uuid=None, friendly_name=None, ) def start_participant_recording(self, participant_id, uuid=None, friendly_name=None, file_format='mp3', recording_callback_url=None, recording_callback_method='POST', - callback_url=None, callback_method=None): + callback_url=None, callback_method=None, record_track_type='all'): mpc_id = self.__make_mpc_id(friendly_name, uuid) return self.client.request('POST', ('MultiPartyCall', mpc_id, 'Participant', participant_id, 'Record'), - self.__clean_identifiers(to_param_dict(self.start_recording, locals())), + self.__clean_identifiers(to_param_dict(self.start_participant_recording, locals())), is_voice_request=True) @validate_args( @@ -571,13 +589,15 @@ def start_participant_recording(self, participant_id, uuid=None, friendly_name=N uuid=[optional(of_type_exact(str))], callback_url=[optional(is_url())], callback_method=[optional(of_type(six.text_type))], + record_track_type=[optional(of_type_exact(str))] ) def stop_participant_recording(self, participant_id, uuid=None, friendly_name=None, callback_url=None, - callback_method=None): + callback_method=None, + record_track_type='all'): mpc_id = self.__make_mpc_id(friendly_name, uuid) return self.client.request('DELETE', ('MultiPartyCall', mpc_id, 'Participant', participant_id, 'Record'), to_param_dict(self.stop_participant_recording, locals()), is_voice_request=True) @@ -588,9 +608,10 @@ def stop_participant_recording(self, uuid=[optional(of_type_exact(str))], callback_url=[optional(is_url())], callback_method=[optional(of_type(six.text_type))], + record_track_type=[optional(of_type_exact(str))] ) def pause_participant_recording(self, participant_id, uuid=None, friendly_name=None, - callback_url=None, callback_method=None): + callback_url=None, callback_method=None, record_track_type='all'): mpc_id = self.__make_mpc_id(friendly_name, uuid) return self.client.request('POST', ('MultiPartyCall', mpc_id, 'Participant', participant_id, 'Record', 'Pause'), to_param_dict(self.pause_participant_recording, locals()), is_voice_request=True) @@ -601,9 +622,10 @@ def pause_participant_recording(self, participant_id, uuid=None, friendly_name=N uuid=[optional(of_type_exact(str))], callback_url=[optional(is_url())], callback_method=[optional(of_type(six.text_type))], + record_track_type=[optional(of_type_exact(str))] ) def resume_participant_recording(self, participant_id, uuid=None, friendly_name=None, - callback_url=None, callback_method=None): + callback_url=None, callback_method=None, record_track_type='all'): mpc_id = self.__make_mpc_id(friendly_name, uuid) return self.client.request('POST', ('MultiPartyCall', mpc_id, 'Participant', participant_id, 'Record', 'Resume'), diff --git a/plivo/version.py b/plivo/version.py index 4f982245..cc87a7dc 100644 --- a/plivo/version.py +++ b/plivo/version.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '4.46.0' +__version__ = '4.47.0' diff --git a/plivo/xml/MultiPartyCallElement.py b/plivo/xml/MultiPartyCallElement.py index 395e311b..6104ba0c 100644 --- a/plivo/xml/MultiPartyCallElement.py +++ b/plivo/xml/MultiPartyCallElement.py @@ -159,6 +159,19 @@ def set_record(self, record): self.record = record return self + @property + def record_participant_track(self): + return self.__record_participant_track + + @record_participant_track.setter + @validate_args(record_participant_track=[optional(of_type_exact(bool))]) + def record_participant_track(self, record_participant_track): + self.__record_participant_track = record_participant_track + + def set_record_participant_track(self, record_participant_track): + self.record_participant_track = record_participant_track + return self + @property def record_file_format(self): return self.__record_file_format @@ -535,6 +548,7 @@ def __init__( customer_hold_music_url=None, customer_hold_music_method='GET', record=False, + record_participant_track=False, record_file_format='mp3', recording_callback_url=None, recording_callback_method='POST', @@ -576,6 +590,7 @@ def __init__( self.customer_hold_music_url = customer_hold_music_url self.customer_hold_music_method = customer_hold_music_method self.record = record + self.record_participant_track = record_participant_track self.record_file_format = record_file_format self.recording_callback_url = recording_callback_url self.recording_callback_method = recording_callback_method @@ -609,6 +624,7 @@ def to_dict(self): 'customerHoldMusicUrl': self.customer_hold_music_url, 'customerHoldMusicMethod': self.customer_hold_music_method, 'record': self.record, + 'recordParticipantTrack': self.record_participant_track, 'recordFileFormat': self.record_file_format, 'recordingCallbackUrl': self.recording_callback_url, 'recordingCallbackMethod': self.recording_callback_method, diff --git a/setup.py b/setup.py index aaa3c8cd..a511dda7 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='plivo', - version='4.46.0', + version='4.47.0', 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', diff --git a/tests/resources/test_multipartycalls.py b/tests/resources/test_multipartycalls.py index ff527197..218df67c 100644 --- a/tests/resources/test_multipartycalls.py +++ b/tests/resources/test_multipartycalls.py @@ -170,6 +170,7 @@ def test_add_participant(self): 'status_callback_events': 'mpc-state-changes,participant-state-changes', 'record_file_format': 'mp3', 'record': False, + 'record_participant_track': False, 'record_min_member_count': 1, 'on_exit_action_method': 'POST', 'status_callback_method': 'GET', @@ -485,7 +486,8 @@ def test_start_participant_recording(self): expected_method='POST', expected_request_body={'file_format': 'wav', 'recording_callback_url': recording_callback_url, - 'recording_callback_method': 'POST'}, + 'recording_callback_method': 'POST', + 'record_track_type': 'all'}, actual_response=start_participant_recording_response) def test_stop_participant_recording(self): @@ -494,7 +496,10 @@ def test_stop_participant_recording(self): self.client.multi_party_calls.stop_participant_recording(friendly_name='Voice', participant_id=participant_id) self.__assert_requests(expected_url='https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/MultiPartyCall' '/name_{}/Participant/{}/Record/'.format('Voice', participant_id), - expected_method='DELETE') + expected_method='DELETE', + expected_request_body={'record_track_type': 'all', + 'friendly_name': 'Voice', + 'participant_id': 10}) def test_pause_participant_recording(self): participant_id = 10 @@ -502,7 +507,10 @@ def test_pause_participant_recording(self): self.client.multi_party_calls.pause_participant_recording(friendly_name='Voice', participant_id=participant_id) self.__assert_requests(expected_url='https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/MultiPartyCall' '/name_{}/Participant/{}/Record/Pause/'.format('Voice', participant_id), - expected_method='POST') + expected_method='POST', + expected_request_body={'record_track_type': 'all', + 'friendly_name': 'Voice', + 'participant_id': 10}) def test_resume_participant_recording(self): participant_id = 10 @@ -510,7 +518,10 @@ def test_resume_participant_recording(self): self.client.multi_party_calls.resume_participant_recording(friendly_name='Voice', participant_id=participant_id) self.__assert_requests(expected_url='https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/MultiPartyCall' '/name_{}/Participant/{}/Record/Resume/'.format('Voice', participant_id), - expected_method='POST') + expected_method='POST', + expected_request_body={'record_track_type': 'all', + 'friendly_name': 'Voice', + 'participant_id': 10}) @with_response(202) def test_start_play_audio(self): diff --git a/tests/xml/test_MultiPartyCallElement.py b/tests/xml/test_MultiPartyCallElement.py index 7adf5754..e6084ca6 100644 --- a/tests/xml/test_MultiPartyCallElement.py +++ b/tests/xml/test_MultiPartyCallElement.py @@ -12,8 +12,8 @@ def test_default_xml(self): 'customerHoldMusicMethod="GET" endMpcOnExit="false" enterSound="beep:1" ' \ 'enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" hold="false" ' \ 'maxDuration="14400" maxParticipants="10" mute="false" onExitActionMethod="POST" ' \ - 'record="false" recordFileFormat="mp3" recordMinMemberCount="1" ' \ - 'recordingCallbackMethod="POST" ' \ + 'record="false" recordParticipantTrack="false" recordFileFormat="mp3" ' \ + 'recordMinMemberCount="1" recordingCallbackMethod="POST" ' \ 'relayDTMFInputs="false" role="agent" startMpcOnEnter="true" ' \ 'startRecordingAudioMethod="GET" ' \ 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ @@ -29,8 +29,8 @@ def test_setting_optional_fields(self): 'customerHoldMusicMethod="GET" endMpcOnExit="false" enterSound="beep:1" ' \ 'enterSoundMethod="GET" exitSound="beep:1" exitSoundMethod="GET" hold="false" ' \ 'maxDuration="14400" maxParticipants="10" mute="false" onExitActionMethod="POST" ' \ - 'record="false" recordFileFormat="mp3" recordMinMemberCount="1" ' \ - 'recordingCallbackMethod="POST" ' \ + 'record="false" recordParticipantTrack="false" recordFileFormat="mp3" ' \ + 'recordMinMemberCount="1" recordingCallbackMethod="POST" ' \ 'relayDTMFInputs="false" role="supervisor" startMpcOnEnter="true" ' \ 'startRecordingAudioMethod="GET" ' \ 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ @@ -71,9 +71,9 @@ def test_builder_setting(self): 'customerHoldMusicUrl="http://plivo.com/voice.mp3" endMpcOnExit="true" enterSound="beep:1" ' \ 'enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" hold="false" ' \ 'maxDuration="4500" maxParticipants="9" mute="false" onExitActionMethod="GET" ' \ - 'onExitActionUrl="http://plivo.com/api.mp3" record="false" recordFileFormat="mp3" ' \ - 'recordingCallbackMethod="POST" relayDTMFInputs="false" role="customer" ' \ - 'startMpcOnEnter="true" startRecordingAudio="http://plivo.com/api.mp3" ' \ + 'onExitActionUrl="http://plivo.com/api.mp3" record="false" recordParticipantTrack="false" ' \ + 'recordFileFormat="mp3" recordingCallbackMethod="POST" relayDTMFInputs="false" ' \ + 'role="customer" startMpcOnEnter="true" startRecordingAudio="http://plivo.com/api.mp3" ' \ 'startRecordingAudioMethod="GET" ' \ 'statusCallbackEvents="mpc-state-changes,participant-state-changes" ' \ 'statusCallbackMethod="POST" stayAlone="false" stopRecordingAudio="http://plivo.com/api.mp3" ' \