Back out accidental changes by anthm
authorMark Spencer <markster@digium.com>
Fri, 2 Jul 2004 23:11:14 +0000 (23:11 +0000)
committerMark Spencer <markster@digium.com>
Fri, 2 Jul 2004 23:11:14 +0000 (23:11 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3378 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
codecs/Makefile
include/asterisk/cdr.h
include/asterisk/manager.h
res/res_musiconhold.c

index 8c8bd07..4139ae7 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -194,13 +194,6 @@ endif
 CC=gcc
 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
        @echo " +--------- Asterisk Build Complete ---------+"  
        @echo " + Asterisk has successfully been built, but +"  
@@ -212,11 +205,6 @@ _all: all
 
 all: depend asterisk subdirs
 
-#######  res_perl
-perlxsi.o: 
-       $(CC) -c perlxsi.c $(PERLCFLAGS) -o perlxsi.o
-####### /res_perl
-
 editline/config.h:
        cd editline && unset CFLAGS LIBS && ./configure ; \
 
index 9a1d561..43c4e13 100755 (executable)
 # and have placed it in the g723.1 directory and/or the Annex-B code in 
 # 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.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")
 MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
 CFLAGS+=-fPIC
@@ -29,9 +26,6 @@ CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include"
 
 LIBG723=g723.1/libg723.a
 LIBG723B=g723.1b/libg723b.a
-LIBG729=g729cp/libg729.a
-LIBG729AB=g729abc/libg729ab.a
-LIBG729B=g729bc/libg729b.a
 LIBGSM=gsm/lib/libgsm.a
 LIBGSMT=gsm/lib/libgsm.a
 LIBLPC10=lpc10/liblpc10.a
@@ -39,7 +33,7 @@ LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib")
 LIBSPEEX+=-lspeex -lm
 LIBILBC=ilbc/libilbc.a
 
-CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) $(MODG729) codec_gsm.so codec_lpc10.so  \
+CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_lpc10.so  \
         codec_adpcm.so codec_ulaw.so codec_alaw.so codec_a_mu.so \
        codec_g726.so
 
@@ -49,9 +43,6 @@ clean:
        rm -f *.so *.o .depend
        ! [ -d g723.1 ] || $(MAKE) -C g723.1 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 lpc10 clean
        $(MAKE) -C ilbc clean
@@ -59,15 +50,6 @@ clean:
 $(LIBG723):
        $(MAKE) -C g723.1 all
 
-$(LIBG729):
-       $(MAKE) -C g729cp all
-
-$(LIBG729B):
-       $(MAKE) -C g729bc all
-
-$(LIBG729AB):
-       $(MAKE) -C g729abc all
-
 gsm/lib/libgsm.a:
        $(MAKE) -C gsm lib/libgsm.a
 
@@ -92,24 +74,6 @@ codec_g723_1b.o : codec_g723_1.c
 codec_g723_1b.so : codec_g723_1b.o $(LIBG723B)
        $(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) 
        $(CC) $(SOLINK) -o $@ $< $(LIBGSM)
 
