[svn-commits] may: branch may/chan_ooh323_rework r225766 - /team/may/chan_ooh323_rework/add...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Oct 25 19:13:13 CDT 2009


Author: may
Date: Sun Oct 25 19:13:10 2009
New Revision: 225766

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225766
Log:
remove spandsp related code and t38 transparent mode
(it must be done in core or applications)

Modified:
    team/may/chan_ooh323_rework/addons/Makefile
    team/may/chan_ooh323_rework/addons/chan_ooh323.c

Modified: team/may/chan_ooh323_rework/addons/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/Makefile?view=diff&rev=225766&r1=225765&r2=225766
==============================================================================
--- team/may/chan_ooh323_rework/addons/Makefile (original)
+++ team/may/chan_ooh323_rework/addons/Makefile Sun Oct 25 19:13:10 2009
@@ -44,7 +44,7 @@
 
 $(if $(filter format_mp3,$(EMBEDDED_MODS)),modules.link,format_mp3.so): mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o
 
-chan_ooh323.o: _ASTCFLAGS+=$(H323CFLAGS) $(SPANDSP_INCLUDE)
+chan_ooh323.o: _ASTCFLAGS+=$(H323CFLAGS)
 
-$(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): _ASTCFLAGS+=$(H323CFLAGS) -lrt $(SPANDSP_LIB)
+$(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): _ASTCFLAGS+=$(H323CFLAGS) -lrt
 $(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o

Modified: team/may/chan_ooh323_rework/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/chan_ooh323.c?view=diff&rev=225766&r1=225765&r2=225766
==============================================================================
--- team/may/chan_ooh323_rework/addons/chan_ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/chan_ooh323.c Sun Oct 25 19:13:10 2009
@@ -18,13 +18,6 @@
 #include "chan_ooh323.h"
 #include <math.h>
 
-#define HAVE_SPANDSP_EXPOSE_H
-#include <spandsp.h>
-#ifdef HAVE_SPANDSP_EXPOSE_H
-#include <spandsp/expose.h>
-#endif
-#include <spandsp/version.h>
-
 /* Defaults */
 #define DEFAULT_CONTEXT "default"
 #define DEFAULT_H323ID "Asterisk PBX"
@@ -45,8 +38,8 @@
 #define MAXT30	240
 #define T38TOAUDIOTIMEOUT 30
 #define T38_DISABLED 0
-#define T38_TRANSPARENT 1
-#define T38_FAXGW 2
+#define T38_ENABLED 1
+#define T38_FAXGW 1
 
 /* Channel description */
 static const char type[] = "OOH323";
@@ -85,7 +78,6 @@
 static int ooh323_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
 
 static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
-static void ast_ooh323c_exit();
 
 
 static const struct ast_channel_tech ooh323_tech = {
@@ -138,7 +130,6 @@
 	int faxmode;
 	int t38_tx_enable;
 	int t38_init;
-	t38_gateway_state_t t38r_state;
 	struct sockaddr_in udptlredirip;
 	time_t lastTxT38;
 	int chmodepend;
@@ -1099,42 +1090,6 @@
 			}
 
 
-/* if we are in fax t30-t38 transparent mode */
-
-			if (p->faxmode && p->t38support == T38_TRANSPARENT) {
-				if (f->subclass == AST_FORMAT_SLINEAR) {
-                        		t38data = f->data.ptr;
-                        		t38samples = f->samples;
-                 		} else {
-				 	t38samples = 0;
-					ast_verbose("Got non-slin frame for %s in transparent fax mode\n",
-						ast->name);
-					ast_set_write_format(ast, AST_FORMAT_SLINEAR);
-					ast_set_read_format(ast, AST_FORMAT_SLINEAR);
-					ast_mutex_unlock(&p->lock);
-					return 0;
-				}
-
-                 		if (t38samples) {
-                        		t38_gateway_rx(&p->t38r_state, t38data, t38samples);
-					if (gH323Debug)
-						ast_debug(4, "t38gw_rx %d\n", t38samples);
-				}
-
-                        	res = f->samples;
-                		time_t ct = time(NULL);
-                		if (ct - p->lastTxT38 > T38TOAUDIOTIMEOUT && !p->chmodepend) {
-					if (gH323Debug)
-                        			ast_verbose("request to change %s to audio because"
-							 "t38 timeout\n", ast->name);
-					ooRequestChangeMode(p->callToken, 0);
-                        		p->chmodepend = 1;
-                        	} 
-				ast_mutex_unlock(&p->lock);
-				return res;
-			}
-
-
 			if (!(f->subclass & ast->nativeformats)) {
 				if (ast->nativeformats != 0) {
 					ast_log(LOG_WARNING, "Asked to transmit frame type %d,"
@@ -1240,7 +1195,7 @@
 		break;
 
       case AST_CONTROL_T38_PARAMETERS:
-		if (p->t38support != T38_FAXGW) {
+		if (p->t38support != T38_ENABLED) {
 			struct ast_control_t38_parameters parameters = { .request_response = 0 };
 			parameters.request_response = AST_T38_REFUSED;
 			ast_queue_control_data(ast, AST_CONTROL_T38_PARAMETERS,
@@ -2199,9 +2154,7 @@
 				else if (!strcasecmp(v->value, "faxgw"))
 					user->t38support = T38_FAXGW;
 				else if (!strcasecmp(v->value, "yes"))
-					user->t38support = T38_FAXGW;
-				else if (!strcasecmp(v->value, "transparent"))
-					user->t38support = T38_TRANSPARENT;
+					user->t38support = T38_ENABLED;
 			}
 			v = v->next;
 		}
@@ -2329,9 +2282,7 @@
 				else if (!strcasecmp(v->value, "faxgw"))
 					peer->t38support = T38_FAXGW;
 				else if (!strcasecmp(v->value, "yes"))
-					peer->t38support = T38_FAXGW;
-				else if (!strcasecmp(v->value, "transparent"))
-					peer->t38support = T38_TRANSPARENT;
+					peer->t38support = T38_ENABLED;
 			}
 			v = v->next;
 		}
@@ -2647,9 +2598,7 @@
 			else if (!strcasecmp(v->value, "faxgw"))
 				gT38Support = T38_FAXGW;
 			else if (!strcasecmp(v->value, "yes"))
-				gT38Support = T38_FAXGW;
-			else if (!strcasecmp(v->value, "transparent"))
-				gT38Support = T38_TRANSPARENT;
+				gT38Support = T38_ENABLED;
 		} else if (!strcasecmp(v->name, "tracelevel")) {
 			gTRCLVL = atoi(v->value);
 			ooH323EpSetTraceLevel(gTRCLVL);
@@ -2771,8 +2720,6 @@
 	ast_cli(a->fd,"%-15s", "T.38 Mode: ");
 	if (peer->t38support == T38_DISABLED)
 		ast_cli(a->fd, "%s\n", "disabled");
-	else if (peer->t38support == T38_TRANSPARENT)
-		ast_cli(a->fd, "%s\n", "audio-transparent");
 	else if (peer->t38support == T38_FAXGW)
 		ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
 
@@ -2911,11 +2858,9 @@
 		else
          ast_cli(a->fd, "%s\n", "unknown");
 
-   ast_cli(a->fd,"%-15s", "T.38 Mode: ");
+   	ast_cli(a->fd,"%-15s", "T.38 Mode: ");
 	if (user->t38support == T38_DISABLED)
 		ast_cli(a->fd, "%s\n", "disabled");
-	else if (user->t38support == T38_TRANSPARENT)
-		ast_cli(a->fd, "%s\n", "audio-transparent");
 	else if (user->t38support == T38_FAXGW)
 		ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
 
@@ -3087,13 +3032,11 @@
 		else if (gDTMFMode & H323_DTMF_INBAND)
          ast_cli(a->fd, "%s\n", "inband");
 	else
-      ast_cli(a->fd, "%s\n", "unknown");
-
-   ast_cli(a->fd,"%-20s", "T.38 Mode: ");
+		ast_cli(a->fd, "%s\n", "unknown");
+
+   	ast_cli(a->fd,"%-20s", "T.38 Mode: ");
 	if (gT38Support == T38_DISABLED)
 		ast_cli(a->fd, "%s\n", "disabled");
-	else if (gT38Support == T38_TRANSPARENT)
-		ast_cli(a->fd, "%s\n", "audio-transparent");
 	else if (gT38Support == T38_FAXGW)
 		ast_cli(a->fd, "%s\n", "faxgw/chan_sip compatible");
 
@@ -4012,7 +3955,7 @@
 	ast_udptl_set_peer(p->udptl, &them);
 	p->t38_tx_enable = 1;
 	p->lastTxT38 = time(NULL);
-	if (p->t38support == T38_FAXGW) {
+	if (p->t38support == T38_ENABLED) {
 		struct ast_control_t38_parameters parameters = { .request_response = 0 };
 		parameters.request_response = AST_T38_NEGOTIATED;
 		ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
@@ -4063,7 +4006,7 @@
 	}
 
 	p->t38_tx_enable = 0;
-	if (p->t38support == T38_FAXGW) {
+	if (p->t38support == T38_ENABLED) {
 		struct ast_control_t38_parameters parameters = { .request_response = 0 };
 		parameters.request_response = AST_T38_TERMINATED;
 		ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
@@ -4131,27 +4074,11 @@
 		f = ast_udptl_read(p->udptl);		/* UDPTL t.38 data */
 		if (gH323Debug) ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
 				f->frametype, f->subclass, f->datalen, ast->name);
-
-/* if not transparent audio t.38 mode */
-		if (p->t38support != T38_TRANSPARENT)
-			break;
-
-		if (!p->faxmode) p->faxmode = 1;
-		if (p->t38_init) {
-			t38_core_rx_ifp_packet(&p->t38r_state.t38x.t38, (uint8_t *)f->data.ptr,
-                                         f->datalen, 0);
-			p->lastTxT38 = time(NULL);
-                }
-                f = &null_frame;
-                break;
+		break;
 
 	default:
 		f = &null_frame;
 	}
-
-	/* Don't send RFC2833 if we're not supposed to */
-   	/* if (f && (f->frametype == AST_FRAME_DTMF) && !(p->dtmfmode & H323_DTMF_RFC2833)) {
-      		return &null_frame; */
 
 	if (p->owner) {
 		/* We already hold the channel lock */
@@ -4162,8 +4089,6 @@
 				ast_set_read_format(p->owner, p->owner->readformat);
 				ast_set_write_format(p->owner, p->owner->writeformat);
 			}
-			/* if (!p->owner->readformat)
-				p->owner->readformat = p->owner->nativeformats; */
 
 			if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad &&
 				(f->subclass == AST_FORMAT_SLINEAR || f->subclass == AST_FORMAT_ALAW ||
@@ -4177,95 +4102,6 @@
 	return f;
 }
 
-static int t30_read(const void *data) {
-
-	struct ast_channel *c = (struct ast_channel *) data;
-	struct ooh323_pvt *p = (struct ooh323_pvt *) c->tech_pvt;
-	int len;
-
-	static uint8_t buffer[AST_FRIENDLY_OFFSET + MAXT30 * sizeof(uint16_t)];
-	int16_t *buf = (int16_t *) (buffer + AST_FRIENDLY_OFFSET);
-	static struct ast_frame outf = {
-		.frametype = AST_FRAME_VOICE,
-		.subclass = AST_FORMAT_SLINEAR,
-	};
-
-
-	if (!p) {
-		ast_log(LOG_ERROR, "No private structure for %s\n", c->name);
-		return 0;
-	}
-
-	ast_mutex_lock(&p->lock);
-
-	if (p->owner) {
-		while (p->owner && ast_channel_trylock(c)) {
-			ast_debug(1,"Failed to grab lock, trying again\n");
-			ast_mutex_unlock(&p->lock);
-			usleep(1);
-			ast_mutex_lock(&p->lock);
-		}
-		if (!p->owner) {
-			ast_mutex_unlock(&p->lock);
-			ast_log(LOG_ERROR, "Channel has no owner\n");
-			return 0;
-		}
-	} else {
-		ast_mutex_unlock(&p->lock);
-		ast_log(LOG_ERROR, "Channel has no owner\n");
-		return 0;
-	}
-
-
-
-	if (p->faxmode && p->t38_init && p->t38_tx_enable) {
-
-
-		if ((len = t38_gateway_tx(&p->t38r_state, buf, MAXT30))) {
-
-			outf.samples = len;
-			AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET,
-						len * sizeof(int16_t));
-			ast_queue_frame(c, &outf);
-
-		}
-	}
-
-	ast_channel_unlock(c);
-	ast_mutex_unlock(&p->lock);
-	return 0;
-}
-
-
-static int t38_tx_packet_handler(t38_core_state_t *s, void *data,
-                		unsigned int* buf, int len, int cout)
-{
-        struct ast_frame f = { AST_FRAME_MODEM, AST_MODEM_T38 };
-        struct ooh323_pvt* p = (struct ooh323_pvt*) data;
-        int res;
-        f.datalen = len;
-        f.data.ptr = buf;
-        f.offset = 0;
-
-        if (gH323Debug)
-         ast_debug(1, "Sending UDPTL packet of %d bytes\n", len);
-        if (p) {
-                ast_mutex_lock(&p->lock);
-                if (p->udptl) {
-                        res = ast_udptl_write(p->udptl, &f);
-                        p->lastTxT38 = time(NULL);
-                }
-                ast_mutex_unlock(&p->lock);
-        }
-        return 0;
-
-}
-
-static void span_message(int level, const char* msg) {
-        if (gH323Debug) ast_debug(1, msg);
-}
-
-
 void onModeChanged(ooCallData *call, int t38mode) {
         struct ooh323_pvt *p;
         struct ast_frame f;
@@ -4310,7 +4146,8 @@
 	if (t38mode) {
 
 
-		if (p->t38support == T38_FAXGW) {
+		if (p->t38support == T38_ENABLED) {
+
 /* AST_T38_CONTROL mode */
 
 			struct ast_control_t38_parameters parameters = { .request_response = 0 };
@@ -4319,49 +4156,9 @@
 							&parameters, sizeof(parameters));
 			p->faxmode = 1;
 
-		} else if (t38_gateway_init(&p->t38r_state, t38_tx_packet_handler, p)) {
-/* transparent slinear mode */
-
-			p->t38_init = 1;
-
-			t38_gateway_set_transmit_on_idle(&p->t38r_state, FALSE);
-
-			span_log_set_tag(&p->t38r_state.logging, "T.38G");
-			span_log_set_tag(&p->t38r_state.t38x.t38.logging, "T.38");
-
-			span_log_set_message_handler(&p->t38r_state.logging, span_message);
-			span_log_set_message_handler(&p->t38r_state.t38x.t38.logging, span_message);
-
-			span_log_set_level(&p->t38r_state.logging,
-				SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-			span_log_set_level(&p->t38r_state.t38x.t38.logging,
-				SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
-
-
-			t38_set_t38_version(&p->t38r_state.t38x.t38, 0);
-
-			t38_set_sequence_number_handling(&p->t38r_state.t38x.t38,0);
-
-			t38_gateway_set_ecm_capability(&p->t38r_state, 1);
-
-			t38_gateway_set_tep_mode(&p->t38r_state, TRUE);
-
-			t38_gateway_set_supported_modems(&p->t38r_state,
-				T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER);
-
-			if (gH323Debug)
-				ast_debug(1,"Going to change native format for %s\n", call->callToken);
-			p->owner->nativeformats = AST_FORMAT_SLINEAR;
-			p->owner->rawreadformat = AST_FORMAT_SLINEAR;
-			p->owner->rawwriteformat = AST_FORMAT_SLINEAR;
-			ast_set_read_format(p->owner, p->owner->rawreadformat);
-			ast_set_write_format(p->owner, p->owner->rawwriteformat);
-			p->faxmode = 1;
-			ast_settimeout(p->owner, 34, t30_read, p->owner);
-			p->lastTxT38 = time(NULL);
 		}
 	} else {
-		if (p->t38support == T38_FAXGW) {
+		if (p->t38support == T38_ENABLED) {
 			struct ast_control_t38_parameters parameters = { .request_response = 0 };
 			parameters.request_response = AST_T38_REQUEST_TERMINATE;
 			ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, 




More information about the svn-commits mailing list