[svn-commits] branch oej/siptransfer r27721 - in /team/oej/siptransfer: ./ apps/ channels/ ...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed May 17 00:33:33 MST 2006


Author: oej
Date: Wed May 17 02:33:33 2006
New Revision: 27721

URL: http://svn.digium.com/view/asterisk?rev=27721&view=rev
Log:
Updating to trunk

Modified:
    team/oej/siptransfer/   (props changed)
    team/oej/siptransfer/apps/app_channelredirect.c
    team/oej/siptransfer/apps/app_dial.c
    team/oej/siptransfer/apps/app_settransfercapability.c
    team/oej/siptransfer/apps/app_voicemail.c
    team/oej/siptransfer/channel.c
    team/oej/siptransfer/channels/chan_misdn.c
    team/oej/siptransfer/channels/chan_sip.c
    team/oej/siptransfer/channels/chan_zap.c
    team/oej/siptransfer/channels/misdn/isdn_lib.c
    team/oej/siptransfer/channels/misdn/isdn_lib.h
    team/oej/siptransfer/channels/misdn/isdn_msg_parser.c
    team/oej/siptransfer/funcs/func_odbc.c
    team/oej/siptransfer/include/asterisk/frame.h
    team/oej/siptransfer/include/asterisk/rtp.h
    team/oej/siptransfer/rtp.c

Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 17 02:33:33 2006
@@ -1,1 +1,1 @@
-/trunk:1-27339
+/trunk:1-27720

Modified: team/oej/siptransfer/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_channelredirect.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_channelredirect.c (original)
+++ team/oej/siptransfer/apps/app_channelredirect.c Wed May 17 02:33:33 2006
@@ -40,6 +40,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
 #include "asterisk/features.h"
+#include "asterisk/options.h"
 
 static char *app = "ChannelRedirect";
 static char *synopsis = "Redirects given channel to a dialplan target.";
@@ -105,7 +106,8 @@
 		goto chanquit;
 	}
 
-	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
 
 	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
 		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);

Modified: team/oej/siptransfer/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_dial.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_dial.c (original)
+++ team/oej/siptransfer/apps/app_dial.c Wed May 17 02:33:33 2006
@@ -472,6 +472,8 @@
 					c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
 					if (!c)
 						ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
+					else
+						ast_channel_inherit_variables(in, o->chan);
 				} else {
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", c->name);
@@ -1051,6 +1053,8 @@
 				tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
 				if (!tmp->chan)
 					ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
+				else
+					ast_channel_inherit_variables(chan, tmp->chan);
 			} else {
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tmp->chan->name);

Modified: team/oej/siptransfer/apps/app_settransfercapability.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_settransfercapability.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_settransfercapability.c (original)
+++ team/oej/siptransfer/apps/app_settransfercapability.c Wed May 17 02:33:33 2006
@@ -65,7 +65,7 @@
 "  RESTRICTED_DIGITAL : 0x09 - Restricted digital information\n"
 "  3K1AUDIO           : 0x10 - 3.1kHz Audio (fax calls)\n"
 "  DIGITAL_W_TONES    : 0x11 - Unrestricted digital information with tones/announcements\n"
-"  VIDEO              : 0x18 - Video:\n"
+"  VIDEO              : 0x18 - Video\n"
 "\n"
 ;
 

