[asterisk-commits] file: branch file/rtp_engine-mark2 r183992 - /team/file/rtp_engine-mark2/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 24 13:55:11 CDT 2009


Author: file
Date: Tue Mar 24 13:55:08 2009
New Revision: 183992

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183992
Log:
Implement the stop callback.

Modified:
    team/file/rtp_engine-mark2/res/res_rtp_asterisk.c

Modified: team/file/rtp_engine-mark2/res/res_rtp_asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/res/res_rtp_asterisk.c?view=diff&rev=183992&r1=183991&r2=183992
==============================================================================
--- team/file/rtp_engine-mark2/res/res_rtp_asterisk.c (original)
+++ team/file/rtp_engine-mark2/res/res_rtp_asterisk.c Tue Mar 24 13:55:08 2009
@@ -256,6 +256,7 @@
 static int ast_rtp_get_stat(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
 static int ast_rtp_dtmf_compatible(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
 static void ast_rtp_stun_request(struct ast_rtp_instance *instance, struct sockaddr_in *suggestion, const char *username);
+static void ast_rtp_stop(struct ast_rtp_instance *instance);
 
 /* RTP Engine Declaration */
 static struct ast_rtp_engine asterisk_rtp_engine = {
@@ -276,6 +277,7 @@
 	.get_stat = ast_rtp_get_stat,
 	.dtmf_compatible = ast_rtp_dtmf_compatible,
 	.stun_request = ast_rtp_stun_request,
+	.stop = ast_rtp_stop,
 };
 
 static inline int rtp_debug_test_addr(struct sockaddr_in *addr)
@@ -2245,6 +2247,29 @@
 	ast_stun_request(rtp->s, suggestion, username, NULL);
 }
 
+static void ast_rtp_stop(struct ast_rtp_instance *instance)
+{
+	struct ast_rtp *rtp = instance->data;
+
+	if (rtp->rtcp) {
+		AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid);
+	}
+	if (rtp->red) {
+		AST_SCHED_DEL(rtp->sched, rtp->red->schedid);
+		free(rtp->red);
+		rtp->red = NULL;
+	}
+
+	memset(&instance->remote_address.sin_addr, 0, sizeof(instance->remote_address.sin_addr));
+	memset(&instance->remote_address.sin_port, 0, sizeof(instance->remote_address.sin_port));
+	if (rtp->rtcp) {
+		memset(&rtp->rtcp->them.sin_addr, 0, sizeof(rtp->rtcp->them.sin_addr));
+		memset(&rtp->rtcp->them.sin_port, 0, sizeof(rtp->rtcp->them.sin_port));
+	}
+
+	ast_set_flag(rtp, FLAG_NEED_MARKER_BIT);
+}
+
 static char *rtp_do_debug_ip(struct ast_cli_args *a)
 {
 	struct hostent *hp;




More information about the asterisk-commits mailing list