[asterisk-commits] file: branch file/rtp_engine-mark2 r185703 - in /team/file/rtp_engine-mark2: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 31 19:31:45 CDT 2009


Author: file
Date: Tue Mar 31 19:31:38 2009
New Revision: 185703

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185703
Log:
Make the ast_rtp_instance structure opaque.

Modified:
    team/file/rtp_engine-mark2/UPGRADE.txt
    team/file/rtp_engine-mark2/channels/chan_gtalk.c
    team/file/rtp_engine-mark2/channels/chan_h323.c
    team/file/rtp_engine-mark2/channels/chan_jingle.c
    team/file/rtp_engine-mark2/channels/chan_mgcp.c
    team/file/rtp_engine-mark2/channels/chan_sip.c
    team/file/rtp_engine-mark2/channels/chan_skinny.c
    team/file/rtp_engine-mark2/channels/chan_unistim.c
    team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
    team/file/rtp_engine-mark2/main/rtp_engine.c
    team/file/rtp_engine-mark2/res/res_rtp_asterisk.c

Modified: team/file/rtp_engine-mark2/UPGRADE.txt
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/UPGRADE.txt?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/UPGRADE.txt (original)
+++ team/file/rtp_engine-mark2/UPGRADE.txt Tue Mar 31 19:31:38 2009
@@ -23,7 +23,7 @@
 * The usage of RTP inside of Asterisk has now become modularized. This means
   the Asterisk RTP stack now exists as a loadable module, res_rtp_asterisk.
   If you are not using autoload=yes in modules.conf you will need to ensure
-  it is set to load. If not then any module which uses RTP (such as chan_sip)
+  it is set to load. If not, then any module which uses RTP (such as chan_sip)
   will not be able to send or receive calls.
 
 From 1.6.1 to 1.6.2:

Modified: team/file/rtp_engine-mark2/channels/chan_gtalk.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_gtalk.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_gtalk.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_gtalk.c Tue Mar 31 19:31:38 2009
@@ -613,13 +613,13 @@
 	/* codec points to the first <payload-type/> tag */
 	codec = iks_first_tag(iks_first_tag(iks_first_tag(pak->x)));
 	while (codec) {
-		ast_rtp_codecs_payloads_set_m_type(&tmp->rtp->codecs, tmp->rtp, atoi(iks_find_attrib(codec, "id")));
-		ast_rtp_codecs_payloads_set_rtpmap_type(&tmp->rtp->codecs, tmp->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+		ast_rtp_codecs_payloads_set_m_type(ast_rtp_instance_get_codecs(tmp->rtp), tmp->rtp, atoi(iks_find_attrib(codec, "id")));
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(tmp->rtp), tmp->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
 		codec = iks_next_tag(codec);
 	}
 	
 	/* Now gather all of the codecs that we are asked for */
-	ast_rtp_codecs_payload_formats(&tmp->rtp->codecs, &tmp->peercapability, &peernoncodeccapability);
+	ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(tmp->rtp), &tmp->peercapability, &peernoncodeccapability);
 	
 	/* at this point, we received an awser from the remote Gtalk client,
 	   which allows us to compare capabilities */
@@ -806,7 +806,7 @@
 		goto safeout;
 	}
 
-	memcpy(&sin, &p->rtp->local_address, sizeof(sin));
+	ast_rtp_instance_get_local_address(p->rtp, &sin);
 	ast_find_ourip(&us, bindaddr);
 	if (!strcmp(ast_inet_ntoa(us), "127.0.0.1")) {
 		ast_log(LOG_WARNING, "Found a loopback IP on the system, check your network configuration or set the bindaddr attribute.");
@@ -949,7 +949,7 @@
 	/* clear codecs */
 	tmp->rtp = ast_rtp_instance_new(NULL, sched, &bindaddr, NULL);
 	ast_rtp_instance_set_prop(tmp->rtp, AST_RTP_PROPERTY_RTCP, 1);
-	ast_rtp_codecs_payloads_clear(&tmp->rtp->codecs, tmp->rtp);
+	ast_rtp_codecs_payloads_clear(ast_rtp_instance_get_codecs(tmp->rtp), tmp->rtp);
 
 	/* add user configured codec capabilites */
 	if (client->capability)
@@ -1011,7 +1011,7 @@
 
 	/* Set Frame packetization */
 	if (i->rtp)
-		ast_rtp_codecs_packetization_set(&i->rtp->codecs, i->rtp, &i->prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(i->rtp), i->rtp, &i->prefs);
 
 	tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | (i->jointcapability & AST_FORMAT_VIDEO_MASK);
 	fmt = ast_best_codec(tmp->nativeformats);
@@ -1204,13 +1204,13 @@
 	codec = iks_first_tag(iks_first_tag(iks_first_tag(pak->x)));
 	
 	while (codec) {
-		ast_rtp_codecs_payloads_set_m_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")));
-		ast_rtp_codecs_payloads_set_rtpmap_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+		ast_rtp_codecs_payloads_set_m_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")));
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
 		codec = iks_next_tag(codec);
 	}
 	
 	/* Now gather all of the codecs that we are asked for */
-	ast_rtp_codecs_payload_formats(&p->rtp->codecs, &p->peercapability, &peernoncodeccapability);
+	ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(p->rtp), &p->peercapability, &peernoncodeccapability);
 	p->jointcapability = p->capability & p->peercapability;
 	ast_mutex_unlock(&p->lock);
 		
