[svn-commits] kpfleming: branch kpfleming/udptl-updates r206274 - in /team/kpfleming/udptl-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 13 16:18:48 CDT 2009


Author: kpfleming
Date: Mon Jul 13 16:18:44 2009
New Revision: 206274

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206274
Log:
some work in progress:

remove AST_CONTROL_T38 as T.38 negotiation without endpoint parameters is not useful

remove T.38 'capabilities' logic from chan_sip as it should not actually care about the parameters at all,
except for the UDPTL error correction mode (if any)


Modified:
    team/kpfleming/udptl-updates/channels/chan_sip.c
    team/kpfleming/udptl-updates/include/asterisk/frame.h
    team/kpfleming/udptl-updates/main/channel.c
    team/kpfleming/udptl-updates/main/frame.c
    team/kpfleming/udptl-updates/main/rtp_engine.c

Modified: team/kpfleming/udptl-updates/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/udptl-updates/channels/chan_sip.c?view=diff&rev=206274&r1=206273&r2=206274
==============================================================================
--- team/kpfleming/udptl-updates/channels/chan_sip.c (original)
+++ team/kpfleming/udptl-updates/channels/chan_sip.c Mon Jul 13 16:18:44 2009
@@ -1510,10 +1510,10 @@
 #define SIP_PAGE2_SUBSCRIBEMWIONLY	(1 << 18)	/*!< GP: Only issue MWI notification if subscribed to */
 #define SIP_PAGE2_IGNORESDPVERSION	(1 << 19)	/*!< GDP: Ignore the SDP session version number we receive and treat all sessions as new */
 
-#define SIP_PAGE2_T38SUPPORT		        (7 << 20)	/*!< GDP: T38 Fax Passthrough Support */
-#define SIP_PAGE2_T38SUPPORT_UDPTL	        (1 << 20)	/*!< GDP: T38 Fax Passthrough Support (no error correction) */
-#define SIP_PAGE2_T38SUPPORT_UDPTL_FEC	        (2 << 20)	/*!< GDP: T38 Fax Passthrough Support (FEC error correction) */
-#define SIP_PAGE2_T38SUPPORT_UDPTL_REDUNDANCY	(4 << 20)	/*!< GDP: T38 Fax Passthrough Support (redundancy error correction) */
+#define SIP_PAGE2_T38SUPPORT		        (7 << 20)	/*!< GDP: T.38 Fax Support */
+#define SIP_PAGE2_T38SUPPORT_UDPTL	        (1 << 20)	/*!< GDP: T.38 Fax Support (no error correction) */
+#define SIP_PAGE2_T38SUPPORT_UDPTL_FEC	        (2 << 20)	/*!< GDP: T.38 Fax Support (FEC error correction) */
+#define SIP_PAGE2_T38SUPPORT_UDPTL_REDUNDANCY	(4 << 20)	/*!< GDP: T.38 Fax Support (redundancy error correction) */
 
 #define SIP_PAGE2_CALL_ONHOLD		(3 << 23)	/*!< D: Call hold states: */
 #define SIP_PAGE2_CALL_ONHOLD_ACTIVE    (1 << 23)       /*!< D: Active hold */
@@ -1563,8 +1563,6 @@
 #define T38FAX_RATE_12000			(1 << 12)	/*!< 12000 bps t38FaxRate */
 #define T38FAX_RATE_14400			(1 << 13)	/*!< 14400 bps t38FaxRate */
 