Modified: team/oej/siptransfer/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_voicemail.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_voicemail.c (original)
+++ team/oej/siptransfer/apps/app_voicemail.c Wed May 17 02:33:33 2006
@@ -2413,17 +2413,17 @@
 
 static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
 {
-	char tmptxtfile[256], txtfile[256];
+	char txtfile[256], tmptxtfile[256];
 	char callerid[256];
 	FILE *txt;
-	int res = 0;
+	int res = 0, txtdes;
 	int msgnum;
 	int duration = 0;
 	int ausemacro = 0;
 	int ousemacro = 0;
 	int ouseexten = 0;
 	char date[256];
-	char dir[256];
+	char dir[256], tmpdir[260];
 	char fn[256];
 	char prefile[256]="";
 	char tempfile[256]="";
@@ -2475,6 +2475,7 @@
 	DISPOSE(tempfile, -1);
 	/* It's easier just to try to make it than to check for its existence */
 	create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
+	create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp");
 
 	/* Check current or macro-calling context for special extensions */
 	if (ast_test_flag(vmu, VM_OPERATOR)) {
@@ -2579,121 +2580,129 @@
 	if (!ast_strlen_zero(fmt)) {
 		msgnum = 0;
 
-		if (vm_lock_path(dir)) {
-			free_user(vmu);
-			return ERROR_LOCK_PATH;
-		}
-
-		/* 
-		 * This operation can be very expensive if done say over NFS or if the mailbox has 100+ messages
-		 * in the folder.  So we should get this first so we don't cut off the first few seconds of the 
-		 * message.  
-		 */
-		do {
-			make_file(fn, sizeof(fn), dir, msgnum);
-			if (!EXISTS(dir,msgnum,fn,chan->language))
-				break;
-			msgnum++;
-		} while (msgnum < vmu->maxmsg);
+		if (count_messages(vmu, dir) >= vmu->maxmsg) {
+			res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
+			if (!res)
+				res = ast_waitstream(chan, "");
+			ast_log(LOG_WARNING, "No more messages possible\n");
+			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+			goto leave_vm_out;
+		}
+
+		snprintf(tmptxtfile, sizeof(tmptxtfile), "%s/XXXXXX", tmpdir);
+		txtdes = mkstemp(tmptxtfile);
+		if (txtdes < 0) {
+			res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
+			if (!res)
+				res = ast_waitstream(chan, "");
+			ast_log(LOG_ERROR, "Unable to create message file: %s\n", strerror(errno));
+			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+			goto leave_vm_out;
+		}
 
 		/* Now play the beep once we have the message number for our next message. */
 		if (res >= 0) {
 			/* Unless we're *really* silent, try to send the beep */
 			res = ast_stream_and_wait(chan, "beep", chan->language, "");
 		}
-		if (msgnum < vmu->maxmsg) {
-			/* assign a variable with the name of the voicemail file */	  
-			pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);
-				
-			/* Store information */
-			snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
-			snprintf(tmptxtfile, sizeof(tmptxtfile), "%s.txt.tmp", fn);
-			txt = fopen(tmptxtfile, "w+");
-			if (txt) {
-				get_date(date, sizeof(date));
-				fprintf(txt, 
-					";\n"
-					"; Message Information file\n"
-					";\n"
-					"[message]\n"
-					"origmailbox=%s\n"
-					"context=%s\n"
-					"macrocontext=%s\n"
-					"exten=%s\n"
-					"priority=%d\n"
-					"callerchan=%s\n"
-					"callerid=%s\n"
-					"origdate=%s\n"
-					"origtime=%ld\n"
-					"category=%s\n",
-					ext,
-					chan->context,
-					chan->macrocontext, 
-					chan->exten,
-					chan->priority,
-					chan->name,
-					ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
-					date, (long)time(NULL),
-					category ? category : ""); 
-			} else
-				ast_log(LOG_WARNING, "Error opening text file for output\n");
-			res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir, options->record_gain);
-			if (res == '0') {
-				if (txt && EXISTS(dir,msgnum,fn,chan->language)) {
-					fclose(txt);
-					rename(tmptxtfile, txtfile);
-				} else if (txt && !EXISTS(dir,msgnum,fn,chan->language)) {
-					if (option_debug) 
-						ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n");
-					fclose(txt);
-					unlink(tmptxtfile);	
-				}
-				goto transfer;
-			}
-			if (res > 0)
-				res = 0;
-			if (txt) {
-				fprintf(txt, "duration=%d\n", duration);
-				fclose(txt);
-				rename(tmptxtfile, txtfile);
-			}
-				
+
+		/* Store information */
+		txt = fdopen(txtdes, "w+");
+		if (txt) {
+			get_date(date, sizeof(date));
+			fprintf(txt, 
+				";\n"
+				"; Message Information file\n"
+				";\n"
+				"[message]\n"
+				"origmailbox=%s\n"
+				"context=%s\n"
+				"macrocontext=%s\n"
+				"exten=%s\n"
+				"priority=%d\n"
+				"callerchan=%s\n"
+				"callerid=%s\n"
+				"origdate=%s\n"
+				"origtime=%ld\n"
+				"category=%s\n",
+				ext,
+				chan->context,
+				chan->macrocontext, 
+				chan->exten,
+				chan->priority,
+				chan->name,
+				ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
+				date, (long)time(NULL),
+				category ? category : ""); 
+		} else
+			ast_log(LOG_WARNING, "Error opening text file for output\n");
+		res = play_record_review(chan, NULL, tmptxtfile, vmmaxmessage, fmt, 1, vmu, &duration, NULL, options->record_gain);
+
+		if (txt) {
 			if (duration < vmminmessage) {
 				if (option_verbose > 2) 
 					ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);
 				DELETE(dir,msgnum,fn);
-				/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
-				pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
-				goto leave_vm_out;
-			}
-			/* Are there to be more recipients of this message? */
-			while (tmpptr) {
-				struct ast_vm_user recipu, *recip;
-				char *exten, *context;
-					
-				exten = strsep(&tmpptr, "&");
-				context = strchr(exten, '@');
-				if (context) {
-					*context = '\0';
-					context++;
+			} else {
+				fprintf(txt, "duration=%d\n", duration);
+				fclose(txt);
+				if (vm_lock_path(dir)) {
+					ast_log(LOG_ERROR, "Couldn't lock directory %s.  Voicemail will be lost.\n", dir);
+					/* Delete files */
+					ast_filedelete(tmptxtfile, NULL);
+					unlink(tmptxtfile);
+				} else {
+					for (;;) {
+						make_file(fn, sizeof(fn), dir, msgnum);
+						if (!EXISTS(dir, msgnum, fn, NULL))
+							break;
+						msgnum++;
+					}
+
+					/* assign a variable with the name of the voicemail file */	  
+					pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);
+
+					snprintf(txtfile, sizeof(txtfile), "%s.txt", fn);
+					ast_filerename(tmptxtfile, fn, NULL);
+					rename(tmptxtfile, txtfile);
+
+					ast_unlock_path(dir);
+
+					/* Are there to be more recipients of this message? */
+					while (tmpptr) {
+						struct ast_vm_user recipu, *recip;
+						char *exten, *context;
+
+						exten = strsep(&tmpptr, "&");
+						context = strchr(exten, '@');
+						if (context) {
+							*context = '\0';
+							context++;
+						}
+						if ((recip = find_user(&recipu, context, exten))) {
+							copy_message(chan, vmu, 0, msgnum, duration, recip, fmt);
+							free_user(recip);
+						}
+					}
+					if (ast_fileexists(fn, NULL, NULL)) {
+						STORE(dir, vmu->mailbox, vmu->context, msgnum);
+						notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
+						DISPOSE(dir, msgnum);
+					}
 				}
-				if ((recip = find_user(&recipu, context, exten))) {
-					copy_message(chan, vmu, 0, msgnum, duration, recip, fmt);
-					free_user(recip);
-				}
-			}
-			if (ast_fileexists(fn, NULL, NULL)) {
-				STORE(dir, vmu->mailbox, vmu->context, msgnum);
-				notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
-				DISPOSE(dir, msgnum);
-			}
+			}
+		}
+
+		if (res == '0') {
+			goto transfer;
+		} else if (res > 0)
+			res = 0;
+
+		if (duration < vmminmessage)
+			/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
+			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+		else
 			pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
