Yura Yaroshevich | 2767632 | 2018-01-02 14:44:35 +0300 | [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 <WebRTC/RTCMacros.h> |
| 14 | |
| 15 | NS_ASSUME_NONNULL_BEGIN |
| 16 | |
| 17 | RTC_EXPORT |
| 18 | @protocol RTCDtmfSender <NSObject> |
| 19 | |
| 20 | /** |
| 21 | * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise |
| 22 | * returns false. To be able to send DTMF, the associated RTCRtpSender must be |
| 23 | * able to send packets, and a "telephone-event" codec must be negotiated. |
| 24 | */ |
| 25 | @property(nonatomic, readonly) BOOL canInsertDtmf; |
| 26 | |
| 27 | /** |
| 28 | * Queues a task that sends the DTMF tones. The tones parameter is treated |
| 29 | * as a series of characters. The characters 0 through 9, A through D, #, and * |
| 30 | * generate the associated DTMF tones. The characters a to d are equivalent |
| 31 | * to A to D. The character ',' indicates a delay of 2 seconds before |
| 32 | * processing the next character in the tones parameter. |
| 33 | * |
| 34 | * Unrecognized characters are ignored. |
| 35 | * |
| 36 | * @param duration The parameter indicates the duration to use for each |
| 37 | * character passed in the tones parameter. The duration cannot be more |
| 38 | * than 6000 or less than 70 ms. |
| 39 | * |
| 40 | * @param interToneGap The parameter indicates the gap between tones. |
| 41 | * This parameter must be at least 50 ms but should be as short as |
| 42 | * possible. |
| 43 | * |
| 44 | * If InsertDtmf is called on the same object while an existing task for this |
| 45 | * object to generate DTMF is still running, the previous task is canceled. |
| 46 | * Returns true on success and false on failure. |
| 47 | */ |
| 48 | - (BOOL)insertDtmf:(nonnull NSString *)tones |
| 49 | duration:(NSTimeInterval)duration |
| 50 | interToneGap:(NSTimeInterval)interToneGap; |
| 51 | |
| 52 | /** The tones remaining to be played out */ |
| 53 | - (nonnull NSString *)remainingTones; |
| 54 | |
| 55 | /** |
| 56 | * The current tone duration value. This value will be the value last set via the |
| 57 | * insertDtmf method, or the default value of 100 ms if insertDtmf was never called. |
| 58 | */ |
| 59 | - (NSTimeInterval)duration; |
| 60 | |
| 61 | /** |
| 62 | * The current value of the between-tone gap. This value will be the value last set |
| 63 | * via the insertDtmf() method, or the default value of 50 ms if insertDtmf() was never |
| 64 | * called. |
| 65 | */ |
| 66 | - (NSTimeInterval)interToneGap; |
| 67 | |
| 68 | @end |
| 69 | |
| 70 | NS_ASSUME_NONNULL_END |