[svn-commits] juggie: branch juggie/NoLossCDR r78330 - in /team/juggie/NoLossCDR: ./ apps/ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 6 20:33:06 CDT 2007


Author: juggie
Date: Mon Aug  6 20:33:05 2007
New Revision: 78330

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78330
Log:
shakes fist @ automerge, up to speed w/ CDRBatch again

Modified:
    team/juggie/NoLossCDR/   (props changed)
    team/juggie/NoLossCDR/apps/app_dial.c
    team/juggie/NoLossCDR/apps/app_senddtmf.c
    team/juggie/NoLossCDR/apps/app_test.c
    team/juggie/NoLossCDR/channels/chan_agent.c
    team/juggie/NoLossCDR/include/asterisk/app.h
    team/juggie/NoLossCDR/include/asterisk/channel.h
    team/juggie/NoLossCDR/main/app.c
    team/juggie/NoLossCDR/main/channel.c
    team/juggie/NoLossCDR/res/res_features.c

Propchange: team/juggie/NoLossCDR/
            ('svnmerge-integrated' removed)

Modified: team/juggie/NoLossCDR/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_dial.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/apps/app_dial.c (original)
+++ team/juggie/NoLossCDR/apps/app_dial.c Mon Aug  6 20:33:05 2007
@@ -1527,7 +1527,7 @@
 			/* Ok, done. stop autoservice */
 			res = ast_autoservice_stop(chan);
 			if (digit > 0 && !res)
-				res = ast_senddigit(chan, digit); 
+				res = ast_senddigit(chan, digit, 0); 
 			else
 				res = digit;
 
@@ -1696,12 +1696,12 @@
 			if (!ast_strlen_zero(dtmfcalled)) { 
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the called party.\n", dtmfcalled);
-				res = ast_dtmf_stream(peer,chan,dtmfcalled,250);
+				res = ast_dtmf_stream(peer,chan,dtmfcalled,250,0);
 			}
 			if (!ast_strlen_zero(dtmfcalling)) {
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the calling party.\n", dtmfcalling);
-				res = ast_dtmf_stream(chan,peer,dtmfcalling,250);
+				res = ast_dtmf_stream(chan,peer,dtmfcalling,250,0);
 			}
 		}
 		

Modified: team/juggie/NoLossCDR/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_senddtmf.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/apps/app_senddtmf.c (original)
+++ team/juggie/NoLossCDR/apps/app_senddtmf.c Mon Aug  6 20:33:05 2007
@@ -60,10 +60,11 @@
 {
 	int res = 0;
 	char *data;
-	int timeout;
+	int timeout = 0, duration = 0;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(digits);
 		AST_APP_ARG(timeout);
+		AST_APP_ARG(duration);
 	);
 
 	if (ast_strlen_zero(vdata)) {
@@ -74,8 +75,11 @@
 	data = ast_strdupa(vdata);
 	AST_STANDARD_APP_ARGS(args, data);
 
-	timeout = atoi(args.timeout);
-	res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250 : timeout);
+	if (!ast_strlen_zero(args.timeout))
+		timeout = atoi(args.timeout);
+	if (!ast_strlen_zero(args.duration))
+		duration = atoi(args.duration);
+	res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250 : timeout, duration);
 
 	return res;
 }
@@ -102,7 +106,7 @@
 		return 0;
 	}
 
-	ast_senddigit(chan, *digit);
+	ast_senddigit(chan, *digit, 0);
 
 	ast_mutex_unlock(&chan->lock);
 	astman_send_ack(s, m, "DTMF successfully queued");

Modified: team/juggie/NoLossCDR/apps/app_test.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_test.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/apps/app_test.c (original)
+++ team/juggie/NoLossCDR/apps/app_test.c Mon Aug  6 20:33:05 2007
@@ -148,7 +148,7 @@
 	res = ast_safe_sleep(chan, 3000);
 	/* Transmit client version */
 	if (!res)
-		res = ast_dtmf_stream(chan, NULL, "8378*1#", 0);
+		res = ast_dtmf_stream(chan, NULL, "8378*1#", 0, 0);
 	ast_debug(1, "Transmit client version\n");
 	
 	/* Read server version */