-		} else {
-			ast_unlock_path(dir);
-			res = ast_stream_and_wait(chan, "vm-mailboxfull", chan->language, "");
-			ast_log(LOG_WARNING, "No more messages possible\n");
-			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
-		}
 	} else
 		ast_log(LOG_WARNING, "No format for saving voicemail?\n");
  leave_vm_out:

Modified: team/oej/siptransfer/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channel.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channel.c (original)
+++ team/oej/siptransfer/channel.c Wed May 17 02:33:33 2006
@@ -1956,9 +1956,11 @@
 			if (f->subclass == AST_CONTROL_ANSWER) {
 				if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
 					ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
+					ast_frfree(f);
 					f = &ast_null_frame;
 				} else if (prestate == AST_STATE_UP) {
 					ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
+					ast_frfree(f);
 					f = &ast_null_frame;
 				} else {
 					/* Answer the CDR */
@@ -1974,6 +1976,7 @@
 					chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
 				else
 					ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
+				ast_frfree(f);
 				f = &ast_null_frame;
 			}
 			break;

Modified: team/oej/siptransfer/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_misdn.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_misdn.c (original)
+++ team/oej/siptransfer/channels/chan_misdn.c Wed May 17 02:33:33 2006
@@ -105,6 +105,7 @@
 
 
 
+
 /* BEGIN: chan_misdn.h */
 
 
@@ -206,6 +207,12 @@
 };
 static struct robin_list *robin = NULL;
 