@@ -1274,7 +1274,7 @@
 			 p->ourcandidates->username);
 		
 		/* Find out the result of the STUN */
-		memcpy(&aux, &p->rtp->remote_address, sizeof(aux));
+		ast_rtp_instance_get_remote_address(p->rtp, &aux);
 
 		/* If the STUN result is different from the IP of the hostname,
 			lock on the stun IP of the hostname advertised by the

Modified: team/file/rtp_engine-mark2/channels/chan_h323.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_h323.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_h323.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_h323.c Tue Mar 31 19:31:38 2009
@@ -972,12 +972,12 @@
 	ast_rtp_instance_set_prop(pvt->rtp, AST_RTP_PROPERTY_NAT, pvt->options.nat);
 
 	if (pvt->dtmf_pt[0] > 0)
-		ast_rtp_codecs_payloads_set_rtpmap_type(&pvt->rtp->codecs, pvt->rtp, pvt->dtmf_pt[0], "audio", "telephone-event", 0);
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, pvt->dtmf_pt[0], "audio", "telephone-event", 0);
 	if (pvt->dtmf_pt[1] > 0)
-		ast_rtp_codecs_payloads_set_rtpmap_type(&pvt->rtp->codecs, pvt->rtp, pvt->dtmf_pt[1], "audio", "cisco-telephone-event", 0);
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, pvt->dtmf_pt[1], "audio", "cisco-telephone-event", 0);
 
 	if (pvt->peercapability)
-		ast_rtp_codecs_packetization_set(&pvt->rtp->codecs, pvt->rtp, &pvt->peer_prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);
 
 	if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
 		ast_jb_configure(pvt->owner, &global_jbconf);
@@ -1912,7 +1912,7 @@
 		return NULL;
 	}
 	/* figure out our local RTP port and tell the H.323 stack about it */
-	memcpy(&us, &pvt->rtp->local_address, sizeof(us));
+	ast_rtp_instance_get_local_address(pvt->rtp, &us);
 	ast_mutex_unlock(&pvt->lock);
 
 	ast_copy_string(info->addr, ast_inet_ntoa(us.sin_addr), sizeof(info->addr));
@@ -1952,7 +1952,7 @@
 		__oh323_rtp_create(pvt);
 
 	if ((pt == 2) && (pvt->jointcapability & AST_FORMAT_G726_AAL2)) {
-		ast_rtp_codecs_payloads_set_rtpmap_type(&pvt->rtp->codecs, pvt->rtp, pt, "audio", "G726-32", AST_RTP_OPT_G726_NONSTANDARD);
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, pt, "audio", "G726-32", AST_RTP_OPT_G726_NONSTANDARD);
 	}
 
 	them.sin_family = AF_INET;
@@ -1977,7 +1977,7 @@
 	/* Change native format to reflect information taken from OLC/OLCAck */
 	nativeformats_changed = 0;
 	if (pt != 128 && pvt->rtp) {	/* Payload type is invalid, so try to use previously decided */
-		struct ast_rtp_payload_type rtptype = ast_rtp_codecs_payload_lookup(&pvt->rtp->codecs, pt);
+		struct ast_rtp_payload_type rtptype = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(pvt->rtp), pt);
 		if (h323debug)
 			ast_debug(1, "Native format is set to %d from %d by RTP payload type %d\n", rtptype.code, pvt->nativeformats, pt);
 		if (pvt->nativeformats != rtptype.code) {
@@ -2420,7 +2420,7 @@
 		return;
 	}
 	if (pvt->rtp) {
-		ast_rtp_codecs_payloads_set_rtpmap_type(&pvt->rtp->codecs, pvt->rtp, payload, "audio", (is_cisco ? "cisco-telephone-event" : "telephone-event"), 0);
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, payload, "audio", (is_cisco ? "cisco-telephone-event" : "telephone-event"), 0);
 	}
 	pvt->dtmf_pt[is_cisco ? 1 : 0] = payload;
 	ast_mutex_unlock(&pvt->lock);
@@ -2451,7 +2451,7 @@
 			}
 		}
 		if (pvt->rtp)
-			ast_rtp_codecs_packetization_set(&pvt->rtp->codecs, pvt->rtp, &pvt->peer_prefs);
+			ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);
 	}
 	ast_mutex_unlock(&pvt->lock);
 }
@@ -3177,8 +3177,8 @@
 		ast_log(LOG_ERROR, "No Private Structure, this is bad\n");
 		return -1;
 	}
-	memcpy(&them, &rtp->remote_address, sizeof(them));
-	memcpy(&us, &rtp->local_address, sizeof(us));
+	ast_rtp_instance_get_remote_address(rtp, &them);
+	ast_rtp_instance_get_local_address(rtp, &us);
 #if 0	/* Native bridge still isn't ready */
 	h323_native_bridge(pvt->cd.call_token, ast_inet_ntoa(them.sin_addr), mode);
 #endif