@@ -166,9 +166,9 @@
 		res = ast_safe_sleep(chan, 1000);
 	/* Send test id */
 	if (!res) 
-		res = ast_dtmf_stream(chan, NULL, testid, 0);		
+		res = ast_dtmf_stream(chan, NULL, testid, 0, 0);		
 	if (!res) 
-		res = ast_dtmf_stream(chan, NULL, "#", 0);		
+		res = ast_dtmf_stream(chan, NULL, "#", 0, 0);		
 	ast_debug(1, "send test identifier: %s\n", testid);
 
 	if ((res >=0) && (!ast_strlen_zero(testid))) {
@@ -198,7 +198,7 @@
 			if (!res) {
 				/* Step 2: Send "2" */
 				ast_debug(1, "TestClient: 2.  Send DTMF 2\n");
-				res = ast_dtmf_stream(chan, NULL, "2", 0);
+				res = ast_dtmf_stream(chan, NULL, "2", 0, 0);
 				fprintf(f, "SEND DTMF 2:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res = 0;
@@ -265,7 +265,7 @@
 			if (!res) {
 				/* Step 10: Send "7" */
 				ast_debug(1, "TestClient: 7.  Send DTMF 7\n");
-				res = ast_dtmf_stream(chan, NULL, "7", 0);
+				res = ast_dtmf_stream(chan, NULL, "7", 0, 0);
 				fprintf(f, "SEND DTMF 7:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res =0;
@@ -318,7 +318,7 @@
 
 	res = ast_safe_sleep(chan, 1000);
 	if (!res)
-		res = ast_dtmf_stream(chan, NULL, "8378*1#", 0);
+		res = ast_dtmf_stream(chan, NULL, "8378*1#", 0, 0);
 	if (res > 0)
 		res = 0;
 
@@ -344,7 +344,7 @@
 			if (!res) {
 				/* Step 1: Send "1" */
 				ast_debug(1, "TestServer: 1.  Send DTMF 1\n");
-				res = ast_dtmf_stream(chan, NULL, "1", 0);
+				res = ast_dtmf_stream(chan, NULL, "1", 0,0 );
 				fprintf(f, "SEND DTMF 1:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res = 0;
@@ -370,7 +370,7 @@
 			if (!res) {
 				/* Step 4: Send "4" */
 				ast_debug(1, "TestServer: 4.  Send DTMF 4\n");
-				res = ast_dtmf_stream(chan, NULL, "4", 0);
+				res = ast_dtmf_stream(chan, NULL, "4", 0, 0);
 				fprintf(f, "SEND DTMF 4:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res = 0;
@@ -397,7 +397,7 @@
 			if (!res) {
 				/* Step 7: Send "5" */
 				ast_debug(1, "TestServer: 7.  Send DTMF 5\n");
-				res = ast_dtmf_stream(chan, NULL, "5", 0);
+				res = ast_dtmf_stream(chan, NULL, "5", 0, 0);
 				fprintf(f, "SEND DTMF 5:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res = 0;
@@ -426,7 +426,7 @@
 			if (!res) {
 				/* Step 10: Send "8" */
 				ast_debug(1, "TestServer: 10.  Send DTMF 8\n");
-				res = ast_dtmf_stream(chan, NULL, "8", 0);
+				res = ast_dtmf_stream(chan, NULL, "8", 0, 0);
 				fprintf(f, "SEND DTMF 8:   %s\n", (res < 0) ? "FAIL" : "PASS");
 				if (res > 0)
 					res = 0;

Modified: team/juggie/NoLossCDR/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/channels/chan_agent.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/channels/chan_agent.c (original)
+++ team/juggie/NoLossCDR/channels/chan_agent.c Mon Aug  6 20:33:05 2007
@@ -1350,6 +1350,7 @@
 	struct agent_pvt *p;
 	char *username = NULL;
 	char *loginChan = NULL;
+	char *talkingto = NULL;
 	char *talkingtoChan = NULL;
 	char *status = NULL;
 
@@ -1373,6 +1374,7 @@
 
 		if (!ast_strlen_zero(p->loginchan) && !p->chan) {
 			loginChan = p->loginchan;
+			talkingto = "n/a";
 			talkingtoChan = "n/a";
 			status = "AGENT_IDLE";
 			if (p->acknowledged) {
@@ -1382,14 +1384,20 @@
 		} else if (p->chan) {
 			loginChan = ast_strdupa(p->chan->name);
 			if (p->owner && p->owner->_bridge) {
-        			talkingtoChan = p->chan->cid.cid_num;
+				talkingto = p->chan->cid.cid_num;
+				if (ast_bridged_channel(p->owner))
+					talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name);
+				else
+					talkingtoChan = "n/a";
         			status = "AGENT_ONCALL";
 			} else {
-        			talkingtoChan = "n/a";
+				talkingto = "n/a";
+				talkingtoChan = "n/a";
         			status = "AGENT_IDLE";
 			}
 		} else {
 			loginChan = "n/a";
+			talkingto = "n/a";
 			talkingtoChan = "n/a";
 			status = "AGENT_LOGGEDOFF";
 		}
@@ -1401,9 +1409,10 @@
 			"LoggedInChan: %s\r\n"
 			"LoggedInTime: %d\r\n"
 			"TalkingTo: %s\r\n"
+			"TalkingToChan: %s\r\n"
 			"%s"
 			"\r\n",
-			p->agent, username, status, loginChan, (int)p->loginstart, talkingtoChan, idText);
+			p->agent, username, status, loginChan, (int)p->loginstart, talkingto, talkingtoChan, idText);
 		ast_mutex_unlock(&p->lock);
 	}
 	AST_LIST_UNLOCK(&agents);

Modified: team/juggie/NoLossCDR/include/asterisk/app.h
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/include/asterisk/app.h?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/include/asterisk/app.h (original)
+++ team/juggie/NoLossCDR/include/asterisk/app.h Mon Aug  6 20:33:05 2007
@@ -157,8 +157,9 @@
   \param between This is the number of milliseconds to wait in between each
                  DTMF digit.  If zero milliseconds is specified, then the
                  default value of 100 will be used.
+  \param duration This is the duration that each DTMF digit should have.
 */
-int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between);
+int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration);
 
 /*! Stream a filename (or file descriptor) as a generator. */
 int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride);

Modified: team/juggie/NoLossCDR/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/include/asterisk/channel.h?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/include/asterisk/channel.h (original)
+++ team/juggie/NoLossCDR/include/asterisk/channel.h Mon Aug  6 20:33:05 2007
@@ -951,9 +951,10 @@
  * Send a DTMF digit to a channel.
  * \param chan channel to act upon
  * \param digit the DTMF digit to send, encoded in ASCII
+ * \param duration the duration of the digit ending in ms
  * \return Returns 0 on success, -1 on failure
  */
-int ast_senddigit(struct ast_channel *chan, char digit);
+int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration);
 
 /*! \brief Send a DTMF digit to a channel
  * Send a DTMF digit to a channel.

Modified: team/juggie/NoLossCDR/main/app.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/app.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/main/app.c (original)
+++ team/juggie/NoLossCDR/main/app.c Mon Aug  6 20:33:05 2007
@@ -245,7 +245,7 @@
 	return 0;
 }
 
-int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between) 
+int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration) 
 {
 	const char *ptr;
 	int res = 0;
@@ -274,7 +274,7 @@
 				/* ignore return values if not supported by channel */
 				ast_indicate(chan, AST_CONTROL_FLASH);
 			} else
-				ast_senddigit(chan, *ptr);
+				ast_senddigit(chan, *ptr, duration);
 			/* pause between digits */
 			if ((res = ast_safe_sleep(chan, between)))
 				break;

Modified: team/juggie/NoLossCDR/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/channel.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/main/channel.c (original)
+++ team/juggie/NoLossCDR/main/channel.c Mon Aug  6 20:33:05 2007
@@ -2263,9 +2263,10 @@
 			 * However, only let emulation be forced if the other end cares about BEGIN frames */
 			if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF) ||
 				(ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)) ) {
-				if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2)
+				if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2) {
+					ast_log(LOG_DTMF, "DTMF end '%c' put into dtmf queue on %s\n", f->subclass, chan->name);
 					chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
-				else
+				} else
 					ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
 				ast_frfree(f);
 				f = &ast_null_frame;
