[asterisk-commits] mmichelson: branch mmichelson/sip_endpoint_reorg r395747 - in /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 30 09:46:55 CDT 2013


Author: mmichelson
Date: Tue Jul 30 09:46:53 2013
New Revision: 395747

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395747
Log:
Place T.38 options into their own struct.


Modified:
    team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c
    team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
    team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
    team/mmichelson/sip_endpoint_reorg/res/res_sip_t38.c

Modified: team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c?view=diff&rev=395747&r1=395746&r2=395747
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c (original)
+++ team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c Tue Jul 30 09:46:53 2013
@@ -943,7 +943,7 @@
 
 	switch (option) {
 	case AST_OPTION_T38_STATE:
-		if (session->endpoint->t38udptl) {
+		if (session->endpoint->media.t38.enabled) {
 			switch (session->t38state) {
 			case T38_LOCAL_REINVITE:
 			case T38_PEER_REINVITE:

Modified: team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h?view=diff&rev=395747&r1=395746&r2=395747
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h Tue Jul 30 09:46:53 2013
@@ -472,6 +472,19 @@
 	unsigned int disable_on_nat;
 };
 
+struct ast_sip_t38_configuration {
+	/*! Whether T.38 UDPTL support is enabled or not */
+	unsigned int enabled;
+	/*! Error correction setting for T.38 UDPTL */
+	enum ast_t38_ec_modes error_correction;
+	/*! Explicit T.38 max datagram value, may be 0 to indicate the remote side can be trusted */
+	unsigned int maxdatagram;
+	/*! Whether NAT Support is enabled for T.38 UDPTL sessions or not */
+	unsigned int nat;
+	/*! Whether to use IPv6 for UDPTL or not */
+	unsigned int ipv6;
+};
+
 /*!
  * \brief Media configuration for SIP endpoints
  */
@@ -488,6 +501,8 @@
 	struct ast_sip_media_rtp_configuration rtp;
 	/*! Direct media options */
 	struct ast_sip_direct_media_configuration direct_media;
+	/*! T.38 (FoIP) options */
+	struct ast_sip_t38_configuration t38;
 	/*! Codec preferences */
 	struct ast_codec_pref prefs;
 	/*! Configured codecs */
@@ -555,18 +570,8 @@
 	struct ast_endpoint *persistent;
 	/*! The number of channels at which busy device state is returned */
 	unsigned int devicestate_busy_at;
-	/*! Whether T.38 UDPTL support is enabled or not */
-	unsigned int t38udptl;
-	/*! Error correction setting for T.38 UDPTL */
-	enum ast_t38_ec_modes t38udptl_ec;
-	/*! Explicit T.38 max datagram value, may be 0 to indicate the remote side can be trusted */
-	unsigned int t38udptl_maxdatagram;
 	/*! Whether fax detection is enabled or not (CNG tone detection) */
 	unsigned int faxdetect;
-	/*! Whether NAT Support is enabled for T.38 UDPTL sessions or not */
-	unsigned int t38udptl_nat;
-	/*! Whether to use IPv6 for UDPTL or not */
-	unsigned int t38udptl_ipv6;
 	/*! Determines if transfers (using REFER) are allowed by this endpoint */
 	unsigned int allowtransfer;
 };

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c?view=diff&rev=395747&r1=395746&r2=395747
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c Tue Jul 30 09:46:53 2013
@@ -525,11 +525,11 @@
 	struct ast_sip_endpoint *endpoint = obj;
 
 	if (!strcmp(var->value, "none")) {
-		endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_NONE;
+		endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_NONE;
 	} else if (!strcmp(var->value, "fec")) {
-		endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_FEC;
+		endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_FEC;
 	} else if (!strcmp(var->value, "redundancy")) {
-		endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_REDUNDANCY;
+		endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_REDUNDANCY;
 	} else {
 		return -1;
 	}
@@ -677,12 +677,12 @@
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedcallgroup", "", named_groups_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedpickupgroup", "", named_groups_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "devicestate_busy_at", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, devicestate_busy_at));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, t38udptl));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.enabled));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "t38udptl_ec", "none", t38udptl_ec_handler, NULL, 0, 0);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_maxdatagram", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, t38udptl_maxdatagram));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_maxdatagram", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.t38.maxdatagram));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "faxdetect", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, faxdetect));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, t38udptl_nat));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, t38udptl_ipv6));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.nat));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38udptl_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.ipv6));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tonezone", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, zone));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "language", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, language));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "recordonfeature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.onfeature));

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_t38.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_t38.c?view=diff&rev=395747&r1=395746&r2=395747
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_t38.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_t38.c Tue Jul 30 09:46:53 2013
@@ -248,13 +248,13 @@
 	}
 
 	if (!(session_media->udptl = ast_udptl_new_with_bindaddr(NULL, NULL, 0,
-		session->endpoint->t38udptl_ipv6 ? &address_ipv6 : &address_ipv4))) {
+		session->endpoint->media.t38.ipv6 ? &address_ipv6 : &address_ipv4))) {
 		return -1;
 	}
 
 	ast_channel_set_fd(session->channel, 5, ast_udptl_fd(session_media->udptl));
