Skip to content

Commit

Permalink
Merge pull request #282 from plivo/VT-8465
Browse files Browse the repository at this point in the history
Remove plivo bin URL in python SDK
  • Loading branch information
sandeep-plivo authored Nov 19, 2024
2 parents 8a58839 + 59efd11 commit 076ac92
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 45 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log

## [4.57.0](https://github.com/plivo/plivo-go/tree/v4.57.0) (2024-11-15)
## [4.58.0](https://github.com/plivo/plivo-python/tree/v4.58.0) (2024-11-19)
**Feature - Transcription params added in MPC XML Element**
- Support for the `transcriptionUrl`, `transcript` parameter in MPC XML Element.

## [4.57.0](https://github.com/plivo/plivo-python/tree/v4.57.0) (2024-11-15)
**Feature - CreateRecordingTranscription, GetRecordingTranscription and DeleteRecordingTranscription feature added**
- Support added to create transcription for recorded calls for which transcription is not available and get API to retrieve and delete API to delete.
- Support for the `type` filter parameter, supported filters are transcription, raw and diarized
Expand Down
2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.57.0'
__version__ = '4.58.0'
37 changes: 35 additions & 2 deletions plivo/xml/MultiPartyCallElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,32 @@ def set_relay_dtmf_inputs(self, relay_dtmf_inputs):
self.relay_dtmf_inputs = relay_dtmf_inputs
return self

@property
def transcript(self):
return self.__transcript

@transcript.setter
@validate_args(transcript=[optional(of_type_exact(bool))])
def transcript(self, transcript):
self.__transcript = transcript

def set_transcript(self, transcript):
self.transcript = transcript
return self

@property
def transcription_url(self):
return self.__transcription_url

@transcription_url.setter
@validate_args(transcription_url=[optional(of_type_exact(str), is_url())])
def transcription_url(self, transcription_url):
self.__transcription_url = transcription_url

def set_transcription_url(self, transcription_url):
self.transcription_url = transcription_url
return self

