aboutsummaryrefslogtreecommitdiffstats
path: root/main/dial.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-25 02:52:10 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-25 02:52:10 +0000
commit580f3eea916676ec98322bba0daf9beed04bd898 (patch)
tree4163b0ad6c4236b872a3671d3cbea81ae4b67d95 /main/dial.c
parent9ed296771362f957fc5bc33f8791884fd60afbd2 (diff)
Add an API call that steals the answered channel so that a destruction of the dialing structure does not hang it up.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@100325 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/dial.c')
-rw-r--r--main/dial.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/dial.c b/main/dial.c
index 7b6ce871e..83e6fbd71 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -721,6 +721,25 @@ struct ast_channel *ast_dial_answered(struct ast_dial *dial)
return ((dial->state == AST_DIAL_RESULT_ANSWERED) ? AST_LIST_FIRST(&dial->channels)->owner : NULL);
}
+/*! \brief Steal the channel that answered
+ * \note Returns the Asterisk channel that answered and removes it from the dialing structure
+ * \param dial Dialing structure
+ */
+struct ast_channel *ast_dial_answered_steal(struct ast_dial *dial)
+{
+ struct ast_channel *chan = NULL;
+
+ if (!dial)
+ return NULL;
+
+ if (dial->state == AST_DIAL_RESULT_ANSWERED) {
+ chan = AST_LIST_FIRST(&dial->channels)->owner;
+ AST_LIST_FIRST(&dial->channels)->owner = NULL;
+ }
+
+ return chan;
+}
+
/*! \brief Return state of dial
* \note Returns the state of the dial attempt
* \param dial Dialing structure