-/*!< This is default: NO MMR and JBIG transcoding, NO fill bit removal, transferredTCF TCF, UDP FEC, Version 0 and 9600 max fax rate */
-static int global_t38_capability = T38FAX_VERSION_0 | T38FAX_RATE_2400 | T38FAX_RATE_4800 | T38FAX_RATE_7200 | T38FAX_RATE_9600;
 /*@}*/ 
 
 /*! \brief debugging state
@@ -1597,11 +1595,9 @@
 
 /*! \brief T.38 channel settings (at some point we need to make this alloc'ed */
 struct t38properties {
-	struct ast_flags t38support;	/*!< Flag for udptl, rtp or tcp support for this session */
-	int capability;			/*!< Our T38 capability */
-	int peercapability;		/*!< Peers T38 capability */
-	int jointcapability;		/*!< Supported T38 capability at both ends */
 	enum t38state state;		/*!< T.38 state */
+	struct ast_control_t38_parameters our_parms;
+	struct ast_control_t38_parameters their_parms;
 };
 
 /*! \brief Parameters to know status of transfer */
@@ -4171,7 +4167,7 @@
 		sip_pvt_lock(p);
 
 		/* Now if T38 support is enabled we need to look and see what the current state is to get what we want to report back */
-		if (ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT)) {
+		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT)) {
 			switch (p->t38.state) {
 			case T38_LOCAL_REINVITE:
 			case T38_PEER_REINVITE:
@@ -4903,56 +4899,11 @@
 	}
 }
 
-/*! \brief Helper function which interprets T.38 capabilities and fills a parameters structure in */
-static void fill_t38_parameters(int capabilities, struct ast_control_t38_parameters *parameters, struct sip_pvt *p)
-{
-	if (capabilities & T38FAX_VERSION_0) {
-		parameters->version = 0;
-	} else if (capabilities & T38FAX_VERSION_1) {
-		parameters->version = 1;
-	}
-
-	if (capabilities & T38FAX_RATE_14400) {
-		parameters->rate = AST_T38_RATE_14400;
-	} else if (capabilities & T38FAX_RATE_12000) {
-		parameters->rate = AST_T38_RATE_12000;
-	} else if (capabilities & T38FAX_RATE_9600) {
-		parameters->rate = AST_T38_RATE_9600;
-	} else if (capabilities & T38FAX_RATE_7200) {
-		parameters->rate = AST_T38_RATE_7200;
-	} else if (capabilities & T38FAX_RATE_4800) {
-		parameters->rate = AST_T38_RATE_4800;
-	} else if (capabilities & T38FAX_RATE_2400) {
-		parameters->rate = AST_T38_RATE_2400;
-	}
-
-	if (capabilities & T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF) {
-		parameters->rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF;
-	} else if (capabilities & T38FAX_RATE_MANAGEMENT_LOCAL_TCF) {
-		parameters->rate_management = AST_T38_RATE_MANAGEMENT_LOCAL_TCF;
-	}
-
-	if (capabilities & T38FAX_FILL_BIT_REMOVAL) {
-		parameters->fill_bit_removal = 1;
-	}
-
-	if (capabilities & T38FAX_TRANSCODING_MMR) {
-		parameters->transcoding_mmr = 1;
-	}
-
-	if (capabilities & T38FAX_TRANSCODING_JBIG) {
-		parameters->transcoding_jbig = 1;
-	}
-
-	parameters->max_ifp = ast_udptl_get_far_max_ifp(p->udptl);
-}
-
 /*! \brief Change the T38 state on a SIP dialog */
 static void change_t38_state(struct sip_pvt *p, int state)
 {
 	int old = p->t38.state;
 	struct ast_channel *chan = p->owner;
-	enum ast_control_t38 message = 0;
 	struct ast_control_t38_parameters parameters = { 0, };
 
 	/* Don't bother changing if we are already in the state wanted */
@@ -4968,21 +4919,19 @@
 
 	/* Given the state requested and old state determine what control frame we want to queue up */
 	if (state == T38_PEER_REINVITE) {
-		message = parameters.request_response = AST_T38_REQUEST_NEGOTIATE;
-		fill_t38_parameters(p->t38.peercapability, &parameters, p);
+		parameters.request_response = AST_T38_REQUEST_NEGOTIATE;
+		/* KPF: store their parameters */
 	} else if (state == T38_ENABLED) {
-		message = parameters.request_response = AST_T38_NEGOTIATED;
-		fill_t38_parameters(p->t38.jointcapability, &parameters, p);
+		parameters = p->t38.their_parms;
+		parameters.request_response = AST_T38_NEGOTIATED;
 	} else if (state == T38_DISABLED && old == T38_ENABLED)
-		message = parameters.request_response = AST_T38_TERMINATED;
+		parameters.request_response = AST_T38_TERMINATED;
 	else if (state == T38_DISABLED && old == T38_LOCAL_REINVITE)
-		message = parameters.request_response = AST_T38_REFUSED;
+		parameters.request_response = AST_T38_REFUSED;
 
 	/* Woot we got a message, create a control frame and send it on! */
 	if (parameters.request_response)
 		ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
-	if (message)
-		ast_queue_control_data(chan, AST_CONTROL_T38, &message, sizeof(message));
 
 	if (ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT) && !p->outgoing_call) {
 		/* fax detection is enabled and this is an incoming call */
@@ -5008,21 +4957,17 @@
 }
 
 /*! \brief Set the global T38 capabilities on a SIP dialog structure */