Modified: team/file/rtp_engine-mark2/channels/chan_jingle.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_jingle.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_jingle.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_jingle.c Tue Mar 31 19:31:38 2009
@@ -614,7 +614,7 @@
 		goto safeout;
 	}
 
-	memcpy(&sin, &p->rtp->local_address, sizeof(sin));
+	ast_rtp_instance_get_local_address(p->rtp, &sin);
 	ast_find_ourip(&us, bindaddr);
 
 	/* Setup our first jingle candidate */
@@ -818,7 +818,7 @@
 
 	/* Set Frame packetization */
 	if (i->rtp)
-		ast_rtp_codecs_packetization_set(&i->rtp->codecs, i->rtp, &i->prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(i->rtp), i->rtp, &i->prefs);
 
 	tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | (i->jointcapability & AST_FORMAT_VIDEO_MASK);
 	fmt = ast_best_codec(tmp->nativeformats);
@@ -1002,8 +1002,8 @@
 		        ast_copy_string(p->audio_content_name, iks_find_attrib(content, "name"), sizeof(p->audio_content_name));
 
 			while (codec) {
-				ast_rtp_codecs_payloads_set_m_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")));
-				ast_rtp_codecs_payloads_set_rtpmap_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+				ast_rtp_codecs_payloads_set_m_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")));
+				ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
 				codec = iks_next(codec);
 			}
 		}
@@ -1018,8 +1018,8 @@
 		        ast_copy_string(p->video_content_name, iks_find_attrib(content, "name"), sizeof(p->video_content_name));
 
 			while (codec) {
-				ast_rtp_codecs_payloads_set_m_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")));
-				ast_rtp_codecs_payloads_set_rtpmap_type(&p->rtp->codecs, p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+				ast_rtp_codecs_payloads_set_m_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")));
+				ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
 				codec = iks_next(codec);
 			}
 		}

Modified: team/file/rtp_engine-mark2/channels/chan_mgcp.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_mgcp.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_mgcp.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_mgcp.c Tue Mar 31 19:31:38 2009
@@ -1879,7 +1879,7 @@
 	printf("Peer RTP is at port %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
 #endif	
 	/* Scan through the RTP payload types specified in a "m=" line: */
-	ast_rtp_codecs_payloads_clear(&sub->rtp->codecs, sub->rtp);
+	ast_rtp_codecs_payloads_clear(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp);
 	codecs = ast_strdupa(m + len);
 	while (!ast_strlen_zero(codecs)) {
 		if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
@@ -1888,7 +1888,7 @@
 			ast_log(LOG_WARNING, "Error in codec string '%s' at '%s'\n", m, codecs);
 			return -1;
 		}
-		ast_rtp_codecs_payloads_set_m_type(&sub->rtp->codecs, sub->rtp, codec);
+		ast_rtp_codecs_payloads_set_m_type(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp, codec);
 		codec_count++;
 		codecs += len;
 	}
@@ -1901,11 +1901,11 @@
 		if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
 			continue;
 		/* Note: should really look at the 'freq' and '#chans' params too */
-		ast_rtp_codecs_payloads_set_rtpmap_type(&sub->rtp->codecs, sub->rtp, codec, "audio", mimeSubtype, 0);
+		ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp, codec, "audio", mimeSubtype, 0);
 	}
 
 	/* Now gather all of the codecs that were asked for: */
-	ast_rtp_codecs_payload_formats(&sub->rtp->codecs, &peercapability, &peerNonCodecCapability);
+	ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), &peercapability, &peerNonCodecCapability);
 	p->capability = capability & peercapability;
 	if (mgcpdebug) {
 		ast_verbose("Capabilities: us - %d, them - %d, combined - %d\n",
@@ -2066,9 +2066,9 @@
 		ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n");
 		return -1;
 	}
-	memcpy(&sin, &sub->rtp->local_address, sizeof(sin));
+	ast_rtp_instance_get_local_address(sub->rtp, &sin);
 	if (rtp) {
-		memcpy(&dest, &sub->rtp->remote_address, sizeof(dest));
+		ast_rtp_instance_get_remote_address(sub->rtp, &dest);
 	} else {
 		if (sub->tmpdest.sin_addr.s_addr) {
 			dest.sin_addr = sub->tmpdest.sin_addr;
@@ -2094,7 +2094,7 @@
 			if (mgcpdebug) {
 				ast_verbose("Answering with capability %d\n", x);
 			}
-			codec = ast_rtp_codecs_payload_code(&sub->rtp->codecs, 1, x);
+			codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, x);
 			if (codec > -1) {
 				snprintf(costr, sizeof(costr), " %d", codec);
 				strncat(m, costr, sizeof(m) - strlen(m) - 1);
@@ -2108,7 +2108,7 @@
 			if (mgcpdebug) {
 				ast_verbose("Answering with non-codec capability %d\n", x);
 			}
-			codec = ast_rtp_codecs_payload_code(&sub->rtp->codecs, 0, x);
+			codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 0, x);
 			if (codec > -1) {
 				snprintf(costr, sizeof(costr), " %d", codec);
 				strncat(m, costr, sizeof(m) - strlen(m) - 1);
@@ -2147,7 +2147,7 @@
 	if (ast_strlen_zero(sub->cxident) && rtp) {
 		/* We don't have a CXident yet, store the destination and
 		   wait a bit */
-		memcpy(&sub->tmpdest, &rtp->remote_address, sizeof(sub->tmpdest));
+		ast_rtp_instance_get_remote_address(rtp, &sub->tmpdest);
 		return 0;
 	}
 	ast_copy_string(local, "p:20", sizeof(local));

Modified: team/file/rtp_engine-mark2/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_sip.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_sip.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_sip.c Tue Mar 31 19:31:38 2009
@@ -4702,9 +4702,8 @@
 		if (!(dialog->vrtp = ast_rtp_instance_new(dialog->engine, sched, &bindaddr, NULL))) {
 			return -1;
 		}
-		dialog->vrtp->timeout = global_rtptimeout;
-		dialog->vrtp->holdtimeout = global_rtpholdtimeout;
-		dialog->vrtp->keepalive = global_rtpkeepalive;
+		ast_rtp_instance_set_timeout(dialog->vrtp, global_rtptimeout);
+		ast_rtp_instance_set_hold_timeout(dialog->vrtp, global_rtpholdtimeout);
 
 		ast_rtp_instance_set_prop(dialog->vrtp, AST_RTP_PROPERTY_RTCP, 1);
 	}
@@ -4713,16 +4712,14 @@
 		if (!(dialog->trtp = ast_rtp_instance_new(dialog->engine, sched, &bindaddr, NULL))) {
 			return -1;
 		}
-		dialog->trtp->timeout = global_rtptimeout;
-		dialog->trtp->holdtimeout = global_rtpholdtimeout;
-		dialog->trtp->keepalive = global_rtpkeepalive;
+		ast_rtp_instance_set_timeout(dialog->trtp, global_rtptimeout);
+		ast_rtp_instance_set_hold_timeout(dialog->trtp, global_rtpholdtimeout);
 
 		ast_rtp_instance_set_prop(dialog->trtp, AST_RTP_PROPERTY_RTCP, 1);
 	}
 
-	dialog->rtp->timeout = global_rtptimeout;
-	dialog->rtp->holdtimeout = global_rtpholdtimeout;
-	dialog->rtp->keepalive = global_rtpkeepalive;
+	ast_rtp_instance_set_timeout(dialog->rtp, global_rtptimeout);
+	ast_rtp_instance_set_hold_timeout(dialog->rtp, global_rtpholdtimeout);
 
 	ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_RTCP, 1);
 	ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
@@ -4784,22 +4781,19 @@
 	if (dialog->rtp) { /* Audio */
 		ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 		ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
-		dialog->rtp->timeout = peer->rtptimeout;
-		dialog->rtp->holdtimeout = peer->rtpholdtimeout;
-		dialog->rtp->keepalive = peer->rtpkeepalive;
+		ast_rtp_instance_set_timeout(dialog->rtp, peer->rtptimeout);
+		ast_rtp_instance_set_hold_timeout(dialog->rtp, peer->rtpholdtimeout);
 		/* Set Frame packetization */
-		ast_rtp_codecs_packetization_set(&dialog->rtp->codecs, dialog->rtp, &dialog->prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(dialog->rtp), dialog->rtp, &dialog->prefs);
 		dialog->autoframing = peer->autoframing;
 	}
 	if (dialog->vrtp) { /* Video */
-                dialog->vrtp->timeout = peer->rtptimeout;
-		dialog->vrtp->holdtimeout = peer->rtpholdtimeout;
-		dialog->vrtp->keepalive = peer->rtpkeepalive;
+		ast_rtp_instance_set_timeout(dialog->vrtp, peer->rtptimeout);
+		ast_rtp_instance_set_hold_timeout(dialog->vrtp, peer->rtpholdtimeout);
 	}
 	if (dialog->trtp) { /* Realtime text */
-		dialog->trtp->timeout = peer->rtptimeout;
-		dialog->trtp->holdtimeout = peer->rtpholdtimeout;
-		dialog->trtp->keepalive = peer->rtpkeepalive;
+		ast_rtp_instance_set_timeout(dialog->trtp, peer->rtptimeout);
+		ast_rtp_instance_set_hold_timeout(dialog->trtp, peer->rtpholdtimeout);
 	}
 
 	ast_string_field_set(dialog, peername, peer->name);