+
+
+struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame *frame);
+
+
+
 static inline void free_robin_list_r (struct robin_list *r)
 {
         if (r) {
@@ -300,6 +307,9 @@
 static int misdn_facility_exec(struct ast_channel *chan, void *data);
 
 int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
+
+
+void debug_numplan(int port, int numplan, char *type);
 
 /*************** Helpers *****************/
 
@@ -1227,6 +1237,28 @@
 }
 
 
+void debug_numplan(int port, int numplan, char *type)
+{
+	switch (numplan) {
+	case NUMPLAN_INTERNATIONAL:
+		chan_misdn_log(2, port, " --> %s: International\n",type);
+		break;
+	case NUMPLAN_NATIONAL:
+		chan_misdn_log(2, port, " --> %s: National\n",type);
+		break;
+	case NUMPLAN_SUBSCRIBER:
+		chan_misdn_log(2, port, " --> %s: Subscriber\n",type);
+		break;
+	case NUMPLAN_UNKNOWN:
+		chan_misdn_log(2, port, " --> %s: Unknown\n",type);
+		break;
+		/* Maybe we should cut off the prefix if present ? */
+	default:
+		chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
+		break;
+	}
+}
+
 static int read_config(struct chan_list *ch, int orig) {
 
 	if (!ch) {
@@ -1291,8 +1323,7 @@
 	
 	misdn_cfg_get( bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
 	
-	ast_copy_string (ast->context,ch->context,sizeof(ast->context));
-	
+	ast_copy_string (ast->context,ch->context,sizeof(ast->context));	
 	{
 		int ec, ectr;
 		
@@ -1311,7 +1342,6 @@
 		}
 	}
 	
-	
 	{
 		int eb3;
 		
@@ -1321,7 +1351,6 @@
 	
 	port=bc->port;
 	
-
 	{
 		char buf[256];
 		ast_group_t pg,cg;
@@ -1334,10 +1363,8 @@
 		ast->callgroup=cg;
 	}
 	
-	
 	if ( orig  == ORG_AST) {
 		misdn_cfg_get( port, MISDN_CFG_TE_CHOOSE_CHANNEL, &(bc->te_choose_channel), sizeof(int));
-		
 		
 		{
 			char callerid[BUFFERSIZE+1];
@@ -1354,67 +1381,11 @@
 
 			
 			misdn_cfg_get( port, MISDN_CFG_DIALPLAN, &bc->dnumplan, sizeof(int));
-			switch (bc->dnumplan) {
-			case NUMPLAN_INTERNATIONAL:
-				chan_misdn_log(2, port, " --> TON: International\n");
-				break;
-			case NUMPLAN_NATIONAL:
-				chan_misdn_log(2, port, " --> TON: National\n");
-				break;
-			case NUMPLAN_SUBSCRIBER:
-				chan_misdn_log(2, port, " --> TON: Subscriber\n");
-				break;
-			case NUMPLAN_UNKNOWN:
-				chan_misdn_log(2, port, " --> TON: Unknown\n");
-				break;
-				/* Maybe we should cut off the prefix if present ? */
-			default:
-				chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
-				break;
-			}
-
-
 			misdn_cfg_get( port, MISDN_CFG_LOCALDIALPLAN, &bc->onumplan, sizeof(int));
-			switch (bc->onumplan) {
-			case NUMPLAN_INTERNATIONAL:
-				chan_misdn_log(2, port, " --> LTON: International\n");
-				break;
-			case NUMPLAN_NATIONAL:
-				chan_misdn_log(2, port, " --> LTON: National\n");
-				break;
-			case NUMPLAN_SUBSCRIBER:
-				chan_misdn_log(2, port, " --> LTON: Subscriber\n");
-				break;
-			case NUMPLAN_UNKNOWN:
-				chan_misdn_log(2, port, " --> LTON: Unknown\n");
-				break;
-				/* Maybe we should cut off the prefix if present ? */
-			default:
-					chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
-					break;
-			}
-
 			misdn_cfg_get( port, MISDN_CFG_CPNDIALPLAN, &bc->cpnnumplan, sizeof(int));
-
-			switch (bc->cpnnumplan) {
-			case NUMPLAN_INTERNATIONAL:
-				chan_misdn_log(2, port, " --> CTON: International\n");
-				break;
-			case NUMPLAN_NATIONAL:
-				chan_misdn_log(2, port, " --> CTON: National\n");
-				break;
-			case NUMPLAN_SUBSCRIBER:
-				chan_misdn_log(2, port, " --> CTON: Subscriber\n");
-				break;
-			case NUMPLAN_UNKNOWN:
-				chan_misdn_log(2, port, " --> CTON: Unknown\n");
-				break;
-				/* Maybe we should cut off the prefix if present ? */
-			default:
-					chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
-					break;
-			}
-
+			debug_numplan(port, bc->dnumplan,"TON");
+			debug_numplan(port, bc->onumplan,"LTON");
+			debug_numplan(port, bc->cpnnumplan,"CTON");
 		}
 
 		
@@ -1422,25 +1393,7 @@
 	} else { /** ORIGINATOR MISDN **/
 	
 		misdn_cfg_get( port, MISDN_CFG_CPNDIALPLAN, &bc->cpnnumplan, sizeof(int));
-
-		switch (bc->cpnnumplan) {
-			case NUMPLAN_INTERNATIONAL:
-				chan_misdn_log(2, port, " --> CTON: International\n");
-				break;
-			case NUMPLAN_NATIONAL:
-				chan_misdn_log(2, port, " --> CTON: National\n");
-				break;
-			case NUMPLAN_SUBSCRIBER:
-				chan_misdn_log(2, port, " --> CTON: Subscriber\n");
-				break;
-			case NUMPLAN_UNKNOWN:
-				chan_misdn_log(2, port, " --> CTON: Unknown\n");
-				break;
-				/* Maybe we should cut off the prefix if present ? */
-			default:
-				chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
-				break;
-		}
+		debug_numplan(port, bc->cpnnumplan,"CTON");
 		
 		char prefix[BUFFERSIZE+1]="";
 		switch( bc->onumplan ) {
@@ -1451,14 +1404,6 @@
 		case NUMPLAN_NATIONAL:
 			misdn_cfg_get( bc->port, MISDN_CFG_NATPREFIX, prefix, BUFFERSIZE);
 			break;
-			
-			
-		case NUMPLAN_SUBSCRIBER:
-			/* dunno what to do here ? */
-			break;
-			
-		case NUMPLAN_UNKNOWN:
-				break;
 		default:
 			break;
 		}
@@ -1471,7 +1416,6 @@
 			strcpy(bc->oad,tmp);
 		}
 		
-		
 		if (!ast_strlen_zero(bc->dad)) {
 			ast_copy_string(bc->orig_dad,bc->dad, sizeof(bc->orig_dad));
 		}
@@ -1479,23 +1423,15 @@
 		if ( ast_strlen_zero(bc->dad) && !ast_strlen_zero(bc->keypad)) {
 			ast_copy_string(bc->dad,bc->keypad, sizeof(bc->dad));
 		}
+
 		prefix[0] = 0;
 		
 		switch( bc->dnumplan ) {
 		case NUMPLAN_INTERNATIONAL:
 			misdn_cfg_get( bc->port, MISDN_CFG_INTERNATPREFIX, prefix, BUFFERSIZE);
 			break;
-			
-			case NUMPLAN_NATIONAL:
-				misdn_cfg_get( bc->port, MISDN_CFG_NATPREFIX, prefix, BUFFERSIZE);
-				break;
-				
-				
-		case NUMPLAN_SUBSCRIBER:
-				/* dunno what to do here ? */
-			break;
-			
-		case NUMPLAN_UNKNOWN:
+		case NUMPLAN_NATIONAL:
+			misdn_cfg_get( bc->port, MISDN_CFG_NATPREFIX, prefix, BUFFERSIZE);
 			break;
 		default:
 			break;
@@ -1520,7 +1456,8 @@
 				free(ast->cid.cid_rdnis);
 			ast->cid.cid_rdnis = strdup(bc->rad);
 		}
-	}
+	} /* ORIG MISDN END */
+
 	return 0;
 }
 
@@ -1552,10 +1489,7 @@
 				chan_misdn_log(-1,0,"misdn_call: No Extension given!\n");
 				return -1;
 			}
-			
-		}
-		
-		
+		}
 	}
 
 	if (!ast) {
@@ -1570,7 +1504,6 @@
 		return -1;
 	}
 
-
 	if (!ch) {
 		ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name);
 		ast->hangupcause=41;
@@ -1591,12 +1524,9 @@
 	strncpy(newbc->dad,ext,sizeof( newbc->dad));
 	strncpy(ast->exten,ext,sizeof(ast->exten));
 	
-	
 	chan_misdn_log(1, port, "* CALL: %s\n",dest);
 	
 	chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
