mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 03:59:01 +00:00
various code cleanups (bug #4353)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
app.c
2
app.c
@@ -271,7 +271,7 @@ int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digi
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_waitfor(chan,100);
|
res = ast_waitfor(chan,100);
|
||||||
if (res > -1) {
|
if (res > -1) {
|
||||||
for (ptr=digits;*ptr;*ptr++) {
|
for (ptr=digits; *ptr; ptr++) {
|
||||||
if (*ptr == 'w') {
|
if (*ptr == 'w') {
|
||||||
res = ast_safe_sleep(chan, 500);
|
res = ast_safe_sleep(chan, 500);
|
||||||
if (res)
|
if (res)
|
||||||
|
@@ -65,24 +65,19 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
|
|||||||
file = tmp;
|
file = tmp;
|
||||||
|
|
||||||
if ((skip=strchr(tmp,'|'))) {
|
if ((skip=strchr(tmp,'|'))) {
|
||||||
*skip = '\0';
|
*skip++ = '\0';
|
||||||
*skip++;
|
|
||||||
fwd=strchr(skip,'|');
|
fwd=strchr(skip,'|');
|
||||||
if (fwd) {
|
if (fwd) {
|
||||||
*fwd = '\0';
|
*fwd++ = '\0';
|
||||||
*fwd++;
|
|
||||||
rev = strchr(fwd,'|');
|
rev = strchr(fwd,'|');
|
||||||
if (rev) {
|
if (rev) {
|
||||||
*rev = '\0';
|
*rev++ = '\0';
|
||||||
*rev++;
|
|
||||||
stop = strchr(rev,'|');
|
stop = strchr(rev,'|');
|
||||||
if (stop) {
|
if (stop) {
|
||||||
*stop = '\0';
|
*stop++ = '\0';
|
||||||
*stop++;
|
|
||||||
pause = strchr(stop,'|');
|
pause = strchr(stop,'|');
|
||||||
if (pause) {
|
if (pause) {
|
||||||
*pause = '\0';
|
*pause++ = '\0';
|
||||||
*pause++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h> /* for mkdir */
|
||||||
#include "asterisk/file.h"
|
#include "asterisk/file.h"
|
||||||
#include "asterisk/logger.h"
|
#include "asterisk/logger.h"
|
||||||
#include "asterisk/channel.h"
|
#include "asterisk/channel.h"
|
||||||
|
@@ -11,6 +11,9 @@
|
|||||||
* the GNU General Public License
|
* the GNU General Public License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/file.h"
|
#include "asterisk/file.h"
|
||||||
#include "asterisk/logger.h"
|
#include "asterisk/logger.h"
|
||||||
@@ -26,9 +29,6 @@
|
|||||||
#else
|
#else
|
||||||
#include <zaptel.h>
|
#include <zaptel.h>
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
static char *tdesc = "Flash zap trunk application";
|
static char *tdesc = "Flash zap trunk application";
|
||||||
|
|
||||||
|
@@ -267,6 +267,8 @@ static struct ast_channel inuse = { "GR-303InUse" };
|
|||||||
#ifdef PRI_GETSET_TIMERS
|
#ifdef PRI_GETSET_TIMERS
|
||||||
static int pritimers[PRI_MAX_TIMERS];
|
static int pritimers[PRI_MAX_TIMERS];
|
||||||
#endif
|
#endif
|
||||||
|
static int pridebugfd = -1;
|
||||||
|
static char pridebugfilename[1024]="";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Wait up to 16 seconds for first digit (FXO logic) */
|
/* Wait up to 16 seconds for first digit (FXO logic) */
|
||||||
@@ -288,8 +290,6 @@ AST_MUTEX_DEFINE_STATIC(iflock);
|
|||||||
static int ifcount = 0;
|
static int ifcount = 0;
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(pridebugfdlock);
|
AST_MUTEX_DEFINE_STATIC(pridebugfdlock);
|
||||||
static int pridebugfd = -1;
|
|
||||||
static char pridebugfilename[1024]="";
|
|
||||||
|
|
||||||
/* Whether we answer on a Polarity Switch event */
|
/* Whether we answer on a Polarity Switch event */
|
||||||
static int answeronpolarityswitch = 0;
|
static int answeronpolarityswitch = 0;
|
||||||
|
@@ -119,7 +119,7 @@ static void dump_datetime(char *output, int maxlen, void *value, int len)
|
|||||||
tm.tm_mday = (val >> 16) & 0x1f;
|
tm.tm_mday = (val >> 16) & 0x1f;
|
||||||
tm.tm_mon = ((val >> 21) & 0x0f) - 1;
|
tm.tm_mon = ((val >> 21) & 0x0f) - 1;
|
||||||
tm.tm_year = ((val >> 25) & 0x7f) + 100;
|
tm.tm_year = ((val >> 25) & 0x7f) + 100;
|
||||||
strftime(output, maxlen, "%F %T", &tm);
|
strftime(output, maxlen, "%Y-%m-%d %T", &tm);
|
||||||
} else
|
} else
|
||||||
ast_copy_string(output, "Invalid DATETIME format!", maxlen);
|
ast_copy_string(output, "Invalid DATETIME format!", maxlen);
|
||||||
}
|
}
|
||||||
|
2
config.c
2
config.c
@@ -486,7 +486,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|||||||
/* #exec </path/to/executable>
|
/* #exec </path/to/executable>
|
||||||
We create a tmp file, then we #include it, then we delete it. */
|
We create a tmp file, then we #include it, then we delete it. */
|
||||||
if (do_exec) {
|
if (do_exec) {
|
||||||
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%ld.%ld", time(NULL), pthread_self());
|
snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%ld.%ld", time(NULL), (long)pthread_self());
|
||||||
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
|
snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);
|
||||||
ast_safe_system(cmd);
|
ast_safe_system(cmd);
|
||||||
cur = exec_file;
|
cur = exec_file;
|
||||||
|
Reference in New Issue
Block a user