Index: src/include/openzap.h
===================================================================
--- src/include/openzap.h	(revision 575)
+++ src/include/openzap.h	(working copy)
@@ -422,6 +422,7 @@
 	zio_event_cb_t event_callback;
 	uint32_t skip_read_frames;
 	zap_buffer_t *dtmf_buffer;
+	zap_buffer_t *gen_dtmf_buffer;
 	zap_buffer_t *digit_buffer;
 	zap_buffer_t *fsk_buffer;
 	uint32_t dtmf_on;
Index: src/zap_io.c
===================================================================
--- src/zap_io.c	(revision 575)
+++ src/zap_io.c	(working copy)
@@ -239,6 +239,7 @@
 		}
 
 		zap_buffer_destroy(&zchan->digit_buffer);
+		zap_buffer_destroy(&zchan->gen_dtmf_buffer);
 		zap_buffer_destroy(&zchan->dtmf_buffer);
 		zap_buffer_destroy(&zchan->fsk_buffer);
 
@@ -455,7 +456,8 @@
 
 		zap_mutex_create(&new_chan->mutex);
 		zap_buffer_create(&new_chan->digit_buffer, 128, 128, 0);
-
+		zap_buffer_create(&new_chan->gen_dtmf_buffer, 128, 128, 0);
+		
 		new_chan->dtmf_hangup_buf = calloc (span->dtmf_hangup_len + 1, sizeof (char));
 
 		zap_set_flag(new_chan, ZAP_CHANNEL_CONFIGURED | ZAP_CHANNEL_READY);
@@ -958,6 +960,10 @@
 		zap_buffer_zero(zchan->dtmf_buffer);
 	}
 
+	if (zchan->gen_dtmf_buffer) {
+		zap_buffer_zero(zchan->gen_dtmf_buffer);
+	}
+
 	if (zchan->digit_buffer) {
 		zap_buffer_zero(zchan->digit_buffer);
 	}
@@ -1410,28 +1416,16 @@
 	case ZAP_COMMAND_SEND_DTMF:
 		{
 			if (!zap_channel_test_feature(zchan, ZAP_CHANNEL_FEATURE_DTMF_GENERATE)) {
-				char *cur;
 				char *digits = ZAP_COMMAND_OBJ_CHAR_P;
-				int x = 0;
+				
 
 				if ((status = zchan_activate_dtmf_buffer(zchan)) != ZAP_SUCCESS) {
 					GOTO_STATUS(done, status);
 				}
 				
 				zap_log(ZAP_LOG_DEBUG, "Adding DTMF SEQ [%s]\n", digits);	
+				zap_buffer_write(zchan->gen_dtmf_buffer, digits, strlen(digits));
 				
-				for (cur = digits; *cur; cur++) {
-					int wrote = 0;
-					if ((wrote = teletone_mux_tones(&zchan->tone_session, &zchan->tone_session.TONES[(int)*cur]))) {
-						zap_buffer_write(zchan->dtmf_buffer, zchan->tone_session.buffer, wrote * 2);
-						x++;
-					} else {
-						zap_log(ZAP_LOG_ERROR, "Problem Adding DTMF SEQ [%s]\n", digits);	
-						GOTO_STATUS(done, ZAP_FAIL);
-					}
-				}
-				
-				zchan->skip_read_frames = 200 * x;
 				GOTO_STATUS(done, ZAP_SUCCESS);
 			}
 		}
@@ -1691,6 +1685,7 @@
 	return status;
 }
 
+
 zap_status_t zap_channel_read(zap_channel_t *zchan, void *data, zap_size_t *datalen)
 {
 	zap_status_t status = ZAP_FAIL;
@@ -1890,6 +1885,7 @@
 	zio_codec_t codec_func = NULL;
 	zap_size_t blen = 0, max = datasize;
 	zap_buffer_t *buffer = NULL;
+	size_t dlen;
 
 	assert(zchan != NULL);
 	assert(zchan->zio != NULL);
@@ -1904,6 +1900,33 @@
 		return ZAP_FAIL;
 	}
 	
+	if (zchan->gen_dtmf_buffer && (dlen = zap_buffer_inuse(zchan->gen_dtmf_buffer))) {
+		char digits[128] = "";
+		char *cur;
+		int x = 0;				 
+
+		if (dlen > sizeof(digits) - 1) {
+			dlen = sizeof(digits) - 1;
+		}
+
+		zap_buffer_read(zchan->gen_dtmf_buffer, digits, dlen);
+		
+		for (cur = digits; *cur; cur++) {
+			int wrote = 0;
+			if ((wrote = teletone_mux_tones(&zchan->tone_session, &zchan->tone_session.TONES[(int)*cur]))) {
+				zap_buffer_write(zchan->dtmf_buffer, zchan->tone_session.buffer, wrote * 2);
+				zap_log(ZAP_LOG_ERROR, "GENERATE DTMF [%c]\n", *cur);	
+				x++;
+			} else {
+				zap_log(ZAP_LOG_ERROR, "Problem Adding DTMF SEQ [%s]\n", digits);
+				return ZAP_FAIL;
+			}
+		}
+		
+		zchan->skip_read_frames = 200 * x;
+	}
+
+
 	if (zap_test_flag(zchan, ZAP_CHANNEL_TRANSCODE) && zchan->effective_codec != zchan->native_codec) {
 		if (zchan->native_codec == ZAP_CODEC_ULAW && zchan->effective_codec == ZAP_CODEC_SLIN) {
 			codec_func = zio_slin2ulaw;
Index: mod_openzap/mod_openzap.c
===================================================================
--- mod_openzap/mod_openzap.c	(revision 576)
+++ mod_openzap/mod_openzap.c	(working copy)
@@ -364,7 +364,7 @@
 
 	zap_channel_init(tech_pvt->zchan);
 
-	switch_channel_set_flag(channel, CF_ACCEPT_CNG);
+	//switch_channel_set_flag(channel, CF_ACCEPT_CNG);
 
 	return SWITCH_STATUS_SUCCESS;
 }