+/* KPF: override EC mode based on what remote end answers with or asks for */
 static void set_t38_capabilities(struct sip_pvt *p)
 {
-	p->t38.capability = global_t38_capability;
 	if (p->udptl) {
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) == SIP_PAGE2_T38SUPPORT_UDPTL_REDUNDANCY) {
                         ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY);
-			p->t38.capability |= T38FAX_UDP_EC_REDUNDANCY;
 		} else if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) == SIP_PAGE2_T38SUPPORT_UDPTL_FEC) {
 			ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_FEC);
-			p->t38.capability |= T38FAX_UDP_EC_FEC;
 		} else if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) == SIP_PAGE2_T38SUPPORT_UDPTL) {
 			ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_NONE);
-			p->t38.capability |= T38FAX_UDP_EC_NONE;
-		}
-		p->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF;
+		}
 	}
 }
 
@@ -5120,9 +5065,7 @@
 			/* t38pt_udptl was enabled in the peer and not in [general] */
 			dialog->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr);
 		}
-		ast_copy_flags(&dialog->t38.t38support, &peer->flags[1], SIP_PAGE2_T38SUPPORT);
 		set_t38_capabilities(dialog);
-		dialog->t38.jointcapability = dialog->t38.capability;
 	} else if (dialog->udptl) {
 		ast_udptl_destroy(dialog->udptl);
 		dialog->udptl = NULL;
@@ -5421,9 +5364,6 @@
 		res = -1;
 	} else {
 		int xmitres;
-
-		p->t38.jointcapability = p->t38.capability;
-		ast_debug(2, "Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
 
 		sip_pvt_lock(p);
 		xmitres = transmit_invite(p, SIP_INVITE, 1, 2);
@@ -6440,67 +6380,16 @@
 }
 
 /*! \brief Helper function which updates T.38 capability information and triggers a reinvite */
-static void interpret_t38_parameters(struct sip_pvt *p, enum ast_control_t38 request_response, const struct ast_control_t38_parameters *parameters)
-{
-	if (parameters) {
-		if (!parameters->version) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_VERSION_0;
-		} else if (parameters->version == 1) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_VERSION_1;
-		}
-
-		switch (parameters->rate) {
-		case AST_T38_RATE_14400:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_14400;
-		case AST_T38_RATE_12000:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_12000;
-		case AST_T38_RATE_9600:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_9600;
-		case AST_T38_RATE_7200:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_7200;
-		case AST_T38_RATE_4800:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_4800;
-		case AST_T38_RATE_2400:
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_2400;
-		}
-
-		if (parameters->rate_management == AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF;
-		} else if (parameters->rate_management == AST_T38_RATE_MANAGEMENT_LOCAL_TCF) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_MANAGEMENT_LOCAL_TCF;
-		}
-
-		if (parameters->fill_bit_removal) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_FILL_BIT_REMOVAL;
-		} else {
-			p->t38.capability = p->t38.jointcapability &= ~T38FAX_FILL_BIT_REMOVAL;
-		}
-
-		if (parameters->transcoding_mmr) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_TRANSCODING_MMR;
-		} else {
-			p->t38.capability = p->t38.jointcapability &= ~T38FAX_TRANSCODING_MMR;
-		}
-
-		if (parameters->transcoding_jbig) {
-			p->t38.capability = p->t38.jointcapability |= T38FAX_TRANSCODING_JBIG;
-		} else {
-			p->t38.capability = p->t38.jointcapability &= ~T38FAX_TRANSCODING_JBIG;
-		}
-
-		if (p->udptl && request_response == AST_T38_REQUEST_NEGOTIATE) {
-			ast_udptl_set_local_max_ifp(p->udptl, parameters->max_ifp ? : 100);
-		}
-	}
-
-	switch (request_response) {
+static void interpret_t38_parameters(struct sip_pvt *p, const struct ast_control_t38_parameters *parameters)
+{
+	switch (parameters->request_response) {
 	case AST_T38_NEGOTIATED:
 	case AST_T38_REQUEST_NEGOTIATE:         /* Request T38 */
 		if (p->t38.state == T38_PEER_REINVITE) {
 			AST_SCHED_DEL_UNREF(sched, p->t38id, dialog_unref(p, "when you delete the t38id sched, you should dec the refcount for the stored dialog ptr"));
 			change_t38_state(p, T38_ENABLED);
 			transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
-		} else if (ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT) && p->t38.state != T38_ENABLED) {
+		} else if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && p->t38.state != T38_ENABLED) {
 			change_t38_state(p, T38_LOCAL_REINVITE);
 			if (!p->pendinginvite) {
 				transmit_reinvite_with_sdp(p, TRUE, FALSE);
@@ -6608,19 +6497,12 @@
 		} else
 			res = -1;
 		break;
-	case AST_CONTROL_T38:	/* T38 control frame */
-		if (datalen != sizeof(enum ast_control_t38)) {
-			ast_log(LOG_ERROR, "Invalid datalen for AST_CONTROL_T38. Expected %d, got %d\n", (int)sizeof(enum ast_control_t38), (int)datalen);
-		} else {
-			interpret_t38_parameters(p, *((enum ast_control_t38 *) data), NULL);
-		}
-		break;
 	case AST_CONTROL_T38_PARAMETERS:
 		if (datalen != sizeof(struct ast_control_t38_parameters)) {
 			ast_log(LOG_ERROR, "Invalid datalen for AST_CONTROL_T38_PARAMETERS. Expected %d, got %d\n", (int)sizeof(struct ast_control_t38_parameters), (int)datalen);
 		} else {
 			const struct ast_control_t38_parameters *parameters = data;
-			interpret_t38_parameters(p, parameters->request_response, parameters);
+			interpret_t38_parameters(p, parameters);
 		}
 		break;
 	case AST_CONTROL_SRCUPDATE:
@@ -7044,7 +6926,7 @@
 	if (f && p->dsp) {
 		f = ast_dsp_process(p->owner, p->dsp, f);
 		if (f && f->frametype == AST_FRAME_DTMF) {
-			if (ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT) && f->subclass == 'f') {
+			if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && f->subclass == 'f') {
 				ast_debug(1, "Fax CNG detected on %s\n", ast->name);
 				*faxdetect = 1;
 			} else {
@@ -7069,7 +6951,7 @@
 
 	/* If we are NOT bridged to another channel, and we have detected fax tone we issue T38 re-invite to a peer */
 	/* If we are bridged then it is the responsibility of the SIP device to issue T38 re-invite if it detects CNG or fax preamble */
-	if (faxdetected && ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT) && (p->t38.state == T38_DISABLED) && !(ast_bridged_channel(ast))) {
+	if (faxdetected && ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && (p->t38.state == T38_DISABLED) && !(ast_bridged_channel(ast))) {
 		if (!ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 			if (!p->pendinginvite) {
 				ast_debug(3, "Sending reinvite on SIP (%s) for T.38 negotiation.\n", ast->name);
@@ -7243,9 +7125,7 @@
 	    (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
 		p->noncodeccapability |= AST_RTP_DTMF;
 	if (p->udptl) {
-		ast_copy_flags(&p->t38.t38support, &p->flags[1], SIP_PAGE2_T38SUPPORT);
 		set_t38_capabilities(p);
-		p->t38.jointcapability = p->t38.capability;
 	}
 	ast_string_field_set(p, context, sip_cfg.default_context);
 	ast_string_field_set(p, parkinglot, default_parkinglot);
@@ -8642,16 +8522,8 @@
 			}
 		}
 		if (found) { /* Some cisco equipment returns nothing beside c= and m= lines in 200 OK T38 SDP */
-			p->t38.peercapability = peert38capability;
-			p->t38.jointcapability = (peert38capability & 255); /* Put everything beside supported speeds settings */
-			peert38capability &= (T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400);
-			p->t38.jointcapability |= (peert38capability & p->t38.capability); /* Put the lower of our's and peer's speed */
-		}
-		if (debug)
-			ast_debug(1, "Our T38 capability = (%d), peer T38 capability (%d), joint T38 capability (%d)\n",
-				p->t38.capability,
-				p->t38.peercapability,
-				p->t38.jointcapability);
+			/* KPF: fill in default parameters */
+		}
 
 		/* Remote party offers T38, we need to update state */
 		if (t38action == SDP_T38_ACCEPT) {
@@ -8699,7 +8571,7 @@
 	}
 	if (!newjointcapability) {
 		/* If T.38 was not negotiated either, totally bail out... */
-		if (!p->t38.jointcapability || !udptlportno) {
+		if ((p->t38.state == T38_DISABLED) || !udptlportno) {
 			ast_log(LOG_NOTICE, "No compatible codecs, not accepting this offer!\n");
 			/* Do NOT Change current setting */
 			return -1;
@@ -9841,30 +9713,22 @@
 
 
 /*! \brief Get Max T.38 Transmission rate from T38 capabilities */
-static int t38_get_rate(int t38cap)
-{
-	int maxrate = (t38cap & (T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400));
-	
-	if (maxrate & T38FAX_RATE_14400) {
-		ast_debug(2, "T38MaxBitRate 14400 found\n");
+static unsigned int t38_get_rate(enum ast_control_t38_rate rate)
+{
+	switch (rate) {
+	case AST_T38_RATE_2400:
+		return 2400;
+	case AST_T38_RATE_4800:
+		return 4800;
+	case AST_T38_RATE_7200:
+		return 7200;
+	case AST_T38_RATE_9600:
+		return 9600;
+	case AST_T38_RATE_12000:
+		return 12000;
+	case AST_T38_RATE_14400:
 		return 14400;
-	} else if (maxrate & T38FAX_RATE_12000) {
-		ast_debug(2, "T38MaxBitRate 12000 found\n");
-		return 12000;
-	} else if (maxrate & T38FAX_RATE_9600) {
-		ast_debug(2, "T38MaxBitRate 9600 found\n");
-		return 9600;
-	} else if (maxrate & T38FAX_RATE_7200) {
-		ast_debug(2, "T38MaxBitRate 7200 found\n");
-		return 7200;
-	} else if (maxrate & T38FAX_RATE_4800) {
-		ast_debug(2, "T38MaxBitRate 4800 found\n");
-		return 4800;
-	} else if (maxrate & T38FAX_RATE_2400) {
-		ast_debug(2, "T38MaxBitRate 2400 found\n");
-		return 2400;
-	} else {
-		ast_debug(2, "Strange, T38MaxBitRate NOT found in peers T38 SDP.\n");
+	default:
 		return 0;
 	}
 }
@@ -10179,35 +10043,38 @@
 		/* We break with the "recommendation" and send our IP, in order that our
 		   peer doesn't have to ast_gethostbyname() us */
 
-		if (debug) {
-			ast_debug(1, "Our T38 capability (%d), peer T38 capability (%d), joint capability (%d)\n",
-				  p->t38.capability,
-				  p->t38.peercapability,
-				  p->t38.jointcapability);
-		}
-
 		ast_str_append(&m_modem, 0, "m=image %d udptl t38", ntohs(udptldest.sin_port));
 
-		if ((p->t38.jointcapability & T38FAX_VERSION) == T38FAX_VERSION_0)
-			ast_str_append(&a_modem, 0, "a=T38FaxVersion:0\r\n");
-		if ((p->t38.jointcapability & T38FAX_VERSION) == T38FAX_VERSION_1)
-			ast_str_append(&a_modem, 0, "a=T38FaxVersion:1\r\n");
-		if ((x = t38_get_rate(p->t38.jointcapability)))
-			ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n", x);
-		if ((p->t38.jointcapability & T38FAX_FILL_BIT_REMOVAL) == T38FAX_FILL_BIT_REMOVAL)
+		ast_str_append(&a_modem, 0, "a=T38Faxversion:%d\r\n", p->t38.our_parms.version);
+		ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n", t38_get_rate(p->t38.our_parms.rate));
+		if (p->t38.our_parms.fill_bit_removal) {
 			ast_str_append(&a_modem, 0, "a=T38FaxFillBitRemoval\r\n");
-		if ((p->t38.jointcapability & T38FAX_TRANSCODING_MMR) == T38FAX_TRANSCODING_MMR)
+		}
+		if (p->t38.our_parms.transcoding_mmr) {
 			ast_str_append(&a_modem, 0, "a=T38FaxTranscodingMMR\r\n");
-		if ((p->t38.jointcapability & T38FAX_TRANSCODING_JBIG) == T38FAX_TRANSCODING_JBIG)
+		}
+		if (p->t38.our_parms.transcoding_jbig) {
 			ast_str_append(&a_modem, 0, "a=T38FaxTranscodingJBIG\r\n");
-		ast_str_append(&a_modem, 0, "a=T38FaxRateManagement:%s\r\n", (p->t38.jointcapability & T38FAX_RATE_MANAGEMENT_LOCAL_TCF) ? "localTCF" : "transferredTCF");
-		x = ast_udptl_get_local_max_datagram(p->udptl);
-		ast_str_append(&a_modem, 0, "a=T38FaxMaxBuffer:%d\r\n", x);
-		ast_str_append(&a_modem, 0, "a=T38FaxMaxDatagram:%d\r\n", x);
-		if (p->t38.jointcapability & T38FAX_UDP_EC_REDUNDANCY)
+		}
+		switch (p->t38.our_parms.rate_management) {
+		case AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF:
+			ast_str_append(&a_modem, 0, "a=T38FaxRateManagement:transferredTCF\r\n");
+			break;
+		case AST_T38_RATE_MANAGEMENT_LOCAL_TCF:
+			ast_str_append(&a_modem, 0, "a=T38FaxRateManagement:localTCF\r\n");
+			break;
+		}
+		ast_str_append(&a_modem, 0, "a=T38FaxMaxDatagram:%d\r\n", ast_udptl_get_local_max_datagram(p->udptl));
+		switch (ast_test_flag(&p->flags[1],  SIP_PAGE2_T38SUPPORT)) {
+		case SIP_PAGE2_T38SUPPORT_UDPTL:
+			break;
+		case SIP_PAGE2_T38SUPPORT_UDPTL_FEC:
+			ast_str_append(&a_modem, 0, "a=T38FaxUdpEC:t38UDPFEC\r\n");
+			break;
+		case SIP_PAGE2_T38SUPPORT_UDPTL_REDUNDANCY:
 			ast_str_append(&a_modem, 0, "a=T38FaxUdpEC:t38UDPRedundancy\r\n");
-		else if (p->t38.jointcapability & T38FAX_UDP_EC_FEC)
-			ast_str_append(&a_modem, 0, "a=T38FaxUdpEC:t38UDPFEC\r\n");
+			break;
+		}
 	}
 
 	if (needaudio)
@@ -14101,7 +13968,6 @@
 
 	if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && p->udptl) {
 		set_t38_capabilities(p);
-		p->t38.jointcapability = p->t38.capability;
 	}
 
 	/* Copy SIP extensions profile to peer */
@@ -14200,8 +14066,6 @@
 		else
 			p->noncodeccapability &= ~AST_RTP_DTMF;
 		p->jointnoncodeccapability = p->noncodeccapability;
-		if (p->t38.peercapability)
-			p->t38.jointcapability &= p->t38.peercapability;
 		if (!dialog_initialize_rtp(p)) {
 			if (p->rtp) {
 				ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &peer->prefs);
@@ -20353,9 +20217,6 @@
 		/* If T38 is needed but not present, then make it magically appear */
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && !p->udptl && (p->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, bindaddr.sin_addr))) {
 			set_t38_capabilities(p);
-			p->t38.jointcapability = p->t38.capability;
-			set_t38_capabilities(p);
-			p->t38.jointcapability = p->t38.capability;
 		}
 
 		/* We have a succesful authentication, process the SDP portion if there is one */

Modified: team/kpfleming/udptl-updates/include/asterisk/frame.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/udptl-updates/include/asterisk/frame.h?view=diff&rev=206274&r1=206273&r2=206274
==============================================================================
--- team/kpfleming/udptl-updates/include/asterisk/frame.h (original)
+++ team/kpfleming/udptl-updates/include/asterisk/frame.h Mon Jul 13 16:18:44 2009
@@ -319,7 +319,7 @@
 	AST_CONTROL_HOLD = 16,		/*!< Indicate call is placed on hold */
 	AST_CONTROL_UNHOLD = 17,	/*!< Indicate call is left from hold */
 	AST_CONTROL_VIDUPDATE = 18,	/*!< Indicate video frame update */
-	AST_CONTROL_T38 = 19,		/*!< T38 state change request/notification */
+	_XXX_AST_CONTROL_T38 = 19,	/*!< T38 state change request/notification \deprecated This is no longer supported. Use AST_CONTROL_T38_PARAMETERS instead. */
 	AST_CONTROL_SRCUPDATE = 20,     /*!< Indicate source of media has changed */
 	AST_CONTROL_TRANSFER = 21,      /*!< Indicate status of a transfer request */
 	AST_CONTROL_CONNECTED_LINE = 22,/*!< Indicate connected line has changed */

Modified: team/kpfleming/udptl-updates/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/udptl-updates/main/channel.c?view=diff&rev=206274&r1=206273&r2=206274
==============================================================================
--- team/kpfleming/udptl-updates/main/channel.c (original)
+++ team/kpfleming/udptl-updates/main/channel.c Mon Jul 13 16:18:44 2009
@@ -3483,11 +3483,11 @@
 	case AST_CONTROL_TAKEOFFHOOK:
 	case AST_CONTROL_ANSWER:
 	case AST_CONTROL_HANGUP:
-	case AST_CONTROL_T38:
 	case AST_CONTROL_CONNECTED_LINE:
 	case AST_CONTROL_REDIRECTING:
 	case AST_CONTROL_TRANSFER:
 	case AST_CONTROL_T38_PARAMETERS:
+	case _XXX_AST_CONTROL_T38:
 		break;
 
 	case AST_CONTROL_CONGESTION:
@@ -3580,7 +3580,9 @@
 
 	/* Handle conditions that we have tones for. */
 	switch (condition) {
-	case AST_CONTROL_T38:
+	case _XXX_AST_CONTROL_T38:
+		/* deprecated T.38 control frame */
+		return -1;
 	case AST_CONTROL_T38_PARAMETERS:
 		/* there is no way to provide 'default' behavior for these
 		 * control frames, so we need to return failure, but there
@@ -5498,7 +5500,6 @@
 			case AST_CONTROL_HOLD:
 			case AST_CONTROL_UNHOLD:
 			case AST_CONTROL_VIDUPDATE:
-			case AST_CONTROL_T38:
 			case AST_CONTROL_SRCUPDATE:
 				ast_indicate_data(other, f->subclass, f->data.ptr, f->datalen);
 				if (jb_in_use) {

Modified: team/kpfleming/udptl-updates/main/frame.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/udptl-updates/main/frame.c?view=diff&rev=206274&r1=206273&r2=206274
==============================================================================
--- team/kpfleming/udptl-updates/main/frame.c (original)
+++ team/kpfleming/udptl-updates/main/frame.c Mon Jul 13 16:18:44 2009
@@ -839,24 +839,6 @@
 		case AST_CONTROL_UNHOLD:
 			strcpy(subclass, "Unhold");
 			break;
-		case AST_CONTROL_T38:
-			if (f->datalen != sizeof(enum ast_control_t38)) {
-				message = "Invalid";
-			} else {
-				enum ast_control_t38 state = *((enum ast_control_t38 *) f->data.ptr);
-				if (state == AST_T38_REQUEST_NEGOTIATE)
-					message = "Negotiation Requested";
-				else if (state == AST_T38_REQUEST_TERMINATE)
-					message = "Negotiation Request Terminated";
-				else if (state == AST_T38_NEGOTIATED)
-					message = "Negotiated";
-				else if (state == AST_T38_TERMINATED)
-					message = "Terminated";
-				else if (state == AST_T38_REFUSED)
-					message = "Refused";
-			}
-			snprintf(subclass, sizeof(subclass), "T38/%s", message);
-			break;
 		case AST_CONTROL_T38_PARAMETERS:
 			if (f->datalen != sizeof(struct ast_control_t38_parameters *)) {
 				message = "Invalid";

Modified: team/kpfleming/udptl-updates/main/rtp_engine.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/kpfleming/udptl-updates/main/rtp_engine.c?view=diff&rev=206274&r1=206273&r2=206274
==============================================================================
--- team/kpfleming/udptl-updates/main/rtp_engine.c (original)
+++ team/kpfleming/udptl-updates/main/rtp_engine.c Mon Jul 13 16:18:44 2009
@@ -853,7 +853,6 @@
 			if ((fr->subclass == AST_CONTROL_HOLD) ||
 			    (fr->subclass == AST_CONTROL_UNHOLD) ||
 			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass == AST_CONTROL_T38) ||
 			    (fr->subclass == AST_CONTROL_SRCUPDATE) ||
 			    (fr->subclass == AST_CONTROL_T38_PARAMETERS)) {
 				/* If we are going on hold, then break callback mode and P2P bridging */
@@ -1073,7 +1072,6 @@
 			if ((fr->subclass == AST_CONTROL_HOLD) ||
 			    (fr->subclass == AST_CONTROL_UNHOLD) ||
 			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass == AST_CONTROL_T38) ||
 			    (fr->subclass == AST_CONTROL_SRCUPDATE) ||
 			    (fr->subclass == AST_CONTROL_T38_PARAMETERS)) {
 				if (fr->subclass == AST_CONTROL_HOLD) {




More information about the svn-commits mailing list