[asterisk-commits] file: branch 1.4 r48168 - in /branches/1.4: channels/ include/asterisk/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 30 14:18:25 MST 2006


Author: file
Date: Thu Nov 30 15:18:24 2006
New Revision: 48168

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48168
Log:
Do not do a partial bridge for Google Talk since we need to handle STUN. (issue #8448 reported by phsultan)

Modified:
    branches/1.4/channels/chan_gtalk.c
    branches/1.4/include/asterisk/rtp.h
    branches/1.4/main/rtp.c

Modified: branches/1.4/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_gtalk.c?view=diff&rev=48168&r1=48167&r2=48168
==============================================================================
--- branches/1.4/channels/chan_gtalk.c (original)
+++ branches/1.4/channels/chan_gtalk.c Thu Nov 30 15:18:24 2006
@@ -163,7 +163,6 @@
 };
 
 static const char desc[] = "Gtalk Channel";
-static const char type[] = "Gtalk";
 
 static int usecnt = 0;
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
@@ -195,7 +194,7 @@
 
 /*! \brief PBX interface structure for channel registration */
 static const struct ast_channel_tech gtalk_tech = {
-	.type = type,
+	.type = "Gtalk",
 	.description = "Gtalk Channel Driver",
 	.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
 	.requester = gtalk_request,
@@ -223,7 +222,7 @@
 
 /*! \brief RTP driver interface */
 static struct ast_rtp_protocol gtalk_rtp = {
-	type: "gtalk",
+	type: "Gtalk",
 	get_rtp_info: gtalk_get_rtp_peer,
 	set_rtp_peer: gtalk_set_rtp_peer,
 	get_codec: gtalk_get_codec,
@@ -922,10 +921,12 @@
 	fmt = ast_best_codec(tmp->nativeformats);
 
 	if (i->rtp) {
+		ast_rtp_setstun(i->rtp, 1);
 		tmp->fds[0] = ast_rtp_fd(i->rtp);
 		tmp->fds[1] = ast_rtcp_fd(i->rtp);
 	}
 	if (i->vrtp) {
+		ast_rtp_setstun(i->rtp, 1);
 		tmp->fds[2] = ast_rtp_fd(i->vrtp);
 		tmp->fds[3] = ast_rtcp_fd(i->vrtp);
 	}
@@ -1796,7 +1797,7 @@
 
 	/* Make sure we can register our channel type */
 	if (ast_channel_register(&gtalk_tech)) {
-		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+		ast_log(LOG_ERROR, "Unable to register channel class %s\n", gtalk_tech.type);
 		return -1;
 	}
 	return 0;

Modified: branches/1.4/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/rtp.h?view=diff&rev=48168&r1=48167&r2=48168
==============================================================================
--- branches/1.4/include/asterisk/rtp.h (original)
+++ branches/1.4/include/asterisk/rtp.h Thu Nov 30 15:18:24 2006
@@ -186,6 +186,9 @@
 /*! \brief Compensate for devices that send RFC2833 packets all at once */
 void ast_rtp_setdtmfcompensate(struct ast_rtp *rtp, int compensate);
 
+/*! \brief Enable STUN capability */
+void ast_rtp_setstun(struct ast_rtp *rtp, int stun_enable);
+
 int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 
 int ast_rtp_proto_register(struct ast_rtp_protocol *proto);

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=48168&r1=48167&r2=48168
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Thu Nov 30 15:18:24 2006
@@ -183,6 +183,7 @@
 #define FLAG_P2P_NEED_DTMF              (1 << 5)
 #define FLAG_CALLBACK_MODE              (1 << 6)
 #define FLAG_DTMF_COMPENSATE            (1 << 7)
+#define FLAG_HAS_STUN                   (1 << 8)
 
 /*!
  * \brief Structure defining an RTCP session.
@@ -543,6 +544,11 @@
 void ast_rtp_setdtmfcompensate(struct ast_rtp *rtp, int compensate)
 {
 	ast_set2_flag(rtp, compensate ? 1 : 0, FLAG_DTMF_COMPENSATE);
+}
+
+void ast_rtp_setstun(struct ast_rtp *rtp, int stun_enable)
+{
+	ast_set2_flag(rtp, stun_enable ? 1 : 0, FLAG_HAS_STUN);
 }
 
 static struct ast_frame *send_dtmf(struct ast_rtp *rtp, enum ast_frame_type type)
@@ -2843,8 +2849,8 @@
 /*! \brief Helper function to switch a channel and RTP stream into callback mode */
 static int p2p_callback_enable(struct ast_channel *chan, struct ast_rtp *rtp, int *fds, int **iod)
 {
-	/* If we need DTMF or we have no IO structure, then we can't do direct callback */
-	if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) || !rtp->io)
+	/* If we need DTMF, are looking for STUN, or we have no IO structure then we can't do direct callback */
+	if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) || ast_test_flag(rtp, FLAG_HAS_STUN) || !rtp->io)
 		return 0;
 
 	/* If the RTP structure is already in callback mode, remove it temporarily */



More information about the asterisk-commits mailing list