From 8694fd32f6670e9b0aadd0bc350472434b6d5ffb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 11 Apr 2009 16:29:36 +0000 Subject: [PATCH] add dtmf method to mod_opal git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13002 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_opal/mod_opal.cpp | 16 +++++++++++----- src/mod/endpoints/mod_opal/mod_opal.h | 5 +++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_opal/mod_opal.cpp b/src/mod/endpoints/mod_opal/mod_opal.cpp index ac3a9fd74b..6e3b428682 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.cpp +++ b/src/mod/endpoints/mod_opal/mod_opal.cpp @@ -49,6 +49,7 @@ static const char ModuleName[] = "opal"; static switch_status_t on_hangup(switch_core_session_t *session); +static switch_status_t on_destroy(switch_core_session_t *session); static switch_io_routines_t opalfs_io_routines = { @@ -69,9 +70,8 @@ static switch_state_handler_table_t opalfs_event_handlers = { /*.on_routing */ FSConnection::on_routing, /*.on_execute */ FSConnection::on_execute, /*.on_hangup */ on_hangup, - /*.on_loopback */ FSConnection::on_loopback, - /*.on_transmit */ FSConnection::on_transmit, - /*.on_soft_execute */ NULL, + /*.on_exchange_media */ FSConnection::on_exchange_media, + /*.on_soft_execute */ FSConnection::on_soft_execute, /*.on_consume_media*/ NULL, /*.on_hibernate*/ NULL, /*.on_reset*/ NULL, @@ -676,6 +676,12 @@ void FSConnection::OnEstablished() OpalLocalConnection::OnEstablished(); } +PBoolean FSConnection::SendUserInputTone(char tone, unsigned duration) +{ + switch_dtmf_t dtmf = { tone, duration }; + + return (switch_channel_queue_dtmf(m_fsChannel, &dtmf) == SWITCH_STATUS_SUCCESS) ? true : false; +} OpalMediaFormatList FSConnection::GetMediaFormats() const { @@ -887,14 +893,14 @@ static switch_status_t on_hangup(switch_core_session_t *session) } -switch_status_t FSConnection::on_loopback() +switch_status_t FSConnection::on_exchange_media() { PTRACE(3, "mod_opal\tLoopback on connection " << *this); return SWITCH_STATUS_SUCCESS; } -switch_status_t FSConnection::on_transmit() +switch_status_t FSConnection::on_soft_execute() { PTRACE(3, "mod_opal\tTransmit on connection " << *this); return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/endpoints/mod_opal/mod_opal.h b/src/mod/endpoints/mod_opal/mod_opal.h index c2cf2c630c..0b32c05485 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.h +++ b/src/mod/endpoints/mod_opal/mod_opal.h @@ -187,6 +187,7 @@ class FSConnection:public OpalLocalConnection { virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean); virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream); virtual OpalMediaFormatList GetMediaFormats() const; + virtual PBoolean SendUserInputTone(char tone, unsigned duration); void SetCodecs(); @@ -195,8 +196,8 @@ class FSConnection:public OpalLocalConnection { DECLARE_CALLBACK0(on_execute); //DECLARE_CALLBACK0(on_hangup); - DECLARE_CALLBACK0(on_loopback); - DECLARE_CALLBACK0(on_transmit); + DECLARE_CALLBACK0(on_exchange_media); + DECLARE_CALLBACK0(on_soft_execute); DECLARE_CALLBACK1(kill_channel, int, sig); DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);