mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
autodial update
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3377 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
Makefile
12
Makefile
@@ -194,6 +194,13 @@ endif
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
|
|
||||||
|
|
||||||
|
####### res_perl
|
||||||
|
LIBS += $(shell /usr/local/bin/perl -MExtUtils::Embed -e ldopts) $(shell perl -MConfig -e 'print $$Config{libs}')
|
||||||
|
PERLCFLAGS += $(shell /usr/local/bin/perl -MExtUtils::Embed -e ccopts)
|
||||||
|
OBJS += perlxsi.o
|
||||||
|
####### /res_perl
|
||||||
|
|
||||||
_all: all
|
_all: all
|
||||||
@echo " +--------- Asterisk Build Complete ---------+"
|
@echo " +--------- Asterisk Build Complete ---------+"
|
||||||
@echo " + Asterisk has successfully been built, but +"
|
@echo " + Asterisk has successfully been built, but +"
|
||||||
@@ -205,6 +212,11 @@ _all: all
|
|||||||
|
|
||||||
all: depend asterisk subdirs
|
all: depend asterisk subdirs
|
||||||
|
|
||||||
|
####### res_perl
|
||||||
|
perlxsi.o:
|
||||||
|
$(CC) -c perlxsi.c $(PERLCFLAGS) -o perlxsi.o
|
||||||
|
####### /res_perl
|
||||||
|
|
||||||
editline/config.h:
|
editline/config.h:
|
||||||
cd editline && unset CFLAGS LIBS && ./configure ; \
|
cd editline && unset CFLAGS LIBS && ./configure ; \
|
||||||
|
|
||||||
|
@@ -16,9 +16,12 @@
|
|||||||
# and have placed it in the g723.1 directory and/or the Annex-B code in
|
# and have placed it in the g723.1 directory and/or the Annex-B code in
|
||||||
# g723.1b)
|
# g723.1b)
|
||||||
#
|
#
|
||||||
#MODG723=codec_g723_1.so codec_g723_1b.so
|
MODG723=codec_g723_1.so codec_g723_1b.so
|
||||||
MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
|
MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
|
||||||
MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
|
MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
|
||||||
|
MODG729=$(shell [ -f g729cp/codld8cp.c ] && echo "codec_g729.so")
|
||||||
|
MODG729+=$(shell [ -f g729abc/cod_ld8a.c ] && echo "codec_g729ab.so")
|
||||||
|
MODG729+=$(shell [ -f g729bc/cod_ld8c.c ] && echo "codec_g729b.so")
|
||||||
MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
|
MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
|
||||||
MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
|
MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
|
||||||
CFLAGS+=-fPIC
|
CFLAGS+=-fPIC
|
||||||
@@ -26,6 +29,9 @@ CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include"
|
|||||||
|
|
||||||
LIBG723=g723.1/libg723.a
|
LIBG723=g723.1/libg723.a
|
||||||
LIBG723B=g723.1b/libg723b.a
|
LIBG723B=g723.1b/libg723b.a
|
||||||
|
LIBG729=g729cp/libg729.a
|
||||||
|
LIBG729AB=g729abc/libg729ab.a
|
||||||
|
LIBG729B=g729bc/libg729b.a
|
||||||
LIBGSM=gsm/lib/libgsm.a
|
LIBGSM=gsm/lib/libgsm.a
|
||||||
LIBGSMT=gsm/lib/libgsm.a
|
LIBGSMT=gsm/lib/libgsm.a
|
||||||
LIBLPC10=lpc10/liblpc10.a
|
LIBLPC10=lpc10/liblpc10.a
|
||||||
@@ -33,7 +39,7 @@ LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib")
|
|||||||
LIBSPEEX+=-lspeex -lm
|
LIBSPEEX+=-lspeex -lm
|
||||||
LIBILBC=ilbc/libilbc.a
|
LIBILBC=ilbc/libilbc.a
|
||||||
|
|
||||||
CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_lpc10.so \
|
CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) $(MODG729) codec_gsm.so codec_lpc10.so \
|
||||||
codec_adpcm.so codec_ulaw.so codec_alaw.so codec_a_mu.so \
|
codec_adpcm.so codec_ulaw.so codec_alaw.so codec_a_mu.so \
|
||||||
codec_g726.so
|
codec_g726.so
|
||||||
|
|
||||||
@@ -43,6 +49,9 @@ clean:
|
|||||||
rm -f *.so *.o .depend
|
rm -f *.so *.o .depend
|
||||||
! [ -d g723.1 ] || $(MAKE) -C g723.1 clean
|
! [ -d g723.1 ] || $(MAKE) -C g723.1 clean
|
||||||
! [ -d g723.1b ] || $(MAKE) -C g723.1b clean
|
! [ -d g723.1b ] || $(MAKE) -C g723.1b clean
|
||||||
|
! [ -d g729abc ] || $(MAKE) -C g729abc clean
|
||||||
|
! [ -d g729bc ] || $(MAKE) -C g729bc clean
|
||||||
|
! [ -d g729cp ] || $(MAKE) -C g729cp clean
|
||||||
$(MAKE) -C gsm clean
|
$(MAKE) -C gsm clean
|
||||||
$(MAKE) -C lpc10 clean
|
$(MAKE) -C lpc10 clean
|
||||||
$(MAKE) -C ilbc clean
|
$(MAKE) -C ilbc clean
|
||||||
@@ -50,6 +59,15 @@ clean:
|
|||||||
$(LIBG723):
|
$(LIBG723):
|
||||||
$(MAKE) -C g723.1 all
|
$(MAKE) -C g723.1 all
|
||||||
|
|
||||||
|
$(LIBG729):
|
||||||
|
$(MAKE) -C g729cp all
|
||||||
|
|
||||||
|
$(LIBG729B):
|
||||||
|
$(MAKE) -C g729bc all
|
||||||
|
|
||||||
|
$(LIBG729AB):
|
||||||
|
$(MAKE) -C g729abc all
|
||||||
|
|
||||||
gsm/lib/libgsm.a:
|
gsm/lib/libgsm.a:
|
||||||
$(MAKE) -C gsm lib/libgsm.a
|
$(MAKE) -C gsm lib/libgsm.a
|
||||||
|
|
||||||
@@ -74,6 +92,24 @@ codec_g723_1b.o : codec_g723_1.c
|
|||||||
codec_g723_1b.so : codec_g723_1b.o $(LIBG723B)
|
codec_g723_1b.so : codec_g723_1b.o $(LIBG723B)
|
||||||
$(CC) $(SOLINK) -o $@ $< $(LIBG723B) -lm
|
$(CC) $(SOLINK) -o $@ $< $(LIBG723B) -lm
|
||||||
|
|
||||||
|
codec_g729.so : codec_g729.o $(LIBG729)
|
||||||
|
$(CC) $(SOLINK) -o $@ $< $(LIBG729)
|
||||||
|
|
||||||
|
codec_g729.o : codec_g729.c
|
||||||
|
$(CC) -c -o $@ $(CFLAGS) -Dsingle -DANNEX_ALL $<
|
||||||
|
|
||||||
|
codec_g729ab.so : codec_g729ab.o $(LIBG729AB)
|
||||||
|
$(CC) $(SOLINK) -o $@ $< $(LIBG729AB)
|
||||||
|
|
||||||
|
codec_g729ab.o : codec_g729.c
|
||||||
|
$(CC) -c -o $@ $(CFLAGS) -Dsingle -DANNEX_A -DANNEX_B $<
|
||||||
|
|
||||||
|
codec_g729b.so : codec_g729b.o $(LIBG729B)
|
||||||
|
$(CC) $(SOLINK) -o $@ $< $(LIBG729B)
|
||||||
|
|
||||||
|
codec_g729b.o : codec_g729.c
|
||||||
|
$(CC) -c -o $@ $(CFLAGS) -Dsingle -DANNEX_B $<
|
||||||
|
|
||||||
codec_gsm.so: codec_gsm.o $(LIBGSMT)
|
codec_gsm.so: codec_gsm.o $(LIBGSMT)
|
||||||
$(CC) $(SOLINK) -o $@ $< $(LIBGSM)
|
$(CC) $(SOLINK) -o $@ $< $(LIBGSM)
|
||||||
|
|
||||||
|
@@ -48,6 +48,9 @@
|
|||||||
#define EVENT_FLAG_COMMAND (1 << 4) /* Ability to read/set commands */
|
#define EVENT_FLAG_COMMAND (1 << 4) /* Ability to read/set commands */
|
||||||
#define EVENT_FLAG_AGENT (1 << 5) /* Ability to read/set agent info */
|
#define EVENT_FLAG_AGENT (1 << 5) /* Ability to read/set agent info */
|
||||||
#define EVENT_FLAG_USER (1 << 6) /* Ability to read/set user info */
|
#define EVENT_FLAG_USER (1 << 6) /* Ability to read/set user info */
|
||||||
|
#define EVENT_FLAG_CUSTOM1 (1 << 7) /* Ability to read/set user info */
|
||||||
|
#define EVENT_FLAG_CUSTOM2 (1 << 8) /* Ability to read/set user info */
|
||||||
|
#define EVENT_FLAG_CUSTOM3 (1 << 9) /* Ability to read/set user info */
|
||||||
|
|
||||||
/* Export manager structures */
|
/* Export manager structures */
|
||||||
#define MAX_HEADERS 80
|
#define MAX_HEADERS 80
|
||||||
|
@@ -75,10 +75,10 @@ struct mohclass {
|
|||||||
char class[80];
|
char class[80];
|
||||||
char dir[256];
|
char dir[256];
|
||||||
char miscargs[256];
|
char miscargs[256];
|
||||||
|
char customexec[256];
|
||||||
int destroyme;
|
int destroyme;
|
||||||
int pid; /* PID of mpg123 */
|
int pid; /* PID of mpg123 */
|
||||||
int quiet;
|
int quiet;
|
||||||
int single;
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
struct mohdata *members;
|
struct mohdata *members;
|
||||||
/* Source of audio */
|
/* Source of audio */
|
||||||
@@ -106,42 +106,53 @@ AST_MUTEX_DEFINE_STATIC(moh_lock);
|
|||||||
static int spawn_mp3(struct mohclass *class)
|
static int spawn_mp3(struct mohclass *class)
|
||||||
{
|
{
|
||||||
int fds[2];
|
int fds[2];
|
||||||
int files;
|
int files=0;
|
||||||
char fns[MAX_MP3S][80];
|
char fns[MAX_MP3S][80];
|
||||||
char *argv[MAX_MP3S + 50];
|
char *argv[MAX_MP3S + 50];
|
||||||
char xargs[256];
|
char xargs[256];
|
||||||
char *argptr;
|
char *argptr;
|
||||||
int argc = 0;
|
int argc;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
|
if(class->customexec && strlen(class->customexec)) {
|
||||||
|
argc = 0;
|
||||||
|
strncpy(xargs, class->customexec, sizeof(xargs) - 1);
|
||||||
|
argptr = xargs;
|
||||||
|
while(argptr && strlen(argptr)) {
|
||||||
|
argv[argc] = argptr;
|
||||||
|
argptr = strchr(argptr, ',');
|
||||||
|
if (argptr) {
|
||||||
|
*argptr = '\0';
|
||||||
|
argptr++;
|
||||||
|
}
|
||||||
|
argc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
dir = opendir(class->dir);
|
dir = opendir(class->dir);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
|
ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
argv[argc++] = "mpg123";
|
argv[0] = "mpg123";
|
||||||
argv[argc++] = "-q";
|
argv[1] = "-q";
|
||||||
argv[argc++] = "-s";
|
argv[2] = "-s";
|
||||||
argv[argc++] = "--mono";
|
argv[3] = "--mono";
|
||||||
argv[argc++] = "-r";
|
argv[4] = "-r";
|
||||||
argv[argc++] = "8000";
|
argv[5] = "8000";
|
||||||
|
argv[6] = "-b";
|
||||||
if (!class->single) {
|
argv[7] = "2048";
|
||||||
argv[argc++] = "-b";
|
argc = 8;
|
||||||
argv[argc++] = "2048";
|
|
||||||
}
|
|
||||||
|
|
||||||
argv[argc++] = "-f";
|
|
||||||
|
|
||||||
if (class->quiet) {
|
if (class->quiet) {
|
||||||
argv[argc++] = "4096";
|
argv[argc++] = "-f";
|
||||||
} else
|
|
||||||
argv[argc++] = "8192";
|
argv[argc++] = "8192";
|
||||||
|
}
|
||||||
|
|
||||||
/* Look for extra arguments and add them to the list */
|
/* Look for extra arguments and add them to the list */
|
||||||
strncpy(xargs, class->miscargs, sizeof(xargs) - 1);
|
strncpy(xargs, class->miscargs, sizeof(xargs) - 1);
|
||||||
argptr = xargs;
|
argptr = xargs;
|
||||||
while(argptr && !ast_strlen_zero(argptr)) {
|
while(argptr && strlen(argptr)) {
|
||||||
argv[argc++] = argptr;
|
argv[argc++] = argptr;
|
||||||
argptr = strchr(argptr, ',');
|
argptr = strchr(argptr, ',');
|
||||||
if (argptr) {
|
if (argptr) {
|
||||||
@@ -150,6 +161,9 @@ static int spawn_mp3(struct mohclass *class)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
files = 0;
|
files = 0;
|
||||||
while((de = readdir(dir)) && (files < MAX_MP3S)) {
|
while((de = readdir(dir)) && (files < MAX_MP3S)) {
|
||||||
if ((strlen(de->d_name) > 3) && !strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3")) {
|
if ((strlen(de->d_name) > 3) && !strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3")) {
|
||||||
@@ -160,6 +174,10 @@ static int spawn_mp3(struct mohclass *class)
|
|||||||
}
|
}
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pipe(fds)) {
|
if (pipe(fds)) {
|
||||||
ast_log(LOG_WARNING, "Pipe failed\n");
|
ast_log(LOG_WARNING, "Pipe failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -172,28 +190,47 @@ static int spawn_mp3(struct mohclass *class)
|
|||||||
printf("arg%d: %s\n", x, argv[x]);
|
printf("arg%d: %s\n", x, argv[x]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!files) {
|
if (!files && class->customexec && ! strlen(class->customexec)) {
|
||||||
ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir);
|
ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir);
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class->pid = fork();
|
class->pid = fork();
|
||||||
|
|
||||||
if (class->pid < 0) {
|
if (class->pid < 0) {
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
ast_log(LOG_WARNING, "Fork failed: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Fork failed: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!class->pid) {
|
if (!class->pid) {
|
||||||
int x;
|
int x;
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
/* Stdout goes to pipe */
|
/* Stdout goes to pipe */
|
||||||
|
|
||||||
dup2(fds[1], STDOUT_FILENO);
|
dup2(fds[1], STDOUT_FILENO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Close unused file descriptors */
|
/* Close unused file descriptors */
|
||||||
for (x=3;x<8192;x++)
|
for (x=3;x<8192;x++)
|
||||||
close(x);
|
close(x);
|
||||||
/* Child */
|
/* Child */
|
||||||
|
|
||||||
|
|
||||||
|
/* try custom */
|
||||||
|
execv(argv[0], argv);
|
||||||
chdir(class->dir);
|
chdir(class->dir);
|
||||||
/* Default install is /usr/local/bin */
|
/* Default install is /usr/local/bin */
|
||||||
execv(LOCAL_MPG_123, argv);
|
execv(LOCAL_MPG_123, argv);
|
||||||
@@ -485,9 +522,11 @@ static struct ast_generator mohgen =
|
|||||||
generate: moh_generate,
|
generate: moh_generate,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int moh_register(char *classname, char *mode, char *param, char *miscargs)
|
static int moh_register(char *classname, char *mode, char *param, char *miscargs,char *customexec)
|
||||||
{
|
{
|
||||||
struct mohclass *moh;
|
struct mohclass *moh;
|
||||||
|
char custmode[7] = "custom";
|
||||||
|
custmode[7]= (char) NULL;
|
||||||
#ifdef ZAPATA_MOH
|
#ifdef ZAPATA_MOH
|
||||||
int x;
|
int x;
|
||||||
#endif
|
#endif
|
||||||
@@ -504,14 +543,32 @@ static int moh_register(char *classname, char *mode, char *param, char *miscargs
|
|||||||
memset(moh, 0, sizeof(struct mohclass));
|
memset(moh, 0, sizeof(struct mohclass));
|
||||||
|
|
||||||
strncpy(moh->class, classname, sizeof(moh->class) - 1);
|
strncpy(moh->class, classname, sizeof(moh->class) - 1);
|
||||||
|
|
||||||
|
if(customexec && strlen(customexec)) {
|
||||||
|
strncpy(moh->customexec, customexec, sizeof(moh->customexec) - 1);
|
||||||
|
mode=custmode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (miscargs)
|
if (miscargs)
|
||||||
strncpy(moh->miscargs, miscargs, sizeof(moh->miscargs) - 1);
|
strncpy(moh->miscargs, miscargs, sizeof(moh->miscargs) - 1);
|
||||||
if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "mp3nb") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "quietmp3nb") || !strcasecmp(mode, "httpmp3")) {
|
|
||||||
if (!strcasecmp(mode, "mp3nb") || !strcasecmp(mode, "quietmp3nb"))
|
|
||||||
moh->single = 1;
|
|
||||||
if (!strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "quietmp3nb"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "httpmp3") || !strcasecmp(mode, "custom")) {
|
||||||
|
|
||||||
|
|
||||||
|
if(! customexec || (customexec && ! strlen(customexec))) {
|
||||||
|
if (!strcasecmp(mode, "quietmp3"))
|
||||||
moh->quiet = 1;
|
moh->quiet = 1;
|
||||||
strncpy(moh->dir, param, sizeof(moh->dir) - 1);
|
strncpy(moh->dir, param, sizeof(moh->dir) - 1);
|
||||||
|
}
|
||||||
moh->srcfd = -1;
|
moh->srcfd = -1;
|
||||||
#ifdef ZAPATA_MOH
|
#ifdef ZAPATA_MOH
|
||||||
/* It's an MP3 Moh -- Open /dev/zap/pseudo for timing... Is
|
/* It's an MP3 Moh -- Open /dev/zap/pseudo for timing... Is
|
||||||
@@ -526,6 +583,9 @@ static int moh_register(char *classname, char *mode, char *param, char *miscargs
|
|||||||
#else
|
#else
|
||||||
moh->pseudofd = -1;
|
moh->pseudofd = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
|
if (pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
|
||||||
ast_log(LOG_WARNING, "Unable to create moh...\n");
|
ast_log(LOG_WARNING, "Unable to create moh...\n");
|
||||||
if (moh->pseudofd > -1)
|
if (moh->pseudofd > -1)
|
||||||
@@ -578,10 +638,20 @@ static void load_moh_classes(void)
|
|||||||
*args = '\0';
|
*args = '\0';
|
||||||
args++;
|
args++;
|
||||||
}
|
}
|
||||||
moh_register(var->name, var->value, data,args);
|
moh_register(var->name, var->value, data,args,NULL);
|
||||||
}
|
}
|
||||||
var = var->next;
|
var = var->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var = ast_variable_browse(cfg, "custom_exec");
|
||||||
|
while(var) {
|
||||||
|
|
||||||
|
moh_register(var->name,NULL,NULL,NULL,var->value);
|
||||||
|
var = var->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ast_destroy(cfg);
|
ast_destroy(cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user