[asterisk-commits] file: trunk r100325 - in /trunk: include/asterisk/dial.h main/dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 24 20:52:11 CST 2008


Author: file
Date: Thu Jan 24 20:52:10 2008
New Revision: 100325

URL: http://svn.digium.com/view/asterisk?view=rev&rev=100325
Log:
Add an API call that steals the answered channel so that a destruction of the dialing structure does not hang it up.

Modified:
    trunk/include/asterisk/dial.h
    trunk/main/dial.c

Modified: trunk/include/asterisk/dial.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/dial.h?view=diff&rev=100325&r1=100324&r2=100325
==============================================================================
--- trunk/include/asterisk/dial.h (original)
+++ trunk/include/asterisk/dial.h Thu Jan 24 20:52:10 2008
@@ -81,6 +81,12 @@
  * \param dial Dialing structure
  */
 struct ast_channel *ast_dial_answered(struct ast_dial *dial);
+
+/*! \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);
 
 /*! \brief Return state of dial
  * \note Returns the state of the dial attempt

Modified: trunk/main/dial.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dial.c?view=diff&rev=100325&r1=100324&r2=100325
==============================================================================
--- trunk/main/dial.c (original)
+++ trunk/main/dial.c Thu Jan 24 20:52:10 2008
@@ -721,6 +721,25 @@
 	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




More information about the asterisk-commits mailing list