1# coding=utf-8 2r""" 3This code was generated by 4\ / _ _ _| _ _ 5 | (_)\/(_)(_|\/| |(/_ v1.0.0 6 / / 7""" 8 9import json 10from twilio.base.obsolete import deprecated_method 11from twilio.twiml import ( 12 TwiML, 13 format_language, 14) 15 16 17class VoiceResponse(TwiML): 18 """ <Response> TwiML for Voice """ 19 20 def __init__(self, **kwargs): 21 super(VoiceResponse, self).__init__(**kwargs) 22 self.name = 'Response' 23 24 def connect(self, action=None, method=None, **kwargs): 25 """ 26 Create a <Connect> element 27 28 :param action: Action URL 29 :param method: Action URL method 30 :param kwargs: additional attributes 31 32 :returns: <Connect> element 33 """ 34 return self.nest(Connect(action=action, method=method, **kwargs)) 35 36 def dial(self, number=None, action=None, method=None, timeout=None, 37 hangup_on_star=None, time_limit=None, caller_id=None, record=None, 38 trim=None, recording_status_callback=None, 39 recording_status_callback_method=None, 40 recording_status_callback_event=None, answer_on_bridge=None, 41 ring_tone=None, recording_track=None, sequential=None, refer_url=None, 42 refer_method=None, **kwargs): 43 """ 44 Create a <Dial> element 45 46 :param number: Phone number to dial 47 :param action: Action URL 48 :param method: Action URL method 49 :param timeout: Time to wait for answer 50 :param hangup_on_star: Hangup call on star press 51 :param time_limit: Max time length 52 :param caller_id: Caller ID to display 53 :param record: Record the call 54 :param trim: Trim the recording 55 :param recording_status_callback: Recording status callback URL 56 :param recording_status_callback_method: Recording status callback URL method 57 :param recording_status_callback_event: Recording status callback events 58 :param answer_on_bridge: Preserve the ringing behavior of the inbound call until the Dialed call picks up 59 :param ring_tone: Ringtone allows you to override the ringback tone that Twilio will play back to the caller while executing the Dial 60 :param recording_track: To indicate which audio track should be recorded 61 :param sequential: Used to determine if child TwiML nouns should be dialed in order, one after the other (sequential) or dial all at once (parallel). Default is false, parallel 62 :param refer_url: Webhook that will receive future SIP REFER requests 63 :param refer_method: The HTTP method to use for the refer Webhook 64 :param kwargs: additional attributes 65 66 :returns: <Dial> element 67 """ 68 return self.nest(Dial( 69 number=number, 70 action=action, 71 method=method, 72 timeout=timeout, 73 hangup_on_star=hangup_on_star, 74 time_limit=time_limit, 75 caller_id=caller_id, 76 record=record, 77 trim=trim, 78 recording_status_callback=recording_status_callback, 79 recording_status_callback_method=recording_status_callback_method, 80 recording_status_callback_event=recording_status_callback_event, 81 answer_on_bridge=answer_on_bridge, 82 ring_tone=ring_tone, 83 recording_track=recording_track, 84 sequential=sequential, 85 refer_url=refer_url, 86 refer_method=refer_method, 87 **kwargs 88 )) 89 90 def echo(self, **kwargs): 91 """ 92 Create a <Echo> element 93 94 :param kwargs: additional attributes 95 96 :returns: <Echo> element 97 """ 98 return self.nest(Echo(**kwargs)) 99 100 def enqueue(self, name=None, action=None, method=None, wait_url=None, 101 wait_url_method=None, workflow_sid=None, **kwargs): 102 """ 103 Create a <Enqueue> element 104 105 :param name: Friendly name 106 :param action: Action URL 107 :param method: Action URL method 108 :param wait_url: Wait URL 109 :param wait_url_method: Wait URL method 110 :param workflow_sid: TaskRouter Workflow SID 111 :param kwargs: additional attributes 112 113 :returns: <Enqueue> element 114 """ 115 return self.nest(Enqueue( 116 name=name, 117 action=action, 118 method=method, 119 wait_url=wait_url, 120 wait_url_method=wait_url_method, 121 workflow_sid=workflow_sid, 122 **kwargs 123 )) 124 125 def gather(self, input=None, action=None, method=None, timeout=None, 126 speech_timeout=None, max_speech_time=None, profanity_filter=None, 127 finish_on_key=None, num_digits=None, partial_result_callback=None, 128 partial_result_callback_method=None, language=None, hints=None, 129 barge_in=None, debug=None, action_on_empty_result=None, 130 speech_model=None, enhanced=None, **kwargs): 131 """ 132 Create a <Gather> element 133 134 :param input: Input type Twilio should accept 135 :param action: Action URL 136 :param method: Action URL method 137 :param timeout: Time to wait to gather input 138 :param speech_timeout: Time to wait to gather speech input and it should be either auto or a positive integer. 139 :param max_speech_time: Max allowed time for speech input 140 :param profanity_filter: Profanity Filter on speech 141 :param finish_on_key: Finish gather on key 142 :param num_digits: Number of digits to collect 143 :param partial_result_callback: Partial result callback URL 144 :param partial_result_callback_method: Partial result callback URL method 145 :param language: Language to use 146 :param hints: Speech recognition hints 147 :param barge_in: Stop playing media upon speech 148 :param debug: Allow debug for gather 149 :param action_on_empty_result: Force webhook to the action URL event if there is no input 150 :param speech_model: Specify the model that is best suited for your use case 151 :param enhanced: Use enhanced speech model 152 :param kwargs: additional attributes 153 154 :returns: <Gather> element 155 """ 156 return self.nest(Gather( 157 input=input, 158 action=action, 159 method=method, 160 timeout=timeout, 161 speech_timeout=speech_timeout, 162 max_speech_time=max_speech_time, 163 profanity_filter=profanity_filter, 164 finish_on_key=finish_on_key, 165 num_digits=num_digits, 166 partial_result_callback=partial_result_callback, 167 partial_result_callback_method=partial_result_callback_method, 168 language=language, 169 hints=hints, 170 barge_in=barge_in, 171 debug=debug, 172 action_on_empty_result=action_on_empty_result, 173 speech_model=speech_model, 174 enhanced=enhanced, 175 **kwargs 176 )) 177 178 def hangup(self, **kwargs): 179 """ 180 Create a <Hangup> element 181 182 :param kwargs: additional attributes 183 184 :returns: <Hangup> element 185 """ 186 return self.nest(Hangup(**kwargs)) 187 188 def leave(self, **kwargs): 189 """ 190 Create a <Leave> element 191 192 :param kwargs: additional attributes 193 194 :returns: <Leave> element 195 """ 196 return self.nest(Leave(**kwargs)) 197 198 def pause(self, length=None, **kwargs): 199 """ 200 Create a <Pause> element 201 202 :param length: Length in seconds to pause 203 :param kwargs: additional attributes 204 205 :returns: <Pause> element 206 """ 207 return self.nest(Pause(length=length, **kwargs)) 208 209 def play(self, url=None, loop=None, digits=None, **kwargs): 210 """ 211 Create a <Play> element 212 213 :param url: Media URL 214 :param loop: Times to loop media 215 :param digits: Play DTMF tones for digits 216 :param kwargs: additional attributes 217 218 :returns: <Play> element 219 """ 220 return self.nest(Play(url=url, loop=loop, digits=digits, **kwargs)) 221 222 def queue(self, name, url=None, method=None, reservation_sid=None, 223 post_work_activity_sid=None, **kwargs): 224 """ 225 Create a <Queue> element 226 227 :param name: Queue name 228 :param url: Action URL 229 :param method: Action URL method 230 :param reservation_sid: TaskRouter Reservation SID 231 :param post_work_activity_sid: TaskRouter Activity SID 232 :param kwargs: additional attributes 233 234 :returns: <Queue> element 235 """ 236 return self.nest(Queue( 237 name, 238 url=url, 239 method=method, 240 reservation_sid=reservation_sid, 241 post_work_activity_sid=post_work_activity_sid, 242 **kwargs 243 )) 244 245 def record(self, action=None, method=None, timeout=None, finish_on_key=None, 246 max_length=None, play_beep=None, trim=None, 247 recording_status_callback=None, 248 recording_status_callback_method=None, 249 recording_status_callback_event=None, transcribe=None, 250 transcribe_callback=None, **kwargs): 251 """ 252 Create a <Record> element 253 254 :param action: Action URL 255 :param method: Action URL method 256 :param timeout: Timeout to begin recording 257 :param finish_on_key: Finish recording on key 258 :param max_length: Max time to record in seconds 259 :param play_beep: Play beep 260 :param trim: Trim the recording 261 :param recording_status_callback: Status callback URL 262 :param recording_status_callback_method: Status callback URL method 263 :param recording_status_callback_event: Recording status callback events 264 :param transcribe: Transcribe the recording 265 :param transcribe_callback: Transcribe callback URL 266 :param kwargs: additional attributes 267 268 :returns: <Record> element 269 """ 270 return self.nest(Record( 271 action=action, 272 method=method, 273 timeout=timeout, 274 finish_on_key=finish_on_key, 275 max_length=max_length, 276 play_beep=play_beep, 277 trim=trim, 278 recording_status_callback=recording_status_callback, 279 recording_status_callback_method=recording_status_callback_method, 280 recording_status_callback_event=recording_status_callback_event, 281 transcribe=transcribe, 282 transcribe_callback=transcribe_callback, 283 **kwargs 284 )) 285 286 def redirect(self, url, method=None, **kwargs): 287 """ 288 Create a <Redirect> element 289 290 :param url: Redirect URL 291 :param method: Redirect URL method 292 :param kwargs: additional attributes 293 294 :returns: <Redirect> element 295 """ 296 return self.nest(Redirect(url, method=method, **kwargs)) 297 298 def reject(self, reason=None, **kwargs): 299 """ 300 Create a <Reject> element 301 302 :param reason: Rejection reason 303 :param kwargs: additional attributes 304 305 :returns: <Reject> element 306 """ 307 return self.nest(Reject(reason=reason, **kwargs)) 308 309 def say(self, message=None, voice=None, loop=None, language=None, **kwargs): 310 """ 311 Create a <Say> element 312 313 :param message: Message to say 314 :param voice: Voice to use 315 :param loop: Times to loop message 316 :param language: Message langauge 317 :param kwargs: additional attributes 318 319 :returns: <Say> element 320 """ 321 return self.nest(Say(message=message, voice=voice, loop=loop, language=language, **kwargs)) 322 323 def sms(self, message, to=None, from_=None, action=None, method=None, 324 status_callback=None, **kwargs): 325 """ 326 Create a <Sms> element 327 328 :param message: Message body 329 :param to: Number to send message to 330 :param from: Number to send message from 331 :param action: Action URL 332 :param method: Action URL method 333 :param status_callback: Status callback URL 334 :param kwargs: additional attributes 335 336 :returns: <Sms> element 337 """ 338 return self.nest(Sms( 339 message, 340 to=to, 341 from_=from_, 342 action=action, 343 method=method, 344 status_callback=status_callback, 345 **kwargs 346 )) 347 348 def pay(self, input=None, action=None, bank_account_type=None, 349 status_callback=None, status_callback_method=None, timeout=None, 350 max_attempts=None, security_code=None, postal_code=None, 351 min_postal_code_length=None, payment_connector=None, 352 payment_method=None, token_type=None, charge_amount=None, currency=None, 353 description=None, valid_card_types=None, language=None, **kwargs): 354 """ 355 Create a <Pay> element 356 357 :param input: Input type Twilio should accept 358 :param action: Action URL 359 :param bank_account_type: Bank account type for ach transactions. If set, payment method attribute must be provided and value should be set to ach-debit. defaults to consumer-checking 360 :param status_callback: Status callback URL 361 :param status_callback_method: Status callback method 362 :param timeout: Time to wait to gather input 363 :param max_attempts: Maximum number of allowed retries when gathering input 364 :param security_code: Prompt for security code 365 :param postal_code: Prompt for postal code and it should be true/false or default postal code 366 :param min_postal_code_length: Prompt for minimum postal code length 367 :param payment_connector: Unique name for payment connector 368 :param payment_method: Payment method to be used. defaults to credit-card 369 :param token_type: Type of token 370 :param charge_amount: Amount to process. If value is greater than 0 then make the payment else create a payment token 371 :param currency: Currency of the amount attribute 372 :param description: Details regarding the payment 373 :param valid_card_types: Comma separated accepted card types 374 :param language: Language to use 375 :param kwargs: additional attributes 376 377 :returns: <Pay> element 378 """ 379 return self.nest(Pay( 380 input=input, 381 action=action, 382 bank_account_type=bank_account_type, 383 status_callback=status_callback, 384 status_callback_method=status_callback_method, 385 timeout=timeout, 386 max_attempts=max_attempts, 387 security_code=security_code, 388 postal_code=postal_code, 389 min_postal_code_length=min_postal_code_length, 390 payment_connector=payment_connector, 391 payment_method=payment_method, 392 token_type=token_type, 393 charge_amount=charge_amount, 394 currency=currency, 395 description=description, 396 valid_card_types=valid_card_types, 397 language=language, 398 **kwargs 399 )) 400 401 def prompt(self, for_=None, error_type=None, card_type=None, attempt=None, 402 **kwargs): 403 """ 404 Create a <Prompt> element 405 406 :param for_: Name of the payment source data element 407 :param error_type: Type of error 408 :param card_type: Type of the credit card 409 :param attempt: Current attempt count 410 :param kwargs: additional attributes 411 412 :returns: <Prompt> element 413 """ 414 return self.nest(Prompt( 415 for_=for_, 416 error_type=error_type, 417 card_type=card_type, 418 attempt=attempt, 419 **kwargs 420 )) 421 422 def start(self, action=None, method=None, **kwargs): 423 """ 424 Create a <Start> element 425 426 :param action: Action URL 427 :param method: Action URL method 428 :param kwargs: additional attributes 429 430 :returns: <Start> element 431 """ 432 return self.nest(Start(action=action, method=method, **kwargs)) 433 434 def stop(self, **kwargs): 435 """ 436 Create a <Stop> element 437 438 :param kwargs: additional attributes 439 440 :returns: <Stop> element 441 """ 442 return self.nest(Stop(**kwargs)) 443 444 def refer(self, action=None, method=None, **kwargs): 445 """ 446 Create a <Refer> element 447 448 :param action: Action URL 449 :param method: Action URL method 450 :param kwargs: additional attributes 451 452 :returns: <Refer> element 453 """ 454 return self.nest(Refer(action=action, method=method, **kwargs)) 455 456 457class Refer(TwiML): 458 """ <Refer> TwiML Verb """ 459 460 def __init__(self, **kwargs): 461 super(Refer, self).__init__(**kwargs) 462 self.name = 'Refer' 463 464 def sip(self, sip_url, **kwargs): 465 """ 466 Create a <Sip> element 467 468 :param sip_url: SIP URL 469 :param kwargs: additional attributes 470 471 :returns: <Sip> element 472 """ 473 return self.nest(ReferSip(sip_url, **kwargs)) 474 475 @deprecated_method('sip') 476 def refer_sip(self, sip_url, **kwargs): 477 """ 478 Create a <Sip> element 479 480 :param sip_url: SIP URL 481 :param kwargs: additional attributes 482 483 :returns: <Sip> element 484 """ 485 return self.sip(sip_url, **kwargs) 486 487 488class ReferSip(TwiML): 489 """ <Sip> TwiML Noun used in <Refer> """ 490 491 def __init__(self, sip_url, **kwargs): 492 super(ReferSip, self).__init__(**kwargs) 493 self.name = 'Sip' 494 self.value = sip_url 495 496 497class Stop(TwiML): 498 """ <Stop> TwiML Verb """ 499 500 def __init__(self, **kwargs): 501 super(Stop, self).__init__(**kwargs) 502 self.name = 'Stop' 503 504 def stream(self, name=None, connector_name=None, url=None, track=None, 505 status_callback=None, status_callback_method=None, **kwargs): 506 """ 507 Create a <Stream> element 508 509 :param name: Friendly name given to the Stream 510 :param connector_name: Unique name for Stream Connector 511 :param url: URL of the remote service where the Stream is routed 512 :param track: Track to be streamed to remote service 513 :param status_callback: Status Callback URL 514 :param status_callback_method: Status Callback URL method 515 :param kwargs: additional attributes 516 517 :returns: <Stream> element 518 """ 519 return self.nest(Stream( 520 name=name, 521 connector_name=connector_name, 522 url=url, 523 track=track, 524 status_callback=status_callback, 525 status_callback_method=status_callback_method, 526 **kwargs 527 )) 528 529 def siprec(self, name=None, connector_name=None, track=None, **kwargs): 530 """ 531 Create a <Siprec> element 532 533 :param name: Friendly name given to SIPREC 534 :param connector_name: Unique name for Connector 535 :param track: Track to be streamed to remote service 536 :param kwargs: additional attributes 537 538 :returns: <Siprec> element 539 """ 540 return self.nest(Siprec(name=name, connector_name=connector_name, track=track, **kwargs)) 541 542 543class Siprec(TwiML): 544 """ <Siprec> TwiML Noun """ 545 546 def __init__(self, **kwargs): 547 super(Siprec, self).__init__(**kwargs) 548 self.name = 'Siprec' 549 550 def parameter(self, name=None, value=None, **kwargs): 551 """ 552 Create a <Parameter> element 553 554 :param name: The name of the custom parameter 555 :param value: The value of the custom parameter 556 :param kwargs: additional attributes 557 558 :returns: <Parameter> element 559 """ 560 return self.nest(Parameter(name=name, value=value, **kwargs)) 561 562 563class Parameter(TwiML): 564 """ <Parameter> TwiML Noun """ 565 566 def __init__(self, **kwargs): 567 super(Parameter, self).__init__(**kwargs) 568 self.name = 'Parameter' 569 570 571class Stream(TwiML): 572 """ <Stream> TwiML Noun """ 573 574 def __init__(self, **kwargs): 575 super(Stream, self).__init__(**kwargs) 576 self.name = 'Stream' 577 578 def parameter(self, name=None, value=None, **kwargs): 579 """ 580 Create a <Parameter> element 581 582 :param name: The name of the custom parameter 583 :param value: The value of the custom parameter 584 :param kwargs: additional attributes 585 586 :returns: <Parameter> element 587 """ 588 return self.nest(Parameter(name=name, value=value, **kwargs)) 589 590 591class Start(TwiML): 592 """ <Start> TwiML Verb """ 593 594 def __init__(self, **kwargs): 595 super(Start, self).__init__(**kwargs) 596 self.name = 'Start' 597 598 def stream(self, name=None, connector_name=None, url=None, track=None, 599 status_callback=None, status_callback_method=None, **kwargs): 600 """ 601 Create a <Stream> element 602 603 :param name: Friendly name given to the Stream 604 :param connector_name: Unique name for Stream Connector 605 :param url: URL of the remote service where the Stream is routed 606 :param track: Track to be streamed to remote service 607 :param status_callback: Status Callback URL 608 :param status_callback_method: Status Callback URL method 609 :param kwargs: additional attributes 610 611 :returns: <Stream> element 612 """ 613 return self.nest(Stream( 614 name=name, 615 connector_name=connector_name, 616 url=url, 617 track=track, 618 status_callback=status_callback, 619 status_callback_method=status_callback_method, 620 **kwargs 621 )) 622 623 def siprec(self, name=None, connector_name=None, track=None, **kwargs): 624 """ 625 Create a <Siprec> element 626 627 :param name: Friendly name given to SIPREC 628 :param connector_name: Unique name for Connector 629 :param track: Track to be streamed to remote service 630 :param kwargs: additional attributes 631 632 :returns: <Siprec> element 633 """ 634 return self.nest(Siprec(name=name, connector_name=connector_name, track=track, **kwargs)) 635 636 637class Prompt(TwiML): 638 """ <Prompt> Twiml Verb """ 639 640 def __init__(self, **kwargs): 641 super(Prompt, self).__init__(**kwargs) 642 self.name = 'Prompt' 643 644 def say(self, message=None, voice=None, loop=None, language=None, **kwargs): 645 """ 646 Create a <Say> element 647 648 :param message: Message to say 649 :param voice: Voice to use 650 :param loop: Times to loop message 651 :param language: Message langauge 652 :param kwargs: additional attributes 653 654 :returns: <Say> element 655 """ 656 return self.nest(Say(message=message, voice=voice, loop=loop, language=language, **kwargs)) 657 658 def play(self, url=None, loop=None, digits=None, **kwargs): 659 """ 660 Create a <Play> element 661 662 :param url: Media URL 663 :param loop: Times to loop media 664 :param digits: Play DTMF tones for digits 665 :param kwargs: additional attributes 666 667 :returns: <Play> element 668 """ 669 return self.nest(Play(url=url, loop=loop, digits=digits, **kwargs)) 670 671 def pause(self, length=None, **kwargs): 672 """ 673 Create a <Pause> element 674 675 :param length: Length in seconds to pause 676 :param kwargs: additional attributes 677 678 :returns: <Pause> element 679 """ 680 return self.nest(Pause(length=length, **kwargs)) 681 682 683class Pause(TwiML): 684 """ <Pause> TwiML Verb """ 685 686 def __init__(self, **kwargs): 687 super(Pause, self).__init__(**kwargs) 688 self.name = 'Pause' 689 690 691class Play(TwiML): 692 """ <Play> TwiML Verb """ 693 694 def __init__(self, url=None, **kwargs): 695 super(Play, self).__init__(**kwargs) 696 self.name = 'Play' 697 if url: 698 self.value = url 699 700 701class Say(TwiML): 702 """ <Say> TwiML Verb """ 703 704 def __init__(self, message=None, **kwargs): 705 super(Say, self).__init__(**kwargs) 706 self.name = 'Say' 707 if message: 708 self.value = message 709 710 def break_(self, strength=None, time=None, **kwargs): 711 """ 712 Create a <Break> element 713 714 :param strength: Set a pause based on strength 715 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 716 :param kwargs: additional attributes 717 718 :returns: <Break> element 719 """ 720 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 721 722 @deprecated_method('break_') 723 def ssml_break(self, strength=None, time=None, **kwargs): 724 """ 725 Create a <Break> element 726 727 :param strength: Set a pause based on strength 728 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 729 :param kwargs: additional attributes 730 731 :returns: <Break> element 732 """ 733 return self.break_(strength=strength, time=time, **kwargs) 734 735 def emphasis(self, words=None, level=None, **kwargs): 736 """ 737 Create a <Emphasis> element 738 739 :param words: Words to emphasize 740 :param level: Specify the degree of emphasis 741 :param kwargs: additional attributes 742 743 :returns: <Emphasis> element 744 """ 745 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 746 747 @deprecated_method('emphasis') 748 def ssml_emphasis(self, words=None, level=None, **kwargs): 749 """ 750 Create a <Emphasis> element 751 752 :param words: Words to emphasize 753 :param level: Specify the degree of emphasis 754 :param kwargs: additional attributes 755 756 :returns: <Emphasis> element 757 """ 758 return self.emphasis(words=words, level=level, **kwargs) 759 760 def lang(self, words=None, xml_lang=None, **kwargs): 761 """ 762 Create a <Lang> element 763 764 :param words: Words to speak 765 :param xml:lang: Specify the language 766 :param kwargs: additional attributes 767 768 :returns: <Lang> element 769 """ 770 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 771 772 @deprecated_method('lang') 773 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 774 """ 775 Create a <Lang> element 776 777 :param words: Words to speak 778 :param xml:lang: Specify the language 779 :param kwargs: additional attributes 780 781 :returns: <Lang> element 782 """ 783 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 784 785 def p(self, words=None, **kwargs): 786 """ 787 Create a <P> element 788 789 :param words: Words to speak 790 :param kwargs: additional attributes 791 792 :returns: <P> element 793 """ 794 return self.nest(SsmlP(words=words, **kwargs)) 795 796 @deprecated_method('p') 797 def ssml_p(self, words=None, **kwargs): 798 """ 799 Create a <P> element 800 801 :param words: Words to speak 802 :param kwargs: additional attributes 803 804 :returns: <P> element 805 """ 806 return self.p(words=words, **kwargs) 807 808 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 809 """ 810 Create a <Phoneme> element 811 812 :param words: Words to speak 813 :param alphabet: Specify the phonetic alphabet 814 :param ph: Specifiy the phonetic symbols for pronunciation 815 :param kwargs: additional attributes 816 817 :returns: <Phoneme> element 818 """ 819 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 820 821 @deprecated_method('phoneme') 822 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 823 """ 824 Create a <Phoneme> element 825 826 :param words: Words to speak 827 :param alphabet: Specify the phonetic alphabet 828 :param ph: Specifiy the phonetic symbols for pronunciation 829 :param kwargs: additional attributes 830 831 :returns: <Phoneme> element 832 """ 833 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 834 835 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 836 """ 837 Create a <Prosody> element 838 839 :param words: Words to speak 840 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 841 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 842 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 843 :param kwargs: additional attributes 844 845 :returns: <Prosody> element 846 """ 847 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 848 849 @deprecated_method('prosody') 850 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 851 **kwargs): 852 """ 853 Create a <Prosody> element 854 855 :param words: Words to speak 856 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 857 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 858 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 859 :param kwargs: additional attributes 860 861 :returns: <Prosody> element 862 """ 863 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 864 865 def s(self, words=None, **kwargs): 866 """ 867 Create a <S> element 868 869 :param words: Words to speak 870 :param kwargs: additional attributes 871 872 :returns: <S> element 873 """ 874 return self.nest(SsmlS(words=words, **kwargs)) 875 876 @deprecated_method('s') 877 def ssml_s(self, words=None, **kwargs): 878 """ 879 Create a <S> element 880 881 :param words: Words to speak 882 :param kwargs: additional attributes 883 884 :returns: <S> element 885 """ 886 return self.s(words=words, **kwargs) 887 888 def say_as(self, words, interpret_as=None, role=None, **kwargs): 889 """ 890 Create a <Say-As> element 891 892 :param words: Words to be interpreted 893 :param interpret-as: Specify the type of words are spoken 894 :param role: Specify the format of the date when interpret-as is set to date 895 :param kwargs: additional attributes 896 897 :returns: <Say-As> element 898 """ 899 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 900 901 @deprecated_method('say_as') 902 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 903 """ 904 Create a <Say-As> element 905 906 :param words: Words to be interpreted 907 :param interpret-as: Specify the type of words are spoken 908 :param role: Specify the format of the date when interpret-as is set to date 909 :param kwargs: additional attributes 910 911 :returns: <Say-As> element 912 """ 913 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 914 915 def sub(self, words, alias=None, **kwargs): 916 """ 917 Create a <Sub> element 918 919 :param words: Words to be substituted 920 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 921 :param kwargs: additional attributes 922 923 :returns: <Sub> element 924 """ 925 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 926 927 @deprecated_method('sub') 928 def ssml_sub(self, words, alias=None, **kwargs): 929 """ 930 Create a <Sub> element 931 932 :param words: Words to be substituted 933 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 934 :param kwargs: additional attributes 935 936 :returns: <Sub> element 937 """ 938 return self.sub(words, alias=alias, **kwargs) 939 940 def w(self, words=None, role=None, **kwargs): 941 """ 942 Create a <W> element 943 944 :param words: Words to speak 945 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 946 :param kwargs: additional attributes 947 948 :returns: <W> element 949 """ 950 return self.nest(SsmlW(words=words, role=role, **kwargs)) 951 952 @deprecated_method('w') 953 def ssml_w(self, words=None, role=None, **kwargs): 954 """ 955 Create a <W> element 956 957 :param words: Words to speak 958 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 959 :param kwargs: additional attributes 960 961 :returns: <W> element 962 """ 963 return self.w(words=words, role=role, **kwargs) 964 965 966class SsmlW(TwiML): 967 """ Improving Pronunciation by Specifying Parts of Speech in <Say> """ 968 969 def __init__(self, words=None, **kwargs): 970 super(SsmlW, self).__init__(**kwargs) 971 self.name = 'w' 972 if words: 973 self.value = words 974 975 def break_(self, strength=None, time=None, **kwargs): 976 """ 977 Create a <Break> element 978 979 :param strength: Set a pause based on strength 980 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 981 :param kwargs: additional attributes 982 983 :returns: <Break> element 984 """ 985 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 986 987 @deprecated_method('break_') 988 def ssml_break(self, strength=None, time=None, **kwargs): 989 """ 990 Create a <Break> element 991 992 :param strength: Set a pause based on strength 993 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 994 :param kwargs: additional attributes 995 996 :returns: <Break> element 997 """ 998 return self.break_(strength=strength, time=time, **kwargs) 999 1000 def emphasis(self, words=None, level=None, **kwargs): 1001 """ 1002 Create a <Emphasis> element 1003 1004 :param words: Words to emphasize 1005 :param level: Specify the degree of emphasis 1006 :param kwargs: additional attributes 1007 1008 :returns: <Emphasis> element 1009 """ 1010 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 1011 1012 @deprecated_method('emphasis') 1013 def ssml_emphasis(self, words=None, level=None, **kwargs): 1014 """ 1015 Create a <Emphasis> element 1016 1017 :param words: Words to emphasize 1018 :param level: Specify the degree of emphasis 1019 :param kwargs: additional attributes 1020 1021 :returns: <Emphasis> element 1022 """ 1023 return self.emphasis(words=words, level=level, **kwargs) 1024 1025 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 1026 """ 1027 Create a <Phoneme> element 1028 1029 :param words: Words to speak 1030 :param alphabet: Specify the phonetic alphabet 1031 :param ph: Specifiy the phonetic symbols for pronunciation 1032 :param kwargs: additional attributes 1033 1034 :returns: <Phoneme> element 1035 """ 1036 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 1037 1038 @deprecated_method('phoneme') 1039 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 1040 """ 1041 Create a <Phoneme> element 1042 1043 :param words: Words to speak 1044 :param alphabet: Specify the phonetic alphabet 1045 :param ph: Specifiy the phonetic symbols for pronunciation 1046 :param kwargs: additional attributes 1047 1048 :returns: <Phoneme> element 1049 """ 1050 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 1051 1052 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 1053 """ 1054 Create a <Prosody> element 1055 1056 :param words: Words to speak 1057 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1058 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1059 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1060 :param kwargs: additional attributes 1061 1062 :returns: <Prosody> element 1063 """ 1064 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 1065 1066 @deprecated_method('prosody') 1067 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 1068 **kwargs): 1069 """ 1070 Create a <Prosody> element 1071 1072 :param words: Words to speak 1073 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1074 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1075 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1076 :param kwargs: additional attributes 1077 1078 :returns: <Prosody> element 1079 """ 1080 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 1081 1082 def say_as(self, words, interpret_as=None, role=None, **kwargs): 1083 """ 1084 Create a <Say-As> element 1085 1086 :param words: Words to be interpreted 1087 :param interpret-as: Specify the type of words are spoken 1088 :param role: Specify the format of the date when interpret-as is set to date 1089 :param kwargs: additional attributes 1090 1091 :returns: <Say-As> element 1092 """ 1093 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 1094 1095 @deprecated_method('say_as') 1096 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 1097 """ 1098 Create a <Say-As> element 1099 1100 :param words: Words to be interpreted 1101 :param interpret-as: Specify the type of words are spoken 1102 :param role: Specify the format of the date when interpret-as is set to date 1103 :param kwargs: additional attributes 1104 1105 :returns: <Say-As> element 1106 """ 1107 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 1108 1109 def sub(self, words, alias=None, **kwargs): 1110 """ 1111 Create a <Sub> element 1112 1113 :param words: Words to be substituted 1114 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1115 :param kwargs: additional attributes 1116 1117 :returns: <Sub> element 1118 """ 1119 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 1120 1121 @deprecated_method('sub') 1122 def ssml_sub(self, words, alias=None, **kwargs): 1123 """ 1124 Create a <Sub> element 1125 1126 :param words: Words to be substituted 1127 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1128 :param kwargs: additional attributes 1129 1130 :returns: <Sub> element 1131 """ 1132 return self.sub(words, alias=alias, **kwargs) 1133 1134 1135class SsmlSub(TwiML): 1136 """ Pronouncing Acronyms and Abbreviations in <Say> """ 1137 1138 def __init__(self, words, **kwargs): 1139 super(SsmlSub, self).__init__(**kwargs) 1140 self.name = 'sub' 1141 self.value = words 1142 1143 1144class SsmlSayAs(TwiML): 1145 """ Controlling How Special Types of Words Are Spoken in <Say> """ 1146 1147 def __init__(self, words, **kwargs): 1148 super(SsmlSayAs, self).__init__(**kwargs) 1149 self.name = 'say-as' 1150 self.value = words 1151 1152 1153class SsmlProsody(TwiML): 1154 """ Controling Volume, Speaking Rate, and Pitch in <Say> """ 1155 1156 def __init__(self, words=None, **kwargs): 1157 super(SsmlProsody, self).__init__(**kwargs) 1158 self.name = 'prosody' 1159 if words: 1160 self.value = words 1161 1162 def break_(self, strength=None, time=None, **kwargs): 1163 """ 1164 Create a <Break> element 1165 1166 :param strength: Set a pause based on strength 1167 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1168 :param kwargs: additional attributes 1169 1170 :returns: <Break> element 1171 """ 1172 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 1173 1174 @deprecated_method('break_') 1175 def ssml_break(self, strength=None, time=None, **kwargs): 1176 """ 1177 Create a <Break> element 1178 1179 :param strength: Set a pause based on strength 1180 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1181 :param kwargs: additional attributes 1182 1183 :returns: <Break> element 1184 """ 1185 return self.break_(strength=strength, time=time, **kwargs) 1186 1187 def emphasis(self, words=None, level=None, **kwargs): 1188 """ 1189 Create a <Emphasis> element 1190 1191 :param words: Words to emphasize 1192 :param level: Specify the degree of emphasis 1193 :param kwargs: additional attributes 1194 1195 :returns: <Emphasis> element 1196 """ 1197 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 1198 1199 @deprecated_method('emphasis') 1200 def ssml_emphasis(self, words=None, level=None, **kwargs): 1201 """ 1202 Create a <Emphasis> element 1203 1204 :param words: Words to emphasize 1205 :param level: Specify the degree of emphasis 1206 :param kwargs: additional attributes 1207 1208 :returns: <Emphasis> element 1209 """ 1210 return self.emphasis(words=words, level=level, **kwargs) 1211 1212 def lang(self, words=None, xml_lang=None, **kwargs): 1213 """ 1214 Create a <Lang> element 1215 1216 :param words: Words to speak 1217 :param xml:lang: Specify the language 1218 :param kwargs: additional attributes 1219 1220 :returns: <Lang> element 1221 """ 1222 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 1223 1224 @deprecated_method('lang') 1225 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 1226 """ 1227 Create a <Lang> element 1228 1229 :param words: Words to speak 1230 :param xml:lang: Specify the language 1231 :param kwargs: additional attributes 1232 1233 :returns: <Lang> element 1234 """ 1235 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 1236 1237 def p(self, words=None, **kwargs): 1238 """ 1239 Create a <P> element 1240 1241 :param words: Words to speak 1242 :param kwargs: additional attributes 1243 1244 :returns: <P> element 1245 """ 1246 return self.nest(SsmlP(words=words, **kwargs)) 1247 1248 @deprecated_method('p') 1249 def ssml_p(self, words=None, **kwargs): 1250 """ 1251 Create a <P> element 1252 1253 :param words: Words to speak 1254 :param kwargs: additional attributes 1255 1256 :returns: <P> element 1257 """ 1258 return self.p(words=words, **kwargs) 1259 1260 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 1261 """ 1262 Create a <Phoneme> element 1263 1264 :param words: Words to speak 1265 :param alphabet: Specify the phonetic alphabet 1266 :param ph: Specifiy the phonetic symbols for pronunciation 1267 :param kwargs: additional attributes 1268 1269 :returns: <Phoneme> element 1270 """ 1271 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 1272 1273 @deprecated_method('phoneme') 1274 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 1275 """ 1276 Create a <Phoneme> element 1277 1278 :param words: Words to speak 1279 :param alphabet: Specify the phonetic alphabet 1280 :param ph: Specifiy the phonetic symbols for pronunciation 1281 :param kwargs: additional attributes 1282 1283 :returns: <Phoneme> element 1284 """ 1285 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 1286 1287 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 1288 """ 1289 Create a <Prosody> element 1290 1291 :param words: Words to speak 1292 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1293 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1294 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1295 :param kwargs: additional attributes 1296 1297 :returns: <Prosody> element 1298 """ 1299 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 1300 1301 @deprecated_method('prosody') 1302 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 1303 **kwargs): 1304 """ 1305 Create a <Prosody> element 1306 1307 :param words: Words to speak 1308 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1309 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1310 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1311 :param kwargs: additional attributes 1312 1313 :returns: <Prosody> element 1314 """ 1315 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 1316 1317 def s(self, words=None, **kwargs): 1318 """ 1319 Create a <S> element 1320 1321 :param words: Words to speak 1322 :param kwargs: additional attributes 1323 1324 :returns: <S> element 1325 """ 1326 return self.nest(SsmlS(words=words, **kwargs)) 1327 1328 @deprecated_method('s') 1329 def ssml_s(self, words=None, **kwargs): 1330 """ 1331 Create a <S> element 1332 1333 :param words: Words to speak 1334 :param kwargs: additional attributes 1335 1336 :returns: <S> element 1337 """ 1338 return self.s(words=words, **kwargs) 1339 1340 def say_as(self, words, interpret_as=None, role=None, **kwargs): 1341 """ 1342 Create a <Say-As> element 1343 1344 :param words: Words to be interpreted 1345 :param interpret-as: Specify the type of words are spoken 1346 :param role: Specify the format of the date when interpret-as is set to date 1347 :param kwargs: additional attributes 1348 1349 :returns: <Say-As> element 1350 """ 1351 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 1352 1353 @deprecated_method('say_as') 1354 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 1355 """ 1356 Create a <Say-As> element 1357 1358 :param words: Words to be interpreted 1359 :param interpret-as: Specify the type of words are spoken 1360 :param role: Specify the format of the date when interpret-as is set to date 1361 :param kwargs: additional attributes 1362 1363 :returns: <Say-As> element 1364 """ 1365 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 1366 1367 def sub(self, words, alias=None, **kwargs): 1368 """ 1369 Create a <Sub> element 1370 1371 :param words: Words to be substituted 1372 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1373 :param kwargs: additional attributes 1374 1375 :returns: <Sub> element 1376 """ 1377 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 1378 1379 @deprecated_method('sub') 1380 def ssml_sub(self, words, alias=None, **kwargs): 1381 """ 1382 Create a <Sub> element 1383 1384 :param words: Words to be substituted 1385 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1386 :param kwargs: additional attributes 1387 1388 :returns: <Sub> element 1389 """ 1390 return self.sub(words, alias=alias, **kwargs) 1391 1392 def w(self, words=None, role=None, **kwargs): 1393 """ 1394 Create a <W> element 1395 1396 :param words: Words to speak 1397 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1398 :param kwargs: additional attributes 1399 1400 :returns: <W> element 1401 """ 1402 return self.nest(SsmlW(words=words, role=role, **kwargs)) 1403 1404 @deprecated_method('w') 1405 def ssml_w(self, words=None, role=None, **kwargs): 1406 """ 1407 Create a <W> element 1408 1409 :param words: Words to speak 1410 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1411 :param kwargs: additional attributes 1412 1413 :returns: <W> element 1414 """ 1415 return self.w(words=words, role=role, **kwargs) 1416 1417 1418class SsmlS(TwiML): 1419 """ Adding A Pause Between Sentences in <Say> """ 1420 1421 def __init__(self, words=None, **kwargs): 1422 super(SsmlS, self).__init__(**kwargs) 1423 self.name = 's' 1424 if words: 1425 self.value = words 1426 1427 def break_(self, strength=None, time=None, **kwargs): 1428 """ 1429 Create a <Break> element 1430 1431 :param strength: Set a pause based on strength 1432 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1433 :param kwargs: additional attributes 1434 1435 :returns: <Break> element 1436 """ 1437 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 1438 1439 @deprecated_method('break_') 1440 def ssml_break(self, strength=None, time=None, **kwargs): 1441 """ 1442 Create a <Break> element 1443 1444 :param strength: Set a pause based on strength 1445 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1446 :param kwargs: additional attributes 1447 1448 :returns: <Break> element 1449 """ 1450 return self.break_(strength=strength, time=time, **kwargs) 1451 1452 def emphasis(self, words=None, level=None, **kwargs): 1453 """ 1454 Create a <Emphasis> element 1455 1456 :param words: Words to emphasize 1457 :param level: Specify the degree of emphasis 1458 :param kwargs: additional attributes 1459 1460 :returns: <Emphasis> element 1461 """ 1462 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 1463 1464 @deprecated_method('emphasis') 1465 def ssml_emphasis(self, words=None, level=None, **kwargs): 1466 """ 1467 Create a <Emphasis> element 1468 1469 :param words: Words to emphasize 1470 :param level: Specify the degree of emphasis 1471 :param kwargs: additional attributes 1472 1473 :returns: <Emphasis> element 1474 """ 1475 return self.emphasis(words=words, level=level, **kwargs) 1476 1477 def lang(self, words=None, xml_lang=None, **kwargs): 1478 """ 1479 Create a <Lang> element 1480 1481 :param words: Words to speak 1482 :param xml:lang: Specify the language 1483 :param kwargs: additional attributes 1484 1485 :returns: <Lang> element 1486 """ 1487 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 1488 1489 @deprecated_method('lang') 1490 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 1491 """ 1492 Create a <Lang> element 1493 1494 :param words: Words to speak 1495 :param xml:lang: Specify the language 1496 :param kwargs: additional attributes 1497 1498 :returns: <Lang> element 1499 """ 1500 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 1501 1502 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 1503 """ 1504 Create a <Phoneme> element 1505 1506 :param words: Words to speak 1507 :param alphabet: Specify the phonetic alphabet 1508 :param ph: Specifiy the phonetic symbols for pronunciation 1509 :param kwargs: additional attributes 1510 1511 :returns: <Phoneme> element 1512 """ 1513 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 1514 1515 @deprecated_method('phoneme') 1516 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 1517 """ 1518 Create a <Phoneme> element 1519 1520 :param words: Words to speak 1521 :param alphabet: Specify the phonetic alphabet 1522 :param ph: Specifiy the phonetic symbols for pronunciation 1523 :param kwargs: additional attributes 1524 1525 :returns: <Phoneme> element 1526 """ 1527 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 1528 1529 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 1530 """ 1531 Create a <Prosody> element 1532 1533 :param words: Words to speak 1534 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1535 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1536 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1537 :param kwargs: additional attributes 1538 1539 :returns: <Prosody> element 1540 """ 1541 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 1542 1543 @deprecated_method('prosody') 1544 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 1545 **kwargs): 1546 """ 1547 Create a <Prosody> element 1548 1549 :param words: Words to speak 1550 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1551 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1552 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1553 :param kwargs: additional attributes 1554 1555 :returns: <Prosody> element 1556 """ 1557 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 1558 1559 def say_as(self, words, interpret_as=None, role=None, **kwargs): 1560 """ 1561 Create a <Say-As> element 1562 1563 :param words: Words to be interpreted 1564 :param interpret-as: Specify the type of words are spoken 1565 :param role: Specify the format of the date when interpret-as is set to date 1566 :param kwargs: additional attributes 1567 1568 :returns: <Say-As> element 1569 """ 1570 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 1571 1572 @deprecated_method('say_as') 1573 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 1574 """ 1575 Create a <Say-As> element 1576 1577 :param words: Words to be interpreted 1578 :param interpret-as: Specify the type of words are spoken 1579 :param role: Specify the format of the date when interpret-as is set to date 1580 :param kwargs: additional attributes 1581 1582 :returns: <Say-As> element 1583 """ 1584 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 1585 1586 def sub(self, words, alias=None, **kwargs): 1587 """ 1588 Create a <Sub> element 1589 1590 :param words: Words to be substituted 1591 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1592 :param kwargs: additional attributes 1593 1594 :returns: <Sub> element 1595 """ 1596 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 1597 1598 @deprecated_method('sub') 1599 def ssml_sub(self, words, alias=None, **kwargs): 1600 """ 1601 Create a <Sub> element 1602 1603 :param words: Words to be substituted 1604 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1605 :param kwargs: additional attributes 1606 1607 :returns: <Sub> element 1608 """ 1609 return self.sub(words, alias=alias, **kwargs) 1610 1611 def w(self, words=None, role=None, **kwargs): 1612 """ 1613 Create a <W> element 1614 1615 :param words: Words to speak 1616 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1617 :param kwargs: additional attributes 1618 1619 :returns: <W> element 1620 """ 1621 return self.nest(SsmlW(words=words, role=role, **kwargs)) 1622 1623 @deprecated_method('w') 1624 def ssml_w(self, words=None, role=None, **kwargs): 1625 """ 1626 Create a <W> element 1627 1628 :param words: Words to speak 1629 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1630 :param kwargs: additional attributes 1631 1632 :returns: <W> element 1633 """ 1634 return self.w(words=words, role=role, **kwargs) 1635 1636 1637class SsmlPhoneme(TwiML): 1638 """ Using Phonetic Pronunciation in <Say> """ 1639 1640 def __init__(self, words, **kwargs): 1641 super(SsmlPhoneme, self).__init__(**kwargs) 1642 self.name = 'phoneme' 1643 self.value = words 1644 1645 1646class SsmlLang(TwiML): 1647 """ Specifying Another Language for Specific Words in <Say> """ 1648 1649 def __init__(self, words=None, **kwargs): 1650 super(SsmlLang, self).__init__(**kwargs) 1651 self.name = 'lang' 1652 if words: 1653 self.value = words 1654 1655 def break_(self, strength=None, time=None, **kwargs): 1656 """ 1657 Create a <Break> element 1658 1659 :param strength: Set a pause based on strength 1660 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1661 :param kwargs: additional attributes 1662 1663 :returns: <Break> element 1664 """ 1665 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 1666 1667 @deprecated_method('break_') 1668 def ssml_break(self, strength=None, time=None, **kwargs): 1669 """ 1670 Create a <Break> element 1671 1672 :param strength: Set a pause based on strength 1673 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1674 :param kwargs: additional attributes 1675 1676 :returns: <Break> element 1677 """ 1678 return self.break_(strength=strength, time=time, **kwargs) 1679 1680 def emphasis(self, words=None, level=None, **kwargs): 1681 """ 1682 Create a <Emphasis> element 1683 1684 :param words: Words to emphasize 1685 :param level: Specify the degree of emphasis 1686 :param kwargs: additional attributes 1687 1688 :returns: <Emphasis> element 1689 """ 1690 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 1691 1692 @deprecated_method('emphasis') 1693 def ssml_emphasis(self, words=None, level=None, **kwargs): 1694 """ 1695 Create a <Emphasis> element 1696 1697 :param words: Words to emphasize 1698 :param level: Specify the degree of emphasis 1699 :param kwargs: additional attributes 1700 1701 :returns: <Emphasis> element 1702 """ 1703 return self.emphasis(words=words, level=level, **kwargs) 1704 1705 def lang(self, words=None, xml_lang=None, **kwargs): 1706 """ 1707 Create a <Lang> element 1708 1709 :param words: Words to speak 1710 :param xml:lang: Specify the language 1711 :param kwargs: additional attributes 1712 1713 :returns: <Lang> element 1714 """ 1715 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 1716 1717 @deprecated_method('lang') 1718 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 1719 """ 1720 Create a <Lang> element 1721 1722 :param words: Words to speak 1723 :param xml:lang: Specify the language 1724 :param kwargs: additional attributes 1725 1726 :returns: <Lang> element 1727 """ 1728 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 1729 1730 def p(self, words=None, **kwargs): 1731 """ 1732 Create a <P> element 1733 1734 :param words: Words to speak 1735 :param kwargs: additional attributes 1736 1737 :returns: <P> element 1738 """ 1739 return self.nest(SsmlP(words=words, **kwargs)) 1740 1741 @deprecated_method('p') 1742 def ssml_p(self, words=None, **kwargs): 1743 """ 1744 Create a <P> element 1745 1746 :param words: Words to speak 1747 :param kwargs: additional attributes 1748 1749 :returns: <P> element 1750 """ 1751 return self.p(words=words, **kwargs) 1752 1753 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 1754 """ 1755 Create a <Phoneme> element 1756 1757 :param words: Words to speak 1758 :param alphabet: Specify the phonetic alphabet 1759 :param ph: Specifiy the phonetic symbols for pronunciation 1760 :param kwargs: additional attributes 1761 1762 :returns: <Phoneme> element 1763 """ 1764 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 1765 1766 @deprecated_method('phoneme') 1767 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 1768 """ 1769 Create a <Phoneme> element 1770 1771 :param words: Words to speak 1772 :param alphabet: Specify the phonetic alphabet 1773 :param ph: Specifiy the phonetic symbols for pronunciation 1774 :param kwargs: additional attributes 1775 1776 :returns: <Phoneme> element 1777 """ 1778 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 1779 1780 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 1781 """ 1782 Create a <Prosody> element 1783 1784 :param words: Words to speak 1785 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1786 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1787 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1788 :param kwargs: additional attributes 1789 1790 :returns: <Prosody> element 1791 """ 1792 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 1793 1794 @deprecated_method('prosody') 1795 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 1796 **kwargs): 1797 """ 1798 Create a <Prosody> element 1799 1800 :param words: Words to speak 1801 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 1802 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 1803 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 1804 :param kwargs: additional attributes 1805 1806 :returns: <Prosody> element 1807 """ 1808 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 1809 1810 def s(self, words=None, **kwargs): 1811 """ 1812 Create a <S> element 1813 1814 :param words: Words to speak 1815 :param kwargs: additional attributes 1816 1817 :returns: <S> element 1818 """ 1819 return self.nest(SsmlS(words=words, **kwargs)) 1820 1821 @deprecated_method('s') 1822 def ssml_s(self, words=None, **kwargs): 1823 """ 1824 Create a <S> element 1825 1826 :param words: Words to speak 1827 :param kwargs: additional attributes 1828 1829 :returns: <S> element 1830 """ 1831 return self.s(words=words, **kwargs) 1832 1833 def say_as(self, words, interpret_as=None, role=None, **kwargs): 1834 """ 1835 Create a <Say-As> element 1836 1837 :param words: Words to be interpreted 1838 :param interpret-as: Specify the type of words are spoken 1839 :param role: Specify the format of the date when interpret-as is set to date 1840 :param kwargs: additional attributes 1841 1842 :returns: <Say-As> element 1843 """ 1844 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 1845 1846 @deprecated_method('say_as') 1847 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 1848 """ 1849 Create a <Say-As> element 1850 1851 :param words: Words to be interpreted 1852 :param interpret-as: Specify the type of words are spoken 1853 :param role: Specify the format of the date when interpret-as is set to date 1854 :param kwargs: additional attributes 1855 1856 :returns: <Say-As> element 1857 """ 1858 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 1859 1860 def sub(self, words, alias=None, **kwargs): 1861 """ 1862 Create a <Sub> element 1863 1864 :param words: Words to be substituted 1865 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1866 :param kwargs: additional attributes 1867 1868 :returns: <Sub> element 1869 """ 1870 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 1871 1872 @deprecated_method('sub') 1873 def ssml_sub(self, words, alias=None, **kwargs): 1874 """ 1875 Create a <Sub> element 1876 1877 :param words: Words to be substituted 1878 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 1879 :param kwargs: additional attributes 1880 1881 :returns: <Sub> element 1882 """ 1883 return self.sub(words, alias=alias, **kwargs) 1884 1885 def w(self, words=None, role=None, **kwargs): 1886 """ 1887 Create a <W> element 1888 1889 :param words: Words to speak 1890 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1891 :param kwargs: additional attributes 1892 1893 :returns: <W> element 1894 """ 1895 return self.nest(SsmlW(words=words, role=role, **kwargs)) 1896 1897 @deprecated_method('w') 1898 def ssml_w(self, words=None, role=None, **kwargs): 1899 """ 1900 Create a <W> element 1901 1902 :param words: Words to speak 1903 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 1904 :param kwargs: additional attributes 1905 1906 :returns: <W> element 1907 """ 1908 return self.w(words=words, role=role, **kwargs) 1909 1910 1911class SsmlP(TwiML): 1912 """ Adding a Pause Between Paragraphs in <Say> """ 1913 1914 def __init__(self, words=None, **kwargs): 1915 super(SsmlP, self).__init__(**kwargs) 1916 self.name = 'p' 1917 if words: 1918 self.value = words 1919 1920 def break_(self, strength=None, time=None, **kwargs): 1921 """ 1922 Create a <Break> element 1923 1924 :param strength: Set a pause based on strength 1925 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1926 :param kwargs: additional attributes 1927 1928 :returns: <Break> element 1929 """ 1930 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 1931 1932 @deprecated_method('break_') 1933 def ssml_break(self, strength=None, time=None, **kwargs): 1934 """ 1935 Create a <Break> element 1936 1937 :param strength: Set a pause based on strength 1938 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 1939 :param kwargs: additional attributes 1940 1941 :returns: <Break> element 1942 """ 1943 return self.break_(strength=strength, time=time, **kwargs) 1944 1945 def emphasis(self, words=None, level=None, **kwargs): 1946 """ 1947 Create a <Emphasis> element 1948 1949 :param words: Words to emphasize 1950 :param level: Specify the degree of emphasis 1951 :param kwargs: additional attributes 1952 1953 :returns: <Emphasis> element 1954 """ 1955 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 1956 1957 @deprecated_method('emphasis') 1958 def ssml_emphasis(self, words=None, level=None, **kwargs): 1959 """ 1960 Create a <Emphasis> element 1961 1962 :param words: Words to emphasize 1963 :param level: Specify the degree of emphasis 1964 :param kwargs: additional attributes 1965 1966 :returns: <Emphasis> element 1967 """ 1968 return self.emphasis(words=words, level=level, **kwargs) 1969 1970 def lang(self, words=None, xml_lang=None, **kwargs): 1971 """ 1972 Create a <Lang> element 1973 1974 :param words: Words to speak 1975 :param xml:lang: Specify the language 1976 :param kwargs: additional attributes 1977 1978 :returns: <Lang> element 1979 """ 1980 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 1981 1982 @deprecated_method('lang') 1983 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 1984 """ 1985 Create a <Lang> element 1986 1987 :param words: Words to speak 1988 :param xml:lang: Specify the language 1989 :param kwargs: additional attributes 1990 1991 :returns: <Lang> element 1992 """ 1993 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 1994 1995 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 1996 """ 1997 Create a <Phoneme> element 1998 1999 :param words: Words to speak 2000 :param alphabet: Specify the phonetic alphabet 2001 :param ph: Specifiy the phonetic symbols for pronunciation 2002 :param kwargs: additional attributes 2003 2004 :returns: <Phoneme> element 2005 """ 2006 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 2007 2008 @deprecated_method('phoneme') 2009 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 2010 """ 2011 Create a <Phoneme> element 2012 2013 :param words: Words to speak 2014 :param alphabet: Specify the phonetic alphabet 2015 :param ph: Specifiy the phonetic symbols for pronunciation 2016 :param kwargs: additional attributes 2017 2018 :returns: <Phoneme> element 2019 """ 2020 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 2021 2022 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 2023 """ 2024 Create a <Prosody> element 2025 2026 :param words: Words to speak 2027 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 2028 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 2029 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 2030 :param kwargs: additional attributes 2031 2032 :returns: <Prosody> element 2033 """ 2034 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 2035 2036 @deprecated_method('prosody') 2037 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 2038 **kwargs): 2039 """ 2040 Create a <Prosody> element 2041 2042 :param words: Words to speak 2043 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 2044 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 2045 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 2046 :param kwargs: additional attributes 2047 2048 :returns: <Prosody> element 2049 """ 2050 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 2051 2052 def s(self, words=None, **kwargs): 2053 """ 2054 Create a <S> element 2055 2056 :param words: Words to speak 2057 :param kwargs: additional attributes 2058 2059 :returns: <S> element 2060 """ 2061 return self.nest(SsmlS(words=words, **kwargs)) 2062 2063 @deprecated_method('s') 2064 def ssml_s(self, words=None, **kwargs): 2065 """ 2066 Create a <S> element 2067 2068 :param words: Words to speak 2069 :param kwargs: additional attributes 2070 2071 :returns: <S> element 2072 """ 2073 return self.s(words=words, **kwargs) 2074 2075 def say_as(self, words, interpret_as=None, role=None, **kwargs): 2076 """ 2077 Create a <Say-As> element 2078 2079 :param words: Words to be interpreted 2080 :param interpret-as: Specify the type of words are spoken 2081 :param role: Specify the format of the date when interpret-as is set to date 2082 :param kwargs: additional attributes 2083 2084 :returns: <Say-As> element 2085 """ 2086 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 2087 2088 @deprecated_method('say_as') 2089 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 2090 """ 2091 Create a <Say-As> element 2092 2093 :param words: Words to be interpreted 2094 :param interpret-as: Specify the type of words are spoken 2095 :param role: Specify the format of the date when interpret-as is set to date 2096 :param kwargs: additional attributes 2097 2098 :returns: <Say-As> element 2099 """ 2100 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 2101 2102 def sub(self, words, alias=None, **kwargs): 2103 """ 2104 Create a <Sub> element 2105 2106 :param words: Words to be substituted 2107 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 2108 :param kwargs: additional attributes 2109 2110 :returns: <Sub> element 2111 """ 2112 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 2113 2114 @deprecated_method('sub') 2115 def ssml_sub(self, words, alias=None, **kwargs): 2116 """ 2117 Create a <Sub> element 2118 2119 :param words: Words to be substituted 2120 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 2121 :param kwargs: additional attributes 2122 2123 :returns: <Sub> element 2124 """ 2125 return self.sub(words, alias=alias, **kwargs) 2126 2127 def w(self, words=None, role=None, **kwargs): 2128 """ 2129 Create a <W> element 2130 2131 :param words: Words to speak 2132 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 2133 :param kwargs: additional attributes 2134 2135 :returns: <W> element 2136 """ 2137 return self.nest(SsmlW(words=words, role=role, **kwargs)) 2138 2139 @deprecated_method('w') 2140 def ssml_w(self, words=None, role=None, **kwargs): 2141 """ 2142 Create a <W> element 2143 2144 :param words: Words to speak 2145 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 2146 :param kwargs: additional attributes 2147 2148 :returns: <W> element 2149 """ 2150 return self.w(words=words, role=role, **kwargs) 2151 2152 2153class SsmlEmphasis(TwiML): 2154 """ Emphasizing Words in <Say> """ 2155 2156 def __init__(self, words=None, **kwargs): 2157 super(SsmlEmphasis, self).__init__(**kwargs) 2158 self.name = 'emphasis' 2159 if words: 2160 self.value = words 2161 2162 def break_(self, strength=None, time=None, **kwargs): 2163 """ 2164 Create a <Break> element 2165 2166 :param strength: Set a pause based on strength 2167 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 2168 :param kwargs: additional attributes 2169 2170 :returns: <Break> element 2171 """ 2172 return self.nest(SsmlBreak(strength=strength, time=time, **kwargs)) 2173 2174 @deprecated_method('break_') 2175 def ssml_break(self, strength=None, time=None, **kwargs): 2176 """ 2177 Create a <Break> element 2178 2179 :param strength: Set a pause based on strength 2180 :param time: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms 2181 :param kwargs: additional attributes 2182 2183 :returns: <Break> element 2184 """ 2185 return self.break_(strength=strength, time=time, **kwargs) 2186 2187 def emphasis(self, words=None, level=None, **kwargs): 2188 """ 2189 Create a <Emphasis> element 2190 2191 :param words: Words to emphasize 2192 :param level: Specify the degree of emphasis 2193 :param kwargs: additional attributes 2194 2195 :returns: <Emphasis> element 2196 """ 2197 return self.nest(SsmlEmphasis(words=words, level=level, **kwargs)) 2198 2199 @deprecated_method('emphasis') 2200 def ssml_emphasis(self, words=None, level=None, **kwargs): 2201 """ 2202 Create a <Emphasis> element 2203 2204 :param words: Words to emphasize 2205 :param level: Specify the degree of emphasis 2206 :param kwargs: additional attributes 2207 2208 :returns: <Emphasis> element 2209 """ 2210 return self.emphasis(words=words, level=level, **kwargs) 2211 2212 def lang(self, words=None, xml_lang=None, **kwargs): 2213 """ 2214 Create a <Lang> element 2215 2216 :param words: Words to speak 2217 :param xml:lang: Specify the language 2218 :param kwargs: additional attributes 2219 2220 :returns: <Lang> element 2221 """ 2222 return self.nest(SsmlLang(words=words, xml_lang=xml_lang, **kwargs)) 2223 2224 @deprecated_method('lang') 2225 def ssml_lang(self, words=None, xml_lang=None, **kwargs): 2226 """ 2227 Create a <Lang> element 2228 2229 :param words: Words to speak 2230 :param xml:lang: Specify the language 2231 :param kwargs: additional attributes 2232 2233 :returns: <Lang> element 2234 """ 2235 return self.lang(words=words, xml_lang=xml_lang, **kwargs) 2236 2237 def phoneme(self, words, alphabet=None, ph=None, **kwargs): 2238 """ 2239 Create a <Phoneme> element 2240 2241 :param words: Words to speak 2242 :param alphabet: Specify the phonetic alphabet 2243 :param ph: Specifiy the phonetic symbols for pronunciation 2244 :param kwargs: additional attributes 2245 2246 :returns: <Phoneme> element 2247 """ 2248 return self.nest(SsmlPhoneme(words, alphabet=alphabet, ph=ph, **kwargs)) 2249 2250 @deprecated_method('phoneme') 2251 def ssml_phoneme(self, words, alphabet=None, ph=None, **kwargs): 2252 """ 2253 Create a <Phoneme> element 2254 2255 :param words: Words to speak 2256 :param alphabet: Specify the phonetic alphabet 2257 :param ph: Specifiy the phonetic symbols for pronunciation 2258 :param kwargs: additional attributes 2259 2260 :returns: <Phoneme> element 2261 """ 2262 return self.phoneme(words, alphabet=alphabet, ph=ph, **kwargs) 2263 2264 def prosody(self, words=None, volume=None, rate=None, pitch=None, **kwargs): 2265 """ 2266 Create a <Prosody> element 2267 2268 :param words: Words to speak 2269 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 2270 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 2271 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 2272 :param kwargs: additional attributes 2273 2274 :returns: <Prosody> element 2275 """ 2276 return self.nest(SsmlProsody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs)) 2277 2278 @deprecated_method('prosody') 2279 def ssml_prosody(self, words=None, volume=None, rate=None, pitch=None, 2280 **kwargs): 2281 """ 2282 Create a <Prosody> element 2283 2284 :param words: Words to speak 2285 :param volume: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB 2286 :param rate: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n% 2287 :param pitch: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n% 2288 :param kwargs: additional attributes 2289 2290 :returns: <Prosody> element 2291 """ 2292 return self.prosody(words=words, volume=volume, rate=rate, pitch=pitch, **kwargs) 2293 2294 def say_as(self, words, interpret_as=None, role=None, **kwargs): 2295 """ 2296 Create a <Say-As> element 2297 2298 :param words: Words to be interpreted 2299 :param interpret-as: Specify the type of words are spoken 2300 :param role: Specify the format of the date when interpret-as is set to date 2301 :param kwargs: additional attributes 2302 2303 :returns: <Say-As> element 2304 """ 2305 return self.nest(SsmlSayAs(words, interpret_as=interpret_as, role=role, **kwargs)) 2306 2307 @deprecated_method('say_as') 2308 def ssml_say_as(self, words, interpret_as=None, role=None, **kwargs): 2309 """ 2310 Create a <Say-As> element 2311 2312 :param words: Words to be interpreted 2313 :param interpret-as: Specify the type of words are spoken 2314 :param role: Specify the format of the date when interpret-as is set to date 2315 :param kwargs: additional attributes 2316 2317 :returns: <Say-As> element 2318 """ 2319 return self.say_as(words, interpret_as=interpret_as, role=role, **kwargs) 2320 2321 def sub(self, words, alias=None, **kwargs): 2322 """ 2323 Create a <Sub> element 2324 2325 :param words: Words to be substituted 2326 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 2327 :param kwargs: additional attributes 2328 2329 :returns: <Sub> element 2330 """ 2331 return self.nest(SsmlSub(words, alias=alias, **kwargs)) 2332 2333 @deprecated_method('sub') 2334 def ssml_sub(self, words, alias=None, **kwargs): 2335 """ 2336 Create a <Sub> element 2337 2338 :param words: Words to be substituted 2339 :param alias: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation 2340 :param kwargs: additional attributes 2341 2342 :returns: <Sub> element 2343 """ 2344 return self.sub(words, alias=alias, **kwargs) 2345 2346 def w(self, words=None, role=None, **kwargs): 2347 """ 2348 Create a <W> element 2349 2350 :param words: Words to speak 2351 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 2352 :param kwargs: additional attributes 2353 2354 :returns: <W> element 2355 """ 2356 return self.nest(SsmlW(words=words, role=role, **kwargs)) 2357 2358 @deprecated_method('w') 2359 def ssml_w(self, words=None, role=None, **kwargs): 2360 """ 2361 Create a <W> element 2362 2363 :param words: Words to speak 2364 :param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning 2365 :param kwargs: additional attributes 2366 2367 :returns: <W> element 2368 """ 2369 return self.w(words=words, role=role, **kwargs) 2370 2371 2372class SsmlBreak(TwiML): 2373 """ Adding a Pause in <Say> """ 2374 2375 def __init__(self, **kwargs): 2376 super(SsmlBreak, self).__init__(**kwargs) 2377 self.name = 'break' 2378 2379 2380class Pay(TwiML): 2381 """ <Pay> Twiml Verb """ 2382 2383 def __init__(self, **kwargs): 2384 super(Pay, self).__init__(**kwargs) 2385 self.name = 'Pay' 2386 2387 def prompt(self, for_=None, error_type=None, card_type=None, attempt=None, 2388 **kwargs): 2389 """ 2390 Create a <Prompt> element 2391 2392 :param for_: Name of the payment source data element 2393 :param error_type: Type of error 2394 :param card_type: Type of the credit card 2395 :param attempt: Current attempt count 2396 :param kwargs: additional attributes 2397 2398 :returns: <Prompt> element 2399 """ 2400 return self.nest(Prompt( 2401 for_=for_, 2402 error_type=error_type, 2403 card_type=card_type, 2404 attempt=attempt, 2405 **kwargs 2406 )) 2407 2408 def parameter(self, name=None, value=None, **kwargs): 2409 """ 2410 Create a <Parameter> element 2411 2412 :param name: The name of the custom parameter 2413 :param value: The value of the custom parameter 2414 :param kwargs: additional attributes 2415 2416 :returns: <Parameter> element 2417 """ 2418 return self.nest(Parameter(name=name, value=value, **kwargs)) 2419 2420 2421class Sms(TwiML): 2422 """ <Sms> TwiML Noun """ 2423 2424 def __init__(self, message, **kwargs): 2425 super(Sms, self).__init__(**kwargs) 2426 self.name = 'Sms' 2427 self.value = message 2428 2429 2430class Reject(TwiML): 2431 """ <Reject> TwiML Verb """ 2432 2433 def __init__(self, **kwargs): 2434 super(Reject, self).__init__(**kwargs) 2435 self.name = 'Reject' 2436 2437 2438class Redirect(TwiML): 2439 """ <Redirect> TwiML Verb """ 2440 2441 def __init__(self, url, **kwargs): 2442 super(Redirect, self).__init__(**kwargs) 2443 self.name = 'Redirect' 2444 self.value = url 2445 2446 2447class Record(TwiML): 2448 """ <Record> TwiML Verb """ 2449 2450 def __init__(self, **kwargs): 2451 super(Record, self).__init__(**kwargs) 2452 self.name = 'Record' 2453 2454 2455class Queue(TwiML): 2456 """ <Queue> TwiML Noun """ 2457 2458 def __init__(self, name, **kwargs): 2459 super(Queue, self).__init__(**kwargs) 2460 self.name = 'Queue' 2461 self.value = name 2462 2463 2464class Leave(TwiML): 2465 """ <Leave> TwiML Verb """ 2466 2467 def __init__(self, **kwargs): 2468 super(Leave, self).__init__(**kwargs) 2469 self.name = 'Leave' 2470 2471 2472class Hangup(TwiML): 2473 """ <Hangup> TwiML Verb """ 2474 2475 def __init__(self, **kwargs): 2476 super(Hangup, self).__init__(**kwargs) 2477 self.name = 'Hangup' 2478 2479 2480class Gather(TwiML): 2481 """ <Gather> TwiML Verb """ 2482 2483 def __init__(self, **kwargs): 2484 super(Gather, self).__init__(**kwargs) 2485 self.name = 'Gather' 2486 2487 def say(self, message=None, voice=None, loop=None, language=None, **kwargs): 2488 """ 2489 Create a <Say> element 2490 2491 :param message: Message to say 2492 :param voice: Voice to use 2493 :param loop: Times to loop message 2494 :param language: Message langauge 2495 :param kwargs: additional attributes 2496 2497 :returns: <Say> element 2498 """ 2499 return self.nest(Say(message=message, voice=voice, loop=loop, language=language, **kwargs)) 2500 2501 def pause(self, length=None, **kwargs): 2502 """ 2503 Create a <Pause> element 2504 2505 :param length: Length in seconds to pause 2506 :param kwargs: additional attributes 2507 2508 :returns: <Pause> element 2509 """ 2510 return self.nest(Pause(length=length, **kwargs)) 2511 2512 def play(self, url=None, loop=None, digits=None, **kwargs): 2513 """ 2514 Create a <Play> element 2515 2516 :param url: Media URL 2517 :param loop: Times to loop media 2518 :param digits: Play DTMF tones for digits 2519 :param kwargs: additional attributes 2520 2521 :returns: <Play> element 2522 """ 2523 return self.nest(Play(url=url, loop=loop, digits=digits, **kwargs)) 2524 2525 2526class Enqueue(TwiML): 2527 """ <Enqueue> TwiML Noun """ 2528 2529 def __init__(self, name=None, **kwargs): 2530 super(Enqueue, self).__init__(**kwargs) 2531 self.name = 'Enqueue' 2532 if name: 2533 self.value = name 2534 2535 def task(self, body, priority=None, timeout=None, **kwargs): 2536 """ 2537 Create a <Task> element 2538 2539 :param body: TaskRouter task attributes 2540 :param priority: Task priority 2541 :param timeout: Timeout associated with task 2542 :param kwargs: additional attributes 2543 2544 :returns: <Task> element 2545 """ 2546 return self.nest(Task(body, priority=priority, timeout=timeout, **kwargs)) 2547 2548 2549class Task(TwiML): 2550 """ <Task> TwiML Noun """ 2551 2552 def __init__(self, body, **kwargs): 2553 super(Task, self).__init__(**kwargs) 2554 self.name = 'Task' 2555 self.value = body 2556 2557 2558class Echo(TwiML): 2559 """ <Echo> TwiML Verb """ 2560 2561 def __init__(self, **kwargs): 2562 super(Echo, self).__init__(**kwargs) 2563 self.name = 'Echo' 2564 2565 2566class Dial(TwiML): 2567 """ <Dial> TwiML Verb """ 2568 2569 def __init__(self, number=None, **kwargs): 2570 super(Dial, self).__init__(**kwargs) 2571 self.name = 'Dial' 2572 if number: 2573 self.value = number 2574 2575 def client(self, identity=None, url=None, method=None, 2576 status_callback_event=None, status_callback=None, 2577 status_callback_method=None, **kwargs): 2578 """ 2579 Create a <Client> element 2580 2581 :param identity: Client identity 2582 :param url: Client URL 2583 :param method: Client URL Method 2584 :param status_callback_event: Events to trigger status callback 2585 :param status_callback: Status Callback URL 2586 :param status_callback_method: Status Callback URL Method 2587 :param kwargs: additional attributes 2588 2589 :returns: <Client> element 2590 """ 2591 return self.nest(Client( 2592 identity=identity, 2593 url=url, 2594 method=method, 2595 status_callback_event=status_callback_event, 2596 status_callback=status_callback, 2597 status_callback_method=status_callback_method, 2598 **kwargs 2599 )) 2600 2601 def conference(self, name, muted=None, beep=None, 2602 start_conference_on_enter=None, end_conference_on_exit=None, 2603 wait_url=None, wait_method=None, max_participants=None, 2604 record=None, region=None, coach=None, trim=None, 2605 status_callback_event=None, status_callback=None, 2606 status_callback_method=None, recording_status_callback=None, 2607 recording_status_callback_method=None, 2608 recording_status_callback_event=None, event_callback_url=None, 2609 jitter_buffer_size=None, participant_label=None, **kwargs): 2610 """ 2611 Create a <Conference> element 2612 2613 :param name: Conference name 2614 :param muted: Join the conference muted 2615 :param beep: Play beep when joining 2616 :param start_conference_on_enter: Start the conference on enter 2617 :param end_conference_on_exit: End the conferenceon exit 2618 :param wait_url: Wait URL 2619 :param wait_method: Wait URL method 2620 :param max_participants: Maximum number of participants 2621 :param record: Record the conference 2622 :param region: Conference region 2623 :param coach: Call coach 2624 :param trim: Trim the conference recording 2625 :param status_callback_event: Events to call status callback URL 2626 :param status_callback: Status callback URL 2627 :param status_callback_method: Status callback URL method 2628 :param recording_status_callback: Recording status callback URL 2629 :param recording_status_callback_method: Recording status callback URL method 2630 :param recording_status_callback_event: Recording status callback events 2631 :param event_callback_url: Event callback URL 2632 :param jitter_buffer_size: Size of jitter buffer for participant 2633 :param participant_label: A label for participant 2634 :param kwargs: additional attributes 2635 2636 :returns: <Conference> element 2637 """ 2638 return self.nest(Conference( 2639 name, 2640 muted=muted, 2641 beep=beep, 2642 start_conference_on_enter=start_conference_on_enter, 2643 end_conference_on_exit=end_conference_on_exit, 2644 wait_url=wait_url, 2645 wait_method=wait_method, 2646 max_participants=max_participants, 2647 record=record, 2648 region=region, 2649 coach=coach, 2650 trim=trim, 2651 status_callback_event=status_callback_event, 2652 status_callback=status_callback, 2653 status_callback_method=status_callback_method, 2654 recording_status_callback=recording_status_callback, 2655 recording_status_callback_method=recording_status_callback_method, 2656 recording_status_callback_event=recording_status_callback_event, 2657 event_callback_url=event_callback_url, 2658 jitter_buffer_size=jitter_buffer_size, 2659 participant_label=participant_label, 2660 **kwargs 2661 )) 2662 2663 def number(self, phone_number, send_digits=None, url=None, method=None, 2664 status_callback_event=None, status_callback=None, 2665 status_callback_method=None, byoc=None, **kwargs): 2666 """ 2667 Create a <Number> element 2668 2669 :param phone_number: Phone Number to dial 2670 :param send_digits: DTMF tones to play when the call is answered 2671 :param url: TwiML URL 2672 :param method: TwiML URL method 2673 :param status_callback_event: Events to call status callback 2674 :param status_callback: Status callback URL 2675 :param status_callback_method: Status callback URL method 2676 :param byoc: BYOC trunk SID (Beta) 2677 :param kwargs: additional attributes 2678 2679 :returns: <Number> element 2680 """ 2681 return self.nest(Number( 2682 phone_number, 2683 send_digits=send_digits, 2684 url=url, 2685 method=method, 2686 status_callback_event=status_callback_event, 2687 status_callback=status_callback, 2688 status_callback_method=status_callback_method, 2689 byoc=byoc, 2690 **kwargs 2691 )) 2692 2693 def queue(self, name, url=None, method=None, reservation_sid=None, 2694 post_work_activity_sid=None, **kwargs): 2695 """ 2696 Create a <Queue> element 2697 2698 :param name: Queue name 2699 :param url: Action URL 2700 :param method: Action URL method 2701 :param reservation_sid: TaskRouter Reservation SID 2702 :param post_work_activity_sid: TaskRouter Activity SID 2703 :param kwargs: additional attributes 2704 2705 :returns: <Queue> element 2706 """ 2707 return self.nest(Queue( 2708 name, 2709 url=url, 2710 method=method, 2711 reservation_sid=reservation_sid, 2712 post_work_activity_sid=post_work_activity_sid, 2713 **kwargs 2714 )) 2715 2716 def sim(self, sim_sid, **kwargs): 2717 """ 2718 Create a <Sim> element 2719 2720 :param sim_sid: SIM SID 2721 :param kwargs: additional attributes 2722 2723 :returns: <Sim> element 2724 """ 2725 return self.nest(Sim(sim_sid, **kwargs)) 2726 2727 def sip(self, sip_url, username=None, password=None, url=None, method=None, 2728 status_callback_event=None, status_callback=None, 2729 status_callback_method=None, **kwargs): 2730 """ 2731 Create a <Sip> element 2732 2733 :param sip_url: SIP URL 2734 :param username: SIP Username 2735 :param password: SIP Password 2736 :param url: Action URL 2737 :param method: Action URL method 2738 :param status_callback_event: Status callback events 2739 :param status_callback: Status callback URL 2740 :param status_callback_method: Status callback URL method 2741 :param kwargs: additional attributes 2742 2743 :returns: <Sip> element 2744 """ 2745 return self.nest(Sip( 2746 sip_url, 2747 username=username, 2748 password=password, 2749 url=url, 2750 method=method, 2751 status_callback_event=status_callback_event, 2752 status_callback=status_callback, 2753 status_callback_method=status_callback_method, 2754 **kwargs 2755 )) 2756 2757 2758class Sip(TwiML): 2759 """ <Sip> TwiML Noun """ 2760 2761 def __init__(self, sip_url, **kwargs): 2762 super(Sip, self).__init__(**kwargs) 2763 self.name = 'Sip' 2764 self.value = sip_url 2765 2766 2767class Sim(TwiML): 2768 """ <Sim> TwiML Noun """ 2769 2770 def __init__(self, sim_sid, **kwargs): 2771 super(Sim, self).__init__(**kwargs) 2772 self.name = 'Sim' 2773 self.value = sim_sid 2774 2775 2776class Number(TwiML): 2777 """ <Number> TwiML Noun """ 2778 2779 def __init__(self, phone_number, **kwargs): 2780 super(Number, self).__init__(**kwargs) 2781 self.name = 'Number' 2782 self.value = phone_number 2783 2784 2785class Conference(TwiML): 2786 """ <Conference> TwiML Noun """ 2787 2788 def __init__(self, name, **kwargs): 2789 super(Conference, self).__init__(**kwargs) 2790 self.name = 'Conference' 2791 self.value = name 2792 2793 2794class Client(TwiML): 2795 """ <Client> TwiML Noun """ 2796 2797 def __init__(self, identity=None, **kwargs): 2798 super(Client, self).__init__(**kwargs) 2799 self.name = 'Client' 2800 if identity: 2801 self.value = identity 2802 2803 def identity(self, client_identity, **kwargs): 2804 """ 2805 Create a <Identity> element 2806 2807 :param client_identity: Identity of the client to dial 2808 :param kwargs: additional attributes 2809 2810 :returns: <Identity> element 2811 """ 2812 return self.nest(Identity(client_identity, **kwargs)) 2813 2814 def parameter(self, name=None, value=None, **kwargs): 2815 """ 2816 Create a <Parameter> element 2817 2818 :param name: The name of the custom parameter 2819 :param value: The value of the custom parameter 2820 :param kwargs: additional attributes 2821 2822 :returns: <Parameter> element 2823 """ 2824 return self.nest(Parameter(name=name, value=value, **kwargs)) 2825 2826 2827class Identity(TwiML): 2828 """ <Identity> TwiML Noun """ 2829 2830 def __init__(self, client_identity, **kwargs): 2831 super(Identity, self).__init__(**kwargs) 2832 self.name = 'Identity' 2833 self.value = client_identity 2834 2835 2836class Connect(TwiML): 2837 """ <Connect> TwiML Verb """ 2838 2839 def __init__(self, **kwargs): 2840 super(Connect, self).__init__(**kwargs) 2841 self.name = 'Connect' 2842 2843 def room(self, name, participant_identity=None, **kwargs): 2844 """ 2845 Create a <Room> element 2846 2847 :param name: Room name 2848 :param participant_identity: Participant identity when connecting to the Room 2849 :param kwargs: additional attributes 2850 2851 :returns: <Room> element 2852 """ 2853 return self.nest(Room(name, participant_identity=participant_identity, **kwargs)) 2854 2855 def autopilot(self, name, **kwargs): 2856 """ 2857 Create a <Autopilot> element 2858 2859 :param name: Autopilot assistant sid or unique name 2860 :param kwargs: additional attributes 2861 2862 :returns: <Autopilot> element 2863 """ 2864 return self.nest(Autopilot(name, **kwargs)) 2865 2866 def stream(self, name=None, connector_name=None, url=None, track=None, 2867 status_callback=None, status_callback_method=None, **kwargs): 2868 """ 2869 Create a <Stream> element 2870 2871 :param name: Friendly name given to the Stream 2872 :param connector_name: Unique name for Stream Connector 2873 :param url: URL of the remote service where the Stream is routed 2874 :param track: Track to be streamed to remote service 2875 :param status_callback: Status Callback URL 2876 :param status_callback_method: Status Callback URL method 2877 :param kwargs: additional attributes 2878 2879 :returns: <Stream> element 2880 """ 2881 return self.nest(Stream( 2882 name=name, 2883 connector_name=connector_name, 2884 url=url, 2885 track=track, 2886 status_callback=status_callback, 2887 status_callback_method=status_callback_method, 2888 **kwargs 2889 )) 2890 2891 def virtual_agent(self, connector_name=None, language=None, 2892 sentiment_analysis=None, status_callback=None, **kwargs): 2893 """ 2894 Create a <VirtualAgent> element 2895 2896 :param connector_name: Defines the conversation profile Dialogflow needs to use 2897 :param language: Language to be used by Dialogflow to transcribe speech 2898 :param sentiment_analysis: Whether sentiment analysis needs to be enabled or not 2899 :param status_callback: URL to post status callbacks from Twilio 2900 :param kwargs: additional attributes 2901 2902 :returns: <VirtualAgent> element 2903 """ 2904 return self.nest(VirtualAgent( 2905 connector_name=connector_name, 2906 language=language, 2907 sentiment_analysis=sentiment_analysis, 2908 status_callback=status_callback, 2909 **kwargs 2910 )) 2911 2912 2913class VirtualAgent(TwiML): 2914 """ <VirtualAgent> TwiML Noun """ 2915 2916 def __init__(self, **kwargs): 2917 super(VirtualAgent, self).__init__(**kwargs) 2918 self.name = 'VirtualAgent' 2919 2920 2921class Autopilot(TwiML): 2922 """ <Autopilot> TwiML Noun """ 2923 2924 def __init__(self, name, **kwargs): 2925 super(Autopilot, self).__init__(**kwargs) 2926 self.name = 'Autopilot' 2927 self.value = name 2928 2929 2930class Room(TwiML): 2931 """ <Room> TwiML Noun """ 2932 2933 def __init__(self, name, **kwargs): 2934 super(Room, self).__init__(**kwargs) 2935 self.name = 'Room' 2936 self.value = name 2937