@@ -2273,9 +2274,10 @@
 				if (!ast_tvzero(chan->dtmf_tv) && 
 				    ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) {
 					/* If it hasn't been long enough, defer this digit */
-					if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2)
+					if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2) {
+						ast_log(LOG_DTMF, "DTMF end '%c' put into dtmf queue on %s\n", f->subclass, chan->name);
 						chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
-					else
+					} else
 						ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
 					ast_frfree(f);
 					f = &ast_null_frame;
@@ -2297,18 +2299,24 @@
 			} else {
 				struct timeval now = ast_tvnow();
 				if (ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+					ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass, chan->name);
 					ast_clear_flag(chan, AST_FLAG_IN_DTMF);
 					if (!f->len)
 						f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
-				} else if (!f->len)
+				} else if (!f->len) {
+					ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass, chan->name);
 					f->len = AST_MIN_DTMF_DURATION;
+				}
 				if (f->len < AST_MIN_DTMF_DURATION) {
+					ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass, f->len, AST_MIN_DTMF_DURATION, chan->name);
 					ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
 					chan->emulate_dtmf_digit = f->subclass;
 					chan->emulate_dtmf_duration = AST_MIN_DTMF_DURATION - f->len;
 					f = &ast_null_frame;
-				} else
+				} else {
+					ast_log(LOG_DTMF, "DTMF end passthrough '%c' on %s\n", f->subclass, chan->name);
 					chan->dtmf_tv = now;
+				}
 			}
 			break;
 		case AST_FRAME_DTMF_BEGIN:
