RTCDTMFSender
DTMF tones sent over an audio sender.
- class webrtc.interfaces.rtc_dtmf_sender.RTCDTMFSender(native_obj=None)
Sends DTMF (telephone keypad) tones over an audio sender, from
webrtc.RTCRtpSender.dtmf.See MDN: RTCDTMFSender.
- Events:
tonechange (
webrtc.RTCDTMFToneChangeEvent) β A tone started playing, or the last one ended (with an emptytone).
Events
tonechange:Event
Handlers are registered with
on().- insert_dtmf(tones, duration=100, inter_tone_gap=70)
Queues tones to play, replacing the ones not played yet.
Durations and gaps out of range are clamped to the nearest limit.
See MDN: RTCDTMFSender/insertDTMF.
- Parameters:
tones (
str) β The tones:0to9,AtoD(any case),#,*, and,for a 2-second pause. An empty string cancels the tones not played yet.duration (
int, optional) β The length of each tone in milliseconds, clamped to 40 to 6000.inter_tone_gap (
int, optional) β The pause after each tone in milliseconds, clamped to 30 to 6000.
- Raises:
webrtc.InvalidStateError β If the sender canβt send DTMF now.
webrtc.InvalidCharacterError β If
toneshas another character.
- property tone_buffer: str
The tones not played yet, in upper case.
See MDN: RTCDTMFSender/toneBuffer.
- Type:
- property can_insert_dtmf: bool
Whether tones can be sent.
That needs the sender to be negotiated to send with a telephone-event codec. See MDN: RTCDTMFSender/canInsertDTMF.
- Type: