[asterisk-commits] oej: branch oej/midcomstuff r48314 - in /team/oej/midcomstuff: ./ channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Dec 6 02:10:19 MST 2006


Author: oej
Date: Wed Dec  6 03:10:19 2006
New Revision: 48314

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48314
Log:
- Add README
- Fixes for compilation, something that most people want to do

Added:
    team/oej/midcomstuff/README.MIDCOM   (with props)
Modified:
    team/oej/midcomstuff/channels/chan_sip.c

Added: team/oej/midcomstuff/README.MIDCOM
URL: http://svn.digium.com/view/asterisk/team/oej/midcomstuff/README.MIDCOM?view=auto&rev=48314
==============================================================================
--- team/oej/midcomstuff/README.MIDCOM (added)
+++ team/oej/midcomstuff/README.MIDCOM Wed Dec  6 03:10:19 2006
@@ -1,0 +1,7 @@
+This is the Asterisk 1.4 distribution with MIDCOM support.
+You need a version of the Ranch Networks MIDCOM library
+and res_netsec module to compile this.
+
+The MIDCOM implementation use the SIMCO protocol to remotely
+control a Firewall with built-in RTP proxy modules when a
+SIP call is set up.

Propchange: team/oej/midcomstuff/README.MIDCOM
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/oej/midcomstuff/README.MIDCOM
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/oej/midcomstuff/README.MIDCOM
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/oej/midcomstuff/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/midcomstuff/channels/chan_sip.c?view=diff&rev=48314&r1=48313&r2=48314
==============================================================================
--- team/oej/midcomstuff/channels/chan_sip.c (original)
+++ team/oej/midcomstuff/channels/chan_sip.c Wed Dec  6 03:10:19 2006
@@ -1,4 +1,5 @@
-#define SIP_MIDCOM
+#define SIP_MIDCOM	/* During development, set by default in this distribution */
+			/* Needs to be set with configure */
 /*
  * Asterisk -- An open source telephony toolkit.
  *
@@ -1006,7 +1007,7 @@
 	struct sip_invite_param *options;	/*!< Options for INVITE */
 	int autoframing;
 #ifdef SIP_MIDCOM
-	void *r;				/*!< ???? */
+	void *rule;				/*!< struct midcom_rule in midcom_handle_request_invite_hook */
 #endif
 } *iflist = NULL;
 
@@ -1603,9 +1604,17 @@
 	get_codec: sip_get_codec,
 };
 
+/*! \brief Interface structure with callbacks used to connect to UDPTL module*/
+static struct ast_udptl_protocol sip_udptl = {
+	type: "SIP",
+	get_udptl_info: sip_get_udptl_peer,
+	set_udptl_peer: sip_set_udptl_peer,
+};
+
+
 #ifdef SIP_MIDCOM
-/*! \brief  sip_helper: Interface structure with callbacks used to connect to midcom module --*/
-static struct ast_sip_helper_cb sip_helper = {
+/*! \brief  Interface structure with callbacks used to connect to midcom module */
+static struct ast_rtp_helper_cb sip_helper = {
 	ast_rtp_get_peer_audio_helper: sip_rtp_get_peer_audio_helper,
 	ast_rtp_get_peer_video_helper: sip_rtp_get_peer_video_helper,
 	ast_rtp_get_us_audio_helper: sip_rtp_get_us_audio_helper,
@@ -1621,16 +1630,13 @@
 	ast_get_capability_helper: sip_get_capability_helper,
 	ast_softhangup_helper: sip_softhangup_helper,
 };
-#endif
-
-/*! \brief Interface structure with callbacks used to connect to UDPTL module*/
-static struct ast_udptl_protocol sip_udptl = {
-	type: "SIP",
-	get_udptl_info: sip_get_udptl_peer,
-	set_udptl_peer: sip_set_udptl_peer,
-};
-
-#ifdef SIP_MIDCOM /* All these functions needs documentation */
+
+/*! All of these functions needs documentation 
+	Also, one SIP call can have multiple RTP streams, for audio, video, text.
+	Should this interface really care about the content of the RTP stream?
+	or is that an attribute? Do we need audio_helper, video_helper etc?
+	
+*/
 static void sip_rtp_get_peer_audio_helper(void *p, struct sockaddr_in *them)
 {
 	ast_rtp_get_peer(((struct sip_pvt*)p)->rtp, them);
@@ -1653,16 +1659,23 @@
 	vsin->sin_addr = ((struct sip_pvt*)p)->ourip;
 }
 
+/*! Assign a MIDCOM ruleset to a SIP dialog (pvt) */
 static void sip_map_hook_struct(void *p, void *r)
 {
-	((struct sip_pvt*)p)->r = r;
-}
-
+	((struct sip_pvt*)p)->rule = r;
+}
+
+/*! Get a MIDCOM ruleset from a PVT */
 static void *sip_get_hook_struct(void *p)
 {
-	return ((struct sip_pvt*)p)->r;
-}
-
+	return ((struct sip_pvt*)p)->rule;
+}
+
+/*! Get the video status 
+	\note This could be made to a generic function outside of the MIDCOM stuff 
+	Also note, that even if we have the video flag enabled, there might NOT 
+	be video in this call. If that's the question, there need to be more checks.
+*/
 static int sip_get_flag_novideo(void *p)
 {
 	struct sip_pvt *dialog = (struct sip_pvt *) p;
@@ -1679,21 +1692,28 @@
 	memcpy(addr, &((struct sip_pvt *)p)->recv.sin_addr, sizeof(struct in_addr));
 }
 
+/*! \brief Get the SIP username for a given dialog */
 static char *sip_get_username(void *p)
 {
 	return (char *) ((struct sip_pvt*)p)->username;
 }
 
+/*! \brief Get the owner (AST channel) of a SIP dialog */
 static struct ast_channel *sip_channel_helper(void *p)
 {
 	return ((struct sip_pvt*)p)->owner;
 }
 
+/*! \brief Get the bridged channel.
+	\note XXX OEJ: I don't understand... Why can't res_netsec just call
+		ast_bridged_channel? */
 static struct ast_channel *sip_bridged_channel_helper(void *p)
 {
 	return ast_bridged_channel(((struct sip_pvt*)p)->owner);
 }
 
+/*! \brief Get capabilities for a call, after setup. This possibly
+	needs to be done for video too */
 static int sip_get_capability_helper(void *p)
 {
 	struct sip_pvt *dialog = (struct sip_pvt *) p;
@@ -6244,10 +6264,10 @@
 	/* Is this a re-invite to move the media out, then use the original offer from caller  */
 	if (p->redirip.sin_addr.s_addr) {
 #ifdef SIP_MIDCOM
-		if (midcom_cb && p->r) {
+		if (midcom_cb && p->rule) {
 			struct sockaddr_in redirip_hook;
 
-			midcom_cb->ast_get_redirip_audio_hook(p->r, &redirip_hook);
+			midcom_cb->ast_get_redirip_audio_hook(p->rule, &redirip_hook);
 			if (option_debug)
 				ast_log(LOG_DEBUG, "MIDCOM: Replacing %s:%d by %s:%d in SDP before sending to %s\n", ast_inet_ntoa(p->redirip.sin_addr), ntohs(p->redirip.sin_port), ast_inet_ntoa(redirip_hook.sin_addr), ntohs(redirip_hook.sin_port), p->username);
 			dest.sin_port = redirip_hook.sin_port;
@@ -6298,10 +6318,10 @@
 		/* Determine video destination */
 		if (p->vredirip.sin_addr.s_addr) {
 #ifdef SIP_MIDCOM
-			if (midcom_cb && p->r) {
+			if (midcom_cb && p->rule) {
 				struct sockaddr_in vredirip_hook;
 
-				midcom_cb->ast_get_vredirip_video_hook(p->r, &vredirip_hook);
+				midcom_cb->ast_get_vredirip_video_hook(p->rule, &vredirip_hook);
 				if (option_debug)
 					ast_log(LOG_DEBUG, "Replacing %s:%d by %s:%d in video SDP before sending to %s\n", ast_inet_ntoa(p->vredirip.sin_addr), ntohs(p->vredirip.sin_port), ast_inet_ntoa(vredirip_hook.sin_addr), ntohs(vredirip_hook.sin_port), p->username);
 				vdest.sin_port = vredirip_hook.sin_port;
@@ -6528,6 +6548,8 @@
 	if (midcom_cb) {
 		if (!midcom_cb->transmit_response_with_sdp_hook(p)) { 
 			ast_log(LOG_ERROR, "Failed transmit_response_with_sdp_hook()\n");
+			/*! \bug XXX THIS IS CLEARLY a protocol violation. You always need to send a 
+				response. In what cases does this happen?? */
 			return -1;
 		}
 	}
@@ -16815,7 +16837,7 @@
 #ifdef SIP_MIDCOM
 	/*! \note XXX THis function has changed, this needs to be checked /OEJ */
 	if (midcom_cb)
-		midcom_cb->ast_rtp_nat_us_audio_hook(p->rtp, p->r); /* change the ip port in rtp */
+		midcom_cb->ast_rtp_nat_us_audio_hook(p->rtp, p->rule); /* change the ip port in rtp */
 #endif
 
 	*rtp = p->rtp;
@@ -16847,7 +16869,7 @@
 #ifdef SIP_MIDCOM
 	/*! \note XXX THis function has changed, this needs to be checked /OEJ */
 	if (midcom_cb)
-		midcom_cb->ast_rtp_nat_us_audio_hook(p->vrtp, p->r); /* change the ip port in rtp */
+		midcom_cb->ast_rtp_nat_us_audio_hook(p->vrtp, p->rule); /* change the ip port in rtp */
 #endif
 
 	*rtp = p->vrtp;
@@ -16889,7 +16911,7 @@
 #ifdef SIP_MIDCOM
 		/*! \note In 1.4 we return from this function in some cases, before we do this */
 		if (midcom_cb)
-			midcom_cb->ast_rtp_get_their_nat_audio_hook(rtp, p->r);
+			midcom_cb->ast_rtp_get_their_nat_audio_hook(rtp, p->rule);
 #endif
 	} else if (p->redirip.sin_addr.s_addr || ntohs(p->redirip.sin_port) != 0) {
 		memset(&p->redirip, 0, sizeof(p->redirip));
@@ -16900,7 +16922,7 @@
 #ifdef SIP_MIDCOM
 		/*! \note In 1.4 we return from this function in some cases, before we do this */
 		if (midcom_cb)
-			midcom_cb->ast_rtp_get_their_nat_video_hook(vrtp, p->r);
+			midcom_cb->ast_rtp_get_their_nat_video_hook(vrtp, p->rule);
 #endif
 	} else if (p->vredirip.sin_addr.s_addr || ntohs(p->vredirip.sin_port) != 0) {
 		memset(&p->vredirip, 0, sizeof(p->vredirip));



More information about the asterisk-commits mailing list