[asterisk-commits] file: trunk r41316 - in /trunk: channels/ include/asterisk/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Aug 29 20:16:03 MST 2006


Author: file
Date: Tue Aug 29 22:16:03 2006
New Revision: 41316

URL: http://svn.digium.com/view/asterisk?rev=41316&view=rev
Log:
Use an API call (ast_rtp_get_bridged) to return the RTP stream we are bridged to, and also use it in chan_sip so we know to ignore the no RTP activity checking

Modified:
    trunk/channels/chan_sip.c
    trunk/include/asterisk/rtp.h
    trunk/main/rtp.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=41316&r1=41315&r2=41316&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Aug 29 22:16:03 2006
@@ -14365,12 +14365,15 @@
 								ast_mutex_lock(&sip->lock);
 							}
 							if (sip->owner) {
-								ast_log(LOG_NOTICE,
-									"Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
-									sip->owner->name,
-									(long) (t - sip->lastrtprx));
-								/* Issue a softhangup */
-								ast_softhangup_nolock(sip->owner, AST_SOFTHANGUP_DEV);
+								if (!(ast_rtp_get_bridged(sip->rtp))) {
+									ast_log(LOG_NOTICE,
+										"Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
+										sip->owner->name,
+										(long) (t - sip->lastrtprx));
+									/* Issue a softhangup */
+									ast_softhangup_nolock(sip->owner, AST_SOFTHANGUP_DEV);
+								} else
+									ast_log(LOG_NOTICE, "'%s' will not be disconnected in %ld seconds because it is directly bridged to another RTP stream\n", sip->owner->name, (long) (t - sip->lastrtprx));
 								ast_channel_unlock(sip->owner);
 								/* forget the timeouts for this call, since a hangup
 								   has already been requested and we don't want to

Modified: trunk/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/rtp.h?rev=41316&r1=41315&r2=41316&view=diff
==============================================================================
--- trunk/include/asterisk/rtp.h (original)
+++ trunk/include/asterisk/rtp.h Tue Aug 29 22:16:03 2006
@@ -120,6 +120,8 @@
 
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us);
 
+struct ast_rtp *ast_rtp_get_bridged(struct ast_rtp *rtp);
+
 void ast_rtp_destroy(struct ast_rtp *rtp);
 
 void ast_rtp_reset(struct ast_rtp *rtp);

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?rev=41316&r1=41315&r2=41316&view=diff
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Tue Aug 29 22:16:03 2006
@@ -781,7 +781,7 @@
 	}
 
 	/* If we are P2P bridged to another RTP stream, send it directly over */
-	if (rtp->bridged && !bridge_p2p_rtcp_write(rtp, rtcpheader, res))
+	if (ast_rtp_get_bridged(rtp) && !bridge_p2p_rtcp_write(rtp, rtcpheader, res))
 		return &ast_null_frame;
 
 	if (option_debug)
@@ -939,7 +939,7 @@
 /*! \brief Perform a Packet2Packet RTCP write */
 static int bridge_p2p_rtcp_write(struct ast_rtp *rtp, unsigned int *rtcpheader, int len)
 {
-	struct ast_rtp *bridged = rtp->bridged;
+	struct ast_rtp *bridged = ast_rtp_get_bridged(rtp);
 	int res = 0;
 
 	/* If RTCP is not present on the bridged RTP session, then ignore this */
@@ -962,7 +962,7 @@
 /*! \brief Perform a Packet2Packet RTP write */
 static int bridge_p2p_rtp_write(struct ast_rtp *rtp, unsigned int *rtpheader, int len, int hdrlen)
 {
-	struct ast_rtp *bridged = rtp->bridged;
+	struct ast_rtp *bridged = ast_rtp_get_bridged(rtp);
 	int res = 0, payload = 0, bridged_payload = 0, version, padding, mark, ext;
 	struct rtpPayloadType rtpPT;
 	unsigned int seqno;
@@ -1084,7 +1084,7 @@
 	}
 
 	/* If we are bridged to another RTP stream, send direct */
-	if (rtp->bridged && !bridge_p2p_rtp_write(rtp, rtpheader, res, hdrlen))
+	if (ast_rtp_get_bridged(rtp) && !bridge_p2p_rtp_write(rtp, rtpheader, res, hdrlen))
 		return &ast_null_frame;
 
 	if (version != 2)
@@ -1844,6 +1844,11 @@
 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us)
 {
 	*us = rtp->us;
+}
+
+struct ast_rtp *ast_rtp_get_bridged(struct ast_rtp *rtp)
+{
+	return rtp->bridged;
 }
 
 void ast_rtp_stop(struct ast_rtp *rtp)



More information about the asterisk-commits mailing list