def __init__(
self,
content,
Expand Down Expand Up @@ -592,7 +618,9 @@ def __init__(
start_recording_audio=None,
start_recording_audio_method='GET',
stop_recording_audio=None,
stop_recording_audio_method='GET'
stop_recording_audio_method='GET',
transcript=False,
transcription_url=None
):
super(MultiPartyCallElement, self).__init__()
self.stop_recording_audio_method = stop_recording_audio_method
Expand Down Expand Up @@ -632,6 +660,9 @@ def __init__(
self.on_exit_action_url = on_exit_action_url
self.on_exit_action_method = on_exit_action_method
self.relay_dtmf_inputs = relay_dtmf_inputs
self.transcript = transcript
self.transcription_url = transcription_url


def to_dict(self):
d = {
Expand Down Expand Up @@ -670,7 +701,9 @@ def to_dict(self):
'startRecordingAudio': self.start_recording_audio,
'startRecordingAudioMethod': self.start_recording_audio_method,
'stopRecordingAudio': self.stop_recording_audio,
'stopRecordingAudioMethod': self.stop_recording_audio_method
'stopRecordingAudioMethod': self.stop_recording_audio_method,
'transcript': self.transcript,
'transcriptionUrl': self.transcription_url
}
return {
k: six.text_type(map_type(v))
Expand Down
9 changes: 6 additions & 3 deletions plivo/xml/ResponseElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,9 @@ def add_multi_party_call(self,
start_recording_audio=None,
start_recording_audio_method='GET',
stop_recording_audio=None,
stop_recording_audio_method='GET'

stop_recording_audio_method='GET',
transcript=False,
transcription_url=None
):
self.add(
MultiPartyCallElement(
Expand Down Expand Up @@ -400,7 +401,9 @@ def add_multi_party_call(self,
start_recording_audio=start_recording_audio,
start_recording_audio_method=start_recording_audio_method,
stop_recording_audio=stop_recording_audio,
stop_recording_audio_method=stop_recording_audio_method
stop_recording_audio_method=stop_recording_audio_method,
transcript=transcript,
transcription_url=transcription_url
)
)
return self
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.57.0',
version='4.58.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',
Expand Down
6 changes: 3 additions & 3 deletions tests/resources/fixtures/maskingSessionCreateResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "bc0a20bb-9f09-4116-b3f8-709def3a89df",
"callback_url": "http://plivobin.non-prod.plivops.com/1jvpmrs1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"callback_method": "GET",
"created_time": "2023-07-12 15:52:14.772699 +0000 UTC",
"modified_time": "2023-07-12 15:52:14.772699 +0000 UTC",
Expand All @@ -20,10 +20,10 @@
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"recording_callback_method": "GET",
"interaction": null,
"total_call_amount": 0,
Expand Down
6 changes: 3 additions & 3 deletions tests/resources/fixtures/maskingSessionGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"callback_method": "GET",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"modified_time": "2023-07-05 10:25:40.877364 +0000 UTC",
Expand All @@ -17,10 +17,10 @@
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"recording_callback_method": "GET",
"interaction": null,
"total_call_amount": 0,
Expand Down
42 changes: 21 additions & 21 deletions tests/resources/fixtures/maskingSessionListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"amount": 0,
"call_time_limit": 600,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"duration": 2863,
"expiry_time": "2023-07-05 11:13:23.895313 +0000 UTC",
Expand All @@ -26,11 +26,11 @@
"record": true,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/c2146ba4-798d-49b0-8580-53851a16e055/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -43,7 +43,7 @@
"amount": 0,
"call_time_limit": 600,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-07-04 10:29:02.410778 +0000 UTC",
"duration": 2571,
"expiry_time": "2023-07-04 11:11:53.486694 +0000 UTC",
Expand All @@ -56,11 +56,11 @@
"record": true,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/61130623-ac98-4d70-8961-3b3110700e0a/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "61130623-ac98-4d70-8961-3b3110700e0a",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -73,7 +73,7 @@
"amount": 0,
"call_time_limit": 600,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-07-04 07:29:27.14973 +0000 UTC",
"duration": 926,
"expiry_time": "2023-07-04 07:36:50.056529 +0000 UTC",
Expand All @@ -86,11 +86,11 @@
"record": true,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/4b083bef-7b26-4116-95a4-c35f81f5c2c1/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "4b083bef-7b26-4116-95a4-c35f81f5c2c1",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -103,7 +103,7 @@
"amount": 0,
"call_time_limit": 600,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-07-04 06:41:19.396345 +0000 UTC",
"duration": 1244,
"expiry_time": "2023-07-04 07:02:03.635064 +0000 UTC",
Expand All @@ -116,11 +116,11 @@
"record": true,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/24d9691b-3904-488f-9ad8-f5afa6121606/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "24d9691b-3904-488f-9ad8-f5afa6121606",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -133,7 +133,7 @@
"amount": 0,
"call_time_limit": 14400,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-07-03 09:46:07.91423 +0000 UTC",
"duration": 8702,
"expiry_time": "2023-07-03 12:11:09.939161 +0000 UTC",
Expand All @@ -146,11 +146,11 @@
"record": false,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/964c20e0-9d59-40d5-90c3-7006ef5d03f4/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "964c20e0-9d59-40d5-90c3-7006ef5d03f4",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -163,7 +163,7 @@
"amount": 0,
"call_time_limit": 600,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-06-30 06:51:11.021617 +0000 UTC",
"duration": 6702,
"expiry_time": "2023-06-30 08:42:53.503857 +0000 UTC",
Expand All @@ -176,11 +176,11 @@
"record": true,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/c4ea0e4c-b3e7-47c3-a31c-79227ac6939c/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "c4ea0e4c-b3e7-47c3-a31c-79227ac6939c",
"status": "expired",
"total_call_amount": 0,
Expand All @@ -193,7 +193,7 @@
"amount": 0,
"call_time_limit": 14400,
"callback_method": "GET",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"created_time": "2023-06-30 06:39:06.742974 +0000 UTC",
"duration": 6000,
"expiry_time": "2023-06-30 06:39:16.99714 +0000 UTC",
Expand All @@ -206,11 +206,11 @@
"record": false,
"record_file_format": "mp3",
"recording_callback_method": "GET",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/dd3bb3c2-4f18-4988-87f1-9116b00bb875/",
"ring_timeout": 120,
"second_party": "919976106830",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"session_uuid": "dd3bb3c2-4f18-4988-87f1-9116b00bb875",
"status": "expired",
"total_call_amount": 0,
Expand Down
6 changes: 3 additions & 3 deletions tests/resources/fixtures/maskingSessionUpdateResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "7b5c5e17-e1e9-4ccd-a480-42f5c97fbe96",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"callback_method": "GET",
"created_time": "2023-07-06 10:53:32.814078 +0000 +0000",
"modified_time": "2023-07-06 10:53:45.106122 +0000 UTC",
Expand All @@ -18,10 +18,10 @@
"call_time_limit": 14600,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"second_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"record": true,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_url": "https://s3.amazonaws.com/static.plivo.com/callback.xml",
"recording_callback_method": "GET",
"interaction": null,
"total_call_amount": 0,
Expand Down
10 changes: 6 additions & 4 deletions tests/xml/test_MultiPartyCallElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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</MultiPartyCall>'
'waitMusicMethod="GET" transcript="false">Nairobi</MultiPartyCall>'

element = plivoxml.MultiPartyCallElement(content='Nairobi', role='Agent')
self.assertXmlEqual(element.to_string(False), expected_response)
Expand All @@ -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</MultiPartyCall>'
'waitMusicMethod="GET" transcript="false">Tokyo</MultiPartyCall>'

element = plivoxml.MultiPartyCallElement(content='Tokyo', role='supervisor', exit_sound='beep:1')
self.assertXmlEqual(element.to_string(False), expected_response)
Expand Down Expand Up @@ -79,13 +79,15 @@ def test_builder_setting(self):
'statusCallbackMethod="POST" stayAlone="false" stopRecordingAudio="http://plivo.com/api.mp3" ' \
'stopRecordingAudioMethod="GET" ' \
'waitTime="5" ' \
'waitMusicMethod="GET" recordMinMemberCount="1">Helsinki</MultiPartyCall> '
'waitMusicMethod="GET" recordMinMemberCount="1" transcript="true" transcriptionUrl="http://plivo.com/api.mp3" >Helsinki</MultiPartyCall> '
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_wait_time(5)
set_wait_time(5). \
set_transcript(True). \
set_transcription_url("http://plivo.com/api.mp3")

self.assertXmlEqual(expected_xml, element.to_string(False))
Loading

0 comments on commit 076ac92

Please sign in to comment.