asterisk/asterisk.patch

Sun, 05 Jun 2011 11:43:33 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sun, 05 Jun 2011 11:43:33 +0200
changeset 347
10bd406e1c51
parent 316
153998c81c45
child 362
7c568c62ffb3
permissions
-rw-r--r--

Update, correct, and add new config logic including fax and license paths.

     1 Index: addons/chan_ooh323.c
     2 diff -Nau addons/chan_ooh323.c.orig addons/chan_ooh323.c
     3 --- addons/chan_ooh323.c.orig	2011-02-18 01:07:20.000000000 +0100
     4 +++ addons/chan_ooh323.c	2011-05-23 17:35:28.331029567 +0200
     5 @@ -23,6 +23,12 @@
     7  #include "chan_ooh323.h"
     8  #include <math.h>
     9 +#if defined __SVR4 && defined __sun
    10 +#include <sys/sockio.h>
    11 +#ifndef IPTOS_MINCOST
    12 +#define IPTOS_MINCOST 0x02
    13 +#endif
    14 +#endif
    16  #define FORMAT_STRING_SIZE	512
    18 Index: addons/ooh323c/src/ooCmdChannel.c
    19 diff -Nau addons/ooh323c/src/ooCmdChannel.c.orig addons/ooh323c/src/ooCmdChannel.c
    20 --- addons/ooh323c/src/ooCmdChannel.c.orig	2010-03-26 00:38:58.000000000 +0100
    21 +++ addons/ooh323c/src/ooCmdChannel.c	2011-05-23 17:35:28.331029567 +0200
    22 @@ -25,6 +25,10 @@
    23  #include "ooCalls.h"
    24  #include "ooCmdChannel.h"
    26 +#ifndef AF_LOCAL
    27 +#define AF_LOCAL AF_UNIX
    28 +#define PF_LOCAL PF_UNIX
    29 +#endif
    31  /** Global endpoint structure */
    32  extern OOH323EndPoint gH323ep;
    33 Index: addons/ooh323c/src/ooSocket.c
    34 diff -Nau addons/ooh323c/src/ooSocket.c.orig addons/ooh323c/src/ooSocket.c
    35 --- addons/ooh323c/src/ooSocket.c.orig	2011-02-16 21:21:17.000000000 +0100
    36 +++ addons/ooh323c/src/ooSocket.c	2011-05-23 17:35:28.331029567 +0200
    37 @@ -24,6 +24,9 @@
    39  #include "ooSocket.h"
    40  #include "ootrace.h"
    41 +#if defined __SVR4 && defined __sun
    42 +#include <sys/sockio.h>
    43 +#endif
    44  #if defined(_WIN32_WCE)
    45  static int inited = 0;
    46  #define SEND_FLAGS     0
    47 Index: addons/ooh323cDriver.c
    48 diff -Nau addons/ooh323cDriver.c.orig addons/ooh323cDriver.c
    49 --- addons/ooh323cDriver.c.orig	2011-02-18 01:07:20.000000000 +0100
    50 +++ addons/ooh323cDriver.c	2011-05-23 17:35:28.338530899 +0200
    51 @@ -27,6 +27,11 @@
    53  #define SEC_TO_HOLD_THREAD 24
    55 +#ifndef AF_LOCAL
    56 +#define AF_LOCAL AF_UNIX
    57 +#define PF_LOCAL PF_UNIX
    58 +#endif
    59 +
    60  extern struct ast_module *myself;
    61  extern OOBOOL gH323Debug;
    62  extern OOH323EndPoint gH323ep;
    63 Index: apps/app_backticks.c
    64 diff -Nau apps/app_backticks.c.orig apps/app_backticks.c
    65 --- apps/app_backticks.c.orig	1970-01-01 01:00:00.000000000 +0100
    66 +++ apps/app_backticks.c	2011-05-23 17:35:28.338530899 +0200
    67 @@ -0,0 +1,129 @@
    68 +
    69 +#include "asterisk.h"
    70 +
    71 +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.52 $")
    72 +
    73 +#include <stdio.h> 
    74 +#include <asterisk/file.h>
    75 +#include <asterisk/logger.h>
    76 +#include <asterisk/channel.h>
    77 +#include <asterisk/pbx.h>
    78 +#include <asterisk/module.h>
    79 +#include <asterisk/lock.h>
    80 +#include <asterisk/app.h>
    81 +#include <stdlib.h>
    82 +#include <unistd.h>
    83 +#include <string.h>
    84 +
    85 +static char *app      = "BackTicks";
    86 +static char *synopsis = "Execute a shell command and save the result as a variable.";
    87 +static char *desc     = "  Backticks(<VARNAME>|<command>)\n\n"
    88 +                        "Be sure to include a full path to the command!\n";
    89 +
    90 +static char *do_backticks(char *command, char *buf, size_t len) 
    91 +{
    92 +    int fds[2], pid = 0;
    93 +    char *ret = NULL;
    94 +
    95 +    memset(buf, 0, len);
    96 +    if (pipe(fds)) {    
    97 +        ast_log(LOG_WARNING, "Pipe/Exec failed\n");
    98 +    } else {
    99 +        pid = fork();
   100 +        if (pid < 0) {
   101 +            ast_log(LOG_WARNING, "Fork failed\n");
   102 +            close(fds[0]);
   103 +            close(fds[1]);
   104 +        } else if (pid) {
   105 +            /* parent */
   106 +            close(fds[1]);
   107 +            read(fds[0], buf, len);
   108 +            close(fds[0]);
   109 +            ret = buf;
   110 +        } else {
   111 +            /* child */
   112 +            char *argv[255] = {0};
   113 +            int argc = 0;
   114 +            char *p;
   115 +            char *mycmd = ast_strdupa(command);
   116 +            close(fds[0]);
   117 +            dup2(fds[1], STDOUT_FILENO);
   118 +            argv[argc++] = mycmd;
   119 +            do {
   120 +                if ((p = strchr(mycmd, ' '))) {
   121 +                    *p = '\0';
   122 +                    mycmd = ++p;
   123 +                    argv[argc++] = mycmd;
   124 +                }
   125 +            } while (p != NULL);
   126 +            close(fds[1]);          
   127 +            execv(argv[0], argv); 
   128 +            ast_log(LOG_ERROR, "exec of %s failed\n", argv[0]);
   129 +            exit(0);
   130 +        }
   131 +    }
   132 +    return ret;
   133 +}
   134 +
   135 +static int backticks_exec(struct ast_channel *chan, void *data)
   136 +{
   137 +    int res = 0;
   138 +    const char *usage = "Usage: Backticks(<VARNAME>|<command>)";
   139 +    char buf[1024], *argv[2], *mydata;
   140 +    int argc = 0;
   141 +    
   142 +    if (!data) {
   143 +        ast_log(LOG_WARNING, "%s\n", usage);
   144 +        return -1;
   145 +    }
   146 +    ast_autoservice_start(chan);
   147 +    if (!(mydata = ast_strdupa(data))) {
   148 +        ast_log(LOG_ERROR, "Memory Error!\n");
   149 +        res = -1;
   150 +    } else {
   151 +        if((argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]))) < 2) {
   152 +            ast_log(LOG_WARNING, "%s\n", usage);
   153 +            res = -1;
   154 +        }
   155 +        if (do_backticks(argv[1], buf, sizeof(buf)))
   156 +            pbx_builtin_setvar_helper(chan, argv[0], buf);
   157 +        else {
   158 +            ast_log(LOG_WARNING, "No Data!\n");
   159 +            res = -1;
   160 +        }
   161 +    }
   162 +    ast_autoservice_stop(chan);
   163 +    return res;
   164 +}
   165 +
   166 +static int function_backticks(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
   167 +{
   168 +    if (!do_backticks(data, buf, len)) {
   169 +        ast_log(LOG_WARNING, "No Data!\n");
   170 +        return -1;
   171 +    }
   172 +    return 0;
   173 +}
   174 +
   175 +static struct ast_custom_function backticks_function = {
   176 +    .name     = "BACKTICKS", 
   177 +    .desc     = "Executes a shell command and evaluates to the result.", 
   178 +    .syntax   = "BACKTICKS(<command>)", 
   179 +    .synopsis = "Executes a shell command.", 
   180 +    .read     = function_backticks
   181 +};
   182 +
   183 +static int unload_module(void)
   184 +{
   185 +    ast_custom_function_unregister(&backticks_function);
   186 +    return ast_unregister_application(app);
   187 +}
   188 +
   189 +static int load_module(void)
   190 +{
   191 +    ast_custom_function_register(&backticks_function);
   192 +    return ast_register_application(app, backticks_exec, synopsis, desc);
   193 +}
   194 +
   195 +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "BACKTICKS() dialplan function");
   196 +
   197 Index: apps/app_meetme.c
   198 diff -Nau apps/app_meetme.c.orig apps/app_meetme.c
   199 --- apps/app_meetme.c.orig	2011-01-29 19:09:37.000000000 +0100
   200 +++ apps/app_meetme.c	2011-05-23 17:35:28.338530899 +0200
   201 @@ -604,6 +604,7 @@
   202  	CONFFLAG_DURATION_LIMIT = (1 << 30),
   203  	/*! Do not write any audio to this channel until the state is up. */
   204  	CONFFLAG_NO_AUDIO_UNTIL_UP = (1 << 31),
   205 +	CONFFLAG_USERNAME = (1 << 32),
   206  };
   208  /* !If set play an intro announcement at start of conference */
   209 @@ -617,6 +618,7 @@
   210  	OPT_ARG_MOH_CLASS = 4,
   211  	OPT_ARG_INTROMSG = 5,
   212  	OPT_ARG_ARRAY_SIZE = 6,
   213 +	OPT_ARG_USERNAME = 7,
   214  };
   216  AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS
   217 @@ -650,6 +652,7 @@
   218  	AST_APP_OPTION('1', CONFFLAG_NOONLYPERSON ),
   219   	AST_APP_OPTION_ARG('S', CONFFLAG_DURATION_STOP, OPT_ARG_DURATION_STOP),
   220  	AST_APP_OPTION_ARG('L', CONFFLAG_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
   221 +	AST_APP_OPTION_ARG('n', CONFFLAG_USERNAME, OPT_ARG_USERNAME),
   222  END_OPTIONS );
   224  static const char * const app = "MeetMe";
   225 @@ -2437,6 +2440,12 @@
   226  		ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW))) {
   227  		char destdir[PATH_MAX];
   229 + 	    if (!ast_test_flag64(confflags, CONFFLAG_USERNAME)
   230 + 		&& !ast_strlen_zero(optargs[OPT_ARG_USERNAME]) 
   231 + 		&& ast_fileexists(optargs[OPT_ARG_USERNAME], NULL, NULL))
   232 + 		snprintf(destdir, sizeof(destdir), "%s", optargs[OPT_ARG_USERNAME]);
   233 + 	    else {
   234 +
   235  		snprintf(destdir, sizeof(destdir), "%s/meetme", ast_config_AST_SPOOL_DIR);
   237  		if (ast_mkdir(destdir, 0777) != 0) {
   238 @@ -2453,6 +2462,7 @@
   239  			res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
   240  		if (res == -1)
   241  			goto outrun;
   242 +	    }
   243  	}
   245  	ast_mutex_lock(&conf->playlock);
   246 Index: apps/app_voicemail.c
   247 diff -Nau apps/app_voicemail.c.orig apps/app_voicemail.c
   248 --- apps/app_voicemail.c.orig	2011-02-08 20:41:42.000000000 +0100
   249 +++ apps/app_voicemail.c	2011-05-23 17:35:28.348531751 +0200
   250 @@ -366,6 +366,7 @@
   251  static char imapport[8];
   252  static char imapflags[128];
   253  static char imapfolder[64];
   254 +static int  imapsubfold = 0;
   255  static char imapparentfolder[64] = "\0";
   256  static char greetingfolder[64];
   257  static char authuser[32];
   258 @@ -2464,7 +2465,7 @@
   259  	}
   261  	/* Build up server information */
   262 -	ast_build_string(&t, &left, "{%s:%s/imap", imapserver, imapport);
   263 +	ast_build_string(&t, &left, "{%s:%s", imapserver, imapport);
   265  	/* Add authentication user if present */
   266  	if (!ast_strlen_zero(authuser))
   267 @@ -6073,6 +6074,7 @@
   268  	/* simple. huh? */
   269  	char sequence[10];
   270  	char mailbox[256];
   271 +	char folder[256];
   272  	int res;
   274  	/* get the real IMAP message number for this message */
   275 @@ -6088,10 +6090,24 @@
   276  		mail_setflag(vms->mailstream, sequence, "\\Unseen");
   277  		mail_clearflag(vms->mailstream, sequence, "\\Seen");
   278  	}
   279 -	if (!strcasecmp(mbox(vmu, NEW_FOLDER), vms->curbox) && (box == NEW_FOLDER || box == OLD_FOLDER)) {
   280 -		ast_mutex_unlock(&vms->lock);
   281 +
   282 +	if ((!strcasecmp(mbox(vmu, NEW_FOLDER), vms->curbox) || \
   283 +		!strcasecmp(mbox(vmu, OLD_FOLDER), vms->curbox)) && \
   284 +		(box == NEW_FOLDER || box == OLD_FOLDER)) {  /* Don't copy data, */
   285 +		ast_mutex_unlock(&vms->lock);                /* just change Seen flag */
   286  		return 0;
   287 +	} else if (box != NEW_FOLDER && box != OLD_FOLDER) { /* Do copy data */
   288 +		if (imapsubfold == 1)                /* using INBOX or subfolder */
   289 +			snprintf(folder, sizeof(folder), "%s%c%s", imapfolder, delimiter, mbox(vmu, box));
   290 +		else
   291 +			strncpy(folder, mbox(vmu, box), sizeof(folder));
   292 +		int res = !mail_copy(vms->mailstream,sequence,folder);
   293 +		ast_mutex_unlock(&vms->lock);
   294 +		return res;
   295 +	} else {  /* Copy data to INBOX delegating new/old status to Seen flag */
   296 +		int res = !mail_copy(vms->mailstream,sequence,imapfolder);
   297  	}
   298 +
   299  	/* Create the folder if it don't exist */
   300  	imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */
   301  	ast_debug(5, "Checking if folder exists: %s\n", mailbox);
   302 @@ -10264,6 +10280,10 @@
   303  #ifndef IMAP_STORAGE
   304  				} else if (!cmd) {
   305  					vms.deleted[vms.curmsg] = 1;
   306 +#else
   307 +				} else if (!cmd && (folder_int(vms.curbox) > 1  || box > 1)) {
   308 +					vms.deleted[vms.curmsg] = 1;  /* Enforce deletion after */
   309 +					deleted = 1;                  /* successful copy op */
   310  #endif
   311  				} else {
   312  					vms.deleted[vms.curmsg] = 0;
   313 @@ -11731,6 +11751,15 @@
   314  		} else {
   315  			ast_copy_string(imapfolder, "INBOX", sizeof(imapfolder));
   316  		}
   317 +		/* IMAP saved (sub)folder location policy */
   318 +		if ((val = ast_variable_retrieve(cfg, "general", "imapsubfold"))) {
   319 +			if (ast_false(val))
   320 +				imapsubfold = 0;
   321 +			else
   322 +				imapsubfold = 1;
   323 +		} else {
   324 +			imapsubfold = 0;
   325 +		}
   326  		if ((val = ast_variable_retrieve(cfg, "general", "imapparentfolder"))) {
   327  			ast_copy_string(imapparentfolder, val, sizeof(imapparentfolder));
   328  		}
   329 Index: apps/.moduleinfo
   330 diff -Nau apps/.moduleinfo.orig apps/.moduleinfo
   331 --- apps/.moduleinfo.orig	2011-05-09 22:22:47.000000000 +0200
   332 +++ apps/.moduleinfo	2011-05-23 17:35:28.348531751 +0200
   333 @@ -72,7 +72,7 @@
   334  <member name="app_image" displayname="Image Transmission Application" remove_on_change="apps/app_image.o apps/app_image.so">
   335  </member>
   336  <member name="app_ivrdemo" displayname="IVR Demo Application" remove_on_change="apps/app_ivrdemo.o apps/app_ivrdemo.so">
   337 -	<defaultenabled>no</defaultenabled>
   338 +	<defaultenabled>yes</defaultenabled>
   339  </member>
   340  <member name="app_jack" displayname="JACK Interface" remove_on_change="apps/app_jack.o apps/app_jack.so">
   341  	<depend>jack</depend>
   342 @@ -127,10 +127,10 @@
   343  <member name="app_rpt" displayname="Radio Repeater/Remote Base Application" remove_on_change="apps/app_rpt.o apps/app_rpt.so">
   344  	<depend>dahdi</depend>
   345  	<depend>tonezone</depend>
   346 -	<defaultenabled>no</defaultenabled>
   347 +	<defaultenabled>yes</defaultenabled>
   348  </member>
   349  <member name="app_saycounted" displayname="Decline words according to channel language" remove_on_change="apps/app_saycounted.o apps/app_saycounted.so">
   350 -	<defaultenabled>no</defaultenabled>
   351 +	<defaultenabled>yes</defaultenabled>
   352  </member>
   353  <member name="app_sayunixtime" displayname="Say time" remove_on_change="apps/app_sayunixtime.o apps/app_sayunixtime.so">
   354  </member>
   355 Index: build_tools/cflags.xml
   356 diff -Nau build_tools/cflags.xml.orig build_tools/cflags.xml
   357 --- build_tools/cflags.xml.orig	2010-02-16 16:36:53.000000000 +0100
   358 +++ build_tools/cflags.xml	2011-05-23 17:35:28.348531751 +0200
   359 @@ -26,10 +26,11 @@
   360  		<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">
   361  		</member>
   362  		<member name="G711_NEW_ALGORITHM" displayname="Use the NEW ulaw/alaw codecs (slower, but cleaner)">
   363 -			<defaultenabled>no</defaultenabled>
   364 +			<defaultenabled>yes</defaultenabled>
   365  		</member>
   366  		<member name="G711_REDUCED_BRANCHING" displayname="New ulaw/alaw codec, reduced branching (might help it run faster in some architectures)">
   367  			<depend>G711_NEW_ALGORITHM</depend>
   368 +			<defaultenabled>yes</defaultenabled>
   369  		</member>
   370  		<member name="TEST_CODING_TABLES" displayname="New ulaw/alaw codec, turn on table tests on init">
   371  			<depend>G711_NEW_ALGORITHM</depend>
   372 Index: chan_capi-1.1.5.919/chan_capi20.h
   373 diff -Nau chan_capi-1.1.5.919/chan_capi20.h.orig chan_capi-1.1.5.919/chan_capi20.h
   374 --- chan_capi-1.1.5.919/chan_capi20.h.orig	2011-01-07 02:29:32.000000000 +0100
   375 +++ chan_capi-1.1.5.919/chan_capi20.h	2011-05-23 17:35:28.348531751 +0200
   376 @@ -4,10 +4,13 @@
   377   * first. Else the checks below will fail.
   378   */
   380 +#include <stddef.h>
   381  #include <capi20.h>
   383  #undef CAPI_OS_HINT
   385 +#ifndef USE_OWN_LIBCAPI
   386 +
   387  #if (defined(__FreeBSD__) || defined(__OpenBSD__) || \
   388       defined(__NetBSD__)  || defined(__APPLE__))
   390 @@ -29,6 +32,8 @@
   391  #include <capiutils.h>
   392  #endif /* BSD */
   394 +#endif
   395 +
   396  #ifndef HEADER_CID
   397  #define HEADER_CID(x) ((x)->adr.adrNCCI)
   398  #endif
   399 Index: chan_capi-1.1.5.919/chan_capi_utils.c
   400 diff -Nau chan_capi-1.1.5.919/chan_capi_utils.c.orig chan_capi-1.1.5.919/chan_capi_utils.c
   401 --- chan_capi-1.1.5.919/chan_capi_utils.c.orig	2011-01-07 02:29:32.000000000 +0100
   402 +++ chan_capi-1.1.5.919/chan_capi_utils.c	2011-05-23 17:35:28.348531751 +0200
   403 @@ -1155,6 +1155,9 @@
   404  {
   405  	MESSAGE_EXCHANGE_ERROR error;
   406  	int waitcount = 50;
   407 +#ifndef CAPI_MANUFACTURER_LEN
   408 +#define CAPI_MANUFACTURER_LEN 64
   409 +#endif
   410  	unsigned char manbuf[CAPI_MANUFACTURER_LEN];
   411  	_cmsg CMSG;
   413 Index: chan_capi-1.1.5.919/libcapi20/capi20.c
   414 diff -Nau chan_capi-1.1.5.919/libcapi20/capi20.c.orig chan_capi-1.1.5.919/libcapi20/capi20.c
   415 --- chan_capi-1.1.5.919/libcapi20/capi20.c.orig	2011-01-07 02:29:31.000000000 +0100
   416 +++ chan_capi-1.1.5.919/libcapi20/capi20.c	2011-05-23 17:35:28.348531751 +0200
   417 @@ -19,8 +19,10 @@
   418  #include <stdio.h>
   419  #include <ctype.h>
   420  #include <assert.h>
   421 +#ifdef __linux__
   422  #define _LINUX_LIST_H
   423  #include <linux/capi.h>
   424 +#endif
   426  #include <sys/socket.h>
   427  #include <netinet/in.h>
   428 @@ -48,17 +50,23 @@
   430  #define SEND_BUFSIZ		(128+2048)
   432 +#if 0
   433  static char capidevname[] = "/dev/capi20";
   434  static char capidevnamenew[] = "/dev/isdn/capi20";
   435 +#endif
   437  static int                  capi_fd = -1;
   438 +#if 0
   439  static capi_ioctl_struct    ioctl_data;
   440 +#endif
   442  static int remote_capi;
   443 +#if 0
   444  static char *globalconfigfilename = "/etc/capi20.conf";
   445  static char *userconfigfilename = ".capi20rc";
   446  static unsigned short int port;
   447  static char hostname[1024];
   448 +#endif
   449  static int tracelevel;
   450  static char *tracefile;
   452 @@ -77,17 +85,21 @@
   453  #define RCAPI_AUTH_USER_REQ                     CAPICMD(0xff, 0x00)
   454  #define RCAPI_AUTH_USER_CONF                    CAPICMD(0xff, 0x01)
   456 +#if 0
   457  static char *skip_whitespace(char *s)
   458  {
   459  	while (*s && isspace(*s)) s++;
   460  		return s;
   461  }
   462 +#endif
   464 +#if 0
   465  static char *skip_nonwhitespace(char *s)
   466  {
   467  	while (*s && !isspace(*s)) s++;
   468  		return s;
   469  } 
   470 +#endif
   472  static unsigned char get_byte(unsigned char **p)
   473  {
   474 @@ -95,10 +107,12 @@
   475  	return((unsigned char)*(*p - 1));
   476  }
   478 +#if 0
   479  static unsigned short get_word(unsigned char **p)
   480  {
   481  	return(get_byte(p) | (get_byte(p) << 8));
   482  }
   483 +#endif
   485  static unsigned short get_netword(unsigned char **p)
   486  {
   487 @@ -144,6 +158,7 @@
   488   * read config file
   489   */
   491 +#if 0
   492  static int read_config(void)
   493  {
   494  	FILE *fp = NULL;
   495 @@ -197,11 +212,13 @@
   496  	fclose(fp);
   497  	return(1);
   498  }
   499 +#endif
   501  /*
   502   *	socket function
   503   */
   505 +#if 0
   506  static int open_socket(void)
   507  {
   508  	int fd;
   509 @@ -225,6 +242,7 @@
   510  	close(fd);
   511  	return(-1);
   512  }
   513 +#endif
   515  static int socket_read(int fd, unsigned char *buf, int l)
   516  {
   517 @@ -328,6 +346,8 @@
   518  	if (likely(capi_fd >= 0))
   519  		return CapiNoError;
   521 +#if 0
   522 +
   523  	/*----- open managment link -----*/
   524  	if (read_config() && (remote_capi)) {
   525  		capi_fd = open_socket();
   526 @@ -347,6 +367,8 @@
   527  	if (ioctl(capi_fd, CAPI_INSTALLED, 0) == 0)
   528  		return CapiNoError;
   530 +#endif
   531 +
   532  	return CapiRegNotInstalled;
   533  }
   535 @@ -421,6 +443,7 @@
   536  	unsigned char *bufferstart;
   537  };
   539 +#if 0
   540  static struct applinfo *alloc_buffers(
   541  	unsigned MaxB3Connection,
   542  	unsigned MaxB3Blks,
   543 @@ -459,6 +482,7 @@
   544  	ap->lastfree->next = 0;
   545  	return ap;
   546  }
   547 +#endif
   549  static void free_buffers(struct applinfo *ap)
   550  {
   551 @@ -576,14 +600,17 @@
   552  	unsigned MaxSizeB3,
   553  	unsigned *ApplID)
   554  {
   555 +#if 0
   556  	int applid = 0;
   557  	char buf[PATH_MAX];
   558  	int i, fd = -1;
   560      *ApplID = 0;
   561 +#endif
   563      if (capi20_isinstalled() != CapiNoError)
   564         return CapiRegNotInstalled;
   565 +#if 0
   566  	if ((!remote_capi) || ((remote_capi) && ((fd = open_socket()) < 0))) {
   567  	    if ((fd = open(capidevname, O_RDWR|O_NONBLOCK, 0666)) < 0 && 
   568  		     (errno == ENOENT)) {
   569 @@ -621,6 +648,8 @@
   570  			close(fd);
   571  			return(errcode);
   572  		}
   573 +    }
   574 +#if 0
   575  	} else if ((applid = ioctl(fd, CAPI_REGISTER, &ioctl_data)) < 0) {
   576  		if (errno == EIO) {
   577  			if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
   578 @@ -666,6 +695,7 @@
   579  		    applid = alloc_applid(fd);
   580  		} // end old driver compatibility
   581  	}
   582 +#endif
   583  	if (remember_applid(applid, fd) < 0) {
   584  		close(fd);
   585  		return CapiRegOSResourceErr;
   586 @@ -676,6 +706,7 @@
   587  		return CapiRegOSResourceErr;
   588  	}
   589  	*ApplID = applid;
   590 +#endif
   591  	return CapiNoError;
   592  }
   594 @@ -784,11 +815,15 @@
   595  	                ret = CapiIllAppNr;
   596  	                break;
   597  	            case EIO:
   598 +#if 0
   599  	                if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
   600 +#endif
   601  	                    ret = CapiMsgOSResourceErr;
   602 +#if 0
   603  	                } else {
   604  						ret = (unsigned)ioctl_data.errcode;
   605  					}
   606 +#endif
   607  	                break;
   608  	          default:
   609  	                ret = CapiMsgOSResourceErr;
   610 @@ -842,7 +877,7 @@
   611  				rcvbuf[15] = (data >> 24) & 0xff;
   612  			} else {
   613  				u_int64_t data;
   614 -				ulong radr = (ulong)rcvbuf;
   615 +				unsigned long radr = (unsigned long)rcvbuf;
   616  				if (CAPIMSG_LEN(rcvbuf) < 30) {
   617  					/*
   618  					 * grr, 64bit arch, but no data64 included,
   619 @@ -899,6 +934,9 @@
   620  {
   621  	if (capi20_isinstalled() != CapiNoError)
   622  		return 0;
   623 +#ifndef CAPI_MANUFACTURER_LEN
   624 +#define CAPI_MANUFACTURER_LEN 64
   625 +#endif
   627  	if (remote_capi) {
   628  		unsigned char buf[100];
   629 @@ -911,15 +949,19 @@
   630  		return Buf;
   631  	}
   633 +#if 0
   634      ioctl_data.contr = Ctrl;
   636  	if (ioctl(capi_fd, CAPI_GET_MANUFACTURER, &ioctl_data) < 0)
   637 +#endif
   638  		return 0;
   640 +#if 0
   641  	memcpy(Buf, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN);
   642  	Buf[CAPI_MANUFACTURER_LEN-1] = 0;
   644  	return Buf;
   645 +#endif
   646  }
   648  unsigned char *
   649 @@ -934,16 +976,20 @@
   650  		set_rcapicmd_header(&p, 14, RCAPI_GET_VERSION_REQ, Ctrl);
   651  		if(!(remote_command(capi_fd, buf, 14, RCAPI_GET_VERSION_CONF)))
   652  			return 0;
   653 -		memcpy(Buf, buf + 1, sizeof(capi_version));
   654 +		memcpy(Buf, buf + 1, 128 /* sizeof(capi_version) */);
   655  		return Buf;
   656  	}
   658 +#if 0
   659  	ioctl_data.contr = Ctrl;
   660  	if (ioctl(capi_fd, CAPI_GET_VERSION, &ioctl_data) < 0) {
   661 +#endif
   662  		return 0;
   663 +#if 0
   664  	}
   665  	memcpy(Buf, &ioctl_data.version, sizeof(capi_version));
   666  	return Buf;
   667 +#endif
   668  }
   670  unsigned char * 
   671 @@ -952,6 +998,10 @@
   672  	if (capi20_isinstalled() != CapiNoError)
   673  		return 0;
   675 +#ifndef CAPI_SERIAL_LEN
   676 +#define CAPI_SERIAL_LEN 8
   677 +#endif
   678 +
   679  	if (remote_capi) {
   680  		unsigned char buf[100];
   681  		unsigned char *p = buf;
   682 @@ -963,15 +1013,19 @@
   683  		return Buf;
   684  	}
   686 +#if 0
   687  	ioctl_data.contr = Ctrl;
   689  	if (ioctl(capi_fd, CAPI_GET_SERIAL, &ioctl_data) < 0)
   690 +#endif
   691  		return 0;
   693 +#if 0
   694  	memcpy(Buf, &ioctl_data.serial, CAPI_SERIAL_LEN);
   695  	Buf[CAPI_SERIAL_LEN-1] = 0;
   697  	return Buf;
   698 +#endif
   699  }
   701  unsigned
   702 @@ -1018,6 +1072,7 @@
   703  			sizeof(ioctl_data.profile.ncontroller));
   704  	}
   705  	return CapiNoError;
   706 +#endif
   707  }
   708  /*
   709   * functions added to the CAPI2.0 spec
   710 Index: chan_capi-1.1.5.919/libcapi20/convert.c
   711 diff -Nau chan_capi-1.1.5.919/libcapi20/convert.c.orig chan_capi-1.1.5.919/libcapi20/convert.c
   712 --- chan_capi-1.1.5.919/libcapi20/convert.c.orig	2011-01-07 02:29:31.000000000 +0100
   713 +++ chan_capi-1.1.5.919/libcapi20/convert.c	2011-05-23 17:35:28.348531751 +0200
   714 @@ -11,7 +11,14 @@
   715  #include <stddef.h>
   716  #include <time.h>
   717  #include <ctype.h>
   718 +#ifdef __FreeBSD__
   719 +#include <sys/endian.h>
   720 +#define bswap_16 bswap16
   721 +#define bswap_32 bswap32
   722 +#define bswap_64 bswap64
   723 +#else
   724  #include <byteswap.h>
   725 +#endif
   727  #include "capi20.h"
   729 Index: chan_capi-1.1.5.919/Makefile
   730 diff -Nau chan_capi-1.1.5.919/Makefile.orig chan_capi-1.1.5.919/Makefile
   731 --- chan_capi-1.1.5.919/Makefile.orig	2011-01-07 02:29:32.000000000 +0100
   732 +++ chan_capi-1.1.5.919/Makefile	2011-05-23 17:35:28.348531751 +0200
   733 @@ -111,6 +111,9 @@
   734  CFLAGS+=-O2
   735  CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
   736  CFLAGS+=$(shell if uname -m | grep -q "ppc\|arm\|s390"; then echo "-fsigned-char"; fi)
   737 +ifeq (${USE_OWN_LIBCAPI},yes)
   738 +CFLAGS+=-DUSE_OWN_LIBCAPI
   739 +endif
   740  ifeq (${DIVA_STREAMING},1)
   741  CFLAGS += -DDIVA_STREAMING=1
   742  endif
   743 Index: channels/chan_sip.c
   744 diff -Nau channels/chan_sip.c.orig channels/chan_sip.c
   745 --- channels/chan_sip.c.orig	2011-04-25 17:11:30.000000000 +0200
   746 +++ channels/chan_sip.c	2011-05-23 17:35:28.358543497 +0200
   747 @@ -11458,7 +11458,16 @@
   748   	} else {
   749   		if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) {
   750   			/* If this is a NOTIFY, use the From: tag in the subscribe (RFC 3265) */
   751 -			snprintf(to, sizeof(to), "<%s%s>;tag=%s", (strncasecmp(p->uri, "sip:", 4) ? "sip:" : ""), p->uri, p->theirtag);
   752 +			if (strncasecmp(p->uri, "sip:", strlen("sip:")))
   753 +				if (strncasecmp(p->uri, "sips:", strlen("sips:")))
   754 +					if (p->socket.type == SIP_TRANSPORT_TLS)
   755 +						snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
   756 +					else
   757 +						snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
   758 +				else /* if (strncasecmp(p->uri, "sips:"... */
   759 +					snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
   760 +			else /* if (strncasecmp(p->uri, "sip:"... */
   761 +				snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
   762   		} else if (p->options && p->options->vxml_url) {
   763   			/* If there is a VXML URL append it to the SIP URL */
   764   			snprintf(to, sizeof(to), "<%s>;%s", p->uri, p->options->vxml_url);
   765 Index: channels/console_video.h
   766 diff -Nau channels/console_video.h.orig channels/console_video.h
   767 --- channels/console_video.h.orig	2008-06-30 17:45:15.000000000 +0200
   768 +++ channels/console_video.h	2011-05-23 17:35:28.358543497 +0200
   769 @@ -28,10 +28,7 @@
   770  		"console {device}"
   771  #else
   773 -#include <ffmpeg/avcodec.h>
   774 -#ifndef OLD_FFMPEG
   775 -#include <ffmpeg/swscale.h>     /* requires a recent ffmpeg */
   776 -#endif
   777 +#include <libavcoded/avcodec.h>
   779  #define CONSOLE_VIDEO_CMDS			\
   780  	"console {videodevice|videocodec"	\
   781 Index: configure
   782 diff -Nau configure.orig configure
   783 --- configure.orig	2011-01-27 18:03:01.000000000 +0100
   784 +++ configure	2011-05-23 17:41:08.331029717 +0200
   785 @@ -4704,11 +4704,6 @@
   786  esac
   788  case "${host_os}" in
   789 -     freebsd*)
   790 -     ac_default_prefix=/usr/local
   791 -     CPPFLAGS=-I/usr/local/include
   792 -     LDFLAGS=-L/usr/local/lib
   793 -     ;;
   794       openbsd*)
   795       ac_default_prefix=/usr/local
   796       if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
   797 @@ -18203,8 +18198,8 @@
   798  		if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
   799        		imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
   800  		fi
   801 -		imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
   802 -	  	imap_include="-I${IMAP_TK_DIR}/c-client"
   803 +		imap_libs="-limap -lssl -lcrypto -lcrypt"
   804 +	  	imap_include="-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap"
   805        	CPPFLAGS="${CPPFLAGS} ${imap_include}"
   806  	  	LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
   807  	  	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   808 @@ -25436,19 +25431,19 @@
   810     # now check for the header.
   811     if test "${AST_LUA_FOUND}" = "yes"; then
   812 -      LUA_LIB="${pbxlibdir} -llua5.1 -lm"
   813 +      LUA_LIB="${pbxlibdir} -llua -lm"
   814        # if --with-LUA=DIR has been specified, use it.
   815        if test "x${LUA_DIR}" != "x"; then
   816           LUA_INCLUDE="-I${LUA_DIR}/include"
   817        fi
   818        LUA_INCLUDE="${LUA_INCLUDE} "
   819 -      if test "xlua5.1/lua.h" = "x" ; then	# no header, assume found
   820 +      if test "xlua/lua.h" = "x" ; then	# no header, assume found
   821           LUA_HEADER_FOUND="1"
   822        else				# check for the header
   823           ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
   824           CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
   825 -         ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
   826 -if test "x$ac_cv_header_lua5_1_lua_h" = x""yes; then :
   827 +         ac_fn_c_check_header_mongrel "$LINENO" "lua/lua.h" "ac_cv_header_lua_lua_h" "$ac_includes_default"
   828 +if test "x$ac_cv_header_lua_lua_h" = x""yes; then :
   829    LUA_HEADER_FOUND=1
   830  else
   831    LUA_HEADER_FOUND=0
   832 @@ -25476,9 +25471,9 @@
   834  if test "x${PBX_LUA}" = "x1" ; then
   835  	if test x"${LUA_DIR}" = x; then
   836 -		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
   837 +		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua"
   838  	else
   839 -		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
   840 +		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua"
   841  	fi
   842  fi
   844 @@ -26157,7 +26152,7 @@
   845        	 pbxlibdir="-L${SQLITE_DIR}"
   846        fi
   847     fi
   848 -   pbxfuncname="sqlite_exec"
   849 +   pbxfuncname="sqlite3_exec"
   850     if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
   851        AST_SQLITE_FOUND=yes
   852     else
   853 @@ -26867,16 +26862,16 @@
   854      if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
   855  	PBX_GMIME=0
   856  	if test -n "$ac_tool_prefix"; then
   857 -  # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
   858 -set dummy ${ac_tool_prefix}gmime-config; ac_word=$2
   859 +   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
   860 + set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
   861  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   862  $as_echo_n "checking for $ac_word... " >&6; }
   863 -if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then :
   864 +if test "${ac_cv_prog_PKGCONFIG+set}" = set; then
   865    $as_echo_n "(cached) " >&6
   866  else
   867 -  case $CONFIG_GMIME in
   868 +  case $PKGCONFIG in
   869    [\\/]* | ?:[\\/]*)
   870 -  ac_cv_path_CONFIG_GMIME="$CONFIG_GMIME" # Let the user override the test with a path.
   871 +  ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
   872    ;;
   873    *)
   874    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   875 @@ -26887,7 +26882,7 @@
   876    test -z "$as_dir" && as_dir=.
   877      for ac_exec_ext in '' $ac_executable_extensions; do
   878    if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   879 -    ac_cv_path_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
   880 +    ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
   881      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   882      break 2
   883    fi
   884 @@ -26898,10 +26893,10 @@
   885    ;;
   886  esac
   887  fi
   888 -CONFIG_GMIME=$ac_cv_path_CONFIG_GMIME
   889 -if test -n "$CONFIG_GMIME"; then
   890 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5
   891 -$as_echo "$CONFIG_GMIME" >&6; }
   892 +PKGCONFIG=$ac_cv_path_PKGCONFIG
   893 +if test -n "$PKGCONFIG"; then
   894 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
   895 +$as_echo "$PKGCONFIG" >&6; }
   896  else
   897    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   898  $as_echo "no" >&6; }
   899 @@ -26909,18 +26904,18 @@
   902  fi
   903 -if test -z "$ac_cv_path_CONFIG_GMIME"; then
   904 -  ac_pt_CONFIG_GMIME=$CONFIG_GMIME
   905 -  # Extract the first word of "gmime-config", so it can be a program name with args.
   906 -set dummy gmime-config; ac_word=$2
   907 +if test -z "$ac_cv_path_PKGCONFIG"; then
   908 +  ac_pt_PKGCONFIG=$PKGCONFIG
   909 +  # Extract the first word of "pkg-config", so it can be a program name with args.
   910 +set dummy pkg-config; ac_word=$2
   911  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   912  $as_echo_n "checking for $ac_word... " >&6; }
   913 -if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then :
   914 +if test "${ac_cv_path_ac_pt_PKGCONFIG+set}" = set; then :
   915    $as_echo_n "(cached) " >&6
   916  else
   917 -  case $ac_pt_CONFIG_GMIME in
   918 +  case $ac_pt_PKGCONFIG in
   919    [\\/]* | ?:[\\/]*)
   920 -  ac_cv_path_ac_pt_CONFIG_GMIME="$ac_pt_CONFIG_GMIME" # Let the user override the test with a path.
   921 +  ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path.
   922    ;;
   923    *)
   924    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   925 @@ -26931,7 +26926,7 @@
   926    test -z "$as_dir" && as_dir=.
   927      for ac_exec_ext in '' $ac_executable_extensions; do
   928    if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   929 -    ac_cv_path_ac_pt_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
   930 +    ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
   931      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   932      break 2
   933    fi
   934 @@ -26942,17 +26937,17 @@
   935    ;;
   936  esac
   937  fi
   938 -ac_pt_CONFIG_GMIME=$ac_cv_path_ac_pt_CONFIG_GMIME
   939 -if test -n "$ac_pt_CONFIG_GMIME"; then
   940 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_GMIME" >&5
   941 -$as_echo "$ac_pt_CONFIG_GMIME" >&6; }
   942 +ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
   943 +if test -n "$ac_pt_PKGCONFIG"; then
   944 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5
   945 +$as_echo "${ECHO_T}$ac_pt_PKGCONFIG" >&6; }
   946  else
   947    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   948  $as_echo "no" >&6; }
   949  fi
   951 -  if test "x$ac_pt_CONFIG_GMIME" = x; then
   952 -    CONFIG_GMIME="No"
   953 +  if test "x$ac_pt_PKGCONFIG" = x; then
   954 +    PKGCONFIG="No"
   955    else
   956      case $cross_compiling:$ac_tool_warned in
   957  yes:)
   958 @@ -26960,17 +26955,15 @@
   959  $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
   960  ac_tool_warned=yes ;;
   961  esac
   962 -    CONFIG_GMIME=$ac_pt_CONFIG_GMIME
   963 +    PKGCONFIG=$ac_pt_PKGCONFIG
   964    fi
   965  else
   966 -  CONFIG_GMIME="$ac_cv_path_CONFIG_GMIME"
   967 +  PKGCONFIG="$ac_cv_path_PKGCONFIG"
   968  fi
   970 -	if test ! "x${CONFIG_GMIME}" = xNo; then
   971 -	    if test x"" = x ; then A=--cflags ; else A="" ; fi
   972 -	    GMIME_INCLUDE=$(${CONFIG_GMIME} $A)
   973 -	    if test x"" = x ; then A=--libs ; else A="" ; fi
   974 -	    GMIME_LIB=$(${CONFIG_GMIME} $A)
   975 +	if test ! "x${PKGCONFIG}" = xNo; then
   976 +	    GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.4 --cflags 2>/dev/null)
   977 +	    GMIME_LIB=$(${PKGCONFIG} gmime-2.4 --libs)
   978  	    if test x"#include <gmime/gmime.h>" != x ; then
   979  		saved_cppflags="${CPPFLAGS}"
   980  		if test "x${GMIME_DIR}" != "x"; then
   981 Index: formats/format_pcm.c
   982 diff -Nau formats/format_pcm.c.orig formats/format_pcm.c
   983 --- formats/format_pcm.c.orig	2010-07-26 05:27:06.000000000 +0200
   984 +++ formats/format_pcm.c	2011-05-23 17:35:28.368530778 +0200
   985 @@ -350,6 +350,7 @@
   986  		ast_log(LOG_WARNING, "Unable to write header\n");
   987  		return -1;
   988  	}
   989 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
   990  	return 0;
   991  }
   993 Index: formats/format_wav.c
   994 diff -Nau formats/format_wav.c.orig formats/format_wav.c
   995 --- formats/format_wav.c.orig	2010-09-02 18:43:09.000000000 +0200
   996 +++ formats/format_wav.c	2011-05-23 17:35:28.368530778 +0200
   997 @@ -310,6 +310,7 @@
   998  		ast_log(LOG_WARNING, "Unable to write header\n");
   999  		return -1;
  1001 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
  1002  	return 0;
  1005 Index: formats/format_wav_gsm.c
  1006 diff -Nau formats/format_wav_gsm.c.orig formats/format_wav_gsm.c
  1007 --- formats/format_wav_gsm.c.orig	2010-07-26 05:27:06.000000000 +0200
  1008 +++ formats/format_wav_gsm.c	2011-05-23 17:35:28.368530778 +0200
  1009 @@ -362,6 +362,7 @@
  1010  		ast_log(LOG_WARNING, "Unable to write header\n");
  1011  		return -1;
  1013 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
  1014  	return 0;
  1017 Index: main/db1-ast/hash/hash.h
  1018 diff -Nau main/db1-ast/hash/hash.h.orig main/db1-ast/hash/hash.h
  1019 --- main/db1-ast/hash/hash.h.orig	2006-08-21 04:11:39.000000000 +0200
  1020 +++ main/db1-ast/hash/hash.h	2011-05-23 17:35:28.368530778 +0200
  1021 @@ -36,6 +36,8 @@
  1022   *	@(#)hash.h	8.3 (Berkeley) 5/31/94
  1023   */
  1025 +#include <stdint.h>
  1027  /* Operations */
  1028  typedef enum {
  1029  	HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
  1030 Index: main/db1-ast/hash/ndbm.c
  1031 diff -Nau main/db1-ast/hash/ndbm.c.orig main/db1-ast/hash/ndbm.c
  1032 --- main/db1-ast/hash/ndbm.c.orig	2006-08-21 04:11:39.000000000 +0200
  1033 +++ main/db1-ast/hash/ndbm.c	2011-05-23 17:35:28.368530778 +0200
  1034 @@ -49,7 +49,8 @@
  1035  #include <string.h>
  1036  #include <stdlib.h>
  1038 -#include <ndbm.h>
  1039 +#include "../include/ndbm.h"
  1040 +#include "../include/db.h"
  1041  #include "hash.h"
  1043  /*
  1044 Index: main/features.c
  1045 diff -Nau main/features.c.orig main/features.c
  1046 --- main/features.c.orig	2011-02-09 20:52:51.000000000 +0100
  1047 +++ main/features.c	2011-05-23 17:35:28.368530778 +0200
  1048 @@ -1658,6 +1658,10 @@
  1049  			snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
  1052 +		for(x = 0; x < strlen(touch_filename); x++) {
  1053 +			if (args[x] == '/')
  1054 +				args[x] = '-';
  1055 +		}
  1056  		for(x = 0; x < strlen(args); x++) {
  1057  			if (args[x] == '/')
  1058  				args[x] = '-';
  1059 @@ -1774,6 +1778,10 @@
  1060  			snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav"));
  1063 +		for( x = 0; x < strlen(touch_filename); x++) {
  1064 +			if (args[x] == '/')
  1065 +				args[x] = '-';
  1066 +		}
  1067  		for( x = 0; x < strlen(args); x++) {
  1068  			if (args[x] == '/')
  1069  				args[x] = '-';
  1070 Index: main/file.c
  1071 diff -Nau main/file.c.orig main/file.c
  1072 --- main/file.c.orig	2011-01-26 02:26:26.000000000 +0100
  1073 +++ main/file.c	2011-05-23 17:35:28.378531576 +0200
  1074 @@ -255,7 +255,7 @@
  1075  	char *fn = NULL;
  1077  	if (!strcmp(ext, "wav49"))
  1078 -		ext = "WAV";
  1079 +		ext = "wav";
  1081  	if (filename[0] == '/') {
  1082  		if (asprintf(&fn, "%s.%s", filename, ext) < 0) {
  1083 Index: main/Makefile
  1084 diff -Nau main/Makefile.orig main/Makefile
  1085 --- main/Makefile.orig	2010-12-18 00:52:04.000000000 +0100
  1086 +++ main/Makefile	2011-05-23 17:35:28.378531576 +0200
  1087 @@ -69,10 +69,7 @@
  1088  endif
  1090  ifeq ($(OSARCH),FreeBSD)
  1091 -  # -V is understood by BSD Make, not by GNU make.
  1092 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  1093 -  AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
  1094 -  AST_LIBS+=-lcrypto
  1095 +  AST_LIBS+=-lpthread -lcrypto
  1096  endif
  1098  ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
  1099 Index: main/tcptls.c
  1100 diff -Nau main/tcptls.c.orig main/tcptls.c
  1101 --- main/tcptls.c.orig	2011-04-25 17:11:30.000000000 +0200
  1102 +++ main/tcptls.c	2011-05-23 17:35:28.378531576 +0200
  1103 @@ -353,6 +353,7 @@
  1104  	if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) {
  1105  		if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0)
  1106  			ast_verb(0, "SSL CA file(%s)/path(%s) error\n", cfg->cafile, cfg->capath);
  1107 +        SSL_CTX_set_client_CA_list(cfg->ssl_ctx, S_OR(cfg->cafile, NULL));
  1110  	ast_verb(0, "SSL certificate ok\n");
  1111 Index: main/udptl.c
  1112 diff -Nau main/udptl.c.orig main/udptl.c
  1113 --- main/udptl.c.orig	2011-02-21 16:02:20.000000000 +0100
  1114 +++ main/udptl.c	2011-05-23 17:35:28.378531576 +0200
  1115 @@ -98,6 +98,18 @@
  1117  #define UDPTL_BUF_MASK              15
  1119 +/*! Copied from chan_oss.c, corrects link errors:
  1120 +udptl.o: In function `calculate_local_max_datagram':
  1121 +main/udptl.c:740: undefined reference to `MIN'
  1122 +udptl.o: In function `calculate_far_max_ifp':
  1123 +main/udptl.c:770: undefined reference to `MAX' */
  1124 +#ifndef MIN
  1125 +#define MIN(a,b) ((a) < (b) ? (a) : (b))
  1126 +#endif
  1127 +#ifndef MAX
  1128 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
  1129 +#endif
  1131  typedef struct {
  1132  	int buf_len;
  1133  	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
  1134 Index: Makefile
  1135 diff -Nau Makefile.orig Makefile
  1136 --- Makefile.orig	2011-02-01 19:02:06.000000000 +0100
  1137 +++ Makefile	2011-05-23 17:35:28.378531576 +0200
  1138 @@ -230,15 +230,6 @@
  1139    _ASTCFLAGS+=-fsigned-char
  1140  endif
  1142 -ifeq ($(OSARCH),FreeBSD)
  1143 -  ifeq ($(PROC),i386)
  1144 -    _ASTCFLAGS+=-march=i686
  1145 -  endif
  1146 -  # -V is understood by BSD Make, not by GNU make.
  1147 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  1148 -  _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  1149 -endif
  1151  ifeq ($(OSARCH),NetBSD)
  1152    _ASTCFLAGS+=-pthread -I/usr/pkg/include
  1153  endif
  1154 Index: menuselect-tree
  1155 diff -Nau menuselect-tree.orig menuselect-tree
  1156 --- menuselect-tree.orig	2011-05-09 22:22:55.000000000 +0200
  1157 +++ menuselect-tree	2011-05-23 17:35:28.378531576 +0200
  1158 @@ -38,6 +38,8 @@
  1159  </member>
  1160  <member name="app_authenticate" displayname="Authentication Application" remove_on_change="apps/app_authenticate.o apps/app_authenticate.so">
  1161  </member>
  1162 +<member name="app_backticks" displayname="BACKTICKS() dialplan function" remove_on_change="apps/app_backticks.o apps/app_backticks.so">
  1163 +</member>
  1164  <member name="app_cdr" displayname="Tell Asterisk to not maintain a CDR for the current call" remove_on_change="apps/app_cdr.o apps/app_cdr.so">
  1165  </member>
  1166  <member name="app_celgenuserevent" displayname="Generate an User-Defined CEL event" remove_on_change="apps/app_celgenuserevent.o apps/app_celgenuserevent.so">
  1167 @@ -937,11 +939,11 @@
  1168  		<member name="CORE-SOUNDS-EN-ALAW" displayname="English, a-Law format">
  1169  		</member>
  1170  		<member name="CORE-SOUNDS-EN-GSM" displayname="English, GSM format" >
  1171 -			<defaultenabled>yes</defaultenabled>
  1172  		</member>
  1173  		<member name="CORE-SOUNDS-EN-G729" displayname="English, G.729 format">
  1174  		</member>
  1175  		<member name="CORE-SOUNDS-EN-G722" displayname="English, G.722 format">
  1176 +			<defaultenabled>yes</defaultenabled>
  1177  		</member>
  1178  		<member name="CORE-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format">
  1179  		</member>
  1180 @@ -1006,7 +1008,6 @@
  1181  	</category>
  1182  	<category name="MENUSELECT_MOH" displayname="Music On Hold File Packages" positive_output="yes">
  1183  		<member name="MOH-OPSOUND-WAV" displayname="opsound.org Music On Hold Files, WAV format" >
  1184 -			<defaultenabled>yes</defaultenabled>
  1185  		</member>
  1186  		<member name="MOH-OPSOUND-ULAW" displayname="opsound.org Music On Hold Files, mu-Law format" >
  1187  		</member>
  1188 @@ -1017,6 +1018,7 @@
  1189  		<member name="MOH-OPSOUND-G729" displayname="opsound.org Music On Hold Files, G.729 format" >
  1190  		</member>
  1191  		<member name="MOH-OPSOUND-G722" displayname="opsound.org Music On Hold Files, G.722 format" >
  1192 +			<defaultenabled>yes</defaultenabled>
  1193  		</member>
  1194  		<member name="MOH-OPSOUND-SLN16" displayname="opsound.org Music On Hold Files, Signed-linear 16kHz format" >
  1195  		</member>
  1196 @@ -1037,6 +1039,7 @@
  1197  		<member name="EXTRA-SOUNDS-EN-G729" displayname="English, G.729 format">
  1198  		</member>
  1199  		<member name="EXTRA-SOUNDS-EN-G722" displayname="English, G.722 format">
  1200 +			<defaultenabled>yes</defaultenabled>
  1201  		</member>
  1202  		<member name="EXTRA-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format">
  1203  		</member>
  1204 Index: res/res_http_post.c
  1205 diff -Nau res/res_http_post.c.orig res/res_http_post.c
  1206 --- res/res_http_post.c.orig	2009-10-27 17:48:54.000000000 +0100
  1207 +++ res/res_http_post.c	2011-05-23 17:35:28.378531576 +0200
  1208 @@ -122,14 +122,8 @@
  1209  		ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n");
  1210  		return;
  1211  	} else if (GMIME_IS_MULTIPART(part)) {
  1212 -		GList *l;
  1214 -		ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
  1215 -		l = GMIME_MULTIPART(part)->subparts;
  1216 -		while (l) {
  1217 -			process_message_callback(l->data, cbinfo);
  1218 -			l = l->next;
  1219 -		}
  1220 +  		ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
  1221 +		g_mime_multipart_foreach(GMIME_MULTIPART(part), process_message_callback, cbinfo);
  1222  	} else if (GMIME_IS_PART(part)) {
  1223  		const char *filename;
  1225 Index: sounds/sounds.xml
  1226 diff -Nau sounds/sounds.xml.orig sounds/sounds.xml
  1227 --- sounds/sounds.xml.orig	2010-10-18 23:51:23.000000000 +0200
  1228 +++ sounds/sounds.xml	2011-05-23 17:35:28.378531576 +0200
  1229 @@ -6,11 +6,11 @@
  1230  		<member name="CORE-SOUNDS-EN-ALAW" displayname="English, a-Law format">
  1231  		</member>
  1232  		<member name="CORE-SOUNDS-EN-GSM" displayname="English, GSM format" >
  1233 -			<defaultenabled>yes</defaultenabled>
  1234  		</member>
  1235  		<member name="CORE-SOUNDS-EN-G729" displayname="English, G.729 format">
  1236  		</member>
  1237  		<member name="CORE-SOUNDS-EN-G722" displayname="English, G.722 format">
  1238 +			<defaultenabled>yes</defaultenabled>
  1239  		</member>
  1240  		<member name="CORE-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format">
  1241  		</member>
  1242 @@ -75,7 +75,6 @@
  1243  	</category>
  1244  	<category name="MENUSELECT_MOH" displayname="Music On Hold File Packages" positive_output="yes">
  1245  		<member name="MOH-OPSOUND-WAV" displayname="opsound.org Music On Hold Files, WAV format" >
  1246 -			<defaultenabled>yes</defaultenabled>
  1247  		</member>
  1248  		<member name="MOH-OPSOUND-ULAW" displayname="opsound.org Music On Hold Files, mu-Law format" >
  1249  		</member>
  1250 @@ -86,6 +85,7 @@
  1251  		<member name="MOH-OPSOUND-G729" displayname="opsound.org Music On Hold Files, G.729 format" >
  1252  		</member>
  1253  		<member name="MOH-OPSOUND-G722" displayname="opsound.org Music On Hold Files, G.722 format" >
  1254 +			<defaultenabled>yes</defaultenabled>
  1255  		</member>
  1256  		<member name="MOH-OPSOUND-SLN16" displayname="opsound.org Music On Hold Files, Signed-linear 16kHz format" >
  1257  		</member>
  1258 @@ -106,6 +106,7 @@
  1259  		<member name="EXTRA-SOUNDS-EN-G729" displayname="English, G.729 format">
  1260  		</member>
  1261  		<member name="EXTRA-SOUNDS-EN-G722" displayname="English, G.722 format">
  1262 +			<defaultenabled>yes</defaultenabled>
  1263  		</member>
  1264  		<member name="EXTRA-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format">
  1265  		</member>
  1266 Index: cdr/cdr_radius.c
  1267 diff -Nau cdr/cdr_radius.c.orig cdr/cdr_radius.c
  1268 --- cdr/cdr_radius.c.orig	2010-07-20 21:35:02.000000000 +0200
  1269 +++ cdr/cdr_radius.c	2011-05-23 17:35:28.378531576 +0200
  1270 @@ -105,10 +105,18 @@
  1271  	if (!rc_avpair_add(rh, tosend, PW_AST_SRC, &cdr->src, strlen(cdr->src), VENDOR_CODE))
  1272  		return -1;
  1274 + 	/* RADIUS standard identifier patch */
  1275 +	if (!rc_avpair_add(rh, tosend, PW_CALLING_STATION_ID, &cdr->src, strlen(cdr->src), 0))
  1276 +		return -1;
  1278   	/* Destination */
  1279  	if (!rc_avpair_add(rh, tosend, PW_AST_DST, &cdr->dst, strlen(cdr->dst), VENDOR_CODE))
  1280  		return -1;
  1282 + 	/* RADIUS standard identifier patch */
  1283 +	if (!rc_avpair_add(rh, tosend, PW_CALLED_STATION_ID, &cdr->dst, strlen(cdr->dst), 0))
  1284 +		return -1;
  1286   	/* Destination context */
  1287  	if (!rc_avpair_add(rh, tosend, PW_AST_DST_CTX, &cdr->dcontext, strlen(cdr->dcontext), VENDOR_CODE))
  1288  		return -1;
  1289 @@ -163,6 +171,10 @@
  1290  	if (!rc_avpair_add(rh, tosend, PW_AST_BILL_SEC, &cdr->billsec, 0, VENDOR_CODE))
  1291  		return -1;
  1293 + 	/* RADIUS standard identifier patch */
  1294 +	if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_TIME, &cdr->billsec, 0, 0))
  1295 +		return -1;
  1297  	/* Disposition */
  1298  	tmp = ast_cdr_disp2str(cdr->disposition);
  1299  	if (!rc_avpair_add(rh, tosend, PW_AST_DISPOSITION, tmp, strlen(tmp), VENDOR_CODE))
  1300 @@ -186,10 +198,14 @@
  1303  	/* Setting Acct-Session-Id & User-Name attributes for proper generation
  1304 -	   of Acct-Unique-Session-Id on server side */
  1305 -	/* Channel */
  1306 -	if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->channel, strlen(cdr->channel), 0))
  1307 -		return -1;
  1308 +	   of Acct-Unique-Session-Id on server side Channel */
  1309 +	{
  1310 +		char szChanuser[PATH_MAX] = {0};
  1311 +		strncpy(szChanuser, &cdr->channel, PATH_MAX-1);
  1312 +		*(strrchr(szChanuser, '-')) = 0;
  1313 +		if (!rc_avpair_add(rh, tosend, PW_USER_NAME, szChanuser, strlen(cdr->channel), 0))
  1314 +			return -1;
  1315 +	}
  1317  	/* Unique ID */
  1318  	if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_ID, &cdr->uniqueid, strlen(cdr->uniqueid), 0))

mercurial