RTCDtmfSender.h 2.4 KB

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