@@ -5985,7 +5979,7 @@
 	sip_pvt_lock(p);
 	switch (ast_test_flag(&p->flags[0], SIP_DTMF)) {
 	case SIP_DTMF_INBAND:
-		if (p->rtp && p->rtp->dtmf_mode == AST_RTP_DTMF_MODE_INBAND) {
+		if (p->rtp && ast_rtp_instance_dtmf_mode_get(p->rtp) == AST_RTP_DTMF_MODE_INBAND) {
 			ast_rtp_instance_dtmf_begin(p->rtp, digit);
 		} else {
 			res = -1; /* Tell Asterisk to generate inband indications */
@@ -6021,7 +6015,7 @@
 			ast_rtp_instance_dtmf_end(p->rtp, digit);
 		break;
 	case SIP_DTMF_INBAND:
-		if (p->rtp && p->rtp->dtmf_mode == AST_RTP_DTMF_MODE_INBAND) {
+		if (p->rtp && ast_rtp_instance_dtmf_mode_get(p->rtp) == AST_RTP_DTMF_MODE_INBAND) {
 			ast_rtp_instance_dtmf_end(p->rtp, digit);
 		} else {
 			res = -1; /* Tell Asterisk to stop inband indications */
@@ -7659,8 +7653,10 @@
 		if (udptlportno > 0) {
 			sin.sin_port = htons(udptlportno);
 			if (ast_test_flag(&p->flags[0], SIP_NAT) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
-				if (p->rtp->remote_address.sin_addr.s_addr) {
-					memcpy(&sin.sin_addr, &p->rtp->remote_address.sin_addr, sizeof(&sin.sin_addr));
+				struct sockaddr_in remote_address;
+				ast_rtp_instance_get_remote_address(p->rtp, &remote_address);
+				if (remote_address.sin_addr.s_addr) {
+					memcpy(&sin, &remote_address, sizeof(sin));
 					if (debug) {
 						ast_log(LOG_DEBUG, "Peer T.38 UDPTL is set behind NAT and with destination, destination address now %s\n", ast_inet_ntoa(sin.sin_addr));
 					}
@@ -7771,17 +7767,17 @@
 				}
 			}
 			if (framing && p->autoframing) {
-				struct ast_codec_pref *pref = &p->rtp->codecs.pref;
+				struct ast_codec_pref *pref = &ast_rtp_instance_get_codecs(p->rtp)->pref;
 				int codec_n;
 				for (codec_n = 0; codec_n < AST_RTP_MAX_PT; codec_n++) {
-					struct ast_rtp_payload_type format = ast_rtp_codecs_payload_lookup(&p->rtp->codecs, codec_n);
+					struct ast_rtp_payload_type format = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(p->rtp), codec_n);
 					if (!format.asterisk_format || !format.code)	/* non-codec or not found */
 						continue;
 					if (option_debug)
 						ast_log(LOG_DEBUG, "Setting framing for %d to %ld\n", format.code, framing);
 					ast_codec_pref_setsize(pref, format.code, framing);
 				}
-				ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, pref);
+				ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, pref);
 			}
 			continue;
 		}
@@ -8075,12 +8071,12 @@
 		p->red = 0;
 	}
 
-	ast_rtp_codecs_payloads_copy(&newaudiortp, &p->rtp->codecs, p->rtp);
+	ast_rtp_codecs_payloads_copy(&newaudiortp, ast_rtp_instance_get_codecs(p->rtp), p->rtp);
 	if (p->vrtp) {
-		ast_rtp_codecs_payloads_copy(&newvideortp, &p->vrtp->codecs, p->vrtp);
+		ast_rtp_codecs_payloads_copy(&newvideortp, ast_rtp_instance_get_codecs(p->vrtp), p->vrtp);
 	}
 	if (p->trtp) {
-		ast_rtp_codecs_payloads_copy(&newtextrtp, &p->trtp->codecs, p->trtp);
+		ast_rtp_codecs_payloads_copy(&newtextrtp, ast_rtp_instance_get_codecs(p->trtp), p->trtp);
 	}
 
 	if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO) {
@@ -8996,11 +8992,11 @@
 
 	if (debug)
 		ast_verbose("Adding codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
-	if ((rtp_code = ast_rtp_codecs_payload_code(&p->rtp->codecs, 1, codec)) == -1)
+	if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 1, codec)) == -1)
 		return;
 
 	if (p->rtp) {
-		struct ast_codec_pref *pref = &p->rtp->codecs.pref;
+		struct ast_codec_pref *pref = &ast_rtp_instance_get_codecs(p->rtp)->pref;
 		fmt = ast_codec_pref_getsize(pref, codec);
 	} else /* I dont see how you couldn't have p->rtp, but good to check for and error out if not there like earlier code */
 		return;
