RTCDtmfSender.h 2.4 KB

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