Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #import <Foundation/Foundation.h> |
| 12 | |
| 13 | #import "RTCMacros.h" |
| 14 | |
| 15 | NS_ASSUME_NONNULL_BEGIN |
| 16 | |
Mirko Bonadei | e8d5724 | 2018-09-17 10:22:56 +0200 | [diff] [blame] | 17 | RTC_OBJC_EXPORT |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 18 | @protocol RTC_OBJC_TYPE |
| 19 | (RTCDtmfSender)<NSObject> |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 20 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 21 | /** |
| 22 | * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise |
| 23 | * returns false. To be able to send DTMF, the associated RTCRtpSender must be |
| 24 | * able to send packets, and a "telephone-event" codec must be negotiated. |
| 25 | */ |
| 26 | @property(nonatomic, readonly) BOOL canInsertDtmf; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Queues a task that sends the DTMF tones. The tones parameter is treated |
| 30 | * as a series of characters. The characters 0 through 9, A through D, #, and * |
| 31 | * generate the associated DTMF tones. The characters a to d are equivalent |
| 32 | * to A to D. The character ',' indicates a delay of 2 seconds before |
| 33 | * processing the next character in the tones parameter. |
| 34 | * |
| 35 | * Unrecognized characters are ignored. |
| 36 | * |
| 37 | * @param duration The parameter indicates the duration to use for each |
| 38 | * character passed in the tones parameter. The duration cannot be more |
| 39 | * than 6000 or less than 70 ms. |
| 40 | * |
| 41 | * @param interToneGap The parameter indicates the gap between tones. |
| 42 | * This parameter must be at least 50 ms but should be as short as |
| 43 | * possible. |
| 44 | * |
| 45 | * If InsertDtmf is called on the same object while an existing task for this |
| 46 | * object to generate DTMF is still running, the previous task is canceled. |
| 47 | * Returns true on success and false on failure. |
| 48 | */ |
| 49 | - (BOOL)insertDtmf:(nonnull NSString *)tones |
| 50 | duration:(NSTimeInterval)duration |
| 51 | interToneGap:(NSTimeInterval)interToneGap; |
| 52 | |
| 53 | /** The tones remaining to be played out */ |
| 54 | - (nonnull NSString *)remainingTones; |
| 55 | |
| 56 | /** |
| 57 | * The current tone duration value. This value will be the value last set via the |
| 58 | * insertDtmf method, or the default value of 100 ms if insertDtmf was never called. |
| 59 | */ |
| 60 | - (NSTimeInterval)duration; |
| 61 | |
| 62 | /** |
| 63 | * The current value of the between-tone gap. This value will be the value last set |
| 64 | * via the insertDtmf() method, or the default value of 50 ms if insertDtmf() was never |
| 65 | * called. |
| 66 | */ |
| 67 | - (NSTimeInterval)interToneGap; |
| 68 | |
| 69 | @end |
| 70 | |
| 71 | NS_ASSUME_NONNULL_END |