asterisk/asterisk.patch

Thu, 15 Sep 2011 19:40:20 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Sep 2011 19:40:20 +0200
changeset 362
7c568c62ffb3
parent 347
10bd406e1c51
child 398
08f5eb82b58f
permissions
-rw-r--r--

Correct paths and buildconf, add sounds, update version, and refresh patch.

     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-08-09 18:13:09.000000000 +0200
     4 +++ addons/chan_ooh323.c	2011-09-14 14:29:50.740457577 +0200
     5 @@ -24,6 +24,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	2011-08-04 21:37:16.000000000 +0200
    21 +++ addons/ooh323c/src/ooCmdChannel.c	2011-09-14 14:29:50.740457577 +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-05-04 22:50:18.000000000 +0200
    36 +++ addons/ooh323c/src/ooSocket.c	2011-09-14 14:29:50.740457577 +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-09-14 14:29:50.740457577 +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-09-14 14:29:50.740457577 +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-07-19 17:43:32.000000000 +0200
   200 +++ apps/app_meetme.c	2011-09-14 14:29:50.747960016 +0200
   201 @@ -606,6 +606,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 @@ -619,6 +620,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 @@ -652,6 +654,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 @@ -2447,6 +2450,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 @@ -2463,6 +2472,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-07-26 16:04:55.000000000 +0200
   249 +++ apps/app_voicemail.c	2011-09-14 14:29:50.747960016 +0200
   250 @@ -373,6 +373,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 @@ -2504,7 +2505,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 @@ -6161,6 +6162,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 @@ -6176,10 +6178,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 @@ -10383,6 +10399,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 @@ -11874,6 +11894,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: cdr/cdr_radius.c
   330 diff -Nau cdr/cdr_radius.c.orig cdr/cdr_radius.c
   331 --- cdr/cdr_radius.c.orig	2011-07-14 22:13:06.000000000 +0200
   332 +++ cdr/cdr_radius.c	2011-09-14 14:29:50.777958246 +0200
   333 @@ -106,10 +106,18 @@
   334  	if (!rc_avpair_add(rh, tosend, PW_AST_SRC, &cdr->src, strlen(cdr->src), VENDOR_CODE))
   335  		return -1;
   337 + 	/* RADIUS standard identifier patch */
   338 +	if (!rc_avpair_add(rh, tosend, PW_CALLING_STATION_ID, &cdr->src, strlen(cdr->src), 0))
   339 +		return -1;
   340 +
   341   	/* Destination */
   342  	if (!rc_avpair_add(rh, tosend, PW_AST_DST, &cdr->dst, strlen(cdr->dst), VENDOR_CODE))
   343  		return -1;
   345 + 	/* RADIUS standard identifier patch */
   346 +	if (!rc_avpair_add(rh, tosend, PW_CALLED_STATION_ID, &cdr->dst, strlen(cdr->dst), 0))
   347 +		return -1;
   348 +
   349   	/* Destination context */
   350  	if (!rc_avpair_add(rh, tosend, PW_AST_DST_CTX, &cdr->dcontext, strlen(cdr->dcontext), VENDOR_CODE))
   351  		return -1;
   352 @@ -164,6 +172,10 @@
   353  	if (!rc_avpair_add(rh, tosend, PW_AST_BILL_SEC, &cdr->billsec, 0, VENDOR_CODE))
   354  		return -1;
   356 + 	/* RADIUS standard identifier patch */
   357 +	if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_TIME, &cdr->billsec, 0, 0))
   358 +		return -1;
   359 +
   360  	/* Disposition */
   361  	tmp = ast_cdr_disp2str(cdr->disposition);
   362  	if (!rc_avpair_add(rh, tosend, PW_AST_DISPOSITION, tmp, strlen(tmp), VENDOR_CODE))
   363 @@ -187,10 +199,14 @@
   364  	}
   366  	/* Setting Acct-Session-Id & User-Name attributes for proper generation
   367 -	   of Acct-Unique-Session-Id on server side */
   368 -	/* Channel */
   369 -	if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->channel, strlen(cdr->channel), 0))
   370 -		return -1;
   371 +	   of Acct-Unique-Session-Id on server side Channel */
   372 +	{
   373 +		char szChanuser[PATH_MAX] = {0};
   374 +		strncpy(szChanuser, &cdr->channel, PATH_MAX-1);
   375 +		*(strrchr(szChanuser, '-')) = 0;
   376 +		if (!rc_avpair_add(rh, tosend, PW_USER_NAME, szChanuser, strlen(cdr->channel), 0))
   377 +			return -1;
   378 +	}
   380  	/* Unique ID */
   381  	if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_ID, &cdr->uniqueid, strlen(cdr->uniqueid), 0))
   382 Index: chan_capi-1.1.5.20110914/chan_capi20.h
   383 diff -Nau chan_capi-1.1.5.20110914/chan_capi20.h.orig chan_capi-1.1.5.20110914/chan_capi20.h
   384 --- chan_capi-1.1.5.20110914/chan_capi20.h.orig	2011-01-07 02:29:32.000000000 +0100
   385 +++ chan_capi-1.1.5.20110914/chan_capi20.h	2011-05-23 17:35:28.348531751 +0200
   386 @@ -4,10 +4,13 @@
   387   * first. Else the checks below will fail.
   388   */
   390 +#include <stddef.h>
   391  #include <capi20.h>
   393  #undef CAPI_OS_HINT
   395 +#ifndef USE_OWN_LIBCAPI
   396 +
   397  #if (defined(__FreeBSD__) || defined(__OpenBSD__) || \
   398       defined(__NetBSD__)  || defined(__APPLE__))
   400 @@ -29,6 +32,8 @@
   401  #include <capiutils.h>
   402  #endif /* BSD */
   404 +#endif
   405 +
   406  #ifndef HEADER_CID
   407  #define HEADER_CID(x) ((x)->adr.adrNCCI)
   408  #endif
   409 Index: chan_capi-1.1.5.20110914/chan_capi_utils.c
   410 diff -Nau chan_capi-1.1.5.20110914/chan_capi_utils.c.orig chan_capi-1.1.5.20110914/chan_capi_utils.c
   411 --- chan_capi-1.1.5.20110914/chan_capi_utils.c.orig	2011-01-07 02:29:32.000000000 +0100
   412 +++ chan_capi-1.1.5.20110914/chan_capi_utils.c	2011-05-23 17:35:28.348531751 +0200
   413 @@ -1158,6 +1158,9 @@
   414  {
   415  	MESSAGE_EXCHANGE_ERROR error;
   416  	int waitcount = 50;
   417 +#ifndef CAPI_MANUFACTURER_LEN
   418 +#define CAPI_MANUFACTURER_LEN 64
   419 +#endif
   420  	unsigned char manbuf[CAPI_MANUFACTURER_LEN];
   421  	_cmsg CMSG;
   423 Index: chan_capi-1.1.5.20110914/libcapi20/capi20.c
   424 diff -Nau chan_capi-1.1.5.20110914/libcapi20/capi20.c.orig chan_capi-1.1.5.20110914/libcapi20/capi20.c
   425 --- chan_capi-1.1.5.20110914/libcapi20/capi20.c.orig	2011-01-07 02:29:31.000000000 +0100
   426 +++ chan_capi-1.1.5.20110914/libcapi20/capi20.c	2011-05-23 17:35:28.348531751 +0200
   427 @@ -19,8 +19,10 @@
   428  #include <stdio.h>
   429  #include <ctype.h>
   430  #include <assert.h>
   431 +#ifdef __linux__
   432  #define _LINUX_LIST_H
   433  #include <linux/capi.h>
   434 +#endif
   436  #include <sys/socket.h>
   437  #include <netinet/in.h>
   438 @@ -48,17 +50,23 @@
   440  #define SEND_BUFSIZ		(128+2048)
   442 +#if 0
   443  static char capidevname[] = "/dev/capi20";
   444  static char capidevnamenew[] = "/dev/isdn/capi20";
   445 +#endif
   447  static int                  capi_fd = -1;
   448 +#if 0
   449  static capi_ioctl_struct    ioctl_data;
   450 +#endif
   452  static int remote_capi;
   453 +#if 0
   454  static char *globalconfigfilename = "/etc/capi20.conf";
   455  static char *userconfigfilename = ".capi20rc";
   456  static unsigned short int port;
   457  static char hostname[1024];
   458 +#endif
   459  static int tracelevel;
   460  static char *tracefile;
   462 @@ -77,17 +85,21 @@
   463  #define RCAPI_AUTH_USER_REQ                     CAPICMD(0xff, 0x00)
   464  #define RCAPI_AUTH_USER_CONF                    CAPICMD(0xff, 0x01)
   466 +#if 0
   467  static char *skip_whitespace(char *s)
   468  {
   469  	while (*s && isspace(*s)) s++;
   470  		return s;
   471  }
   472 +#endif
   474 +#if 0
   475  static char *skip_nonwhitespace(char *s)
   476  {
   477  	while (*s && !isspace(*s)) s++;
   478  		return s;
   479  } 
   480 +#endif
   482  static unsigned char get_byte(unsigned char **p)
   483  {
   484 @@ -95,10 +107,12 @@
   485  	return((unsigned char)*(*p - 1));
   486  }
   488 +#if 0
   489  static unsigned short get_word(unsigned char **p)
   490  {
   491  	return(get_byte(p) | (get_byte(p) << 8));
   492  }
   493 +#endif
   495  static unsigned short get_netword(unsigned char **p)
   496  {
   497 @@ -144,6 +158,7 @@
   498   * read config file
   499   */
   501 +#if 0
   502  static int read_config(void)
   503  {
   504  	FILE *fp = NULL;
   505 @@ -197,11 +212,13 @@
   506  	fclose(fp);
   507  	return(1);
   508  }
   509 +#endif
   511  /*
   512   *	socket function
   513   */
   515 +#if 0
   516  static int open_socket(void)
   517  {
   518  	int fd;
   519 @@ -225,6 +242,7 @@
   520  	close(fd);
   521  	return(-1);
   522  }
   523 +#endif
   525  static int socket_read(int fd, unsigned char *buf, int l)
   526  {
   527 @@ -328,6 +346,8 @@
   528  	if (likely(capi_fd >= 0))
   529  		return CapiNoError;
   531 +#if 0
   532 +
   533  	/*----- open managment link -----*/
   534  	if (read_config() && (remote_capi)) {
   535  		capi_fd = open_socket();
   536 @@ -347,6 +367,8 @@
   537  	if (ioctl(capi_fd, CAPI_INSTALLED, 0) == 0)
   538  		return CapiNoError;
   540 +#endif
   541 +
   542  	return CapiRegNotInstalled;
   543  }
   545 @@ -421,6 +443,7 @@
   546  	unsigned char *bufferstart;
   547  };
   549 +#if 0
   550  static struct applinfo *alloc_buffers(
   551  	unsigned MaxB3Connection,
   552  	unsigned MaxB3Blks,
   553 @@ -459,6 +482,7 @@
   554  	ap->lastfree->next = 0;
   555  	return ap;
   556  }
   557 +#endif
   559  static void free_buffers(struct applinfo *ap)
   560  {
   561 @@ -576,14 +600,17 @@
   562  	unsigned MaxSizeB3,
   563  	unsigned *ApplID)
   564  {
   565 +#if 0
   566  	int applid = 0;
   567  	char buf[PATH_MAX];
   568  	int i, fd = -1;
   570      *ApplID = 0;
   571 +#endif
   573      if (capi20_isinstalled() != CapiNoError)
   574         return CapiRegNotInstalled;
   575 +#if 0
   576  	if ((!remote_capi) || ((remote_capi) && ((fd = open_socket()) < 0))) {
   577  	    if ((fd = open(capidevname, O_RDWR|O_NONBLOCK, 0666)) < 0 && 
   578  		     (errno == ENOENT)) {
   579 @@ -621,6 +648,8 @@
   580  			close(fd);
   581  			return(errcode);
   582  		}
   583 +    }
   584 +#if 0
   585  	} else if ((applid = ioctl(fd, CAPI_REGISTER, &ioctl_data)) < 0) {
   586  		if (errno == EIO) {
   587  			if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
   588 @@ -666,6 +695,7 @@
   589  		    applid = alloc_applid(fd);
   590  		} // end old driver compatibility
   591  	}
   592 +#endif
   593  	if (remember_applid(applid, fd) < 0) {
   594  		close(fd);
   595  		return CapiRegOSResourceErr;
   596 @@ -676,6 +706,7 @@
   597  		return CapiRegOSResourceErr;
   598  	}
   599  	*ApplID = applid;
   600 +#endif
   601  	return CapiNoError;
   602  }
   604 @@ -784,11 +815,15 @@
   605  	                ret = CapiIllAppNr;
   606  	                break;
   607  	            case EIO:
   608 +#if 0
   609  	                if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
   610 +#endif
   611  	                    ret = CapiMsgOSResourceErr;
   612 +#if 0
   613  	                } else {
   614  						ret = (unsigned)ioctl_data.errcode;
   615  					}
   616 +#endif
   617  	                break;
   618  	          default:
   619  	                ret = CapiMsgOSResourceErr;
   620 @@ -842,7 +877,7 @@
   621  				rcvbuf[15] = (data >> 24) & 0xff;
   622  			} else {
   623  				u_int64_t data;
   624 -				ulong radr = (ulong)rcvbuf;
   625 +				unsigned long radr = (unsigned long)rcvbuf;
   626  				if (CAPIMSG_LEN(rcvbuf) < 30) {
   627  					/*
   628  					 * grr, 64bit arch, but no data64 included,
   629 @@ -899,6 +934,9 @@
   630  {
   631  	if (capi20_isinstalled() != CapiNoError)
   632  		return 0;
   633 +#ifndef CAPI_MANUFACTURER_LEN
   634 +#define CAPI_MANUFACTURER_LEN 64
   635 +#endif
   637  	if (remote_capi) {
   638  		unsigned char buf[100];
   639 @@ -911,15 +949,19 @@
   640  		return Buf;
   641  	}
   643 +#if 0
   644      ioctl_data.contr = Ctrl;
   646  	if (ioctl(capi_fd, CAPI_GET_MANUFACTURER, &ioctl_data) < 0)
   647 +#endif
   648  		return 0;
   650 +#if 0
   651  	memcpy(Buf, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN);
   652  	Buf[CAPI_MANUFACTURER_LEN-1] = 0;
   654  	return Buf;
   655 +#endif
   656  }
   658  unsigned char *
   659 @@ -934,16 +976,20 @@
   660  		set_rcapicmd_header(&p, 14, RCAPI_GET_VERSION_REQ, Ctrl);
   661  		if(!(remote_command(capi_fd, buf, 14, RCAPI_GET_VERSION_CONF)))
   662  			return 0;
   663 -		memcpy(Buf, buf + 1, sizeof(capi_version));
   664 +		memcpy(Buf, buf + 1, 128 /* sizeof(capi_version) */);
   665  		return Buf;
   666  	}
   668 +#if 0
   669  	ioctl_data.contr = Ctrl;
   670  	if (ioctl(capi_fd, CAPI_GET_VERSION, &ioctl_data) < 0) {
   671 +#endif
   672  		return 0;
   673 +#if 0
   674  	}
   675  	memcpy(Buf, &ioctl_data.version, sizeof(capi_version));
   676  	return Buf;
   677 +#endif
   678  }
   680  unsigned char * 
   681 @@ -952,6 +998,10 @@
   682  	if (capi20_isinstalled() != CapiNoError)
   683  		return 0;
   685 +#ifndef CAPI_SERIAL_LEN
   686 +#define CAPI_SERIAL_LEN 8
   687 +#endif
   688 +
   689  	if (remote_capi) {
   690  		unsigned char buf[100];
   691  		unsigned char *p = buf;
   692 @@ -963,15 +1013,19 @@
   693  		return Buf;
   694  	}
   696 +#if 0
   697  	ioctl_data.contr = Ctrl;
   699  	if (ioctl(capi_fd, CAPI_GET_SERIAL, &ioctl_data) < 0)
   700 +#endif
   701  		return 0;
   703 +#if 0
   704  	memcpy(Buf, &ioctl_data.serial, CAPI_SERIAL_LEN);
   705  	Buf[CAPI_SERIAL_LEN-1] = 0;
   707  	return Buf;
   708 +#endif
   709  }
   711  unsigned
   712 @@ -1018,6 +1072,7 @@
   713  			sizeof(ioctl_data.profile.ncontroller));
   714  	}
   715  	return CapiNoError;
   716 +#endif
   717  }
   718  /*
   719   * functions added to the CAPI2.0 spec
   720 Index: chan_capi-1.1.5.20110914/libcapi20/convert.c
   721 diff -Nau chan_capi-1.1.5.20110914/libcapi20/convert.c.orig chan_capi-1.1.5.20110914/libcapi20/convert.c
   722 --- chan_capi-1.1.5.20110914/libcapi20/convert.c.orig	2011-01-07 02:29:31.000000000 +0100
   723 +++ chan_capi-1.1.5.20110914/libcapi20/convert.c	2011-05-23 17:35:28.348531751 +0200
   724 @@ -11,7 +11,14 @@
   725  #include <stddef.h>
   726  #include <time.h>
   727  #include <ctype.h>
   728 +#ifdef __FreeBSD__
   729 +#include <sys/endian.h>
   730 +#define bswap_16 bswap16
   731 +#define bswap_32 bswap32
   732 +#define bswap_64 bswap64
   733 +#else
   734  #include <byteswap.h>
   735 +#endif
   737  #include "capi20.h"
   739 Index: chan_capi-1.1.5.20110914/Makefile
   740 diff -Nau chan_capi-1.1.5.20110914/Makefile.orig chan_capi-1.1.5.20110914/Makefile
   741 --- chan_capi-1.1.5.20110914/Makefile.orig	2011-01-07 02:29:32.000000000 +0100
   742 +++ chan_capi-1.1.5.20110914/Makefile	2011-05-23 17:35:28.348531751 +0200
   743 @@ -114,6 +114,9 @@
   744  CFLAGS+=-O2
   745  CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
   746  CFLAGS+=$(shell if uname -m | grep -q "ppc\|arm\|s390"; then echo "-fsigned-char"; fi)
   747 +ifeq (${USE_OWN_LIBCAPI},yes)
   748 +CFLAGS+=-DUSE_OWN_LIBCAPI
   749 +endif
   750  ifeq (${DIVA_STREAMING},1)
   751  CFLAGS += -DDIVA_STREAMING=1
   752  endif
   753 Index: channels/chan_sip.c
   754 diff -Nau channels/chan_sip.c.orig channels/chan_sip.c
   755 --- channels/chan_sip.c.orig	2011-08-10 00:12:59.000000000 +0200
   756 +++ channels/chan_sip.c	2011-09-14 14:29:50.757959000 +0200
   757 @@ -11647,7 +11647,16 @@
   758   	} else {
   759   		if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) {
   760   			/* If this is a NOTIFY, use the From: tag in the subscribe (RFC 3265) */
   761 -			snprintf(to, sizeof(to), "<%s%s>;tag=%s", (strncasecmp(p->uri, "sip:", 4) ? "sip:" : ""), p->uri, p->theirtag);
   762 +			if (strncasecmp(p->uri, "sip:", strlen("sip:")))
   763 +				if (strncasecmp(p->uri, "sips:", strlen("sips:")))
   764 +					if (p->socket.type == SIP_TRANSPORT_TLS)
   765 +						snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
   766 +					else
   767 +						snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
   768 +				else /* if (strncasecmp(p->uri, "sips:"... */
   769 +					snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
   770 +			else /* if (strncasecmp(p->uri, "sip:"... */
   771 +				snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
   772   		} else if (p->options && p->options->vxml_url) {
   773   			/* If there is a VXML URL append it to the SIP URL */
   774   			snprintf(to, sizeof(to), "<%s>;%s", p->uri, p->options->vxml_url);
   775 Index: channels/console_video.h
   776 diff -Nau channels/console_video.h.orig channels/console_video.h
   777 --- channels/console_video.h.orig	2008-06-30 17:45:15.000000000 +0200
   778 +++ channels/console_video.h	2011-09-14 14:29:50.767970949 +0200
   779 @@ -28,10 +28,7 @@
   780  		"console {device}"
   781  #else
   783 -#include <ffmpeg/avcodec.h>
   784 -#ifndef OLD_FFMPEG
   785 -#include <ffmpeg/swscale.h>     /* requires a recent ffmpeg */
   786 -#endif
   787 +#include <libavcoded/avcodec.h>
   789  #define CONSOLE_VIDEO_CMDS			\
   790  	"console {videodevice|videocodec"	\
   791 Index: configure
   792 diff -Nau configure.orig configure
   793 --- configure.orig	2011-08-25 21:08:04.000000000 +0200
   794 +++ configure	2011-09-14 14:29:50.767970949 +0200
   795 @@ -4704,11 +4704,6 @@
   796  esac
   798  case "${host_os}" in
   799 -     freebsd*)
   800 -     ac_default_prefix=/usr/local
   801 -     CPPFLAGS=-I/usr/local/include
   802 -     LDFLAGS=-L/usr/local/lib
   803 -     ;;
   804       openbsd*)
   805       ac_default_prefix=/usr/local
   806       if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
   807 @@ -18308,8 +18303,8 @@
   808  		if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
   809        		imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
   810  		fi
   811 -		imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
   812 -	  	imap_include="-I${IMAP_TK_DIR}/c-client"
   813 +		imap_libs="-limap -lssl -lcrypto -lcrypt"
   814 +	  	imap_include="-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap"
   815        	CPPFLAGS="${CPPFLAGS} ${imap_include}"
   816  	  	LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
   817  	  	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   818 @@ -25541,19 +25536,19 @@
   820     # now check for the header.
   821     if test "${AST_LUA_FOUND}" = "yes"; then
   822 -      LUA_LIB="${pbxlibdir} -llua5.1 -lm"
   823 +      LUA_LIB="${pbxlibdir} -llua -lm"
   824        # if --with-LUA=DIR has been specified, use it.
   825        if test "x${LUA_DIR}" != "x"; then
   826           LUA_INCLUDE="-I${LUA_DIR}/include"
   827        fi
   828        LUA_INCLUDE="${LUA_INCLUDE} "
   829 -      if test "xlua5.1/lua.h" = "x" ; then	# no header, assume found
   830 +      if test "xlua/lua.h" = "x" ; then	# no header, assume found
   831           LUA_HEADER_FOUND="1"
   832        else				# check for the header
   833           ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
   834           CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
   835 -         ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
   836 -if test "x$ac_cv_header_lua5_1_lua_h" = x""yes; then :
   837 +         ac_fn_c_check_header_mongrel "$LINENO" "lua/lua.h" "ac_cv_header_lua_lua_h" "$ac_includes_default"
   838 +if test "x$ac_cv_header_lua_lua_h" = x""yes; then :
   839    LUA_HEADER_FOUND=1
   840  else
   841    LUA_HEADER_FOUND=0
   842 @@ -25581,9 +25576,9 @@
   844  if test "x${PBX_LUA}" = "x1" ; then
   845  	if test x"${LUA_DIR}" = x; then
   846 -		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
   847 +		LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua"
   848  	else
   849 -		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
   850 +		LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua"
   851  	fi
   852  fi
   854 @@ -26262,7 +26257,7 @@
   855        	 pbxlibdir="-L${SQLITE_DIR}"
   856        fi
   857     fi
   858 -   pbxfuncname="sqlite_exec"
   859 +   pbxfuncname="sqlite3_exec"
   860     if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
   861        AST_SQLITE_FOUND=yes
   862     else
   863 @@ -26976,16 +26971,16 @@
   864      if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
   865  	PBX_GMIME=0
   866  	if test -n "$ac_tool_prefix"; then
   867 -  # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
   868 -set dummy ${ac_tool_prefix}gmime-config; ac_word=$2
   869 +   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
   870 + set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
   871  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   872  $as_echo_n "checking for $ac_word... " >&6; }
   873 -if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then :
   874 +if test "${ac_cv_prog_PKGCONFIG+set}" = set; then
   875    $as_echo_n "(cached) " >&6
   876  else
   877 -  case $CONFIG_GMIME in
   878 +  case $PKGCONFIG in
   879    [\\/]* | ?:[\\/]*)
   880 -  ac_cv_path_CONFIG_GMIME="$CONFIG_GMIME" # Let the user override the test with a path.
   881 +  ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
   882    ;;
   883    *)
   884    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   885 @@ -26996,7 +26991,7 @@
   886    test -z "$as_dir" && as_dir=.
   887      for ac_exec_ext in '' $ac_executable_extensions; do
   888    if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   889 -    ac_cv_path_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
   890 +    ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
   891      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   892      break 2
   893    fi
   894 @@ -27007,10 +27002,10 @@
   895    ;;
   896  esac
   897  fi
   898 -CONFIG_GMIME=$ac_cv_path_CONFIG_GMIME
   899 -if test -n "$CONFIG_GMIME"; then
   900 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5
   901 -$as_echo "$CONFIG_GMIME" >&6; }
   902 +PKGCONFIG=$ac_cv_path_PKGCONFIG
   903 +if test -n "$PKGCONFIG"; then
   904 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
   905 +$as_echo "$PKGCONFIG" >&6; }
   906  else
   907    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   908  $as_echo "no" >&6; }
   909 @@ -27018,18 +27013,18 @@
   912  fi
   913 -if test -z "$ac_cv_path_CONFIG_GMIME"; then
   914 -  ac_pt_CONFIG_GMIME=$CONFIG_GMIME
   915 -  # Extract the first word of "gmime-config", so it can be a program name with args.
   916 -set dummy gmime-config; ac_word=$2
   917 +if test -z "$ac_cv_path_PKGCONFIG"; then
   918 +  ac_pt_PKGCONFIG=$PKGCONFIG
   919 +  # Extract the first word of "pkg-config", so it can be a program name with args.
   920 +set dummy pkg-config; ac_word=$2
   921  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   922  $as_echo_n "checking for $ac_word... " >&6; }
   923 -if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then :
   924 +if test "${ac_cv_path_ac_pt_PKGCONFIG+set}" = set; then :
   925    $as_echo_n "(cached) " >&6
   926  else
   927 -  case $ac_pt_CONFIG_GMIME in
   928 +  case $ac_pt_PKGCONFIG in
   929    [\\/]* | ?:[\\/]*)
   930 -  ac_cv_path_ac_pt_CONFIG_GMIME="$ac_pt_CONFIG_GMIME" # Let the user override the test with a path.
   931 +  ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path.
   932    ;;
   933    *)
   934    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   935 @@ -27040,7 +27035,7 @@
   936    test -z "$as_dir" && as_dir=.
   937      for ac_exec_ext in '' $ac_executable_extensions; do
   938    if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   939 -    ac_cv_path_ac_pt_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
   940 +    ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
   941      $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   942      break 2
   943    fi
   944 @@ -27051,17 +27046,17 @@
   945    ;;
   946  esac
   947  fi
   948 -ac_pt_CONFIG_GMIME=$ac_cv_path_ac_pt_CONFIG_GMIME
   949 -if test -n "$ac_pt_CONFIG_GMIME"; then
   950 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_GMIME" >&5
   951 -$as_echo "$ac_pt_CONFIG_GMIME" >&6; }
   952 +ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
   953 +if test -n "$ac_pt_PKGCONFIG"; then
   954 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5
   955 +$as_echo "${ECHO_T}$ac_pt_PKGCONFIG" >&6; }
   956  else
   957    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   958  $as_echo "no" >&6; }
   959  fi
   961 -  if test "x$ac_pt_CONFIG_GMIME" = x; then
   962 -    CONFIG_GMIME="No"
   963 +  if test "x$ac_pt_PKGCONFIG" = x; then
   964 +    PKGCONFIG="No"
   965    else
   966      case $cross_compiling:$ac_tool_warned in
   967  yes:)
   968 @@ -27069,17 +27064,15 @@
   969  $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
   970  ac_tool_warned=yes ;;
   971  esac
   972 -    CONFIG_GMIME=$ac_pt_CONFIG_GMIME
   973 +    PKGCONFIG=$ac_pt_PKGCONFIG
   974    fi
   975  else
   976 -  CONFIG_GMIME="$ac_cv_path_CONFIG_GMIME"
   977 +  PKGCONFIG="$ac_cv_path_PKGCONFIG"
   978  fi
   980 -	if test ! "x${CONFIG_GMIME}" = xNo; then
   981 -	    if test x"" = x ; then A=--cflags ; else A="" ; fi
   982 -	    GMIME_INCLUDE=$(${CONFIG_GMIME} $A)
   983 -	    if test x"" = x ; then A=--libs ; else A="" ; fi
   984 -	    GMIME_LIB=$(${CONFIG_GMIME} $A)
   985 +	if test ! "x${PKGCONFIG}" = xNo; then
   986 +	    GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.4 --cflags 2>/dev/null)
   987 +	    GMIME_LIB=$(${PKGCONFIG} gmime-2.4 --libs)
   988  	    if test x"#include <gmime/gmime.h>" != x ; then
   989  		saved_cppflags="${CPPFLAGS}"
   990  		if test "x${GMIME_DIR}" != "x"; then
   991 Index: formats/format_pcm.c
   992 diff -Nau formats/format_pcm.c.orig formats/format_pcm.c
   993 --- formats/format_pcm.c.orig	2011-07-14 22:13:06.000000000 +0200
   994 +++ formats/format_pcm.c	2011-09-14 14:29:50.767970949 +0200
   995 @@ -354,6 +354,7 @@
   996  		ast_log(LOG_WARNING, "Unable to write header\n");
   997  		return -1;
   998  	}
   999 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
  1000  	return 0;
  1003 Index: formats/format_wav.c
  1004 diff -Nau formats/format_wav.c.orig formats/format_wav.c
  1005 --- formats/format_wav.c.orig	2011-07-29 19:18:56.000000000 +0200
  1006 +++ formats/format_wav.c	2011-09-14 14:29:50.767970949 +0200
  1007 @@ -308,6 +308,7 @@
  1008  		ast_log(LOG_WARNING, "Unable to write header\n");
  1009  		return -1;
  1011 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
  1012  	return 0;
  1015 Index: formats/format_wav_gsm.c
  1016 diff -Nau formats/format_wav_gsm.c.orig formats/format_wav_gsm.c
  1017 --- formats/format_wav_gsm.c.orig	2011-07-14 22:13:06.000000000 +0200
  1018 +++ formats/format_wav_gsm.c	2011-09-14 14:29:50.767970949 +0200
  1019 @@ -366,6 +366,7 @@
  1020  		ast_log(LOG_WARNING, "Unable to write header\n");
  1021  		return -1;
  1023 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
  1024  	return 0;
  1027 Index: main/db1-ast/hash/hash.h
  1028 diff -Nau main/db1-ast/hash/hash.h.orig main/db1-ast/hash/hash.h
  1029 --- main/db1-ast/hash/hash.h.orig	2006-08-21 04:11:39.000000000 +0200
  1030 +++ main/db1-ast/hash/hash.h	2011-09-14 14:29:50.767970949 +0200
  1031 @@ -36,6 +36,8 @@
  1032   *	@(#)hash.h	8.3 (Berkeley) 5/31/94
  1033   */
  1035 +#include <stdint.h>
  1037  /* Operations */
  1038  typedef enum {
  1039  	HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
  1040 Index: main/db1-ast/hash/ndbm.c
  1041 diff -Nau main/db1-ast/hash/ndbm.c.orig main/db1-ast/hash/ndbm.c
  1042 --- main/db1-ast/hash/ndbm.c.orig	2006-08-21 04:11:39.000000000 +0200
  1043 +++ main/db1-ast/hash/ndbm.c	2011-09-14 14:29:50.767970949 +0200
  1044 @@ -49,7 +49,8 @@
  1045  #include <string.h>
  1046  #include <stdlib.h>
  1048 -#include <ndbm.h>
  1049 +#include "../include/ndbm.h"
  1050 +#include "../include/db.h"
  1051  #include "hash.h"
  1053  /*
  1054 Index: main/features.c
  1055 diff -Nau main/features.c.orig main/features.c
  1056 --- main/features.c.orig	2011-08-10 00:12:59.000000000 +0200
  1057 +++ main/features.c	2011-09-14 14:29:50.777958246 +0200
  1058 @@ -1646,6 +1646,10 @@
  1059  			snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
  1062 +		for(x = 0; x < strlen(touch_filename); x++) {
  1063 +			if (args[x] == '/')
  1064 +				args[x] = '-';
  1065 +		}
  1066  		for(x = 0; x < strlen(args); x++) {
  1067  			if (args[x] == '/')
  1068  				args[x] = '-';
  1069 @@ -1762,6 +1766,10 @@
  1070  			snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav"));
  1073 +		for( x = 0; x < strlen(touch_filename); x++) {
  1074 +			if (args[x] == '/')
  1075 +				args[x] = '-';
  1076 +		}
  1077  		for( x = 0; x < strlen(args); x++) {
  1078  			if (args[x] == '/')
  1079  				args[x] = '-';
  1080 Index: main/file.c
  1081 diff -Nau main/file.c.orig main/file.c
  1082 --- main/file.c.orig	2011-07-05 15:23:57.000000000 +0200
  1083 +++ main/file.c	2011-09-14 14:29:50.777958246 +0200
  1084 @@ -256,7 +256,7 @@
  1085  	char *fn = NULL;
  1087  	if (!strcmp(ext, "wav49"))
  1088 -		ext = "WAV";
  1089 +		ext = "wav";
  1091  	if (filename[0] == '/') {
  1092  		if (asprintf(&fn, "%s.%s", filename, ext) < 0) {
  1093 Index: main/Makefile
  1094 diff -Nau main/Makefile.orig main/Makefile
  1095 --- main/Makefile.orig	2011-08-03 17:14:36.000000000 +0200
  1096 +++ main/Makefile	2011-09-14 14:29:50.777958246 +0200
  1097 @@ -69,10 +69,7 @@
  1098  endif
  1100  ifeq ($(OSARCH),FreeBSD)
  1101 -  # -V is understood by BSD Make, not by GNU make.
  1102 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  1103 -  AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
  1104 -  AST_LIBS+=-lcrypto
  1105 +  AST_LIBS+=-lpthread -lcrypto
  1106  endif
  1108  ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
  1109 Index: main/tcptls.c
  1110 diff -Nau main/tcptls.c.orig main/tcptls.c
  1111 --- main/tcptls.c.orig	2011-05-23 18:18:33.000000000 +0200
  1112 +++ main/tcptls.c	2011-09-14 14:29:50.777958246 +0200
  1113 @@ -357,6 +357,7 @@
  1114  	if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) {
  1115  		if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0)
  1116  			ast_verb(0, "SSL CA file(%s)/path(%s) error\n", cfg->cafile, cfg->capath);
  1117 +        SSL_CTX_set_client_CA_list(cfg->ssl_ctx, S_OR(cfg->cafile, NULL));
  1120  	ast_verb(0, "SSL certificate ok\n");
  1121 Index: main/udptl.c
  1122 diff -Nau main/udptl.c.orig main/udptl.c
  1123 --- main/udptl.c.orig	2011-05-03 21:55:49.000000000 +0200
  1124 +++ main/udptl.c	2011-09-14 14:29:50.777958246 +0200
  1125 @@ -98,6 +98,18 @@
  1127  #define UDPTL_BUF_MASK              15
  1129 +/*! Copied from chan_oss.c, corrects link errors:
  1130 +udptl.o: In function `calculate_local_max_datagram':
  1131 +main/udptl.c:740: undefined reference to `MIN'
  1132 +udptl.o: In function `calculate_far_max_ifp':
  1133 +main/udptl.c:770: undefined reference to `MAX' */
  1134 +#ifndef MIN
  1135 +#define MIN(a,b) ((a) < (b) ? (a) : (b))
  1136 +#endif
  1137 +#ifndef MAX
  1138 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
  1139 +#endif
  1141  typedef struct {
  1142  	int buf_len;
  1143  	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
  1144 Index: Makefile
  1145 diff -Nau Makefile.orig Makefile
  1146 --- Makefile.orig	2011-08-25 21:08:04.000000000 +0200
  1147 +++ Makefile	2011-09-14 14:29:50.777958246 +0200
  1148 @@ -230,15 +230,6 @@
  1149    _ASTCFLAGS+=-fsigned-char
  1150  endif
  1152 -ifeq ($(OSARCH),FreeBSD)
  1153 -  ifeq ($(PROC),i386)
  1154 -    _ASTCFLAGS+=-march=i686
  1155 -  endif
  1156 -  # -V is understood by BSD Make, not by GNU make.
  1157 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
  1158 -  _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
  1159 -endif
  1161  ifeq ($(OSARCH),NetBSD)
  1162    _ASTCFLAGS+=-pthread -I/usr/pkg/include
  1163  endif

mercurial