-	
-	
 	
 	chan_misdn_log(3, port, " --> * adding2newbc ext %s\n",ast->exten);
 	if (ast->exten) {
@@ -1637,7 +1567,6 @@
 			misdn_set_opt_exec(ast,opts);
 		else
 			chan_misdn_log(2,port,"NO OPTS GIVEN\n");
-		
 		
 		ch->state=MISDN_CALLING;
 		
@@ -1798,7 +1727,7 @@
 
 
 
-static int misdn_indication(struct ast_channel *ast, int cond)
+static int misdn_indication(struct ast_channel *ast, int cond, const void *data, size_t datalen)
 {
 	struct chan_list *p;
 
@@ -2051,52 +1980,69 @@
 	return 0;
 }
 
+
+struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame *frame)
+{
+	struct ast_frame *f,*f2;
+	if (tmp->trans)
+		f2=ast_translate(tmp->trans, frame,0);
+	else {
+		chan_misdn_log(0, tmp->bc->port, "No T-Path found\n");
+		return NULL;
+	}
+	
+	f = ast_dsp_process(tmp->ast, tmp->dsp, f2);
+	if (f && (f->frametype == AST_FRAME_DTMF)) {
+		ast_log(LOG_DEBUG, "Detected inband DTMF digit: %c", f->subclass);
+		if (f->subclass == 'f' && tmp->faxdetect) {
+			/* Fax tone -- Handle and return NULL */
+			struct ast_channel *ast = tmp->ast;
+			if (!tmp->faxhandled) {
+				tmp->faxhandled++;
+				if (strcmp(ast->exten, "fax")) {
+					if (ast_exists_extension(ast, ast_strlen_zero(ast->macrocontext)? ast->context : ast->macrocontext, "fax", 1, AST_CID_P(ast))) {
+						if (option_verbose > 2)
+							ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name);
+						/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
+						pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten);
+						if (ast_async_goto(ast, ast->context, "fax", 1))
+							ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, ast->context);
+					} else
+						ast_log(LOG_NOTICE, "Fax detected, but no fax extension ctx:%s exten:%s\n",ast->context, ast->exten);
+				} else
+					ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
+			} else
+				ast_log(LOG_DEBUG, "Fax already handled\n");
+			
+		}  else if ( tmp->ast_dsp) {
+			chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n",f->subclass);
+			return f;
+		}
+	}
+
+	frame->frametype = AST_FRAME_NULL;
+	frame->subclass = 0;
+	return frame;
+}
+
+
 static struct ast_frame  *misdn_read(struct ast_channel *ast)
 {
 	struct chan_list *tmp;
-	
-	char blah[255];
-	int len =0 ;
+	int len;
 	
 	if (!ast) return NULL;
 	if (! (tmp=MISDN_ASTERISK_TECH_PVT(ast)) ) return NULL;
 	if (!tmp->bc) return NULL;
 	
-	
-	read(tmp->pipe[0],blah,sizeof(blah));
-	
-	len = misdn_ibuf_usedcount(tmp->bc->astbuf);
-
-	if (!len) {
-		struct ast_frame *frame;
-		if(!tmp->zero_read_cnt)
-			chan_misdn_log(4,tmp->bc->port,"misdn_read: ZERO READ\n");
-		tmp->zero_read_cnt++;
-
-		if (tmp->zero_read_cnt > 5000) {
-			chan_misdn_log(4,tmp->bc->port,"misdn_read: ZERO READ counted > 5000 times\n");
-			tmp->zero_read_cnt=0;
-
-		}
-
-               /*faking Voice Frame*/
-		tmp->frame.frametype = AST_FRAME_VOICE;
-		tmp->frame.subclass = AST_FORMAT_ALAW;
-		memset(tmp->ast_rd_buf,0,128);
-		tmp->frame.data = tmp->ast_rd_buf ;
-		tmp->frame.mallocd =0 ;
-		tmp->frame.datalen = 128;
-		tmp->frame.samples = 128;
-
-		frame=ast_frisolate(&tmp->frame);
-		return frame;
-	}
-
-	/*shrinken len if necessary, we transmit at maximum 4k*/
-	len = len<=sizeof(tmp->ast_rd_buf)?len:sizeof(tmp->ast_rd_buf);
-	
-	misdn_ibuf_memcpy_r(tmp->ast_rd_buf, tmp->bc->astbuf,len);
-	
+	len=read(tmp->pipe[0],tmp->ast_rd_buf,sizeof(tmp->ast_rd_buf));
+
+	if (len<=0) {
+		/* we hangup here, since our pipe is closed */
+		chan_misdn_log(2,tmp->bc->port,"misdn_read: Pipe closed, hanging up\n");
+		return NULL;
+	}
+
 	tmp->frame.frametype  = AST_FRAME_VOICE;
 	tmp->frame.subclass = AST_FORMAT_ALAW;
 	tmp->frame.datalen = len;
@@ -2105,11 +2051,13 @@
 	tmp->frame.offset= 0 ;
 	tmp->frame.src = NULL;
 	tmp->frame.data = tmp->ast_rd_buf ;
-
+	
+	if (tmp->faxdetect || tmp->ast_dsp ) {
+		return process_ast_dsp(tmp, &tmp->frame);
+	}
+	
 	return &tmp->frame;
 }
-
-
 
 
 static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
@@ -2123,10 +2071,6 @@
 		ast_log(LOG_WARNING, "private but no bc\n");
 		return -1;
 	}
-	
-	/*if (ch->bc->tone != TONE_NONE)
-	  tone_indicate(ch,TONE_NONE); */
-	
 	
 	if (ch->holded ) {
 		chan_misdn_log(5, ch->bc->port, "misdn_write: Returning because holded\n");
@@ -2192,10 +2136,6 @@
 	}
 
 	chan_misdn_log(9, ch->bc->port, "Sending :%d bytes 2 MISDN\n",frame->samples);