index 2da5b95..05d5066 100755 (executable)
@@ -63,9 +63,9 @@ struct ast_cdr {
        
        struct timeval end;
        /*! Total time in system, in seconds */
-       int duration;
+       int duration;                           
        /*! Total time call is up, in seconds */
-       int billsec;
+       int billsec;                            
        /*! What happened to the call */
        int disposition;                        
        /*! What flags to use */
index 7e3f8d3..d25e150 100755 (executable)
@@ -48,9 +48,6 @@
 #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_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 */
 #define MAX_HEADERS 80
index dc14467..311cb40 100755 (executable)
@@ -75,10 +75,10 @@ struct mohclass {
        char class[80];
        char dir[256];
        char miscargs[256];
-       char customexec[256];
        int destroyme;
        int pid;                /* PID of mpg123 */
        int quiet;
+       int single;
        pthread_t thread;
        struct mohdata *members;
        /* Source of audio */
@@ -106,82 +106,64 @@ AST_MUTEX_DEFINE_STATIC(moh_lock);
 static int spawn_mp3(struct mohclass *class)
 {
        int fds[2];
-       int files=0;
+       int files;
        char fns[MAX_MP3S][80];
        char *argv[MAX_MP3S + 50];
        char xargs[256];
        char *argptr;
-       int argc;
+       int argc = 0;
        DIR *dir;
        struct dirent *de;
+       dir = opendir(class->dir);
+       if (!dir) {
+               ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
+               return -1;
+       }
+       argv[argc++] = "mpg123";
+       argv[argc++] = "-q";
+       argv[argc++] = "-s";
+       argv[argc++] = "--mono";
+       argv[argc++] = "-r";
+       argv[argc++] = "8000";
+
+       if (!class->single) {
+               argv[argc++] = "-b";
+               argv[argc++] = "2048";
+       }
 
-       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++;
+       argv[argc++] = "-f";
+       
+       if (class->quiet) {
+               argv[argc++] = "4096";
+       } else
+               argv[argc++] = "8192";
+
+       /* Look for extra arguments and add them to the list */
+       strncpy(xargs, class->miscargs, sizeof(xargs) - 1);
+       argptr = xargs;
+       while(argptr && !ast_strlen_zero(argptr)) {
+               argv[argc++] = argptr;
+               argptr = strchr(argptr, ',');
+               if (argptr) {
+                       *argptr = '\0';
+                       argptr++;
                }
        }
-       else {
-         dir = opendir(class->dir);
-         if (!dir) {
-           ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
-           return -1;
-         }
-         argv[0] = "mpg123";
-         argv[1] = "-q";
-         argv[2] = "-s";
-         argv[3] = "--mono";
-         argv[4] = "-r";
-         argv[5] = "8000";
-         argv[6] = "-b";
-         argv[7] = "2048";
-         argc = 8;
-         if (class->quiet) {
-           argv[argc++] = "-f";
-           argv[argc++] = "8192";
-         }
-
-         /* Look for extra arguments and add them to the list */
-         strncpy(xargs, class->miscargs, sizeof(xargs) - 1);
-         argptr = xargs;
-         while(argptr && strlen(argptr)) {
-           argv[argc++] = argptr;
-           argptr = strchr(argptr, ',');
-           if (argptr) {
-             *argptr = '\0';
-             argptr++;
-           }
-         }
-
-               
-
-
-         files = 0;
-         while((de = readdir(dir)) && (files < MAX_MP3S)) {
-           if ((strlen(de->d_name) > 3) && !strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3")) {
-             strncpy(fns[files], de->d_name, sizeof(fns[files]));
-             argv[argc++] = fns[files];
-             files++;
-           }
-         }
-         argv[argc] = NULL;
-         closedir(dir);
-       }
-
-
 
-         if (pipe(fds)) {      
-           ast_log(LOG_WARNING, "Pipe failed\n");
-           return -1;
-         }
+       files = 0;
+       while((de = readdir(dir)) && (files < MAX_MP3S)) {
+               if ((strlen(de->d_name) > 3) && !strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3")) {
+                       strncpy(fns[files], de->d_name, sizeof(fns[files]));
+                       argv[argc++] = fns[files];
+                       files++;
+               }
+       }
+       argv[argc] = NULL;
+       closedir(dir);
+       if (pipe(fds)) {        
+               ast_log(LOG_WARNING, "Pipe failed\n");
+               return -1;
+       }
 #if 0
        printf("%d files total, %d args total\n", files, argc);
        {
@@ -190,47 +172,28 @@ static int spawn_mp3(struct mohclass *class)
                        printf("arg%d: %s\n", x, argv[x]);
        }
 #endif 
-       if (!files &&  class->customexec && ! strlen(class->customexec)) {
+       if (!files) {
                ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir);
                close(fds[0]);
                close(fds[1]);
                return -1;
        }
-
-
-
        class->pid = fork();
-
        if (class->pid < 0) {
                close(fds[0]);
                close(fds[1]);
                ast_log(LOG_WARNING, "Fork failed: %s\n", strerror(errno));
                return -1;
        }
-
-
-
-
-
        if (!class->pid) {
                int x;
                close(fds[0]);
                /* Stdout goes to pipe */
-
                dup2(fds[1], STDOUT_FILENO);
-
-
-
-
-               
-                 /* Close unused file descriptors */
-                 for (x=3;x<8192;x++)
-                   close(x);
-                 /* Child */
-               
-
-                 /* try custom */
-               execv(argv[0], argv);
+               /* Close unused file descriptors */
+               for (x=3;x<8192;x++)
+                       close(x);
+               /* Child */
                chdir(class->dir);
                /* Default install is /usr/local/bin */
                execv(LOCAL_MPG_123, argv);
@@ -522,11 +485,9 @@ static struct ast_generator mohgen =
        generate: moh_generate,
 };
 
-static int moh_register(char *classname, char *mode, char *param, char *miscargs,char *customexec)
+static int moh_register(char *classname, char *mode, char *param, char *miscargs)
 {
        struct mohclass *moh;
-       char custmode[7] = "custom";
-       custmode[7]= (char) NULL;
 #ifdef ZAPATA_MOH
        int x;
 #endif
@@ -543,32 +504,14 @@ static int moh_register(char *classname, char *mode, char *param, char *miscargs
        memset(moh, 0, sizeof(struct mohclass));
 
        strncpy(moh->class, classname, sizeof(moh->class) - 1);
-
-       if(customexec && strlen(customexec)) {
-         strncpy(moh->customexec, customexec, sizeof(moh->customexec) - 1);
-         mode=custmode;
-
-       }
-
        if (miscargs)
-         strncpy(moh->miscargs, miscargs, sizeof(moh->miscargs) - 1);
-
-
-
-
-
-
-
-
-
-       if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "httpmp3") || !strcasecmp(mode, "custom")) {
-
-
-         if(! customexec || (customexec && ! strlen(customexec))) {
-               if (!strcasecmp(mode, "quietmp3"))
+               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"))
                        moh->quiet = 1;
                strncpy(moh->dir, param, sizeof(moh->dir) - 1);
-         }
                moh->srcfd = -1;
 #ifdef ZAPATA_MOH
                /* It's an MP3 Moh -- Open /dev/zap/pseudo for timing...  Is
@@ -583,9 +526,6 @@ static int moh_register(char *classname, char *mode, char *param, char *miscargs
 #else
                moh->pseudofd = -1;
 #endif
-
-
-
                if (pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
                        ast_log(LOG_WARNING, "Unable to create moh...\n");
                        if (moh->pseudofd > -1)
@@ -638,20 +578,10 @@ static void load_moh_classes(void)
                                        *args = '\0';
                                        args++;
                                }
-                               moh_register(var->name, var->value, data,args,NULL);
+                               moh_register(var->name, var->value, data,args);
                        }
                        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);
        }
 }
@@ -676,7 +606,7 @@ static void ast_moh_destroy(void)
                        ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", moh->pid, tbytes);
                        close(moh->srcfd);
                        moh->pid = 0;
-                       }
+               }
                moh = moh->next;
        }
        ast_mutex_unlock(&moh_lock);