@@ -2319,9 +2327,11 @@
 			      ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) ) {
 				ast_frfree(f);
 				f = &ast_null_frame;
+				ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass, chan->name);
 			} else {
 				ast_set_flag(chan, AST_FLAG_IN_DTMF);
 				chan->dtmf_tv = ast_tvnow();
+				ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass, chan->name);
 			}
 			break;
 		case AST_FRAME_NULL:
@@ -2630,14 +2640,14 @@
 	return 0;
 }
 
-int ast_senddigit(struct ast_channel *chan, char digit)
+int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
 {
 	if (chan->tech->send_digit_begin) {
 		ast_senddigit_begin(chan, digit);
-		ast_safe_sleep(chan, AST_DEFAULT_EMULATE_DTMF_DURATION);
-	}
-	
-	return ast_senddigit_end(chan, digit, AST_DEFAULT_EMULATE_DTMF_DURATION);
+		ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
+	}
+	
+	return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
 }
 
 int ast_prod(struct ast_channel *chan)

Modified: team/juggie/NoLossCDR/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/res/res_features.c?view=diff&rev=78330&r1=78329&r2=78330
==============================================================================
--- team/juggie/NoLossCDR/res/res_features.c (original)
+++ team/juggie/NoLossCDR/res/res_features.c Mon Aug  6 20:33:05 2007
@@ -1747,11 +1747,11 @@
 					   digits to come in for features. */
 					ast_debug(1, "Timed out for feature!\n");
 					if (!ast_strlen_zero(peer_featurecode)) {
-						ast_dtmf_stream(chan, peer, peer_featurecode, 0);
+						ast_dtmf_stream(chan, peer, peer_featurecode, 0, 0);
 						memset(peer_featurecode, 0, sizeof(peer_featurecode));
 					}
 					if (!ast_strlen_zero(chan_featurecode)) {
-						ast_dtmf_stream(peer, chan, chan_featurecode, 0);
+						ast_dtmf_stream(peer, chan, chan_featurecode, 0, 0);
 						memset(chan_featurecode, 0, sizeof(chan_featurecode));
 					}
 					if (f)
@@ -1843,7 +1843,7 @@
 			res = ast_feature_interpret(chan, peer, config, featurecode, sense);
 			switch(res) {
 			case FEATURE_RETURN_PASSDIGITS:
-				ast_dtmf_stream(other, who, featurecode, 0);
+				ast_dtmf_stream(other, who, featurecode, 0, 0);
 				/* Fall through */
 			case FEATURE_RETURN_SUCCESS:
 				memset(featurecode, 0, sizeof(chan_featurecode));




More information about the svn-commits mailing list