[Asterisk-cvs] asterisk app.c,1.13,1.14

citats at lists.digium.com citats at lists.digium.com
Fri May 7 17:05:46 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/home/citats/cvs/asterisk

Modified Files:
	app.c 
Log Message:
Code cleanup


Index: app.c
===================================================================
RCS file: /usr/cvsroot/asterisk/app.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- app.c	7 May 2004 20:39:14 -0000	1.13
+++ app.c	7 May 2004 21:14:55 -0000	1.14
@@ -260,47 +260,46 @@
 	return 0;
 }
 
-int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between) {
-  char *ptr=NULL;
-  int res=0;
-  struct ast_frame f;
-  if(!between)
-    between = 100;
-  
-  if(peer)
-    res = ast_autoservice_start(peer);
+int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between) 
+{
+	char *ptr=NULL;
+	int res=0;
+	struct ast_frame f;
+	if (!between)
+		between = 100;
 
-  if (!res) {
-    res = ast_waitfor(chan,100);
-    if(res > -1) {
-      for(ptr=digits;*ptr;*ptr++) {
-	if(*ptr == 'w') {
-	  res = ast_safe_sleep(chan, 500);
-	  if(res) 
-	    break;
-	  continue;
-	}
-	memset(&f, 0, sizeof(f));
-	f.frametype = AST_FRAME_DTMF;
-	f.subclass = *ptr;
-	f.src = "ast_dtmf_stream";
-	if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
-	  ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
-	} 
-	else {
-	  res = ast_write(chan, &f);
-	  if (res) 
-	    break;
-	  /* pause between digits */
-	  res = ast_safe_sleep(chan,between);
-	  if (res) 
-	    break;
-	}
-      }
-    }
-    if(peer)
-      res = ast_autoservice_stop(peer);
-  }
+	if (peer)
+		res = ast_autoservice_start(peer);
 
-  return res;
+	if (!res) {
+		res = ast_waitfor(chan,100);
+		if (res > -1) {
+			for (ptr=digits;*ptr;*ptr++) {
+				if (*ptr == 'w') {
+					res = ast_safe_sleep(chan, 500);
+					if (res) 
+						break;
+					continue;
+				}
+				memset(&f, 0, sizeof(f));
+				f.frametype = AST_FRAME_DTMF;
+				f.subclass = *ptr;
+				f.src = "ast_dtmf_stream";
+				if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
+					ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
+				} else {
+					res = ast_write(chan, &f);
+					if (res) 
+						break;
+					/* pause between digits */
+					res = ast_safe_sleep(chan,between);
+					if (res) 
+						break;
+				}
+			}
+		}
+		if (peer)
+			res = ast_autoservice_stop(peer);
+	}
+	return res;
 }




More information about the svn-commits mailing list