[asterisk-commits] file: trunk r212390 - in /trunk: include/asterisk/rtp_engine.h main/rtp_engine.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Aug 16 14:27:42 CDT 2009


Author: file
Date: Sun Aug 16 14:27:39 2009
New Revision: 212390

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212390
Log:
Add two more API calls for getting the current glue and channel in bridging code.

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

Modified: trunk/include/asterisk/rtp_engine.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/rtp_engine.h?view=diff&rev=212390&r1=212389&r2=212390
==============================================================================
--- trunk/include/asterisk/rtp_engine.h (original)
+++ trunk/include/asterisk/rtp_engine.h Sun Aug 16 14:27:39 2009
@@ -1658,6 +1658,46 @@
  */
 struct ast_rtp_engine *ast_rtp_instance_get_engine(struct ast_rtp_instance *instance);
 
+/*!
+ * \brief Get the RTP glue in use on an RTP instance
+ *
+ * \param instance The RTP instance
+ *
+ * \retval pointer to the glue
+ *
+ * Example:
+ *
+ * \code
+ * struct ast_rtp_glue *glue = ast_rtp_instance_get_active_glue(instance);
+ * \endcode
+ *
+ * This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
+ */
+struct ast_rtp_glue *ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance);
+
+/*!
+ * \brief Get the channel that is associated with an RTP instance while in a bridge
+ *
+ * \param instance The RTP instance
+ *
+ * \retval pointer to the channel
+ *
+ * Example:
+ *
+ * \code
+ * struct ast_channel *chan = ast_rtp_instance_get_chan(instance);
+ * \endcode
+ *
+ * This gets the channel associated with the RTP instance pointed to by 'instance'.
+ *
+ * \note This will only return a channel while in a local or remote bridge.
+ *
+ * \since 1.6.3
+ */
+struct ast_channel *ast_rtp_instance_get_chan(struct ast_rtp_instance *instance);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: trunk/main/rtp_engine.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/rtp_engine.c?view=diff&rev=212390&r1=212389&r2=212390
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Sun Aug 16 14:27:39 2009
@@ -63,6 +63,10 @@
 	int holdtimeout;
 	/*! DTMF mode in use */
 	enum ast_rtp_dtmf_mode dtmf_mode;
+	/*! Glue currently in use */
+	struct ast_rtp_glue *glue;
+	/*! Channel associated with the instance */
+	struct ast_channel *chan;
 };
 
 /*! List of RTP engines that are currently registered */
@@ -1233,6 +1237,11 @@
 		goto done;
 	}
 
+	instance0->glue = glue0;
+	instance1->glue = glue1;
+	instance0->chan = c0;
+	instance1->chan = c1;
+
 	/* Depending on the end result for bridging either do a local bridge or remote bridge */
 	if (audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) {
 		ast_verbose(VERBOSE_PREFIX_3 "Locally bridging %s and %s\n", c0->name, c1->name);
@@ -1243,6 +1252,11 @@
 				tinstance0, tinstance1, glue0, glue1, codec0, codec1, timeoutms, flags,
 				fo, rc, c0->tech_pvt, c1->tech_pvt);
 	}
+
+	instance0->glue = NULL;
+	instance1->glue = NULL;
+	instance0->chan = NULL;
+	instance1->chan = NULL;
 
 	unlock_chans = 0;
 
@@ -1620,3 +1634,13 @@
 {
 	return instance->engine;
 }
+
+struct ast_rtp_glue *ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance)
+{
+	return instance->glue;
+}
+
+struct ast_channel *ast_rtp_instance_get_chan(struct ast_rtp_instance *instance)
+{
+	return instance->chan;
+}




More information about the asterisk-commits mailing list