@@ -9055,7 +9051,7 @@
 	if (debug)
 		ast_verbose("Adding video codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
 
-	if ((rtp_code = ast_rtp_codecs_payload_code(&p->vrtp->codecs, 1, codec)) == -1)
+	if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->vrtp), 1, codec)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -9078,7 +9074,7 @@
 	if (debug)
 		ast_verbose("Adding text codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
 
-	if ((rtp_code = ast_rtp_codecs_payload_code(&p->trtp->codecs, 1, codec)) == -1)
+	if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->trtp), 1, codec)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -9088,7 +9084,7 @@
 	/* Add fmtp code here */
 
 	if (codec == AST_FORMAT_T140RED) {
-		int t140code = ast_rtp_codecs_payload_code(&p->trtp->codecs, 1, AST_FORMAT_T140);
+		int t140code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->trtp), 1, AST_FORMAT_T140);
 		ast_str_append(a_buf, 0, "a=fmtp:%d %d/%d/%d\r\n", rtp_code, 
 			 t140code,
 			 t140code,
@@ -9136,7 +9132,7 @@
 
 	if (debug)
 		ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", format, ast_rtp_lookup_mime_subtype2(0, format, 0));
-	if ((rtp_code = ast_rtp_codecs_payload_code(&p->rtp->codecs, 0, format)) == -1)
+	if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 0, format)) == -1)
 		return;
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -9155,11 +9151,11 @@
 	struct sockaddr_in *dest, struct sockaddr_in *vdest)
 {
 	/* First, get our address */
-	memcpy(sin, &p->rtp->local_address, sizeof(*sin));
+	ast_rtp_instance_get_local_address(p->rtp, sin);
 	if (p->vrtp)
-		memcpy(vsin, &p->vrtp->local_address, sizeof(*vsin));
+		ast_rtp_instance_get_local_address(p->vrtp, vsin);
 	if (p->trtp)
-		memcpy(tsin, &p->trtp->local_address, sizeof(*tsin));
+		ast_rtp_instance_get_local_address(p->trtp, tsin);
 
 	/* Now, try to figure out where we want them to send data */
 	/* Is this a re-invite to move the media out, then use the original offer from caller  */
@@ -9590,7 +9586,7 @@
 	if (p->rtp) {
 		if (!p->autoframing && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 			ast_debug(1, "Setting framing from config on incoming call\n");
-			ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &p->prefs);
+			ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
 		}
 		try_suggested_sip_codec(p);
 		if (p->t38.state == T38_PEER_DIRECT || p->t38.state == T38_ENABLED) {
@@ -12915,7 +12911,7 @@
 	/* XXX what about p->prefs = peer->prefs; ? */
 	/* Set Frame packetization */
 	if (p->rtp) {
-		ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &peer->prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &peer->prefs);
 		p->autoframing = peer->autoframing;
 	}
 
@@ -13014,7 +13010,7 @@
 		if (p->t38.peercapability)
 			p->t38.jointcapability &= p->t38.peercapability;
 		if (!dialog_initialize_rtp(p)) {
-			ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &peer->prefs);
+			ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &peer->prefs);
 			p->autoframing = peer->autoframing;
 		} else {
 			res = AUTH_RTP_FAILED;
@@ -13943,13 +13939,13 @@
 	}
 
 	/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