-	ast_udptl_set_error_correction_scheme(session_media->udptl, session->endpoint->t38udptl_ec);
-	ast_udptl_setnat(session_media->udptl, session->endpoint->t38udptl_nat);
+	ast_udptl_set_error_correction_scheme(session_media->udptl, session->endpoint->media.t38.error_correction);
+	ast_udptl_setnat(session_media->udptl, session->endpoint->media.t38.nat);
 
 	return 0;
 }
@@ -386,7 +386,7 @@
 static struct ast_frame *t38_framehook_write(struct ast_sip_session *session, struct ast_frame *f)
 {
 	if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS &&
-		session->endpoint->t38udptl) {
+		session->endpoint->media.t38.enabled) {
 		struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(session, f);
 
 		if (!data) {
@@ -446,7 +446,7 @@
 		.event_cb = t38_framehook,
 	};
 
-	if ((ast_channel_state(session->channel) == AST_STATE_UP) || !session->endpoint->t38udptl) {
+	if ((ast_channel_state(session->channel) == AST_STATE_UP) || !session->endpoint->media.t38.enabled) {
 		return;
 	}
 
@@ -533,8 +533,8 @@
 		} else if (!pj_stricmp2(&attr->name, "t38faxversion")) {
 			state->their_parms.version = pj_strtoul(&attr->value);
 		} else if (!pj_stricmp2(&attr->name, "t38faxmaxdatagram") || !pj_stricmp2(&attr->name, "t38maxdatagram")) {
-			if (session->endpoint->t38udptl_maxdatagram) {
-				ast_udptl_set_far_max_datagram(session_media->udptl, session->endpoint->t38udptl_maxdatagram);
+			if (session->endpoint->media.t38.maxdatagram) {
+				ast_udptl_set_far_max_datagram(session_media->udptl, session->endpoint->media.t38.maxdatagram);
 			} else {
 				ast_udptl_set_far_max_datagram(session_media->udptl, pj_strtoul(&attr->value));
 			}
@@ -569,7 +569,7 @@
 {
 	struct t38_state *state;
 
-	if (!session->endpoint->t38udptl) {
+	if (!session->endpoint->media.t38.enabled) {
 		return 0;
 	}
 
@@ -600,7 +600,7 @@
 	char host[NI_MAXHOST];
 	RAII_VAR(struct ast_sockaddr *, addrs, NULL, ast_free_ptr);
 
-	if (!session->endpoint->t38udptl) {
+	if (!session->endpoint->media.t38.enabled) {
 		return -1;
 	}
 
@@ -622,8 +622,8 @@
 	}
 
 	/* Check the address family to make sure it matches configured */
-	if ((ast_sockaddr_is_ipv6(addrs) && !session->endpoint->t38udptl_ipv6) ||
-		(ast_sockaddr_is_ipv4(addrs) && session->endpoint->t38udptl_ipv6)) {
+	if ((ast_sockaddr_is_ipv6(addrs) && !session->endpoint->media.t38.ipv6) ||
+		(ast_sockaddr_is_ipv4(addrs) && session->endpoint->media.t38.ipv6)) {
 		/* The address does not match configured */
 		return -1;
 	}
@@ -652,7 +652,7 @@
 	char tmp[512];
 	pj_str_t stmp;
 
-	if (!session->endpoint->t38udptl) {
+	if (!session->endpoint->media.t38.enabled) {
 		return 1;
 	} else if ((session->t38state != T38_LOCAL_REINVITE) && (session->t38state != T38_PEER_REINVITE) &&
 		(session->t38state != T38_ENABLED)) {
@@ -674,7 +674,7 @@
 	if (ast_strlen_zero(session->endpoint->media.external_address)) {
 		pj_sockaddr localaddr;
 
-		if (pj_gethostip(session->endpoint->t38udptl_ipv6 ? pj_AF_INET6() : pj_AF_INET(), &localaddr)) {
+		if (pj_gethostip(session->endpoint->media.t38.ipv6 ? pj_AF_INET6() : pj_AF_INET(), &localaddr)) {
 			return -1;
 		}
 		pj_sockaddr_print(&localaddr, hostip, sizeof(hostip), 2);
@@ -683,7 +683,7 @@
 	}
 
 	media->conn->net_type = STR_IN;
-	media->conn->addr_type = session->endpoint->t38udptl_ipv6 ? STR_IP6 : STR_IP4;
+	media->conn->addr_type = session->endpoint->media.t38.ipv6 ? STR_IP6 : STR_IP4;
 	pj_strdup2(pool, &media->conn->addr, hostip);
 	ast_udptl_get_us(session_media->udptl, &addr);
 	media->desc.port = (pj_uint16_t) ast_sockaddr_port(&addr);




More information about the asterisk-commits mailing list