From a63e3568672ca470a000594df0cb3805d18e84eb Mon Sep 17 00:00:00 2001 From: Samuel Isuani Date: Tue, 30 Jun 2015 15:54:55 -0300 Subject: [PATCH] add key/unkey radio frame --- libs/yiax/yateiax.h | 18 ++++++++++++++++++ modules/yiaxchan.cpp | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/libs/yiax/yateiax.h b/libs/yiax/yateiax.h index 645c95c58..297f1d28b 100644 --- a/libs/yiax/yateiax.h +++ b/libs/yiax/yateiax.h @@ -2101,6 +2101,24 @@ class YIAX_API IAXTransaction : public RefObject, public Mutex inline bool sendProgress() { return sendConnected(IAXFullFrame::Proceeding); } + /** + * Send a KEYRADIO frame to remote peer + * This method is thread safe + * @return False if the current transaction state is not Connected + */ + + inline bool sendKeyRadio() + { return sendConnected(IAXFullFrame::KeyRadio); } + + /** + * Send a UNKEYRADIO frame to remote peer + * This method is thread safe + * @return False if the current transaction state is not Connected + */ + + inline bool sendUnkeyRadio() + { return sendConnected(IAXFullFrame::UnkeyRadio); } + /** * Send an ACCEPT/REGACK frame to remote peer * This method is thread safe diff --git a/modules/yiaxchan.cpp b/modules/yiaxchan.cpp index ce7f01dcb..ab2be043f 100644 --- a/modules/yiaxchan.cpp +++ b/modules/yiaxchan.cpp @@ -558,6 +558,8 @@ class YIAXConnection : public Channel virtual bool msgAnswered(Message& msg); virtual bool msgTone(Message& msg, const char* tone); virtual bool msgText(Message& msg, const char* text); + virtual bool keyRadio(); + virtual bool unkeyRadio(); virtual void disconnected(bool final, const char* reason); bool disconnect(const char* reason = 0); inline IAXTransaction* transaction() const @@ -2648,6 +2650,26 @@ bool YIAXConnection::msgText(Message& msg, const char* text) return false; } +bool YIAXConnection::keyRadio() +{ + Lock lock(&m_mutexTrans); + if (m_transaction) { + m_transaction->sendKeyRadio(); + return true; + } + return false; +} + +bool YIAXConnection::unkeyRadio() +{ + Lock lock(&m_mutexTrans); + if (m_transaction) { + m_transaction->sendUnkeyRadio(); + return true; + } + return false; +} + void YIAXConnection::disconnected(bool final, const char* reason) { DDebug(this,DebugAll,"Disconnected. Final: %s . Reason: '%s' [%p]",