-	/*if speech flip bits*/
-	if ( misdn_cap_is_speech(ch->bc->capability) )
-		flip_buf_bits(frame->data,frame->samples);
-	
 	
 	if ( !ch->bc->nojitter && misdn_cap_is_speech(ch->bc->capability) ) {
 		/* Buffered Transmit (triggert by read from isdn side)*/
@@ -2676,116 +2616,6 @@
 	
 	return tmp;
 }
-
-
-
-static int misdn_tx2ast_frm(struct chan_list * tmp, char * buf,  int len )
-{
-	struct ast_frame frame;
-
-	/* If in hold state we drop frame .. */
-	if (tmp->holded ) return 0;
-	
-	switch(tmp->state) {
-	case MISDN_CLEANING:
-	case MISDN_EXTCANTMATCH:
-		return 0;
-		
-	case MISDN_WAITING4DIGS:
-	default:
-		break;
-	}
-	
-	if (tmp->norxtone) {
-		chan_misdn_log(3, tmp->bc->port, "misdn_tx2ast_frm: Returning because norxtone\n");
-		return 0;
-	}
-	
-	frame.frametype  = AST_FRAME_VOICE;
-	frame.subclass = AST_FORMAT_ALAW;
-	frame.datalen = len;
-	frame.samples = len ;
-	frame.mallocd =0 ;
-	frame.offset= 0 ;
-	frame.src = NULL;
-	frame.data = buf ;
-	
-	if (tmp->faxdetect || tmp->ast_dsp ) {
-		struct ast_frame *f,*f2;
-		if (tmp->trans)
-			f2=ast_translate(tmp->trans, &frame,0);
-		else {
-			chan_misdn_log(0, tmp->bc->port, "No T-Path found\n");
-			return 0;
-		}
-		
-		f = ast_dsp_process(tmp->ast, tmp->dsp, f2);
-		if (f && (f->frametype == AST_FRAME_DTMF)) {
-			ast_log(LOG_DEBUG, "Detected inband DTMF digit: %c", f->subclass);
-			if (f->subclass == 'f' && tmp->faxdetect) {
-				/* Fax tone -- Handle and return NULL */
-				struct ast_channel *ast = tmp->ast;
-				if (!tmp->faxhandled) {
-					tmp->faxhandled++;
-					if (strcmp(ast->exten, "fax")) {
-						if (ast_exists_extension(ast, S_OR(ast->macrocontext, ast->context), "fax", 1, AST_CID_P(ast))) {
-							if (option_verbose > 2)
-								ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name);
-							/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
-							pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten);
-							if (ast_async_goto(ast, ast->context, "fax", 1))
-								ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, ast->context);
-						} else
-							ast_log(LOG_NOTICE, "Fax detected, but no fax extension ctx:%s exten:%s\n",ast->context, ast->exten);
-					} else
-						ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
-				} else
-					ast_log(LOG_DEBUG, "Fax already handled\n");
-				frame.frametype = AST_FRAME_NULL;
-				frame.subclass = 0;
-				f = &frame;
-			}  else if ( tmp->ast_dsp) {
-				struct ast_frame fr;
-				memset(&fr, 0 , sizeof(fr));
-				fr.frametype = AST_FRAME_DTMF;
-				fr.subclass = f->subclass ;
-				fr.src=NULL;
-				fr.data = NULL ;
-				fr.datalen = 0;
-				fr.samples = 0 ;
-				fr.mallocd =0 ;
-				fr.offset= 0 ;
-				
-				chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n",f->subclass);
-				ast_queue_frame(tmp->ast, &fr);
-				
-				frame.frametype = AST_FRAME_NULL;
-				frame.subclass = 0;
-				f = &frame;
-			}
-		}
-	}
-	
-	if (tmp && tmp->ast && MISDN_ASTERISK_PVT (tmp->ast) && MISDN_ASTERISK_TECH_PVT(tmp->ast) ) {
-#if MISDN_DEBUG
-		int i, max=5>len?len:5;
-    
-		printf("write2* %p %d bytes: ",tmp, len);
-    
-		for (i=0; i<  max ; i++) printf("%2.2x ",((char*) frame.data)[i]);
-		printf ("\n");
-#endif
-		chan_misdn_log(9, tmp->bc->port, "Queueing %d bytes 2 Asterisk\n",len);
-		ast_queue_frame(tmp->ast,&frame);
-
-	}  else {
-		ast_log (LOG_WARNING, "No ast || ast->pvt || ch\n");
-	}
-	
-	return 0;
-}
-
-/** Channel Queue ***/
 
 static struct chan_list *find_chan_by_l3id(struct chan_list *list, unsigned long l3id)
 {
@@ -3697,40 +3527,24 @@
 		
 	case EVENT_BCHAN_DATA:
 	{
-		if ( !misdn_cap_is_speech(ch->bc->capability) || bc->nojitter) {
-			misdn_tx2ast_frm(ch, bc->bframe, bc->bframe_len );
+		if ( !misdn_cap_is_speech(ch->bc->capability) ) {
+			struct ast_frame frame;
+			/*In Data Modes we queue frames*/
+			frame.frametype  = AST_FRAME_VOICE; /*we have no data frames yet*/
+			frame.subclass = AST_FORMAT_ALAW;
+			frame.datalen = bc->bframe_len;
+			frame.samples = bc->bframe_len ;
+			frame.mallocd =0 ;
+			frame.offset= 0 ;
+			frame.src = NULL;
+			frame.data = bc->bframe ;
+			
+			ast_queue_frame(ch->ast,&frame);
 		} else {
-			int len=bc->bframe_len;
-			int free=misdn_ibuf_freecount(bc->astbuf);
-		
-			if (bc->bframe_len > free) {
-				ast_log(LOG_DEBUG, "sbuf overflow!\n");
-				len=misdn_ibuf_freecount(bc->astbuf);
-
-				if (len == 0) {
-					ast_log(LOG_WARNING, "BCHAN_DATA: write buffer overflow port:%d channel:%d!\n",bc->port,bc->channel);
-				}
-			}
-			
-			misdn_ibuf_memcpy_w(bc->astbuf, bc->bframe, len);
-			
-			{
-				char blah[1]="\0";
-#ifdef FLATTEN_JITTER
-				{
-					struct timeval tv;
-					gettimeofday(&tv,NULL);
-					
-					if (tv.tv_usec % 10000 > 0 ) {
-						write(ch->pipe[1], blah,sizeof(blah));
-						bc->time_usec=tv.tv_usec;
-					}
-				}
-#else
-				write(ch->pipe[1], blah,sizeof(blah));
-#endif
-				
-				
+			int ret=write(ch->pipe[1], bc->bframe, bc->bframe_len);
+
+			if (ret<=0) {
+				chan_misdn_log(1, bc->port, "Write returned <=0 (err=%s)\n",strerror(errno));
 			}
 		}
 	}

Modified: team/oej/siptransfer/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_sip.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_sip.c (original)
+++ team/oej/siptransfer/channels/chan_sip.c Wed May 17 02:33:33 2006
@@ -2197,6 +2197,7 @@
 		ast_rtp_destroy(r->vrtp);
 		r->vrtp = NULL;
 	}
+	ast_rtp_setdtmf(r->rtp, ast_test_flag(&r->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
 	r->prefs = peer->prefs;
 	natflags = ast_test_flag(&r->flags[0], SIP_NAT) & SIP_NAT_ROUTE;
 	if (r->rtp) {
@@ -3572,9 +3573,12 @@
 			free(p);
 			return NULL;
 		}
+		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
 		ast_rtp_settos(p->rtp, global_tos_audio);
-		if (p->vrtp)
+		if (p->vrtp) {
 			ast_rtp_settos(p->vrtp, global_tos_video);
+			ast_rtp_setdtmf(p->vrtp, 0);
+		}
 		p->rtptimeout = global_rtptimeout;
 		p->rtpholdtimeout = global_rtpholdtimeout;
 		p->rtpkeepalive = global_rtpkeepalive;
@@ -4794,6 +4798,7 @@
 	char c[256];
 	char t[256];
 	char b[256];
+	char *hold;
 	char m_audio[256];
 	char m_video[256];
 	char a_audio[1024];
@@ -4873,6 +4878,11 @@
 	ast_build_string(&m_audio_next, &m_audio_left, "m=audio %d RTP/AVP", ntohs(dest.sin_port));
 	ast_build_string(&m_video_next, &m_video_left, "m=video %d RTP/AVP", ntohs(vdest.sin_port));
 
+	if (ast_test_flag(&p->flags[0], SIP_CALL_ONHOLD))
+		hold = "a=recvonly";
+	else
+		hold = "a=sendrecv";
+
 	/* Prefer the codec we were requested to use, first, no matter what */
 	if (capability & p->prefcodec) {
 		if (p->prefcodec <= AST_FORMAT_MAX_AUDIO)
@@ -4953,11 +4963,11 @@
 	ast_build_string(&m_audio_next, &m_audio_left, "\r\n");
 	ast_build_string(&m_video_next, &m_video_left, "\r\n");
 
-	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio);
+	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
 	if ((p->vrtp) &&
 	    (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
 	    (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */
-		len += strlen(m_video) + strlen(a_video) + strlen(b);
+		len += strlen(m_video) + strlen(a_video) + strlen(b) + strlen(hold);
 
 	add_header(resp, "Content-Type", "application/sdp");
 	add_header_contentLength(resp, len);
@@ -4972,11 +4982,13 @@
 	add_line(resp, t);
 	add_line(resp, m_audio);
 	add_line(resp, a_audio);
+	add_line(resp, hold);
 	if ((p->vrtp) &&
 	    (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
 	    (capability & VIDEO_CODEC_MASK)) { /* only if video response is appropriate */
 		add_line(resp, m_video);
 		add_line(resp, a_video);
+		add_line(resp, hold);
 	}
 
 	/* Update lastrtprx when we send our SDP */
@@ -9132,6 +9144,7 @@
 	ast_mutex_lock(&iflock);
 	for (cur = iflist; cur; cur = cur->next) {
 		if (!strncasecmp(cur->callid, argv[3], len)) {
+			char formatbuf[BUFSIZ/2];
 			ast_cli(fd,"\n");
 			if (cur->subscribed != NONE)
 				ast_cli(fd, "  * Subscription (type: %s)\n", subscription_type2str(cur->subscribed));
@@ -9145,10 +9158,10 @@
 				ast_cli(fd, "  Owner channel ID:       %s\n", "<none>");
 			}
 			ast_cli(fd, "  Our Codec Capability:   %d\n", cur->capability);
-			ast_cli(fd, "  Non-Codec Capability:   %d\n", cur->noncodeccapability);
+			ast_cli(fd, "  Non-Codec Capability (DTMF):   %d\n", cur->noncodeccapability);
 			ast_cli(fd, "  Their Codec Capability:   %d\n", cur->peercapability);
 			ast_cli(fd, "  Joint Codec Capability:   %d\n", cur->jointcapability);
-			ast_cli(fd, "  Format                  %s\n", ast_getformatname(cur->owner ? cur->owner->nativeformats : 0) );
+			ast_cli(fd, "  Format                  %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
 			ast_cli(fd, "  Theoretical Address:    %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), cur->sa.sin_addr), ntohs(cur->sa.sin_port));
 			ast_cli(fd, "  Received Address:       %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), cur->recv.sin_addr), ntohs(cur->recv.sin_port));
 			ast_cli(fd, "  SIP Transfer mode:      %s\n", transfermode2str(cur->allowtransfer));
@@ -11533,6 +11546,7 @@
 		get_rdnis(p, NULL);			/* Get redirect information */
 		extract_uri(p, req);			/* Get the Contact URI */
 		build_contact(p);			/* Build our contact header */
+		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
 
 		if (!replace_id && gotdest) {	/* No matching extension found */
 			if (gotdest == 1 && ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWOVERLAP)) {

Modified: team/oej/siptransfer/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_zap.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_zap.c (original)
+++ team/oej/siptransfer/channels/chan_zap.c Wed May 17 02:33:33 2006
@@ -2899,6 +2899,16 @@
 		}
 		ast_log(LOG_DEBUG, "Set Operator Services mode, value: %d on %s/%s\n",
 			oprmode->mode, chan->name,oprmode->peer->name);;
+		break;
+	case AST_OPTION_ECHOCAN:
+		cp = (char *) data;
+		if (*cp) {
+			ast_log(LOG_DEBUG, "Enabling echo cancelation on %s\n", chan->name);
+			zt_enable_ec(p);
+		} else {
+			ast_log(LOG_DEBUG, "Disabling echo cancelation on %s\n", chan->name);
+			zt_disable_ec(p);
+		}
 		break;
 	}
 	errno = 0;

Modified: team/oej/siptransfer/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/misdn/isdn_lib.c?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channels/misdn/isdn_lib.c (original)
+++ team/oej/siptransfer/channels/misdn/isdn_lib.c Wed May 17 02:33:33 2006
@@ -19,42 +19,6 @@
 void misdn_split_conf(struct misdn_bchannel *bc, int conf_id);
 
 
-void misdn_free_ibuffer(void *ibuf)
-{
-	free_ibuffer((ibuffer_t*)ibuf);
-}
-
-
-void misdn_clear_ibuffer(void *ibuf)
-{
-	clear_ibuffer( (ibuffer_t*)ibuf);
-}
-
-void *misdn_init_ibuffer(int len)
-{
-	return init_ibuffer(len);
-}
-
-int misdn_ibuf_freecount(void *buf)
-{
-	return ibuf_freecount( (ibuffer_t*)buf);
-}
-
-int misdn_ibuf_usedcount(void *buf)
-{
-	return ibuf_usedcount( (ibuffer_t*)buf);
-}
-
-void misdn_ibuf_memcpy_r(char *to, void *buf, int len)
-{
-	ibuf_memcpy_r( to, (ibuffer_t*)buf, len);
-}
-
-void misdn_ibuf_memcpy_w(void *buf, char *from,  int len)
-{
-	ibuf_memcpy_w((ibuffer_t*)buf, from, len);
-}
-
 struct misdn_stack* get_misdn_stack( void );
 
 
@@ -196,7 +160,6 @@
 void te_lib_destroy(int midev) ;
 struct misdn_bchannel *manager_find_bc_by_pid(int pid);
 struct misdn_bchannel *manager_find_bc_holded(struct misdn_bchannel* bc);
-unsigned char * manager_flip_buf_bits ( unsigned char * buf , int len);
 void manager_ph_control_block(struct misdn_bchannel *bc, long c1, void *c2, int c2_len);
 void manager_clean_bc(struct misdn_bchannel *bc );
 void manager_bchannel_setup (struct misdn_bchannel *bc);
@@ -2031,6 +1994,7 @@
 	jlen=cb_jb_empty(bc,&buf[mISDN_HEADER_LEN],len);
 	
 	if (jlen) {
+		flip_buf_bits( &buf[mISDN_HEADER_LEN], jlen);
 		
 		if (jlen < len) {
 			cb_log(5,bc->port,"Jitterbuffer Underrun.\n");
@@ -3586,8 +3550,10 @@
 	
 	frm->len = len;
 	memcpy(&buf[mISDN_HEADER_LEN], data,len);
-	
-	if ( ! misdn_cap_is_speech(bc->capability))
+		
+	if ( misdn_cap_is_speech(bc->capability) ) 
+		flip_buf_bits( &buf[mISDN_HEADER_LEN], len);
+	else
 		cb_log(6, stack->port, "Writing %d data bytes\n",len);
 	
 	cb_log(9, stack->port, "Writing %d bytes 2 mISDN\n",len);

Modified: team/oej/siptransfer/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/misdn/isdn_lib.h?rev=27721&r1=27720&r2=27721&view=diff
==============================================================================
--- team/oej/siptransfer/channels/misdn/isdn_lib.h (original)
+++ team/oej/siptransfer/channels/misdn/isdn_lib.h Wed May 17 02:33:33 2006
@@ -371,18 +371,6 @@
 void get_show_stack_details(int port, char *buf);
 
 
-/** Ibuf interface **/
-int misdn_ibuf_usedcount(void *buf);
-int misdn_ibuf_freecount(void *buf);
-void misdn_ibuf_memcpy_r(char *to, void *from, int len);
-void misdn_ibuf_memcpy_w(void *buf, char *from, int len);
-
-void misdn_free_ibuffer(void *ibuf);
-void misdn_clear_ibuffer(void *ibuf);
-void *misdn_init_ibuffer(int len);
-
-/** Ibuf interface End **/
-
 void misdn_lib_tone_generator_start(struct misdn_bchannel *bc);

[... 338 lines stripped ...]


More information about the svn-commits mailing list