aboutsummaryrefslogtreecommitdiffstats
path: root/main/audiohook.c
diff options
context:
space:
mode:
authorbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-01 16:57:19 +0000
committerbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-01 16:57:19 +0000
commit26a549ebfbb5c4014e3d1c8f421eb8f05b5989b0 (patch)
tree27c35a3350c9aae81be9a3d569d1551d4c0e4a59 /main/audiohook.c
parent46a00af5ab6a1c7ae5b96d708df7076b51c9c2ba (diff)
Add two new dialplan functions from libspeex for applying audio gain control
and denoising to a channel, AGC() and DENOISE(). Also included, is a change to the audiohook API to add a new function (ast_audiohook_remove) that can remove an audiohook from a channel before it is detached. This code is based on a contribution from Switchvox. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114926 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/audiohook.c')
-rw-r--r--main/audiohook.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/main/audiohook.c b/main/audiohook.c
index 1f5bcff4f..37970174e 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -455,6 +455,42 @@ int ast_audiohook_detach_source(struct ast_channel *chan, const char *source)
return (audiohook ? 0 : -1);
}
+/*!
+ * \brief Remove an audiohook from a specified channel
+ *
+ * \param chan Channel to remove from
+ * \param audiohook Audiohook to remove
+ *
+ * \return Returns 0 on success, -1 on failure
+ *
+ * \note The channel does not need to be locked before calling this function
+ */
+int ast_audiohook_remove(struct ast_channel *chan, struct ast_audiohook *audiohook)
+{
+ ast_channel_lock(chan);
+
+ if (!chan->audiohooks) {
+ ast_channel_unlock(chan);
+ return -1;
+ }
+
+ if (audiohook->type == AST_AUDIOHOOK_TYPE_SPY)
+ AST_LIST_REMOVE(&chan->audiohooks->spy_list, audiohook, list);
+ else if (audiohook->type == AST_AUDIOHOOK_TYPE_WHISPER)
+ AST_LIST_REMOVE(&chan->audiohooks->whisper_list, audiohook, list);
+ else if (audiohook->type == AST_AUDIOHOOK_TYPE_MANIPULATE)
+ AST_LIST_REMOVE(&chan->audiohooks->manipulate_list, audiohook, list);
+
+ ast_audiohook_lock(audiohook);
+ audiohook->status = AST_AUDIOHOOK_STATUS_DONE;
+ ast_cond_signal(&audiohook->trigger);
+ ast_audiohook_unlock(audiohook);
+
+ ast_channel_unlock(chan);
+
+ return 0;
+}
+
/*! \brief Pass a DTMF frame off to be handled by the audiohook core
* \param chan Channel that the list is coming off of
* \param audiohook_list List of audiohooks