-	if (dialog->rtp && dialog->rtp->bridged) {
+	if (dialog->rtp && ast_rtp_instance_get_bridged(dialog->rtp)) {
 		ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 		sip_pvt_unlock(dialog);
 		return 0;
 	}
 
-	if (dialog->vrtp && dialog->vrtp->bridged) {
+	if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) {
 		ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 		sip_pvt_unlock(dialog);
 		return 0;
@@ -13963,13 +13959,13 @@
 	   - if that's the case, wait with destruction */
 	if (dialog->needdestroy && !dialog->packets && !dialog->owner) {
 		/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
-		if (dialog->rtp && dialog->rtp->bridged) {
+		if (dialog->rtp && ast_rtp_instance_get_bridged(dialog->rtp)) {
 			ast_debug(2, "Bridge still active.  Delaying destruction of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 			sip_pvt_unlock(dialog);
 			return 0;
 		}
 		
-		if (dialog->vrtp && dialog->vrtp->bridged) {
+		if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) {
 			ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
 			sip_pvt_unlock(dialog);
 			return 0;
@@ -19784,11 +19780,11 @@
 			args.type = "audio";
 
 		if (!strcasecmp(args.type, "audio"))
-			memcpy(&sin, &p->rtp->remote_address, sizeof(sin));
+			ast_rtp_instance_get_remote_address(p->rtp, &sin);
 		else if (!strcasecmp(args.type, "video"))
-			memcpy(&sin, &p->vrtp->remote_address, sizeof(sin));
+			ast_rtp_instance_get_remote_address(p->vrtp, &sin);
 		else if (!strcasecmp(args.type, "text"))
-			memcpy(&sin, &p->trtp->remote_address, sizeof(sin));
+			ast_rtp_instance_get_remote_address(p->trtp, &sin);
 		else
 			return -1;
 
@@ -21110,7 +21106,7 @@
 		return;
 
 	/* If we have no timers set, return now */
-	if (!dialog->rtp->keepalive && !dialog->rtp->timeout && !dialog->rtp->holdtimeout) {
+	if (!ast_rtp_instance_get_timeout(dialog->rtp) && !ast_rtp_instance_get_hold_timeout(dialog->rtp)) {
 		return;
 	}
 
@@ -21121,32 +21117,32 @@
 	*/
 
 	/* Check AUDIO RTP timers */
-	if (dialog->lastrtprx && (dialog->rtp->timeout || dialog->rtp->holdtimeout) && (t > dialog->lastrtprx + dialog->rtp->timeout)) {
-	  if (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_CALL_ONHOLD) || (dialog->rtp->holdtimeout && (t > dialog->lastrtprx + dialog->rtp->holdtimeout))) {
-	    /* Needs a hangup */
-	    if (dialog->rtp->timeout) {
-	      while (dialog->owner && ast_channel_trylock(dialog->owner)) {
-		sip_pvt_unlock(dialog);
-		usleep(1);
-		sip_pvt_lock(dialog);
-	      }
-	      ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
-		      dialog->owner->name, (long) (t - dialog->lastrtprx));
-	      /* Issue a softhangup */
-	      ast_softhangup_nolock(dialog->owner, AST_SOFTHANGUP_DEV);
-	      ast_channel_unlock(dialog->owner);
-	      /* forget the timeouts for this call, since a hangup
-		 has already been requested and we don't want to
-		 repeatedly request hangups
-	      */
-	      dialog->rtp->timeout = 0;
-	      dialog->rtp->holdtimeout = 0;
-	      if (dialog->vrtp) {
-		dialog->vrtp->timeout = 0;
-		dialog->vrtp->holdtimeout = 0;
-	      }
-	    }
-	  }
+	if (dialog->lastrtprx && (ast_rtp_instance_get_timeout(dialog->rtp) || ast_rtp_instance_get_hold_timeout(dialog->rtp)) && (t > dialog->lastrtprx + ast_rtp_instance_get_timeout(dialog->rtp))) {
+		if (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_CALL_ONHOLD) || (ast_rtp_instance_get_hold_timeout(dialog->rtp) && (t > dialog->lastrtprx + ast_rtp_instance_get_hold_timeout(dialog->rtp)))) {
+			/* Needs a hangup */
+			if (ast_rtp_instance_get_timeout(dialog->rtp)) {
+				while (dialog->owner && ast_channel_trylock(dialog->owner)) {
+					sip_pvt_unlock(dialog);
+					usleep(1);
+					sip_pvt_lock(dialog);
+				}
+				ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
+					dialog->owner->name, (long) (t - dialog->lastrtprx));
+				/* Issue a softhangup */
+				ast_softhangup_nolock(dialog->owner, AST_SOFTHANGUP_DEV);
+				ast_channel_unlock(dialog->owner);
+				/* forget the timeouts for this call, since a hangup
+				   has already been requested and we don't want to
+				   repeatedly request hangups
+				*/
+				ast_rtp_instance_set_timeout(dialog->rtp, 0);
+				ast_rtp_instance_set_hold_timeout(dialog->rtp, 0);
+				if (dialog->vrtp) {
+					ast_rtp_instance_set_timeout(dialog->vrtp, 0);
+					ast_rtp_instance_set_hold_timeout(dialog->vrtp, 0);
+				}
+			}
+		}
 	}
 }
 

Modified: team/file/rtp_engine-mark2/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_skinny.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_skinny.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_skinny.c Tue Mar 31 19:31:38 2009
@@ -2632,7 +2632,7 @@
 	s = d->session;
 
 	if (rtp){
-		memcpy(&them, &rtp->remote_address, sizeof(them));
+		ast_rtp_instance_get_remote_address(rtp, &them);
 
 		/* Shutdown any early-media or previous media on re-invite */
 		if (!(req = req_alloc(sizeof(struct stop_media_transmission_message), STOP_MEDIA_TRANSMISSION_MESSAGE)))
@@ -2656,7 +2656,7 @@
 		req->data.startmedia.conferenceId = htolel(sub->callid);
 		req->data.startmedia.passThruPartyId = htolel(sub->callid);
 		if (!(l->canreinvite) || (l->nat)){
-			memcpy(&us, &rtp->local_address, sizeof(us));
+			ast_rtp_instance_get_local_address(rtp, &us);
 			req->data.startmedia.remoteIp = htolel(d->ourip.s_addr);
 			req->data.startmedia.remotePort = htolel(ntohs(us.sin_port));
 		} else {
@@ -3590,7 +3590,7 @@
 	}
 	/* Set Frame packetization */
 	if (sub->rtp)
-		ast_rtp_codecs_packetization_set(&sub->rtp->codecs, sub->rtp, &l->prefs);
+		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp, &l->prefs);
 
 	/* Create the RTP connection */
 	transmit_connect(d, sub);
@@ -5547,7 +5547,7 @@
 
 	if (sub->rtp) {
 		ast_rtp_instance_set_remote_address(sub->rtp, &sin);
-		memcpy(&us, &sub->rtp->local_address, sizeof(us));
+		ast_rtp_instance_get_local_address(sub->rtp, &us);
 	} else {
 		ast_log(LOG_ERROR, "No RTP structure, this is very bad\n");
 		return 0;

Modified: team/file/rtp_engine-mark2/channels/chan_unistim.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_unistim.c?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_unistim.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_unistim.c Tue Mar 31 19:31:38 2009
@@ -2072,7 +2072,7 @@
 	ast_rtp_instance_set_prop(sub->rtp, AST_RTP_PROPERTY_NAT, sub->parent->parent->nat);
 
 	/* Create the RTP connection */
-	memcpy(&us, &sub->rtp->local_address, sizeof(us));
+	ast_rtp_instance_get_local_address(sub->rtp, &us);
 	sin.sin_family = AF_INET;
 	/* Setting up RTP for our side */
 	memcpy(&sin.sin_addr, &sub->parent->parent->session->sin.sin_addr,
@@ -2090,7 +2090,7 @@
 		sub->owner->readformat = fmt;
 		sub->owner->writeformat = fmt;
 	}
-	codec = ast_rtp_codecs_payload_code(&sub->rtp->codecs, 1, sub->owner->readformat);
+	codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, sub->owner->readformat);
 	/* Setting up RTP of the phone */
 	if (public_ip.sin_family == 0)  /* NAT IP override ?   */
 		memcpy(&public, &us, sizeof(public));   /* No defined, using IP from recvmsg  */

Modified: team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h?view=diff&rev=185703&r1=185702&r2=185703
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h Tue Mar 31 19:31:38 2009
@@ -364,30 +364,7 @@
 };
 
 /*! Structure that represents an RTP session (instance) */
-struct ast_rtp_instance {
-	/*! Engine that is handling this RTP instance */
-	struct ast_rtp_engine *engine;
-	/*! Data unique to the RTP engine */
-	void *data;
-	/*! RTP properties that have been set and their value */
-	int properties[AST_RTP_PROPERTY_MAX];
-	/*! Address that we are expecting RTP to come in to */
-	struct sockaddr_in local_address;
-	/*! Address that we are sending RTP to */
-	struct sockaddr_in remote_address;
-	/*! Instance that we are bridged to if doing remote or local bridging */
-	struct ast_rtp_instance *bridged;
-	/*! Payload and packetization information */
-	struct ast_rtp_codecs codecs;
-	/*! RTP timeout time (negative or zero means disabled, negative value means temporarily disabled) */
-	int timeout;
-	/*! RTP timeout when on hold (negative or zero means disabled, negative value means temporarily disabled). */
-	int holdtimeout;
-	/*! Send RTP comfort noice packets for keepalive */
-	int keepalive;
-	/*! DTMF mode in use */
-	enum ast_rtp_dtmf_mode dtmf_mode;
-};
+struct ast_rtp_instance;
 
 /*! Structure that represents the glue that binds an RTP instance to a channel */
 struct ast_rtp_glue {
@@ -552,6 +529,38 @@
 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
 
 /*!
+ * \brief Set the data portion of an RTP instance
+ *
+ * \param instance The RTP instance to manipulate
+ * \param data Pointer to data
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_rtp_instance_set_data(instance, blob);
+ * \endcode
+ *
+ * This sets the data pointer on the RTP instance pointed to by 'instance' to
+ * blob.
+ */
+void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data);
+
+/*!
+ * \brief Get the data portion of an RTP instance
+ *
+ * \param instance The RTP instance we want the data portion from
+ *
+ * Example usage:
+ *
+ * \code
+ * struct *blob = ast_rtp_instance_get_data(instance);
+ ( \endcode
+ *
+ * This gets the data pointer on the RTP instance pointed to by 'instance'.
+ */
+void *ast_rtp_instance_get_data(struct ast_rtp_instance *instance);
+
+/*!
  * \brief Send a frame out over RTP
  *
  * \param instance The RTP instance to send frame out on
@@ -609,6 +618,46 @@
  * structure.
  */
 int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
+
+/*!
+ * \brief Set the address that we are expecting to receive RTP on
+ *
+ * \param instance The RTP instance to change the address on
+ * \param address Address to set it to
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_rtp_instance_set_local_address(instance, &sin);
+ * \endcode
+ *
+ * This changes the local address that RTP is expected on to the address given in the sin
+ * structure.
+ */
+int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
+
+/*!
+ * \brief Get the local address that we are expecting RTP on
+ *
+ * \param instance The RTP instance to get the address from
+ * \param address The variable to store the address in
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct sockaddr_in sin;
+ * ast_rtp_instance_get_local_address(instance, &sin);
+ * \endcode
+ *
+ * This gets the local address that we are expecting RTP on and stores it in the 'sin' structure.
+ */
+int ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
 
 /*!
  * \brief Get the address of the remote endpoint that we are sending RTP to
@@ -666,6 +715,39 @@
  * This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
  */
 void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
+
+/*!
+ * \brief Get the value of an RTP instance property
+ *
+ * \param instance The RTP instance to get the property from
+ * \param property The property to get
+ *
+ * \retval Current value of the property
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT);
+ * \endcode
+ *
+ * This returns the current value of the NAT property on the instance pointed to by instance.
+ */
+int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property);
+
+/*!
+ * \brief Get the codecs structure of an RTP instance
+ *
+ * \param instance The RTP instance to get the codecs structure from
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_rtp_codecs *codecs = ast_rtp_instance_get_codecs(instance);
+ * \endcode
+ *
+ * This gets the codecs structure on the RTP instance pointed to by 'instance'.
+ */
+struct ast_rtp_codecs *ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance);
 
 /*!
  * \brief Clear payload information from an RTP instance
@@ -984,6 +1066,23 @@
 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
 
 /*!
+ * \brief Get the DTMF mode of an RTP instance
+ *
+ * \param instance The RTP instance to get the DTMF mode of
+ *
+ * \retval DTMF mode
+ *
+ * Example usage:
+ *
+ * \code

[... 916 lines stripped ...]



More information about the asterisk-commits mailing list