|
| 1 | +""" |
| 2 | +record.py |
| 3 | +
|
| 4 | +Bandwidth's Record BXML verb |
| 5 | +
|
| 6 | +@copyright Bandwidth INC |
| 7 | +""" |
| 8 | +from ..terminal_verb import TerminalVerb |
| 9 | + |
| 10 | + |
| 11 | +class Record(TerminalVerb): |
| 12 | + |
| 13 | + def __init__( |
| 14 | + self, record_complete_url: str = None, |
| 15 | + record_complete_method: str = None, |
| 16 | + record_complete_fallback_url: str = None, |
| 17 | + record_complete_fallback_method: str = None, |
| 18 | + recording_available_url: str = None, |
| 19 | + recording_available_method: str = None, |
| 20 | + transcribe: str = None, transcription_available_url: str = None, |
| 21 | + transcription_available_method: str = None, username: str=None, |
| 22 | + password: str=None, fallback_username: str=None, |
| 23 | + fallback_password: str=None, tag: str=None, |
| 24 | + terminating_digits: str = None, max_duration: str = None, |
| 25 | + silence_timeout: str = None, file_format: str = None |
| 26 | + ): |
| 27 | + """Initialize a <Record> verb |
| 28 | +
|
| 29 | + Args: |
| 30 | + record_complete_url (str, optional): URL to send the Record Complete event to once the recording has ended. Accepts BXML, and may be a relative URL. This callback will not be sent if the recording ended due to the call hanging up. Defaults to None. |
| 31 | + record_complete_method (str, optional): The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default value is POST. Defaults to None. |
| 32 | + record_complete_fallback_url (str, optional): A fallback url which, if provided, will be used to retry the Record Complete callback delivery in case recordCompleteUrl fails to respond. Defaults to None. |
| 33 | + record_complete_fallback_method (str, optional): The HTTP method to use to deliver the Record Complete callback to recordCompleteFallbackUrl. GET or POST. Default value is POST. Defaults to None. |
| 34 | + recording_available_url (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. |
| 35 | + recording_available_method (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. Defaults to None. |
| 36 | + transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. |
| 37 | + transcription_available_url (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. |
| 38 | + transcription_available_method (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. |
| 39 | + username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. |
| 40 | + password (str, optional): The password to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. |
| 41 | + fallback_username (str, optional): The username to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. |
| 42 | + fallback_password (str, optional): The password to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. |
| 43 | + tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. |
| 44 | + terminating_digits (str, optional): When pressed, this digit will terminate the recording. Default value is “#”. This feature can be disabled with "". Defaults to None. |
| 45 | + max_duration (str, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. |
| 46 | + silence_timeout (str, optional): Length of silence after which to end the recording (in seconds). Max is equivalent to the maximum maxDuration value. Default value is 0, which means no timeout. Defaults to None. |
| 47 | + file_format (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. |
| 48 | + """ |
| 49 | + self.record_complete_url = record_complete_url |
| 50 | + self.record_complete_method = record_complete_method |
| 51 | + self.record_complete_fallback_url = record_complete_fallback_url |
| 52 | + self.record_complete_fallback_method = record_complete_fallback_method |
| 53 | + self.recording_available_url = recording_available_url |
| 54 | + self.recording_available_method = recording_available_method |
| 55 | + self.transcribe = transcribe |
| 56 | + self.transcription_available_url = transcription_available_url |
| 57 | + self.transcription_available_method = transcription_available_method |
| 58 | + self.username = username |
| 59 | + self.password = password |
| 60 | + self.fallback_username = fallback_username |
| 61 | + self.fallback_password = fallback_password |
| 62 | + self.tag = tag |
| 63 | + self.terminating_digits = terminating_digits |
| 64 | + self.max_duration = max_duration |
| 65 | + self.silence_timeout = silence_timeout |
| 66 | + self.file_format = file_format |
| 67 | + super().__init__(tag="Record", content=None) |
| 68 | + |
| 69 | + @property |
| 70 | + def _attributes(self): |
| 71 | + return { |
| 72 | + "recordCompleteUrl": self.record_complete_url, |
| 73 | + "recordCompleteMethod": self.record_complete_method, |
| 74 | + "recordCompleteFallback_url": self.record_complete_fallback_url, |
| 75 | + "recordCompleteFallback_method": self.record_complete_fallback_method, |
| 76 | + "recordingAvailableUrl": self.recording_available_url, |
| 77 | + "recordingAvailableMethod": self.recording_available_method, |
| 78 | + "transcribe": self.transcribe, |
| 79 | + "transcriptionAvailableUrl": self.transcription_available_url, |
| 80 | + "transcriptionAvailableMethod": self.transcription_available_method, |
| 81 | + "username": self.username, |
| 82 | + "password": self.password, |
| 83 | + "fallbackUsername": self.fallback_username, |
| 84 | + "fallbackPassword": self.fallback_password, |
| 85 | + "tag": self.tag, |
| 86 | + "terminatingDigits": self.terminating_digits, |
| 87 | + "maxDuration": self.max_duration, |
| 88 | + "silenceTimeout": self.silence_timeout, |
| 89 | + "fileFormat": self.file_format |
| 90 | + } |
0 commit comments