asterisk/asterisk.patch

Sun, 18 Mar 2012 18:45:29 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sun, 18 Mar 2012 18:45:29 +0100
changeset 405
375c04ff28ba
parent 404
b6420eee9bde
child 414
fd611cde817f
permissions
-rw-r--r--

Update to new vendor version, correct sound versioning, and adjust 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	2012-01-26 21:14:50.000000000 +0100
     4 +++ addons/chan_ooh323.c	2012-03-18 17:47:07.875949857 +0100
     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	2012-03-18 17:47:07.875949857 +0100
    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	2012-03-18 17:47:07.875949857 +0100
    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	2012-03-18 17:47:07.875949857 +0100
    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	2012-03-18 17:47:07.875949857 +0100
    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	2012-01-09 16:37:12.000000000 +0100
   200 +++ apps/app_meetme.c	2012-03-18 17:47:07.875949857 +0100
   201 @@ -614,6 +614,7 @@
   203  /*! Do not write any audio to this channel until the state is up. */
   204  #define CONFFLAG_NO_AUDIO_UNTIL_UP  (1ULL << 31)
   205 +#define CONFFLAG_USERNAME (1 << 32)
   206  /*! If set play an intro announcement at start of conference */
   207  #define CONFFLAG_INTROMSG           (1ULL << 32)
   209 @@ -625,6 +626,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 @@ -658,6 +660,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 @@ -2453,6 +2456,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 @@ -2469,6 +2478,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	2012-01-25 23:21:30.000000000 +0100
   249 +++ apps/app_voicemail.c	2012-03-18 17:47:07.888451260 +0100
   250 @@ -376,6 +376,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 @@ -2524,7 +2525,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 @@ -6186,6 +6187,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 @@ -6201,10 +6203,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 @@ -10478,6 +10494,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 @@ -11996,6 +12016,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	2012-03-18 17:47:07.888451260 +0100
   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	2005-09-20 20:33:40.000000000 +0200
   385 +++ chan_capi-1.1.5.20110914/chan_capi20.h	2012-03-18 17:47:07.888451260 +0100
   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-08-07 16:31:05.000000000 +0200
   412 +++ chan_capi-1.1.5.20110914/chan_capi_utils.c	2012-03-18 17:47:07.888451260 +0100
   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	2010-02-17 20:10:53.000000000 +0100
   426 +++ chan_capi-1.1.5.20110914/libcapi20/capi20.c	2012-03-18 17:47:07.888451260 +0100
   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	2010-09-14 21:54:25.000000000 +0200
   723 +++ chan_capi-1.1.5.20110914/libcapi20/convert.c	2012-03-18 17:47:07.888451260 +0100
   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-02-04 18:41:46.000000000 +0100
   742 +++ chan_capi-1.1.5.20110914/Makefile	2012-03-18 17:47:07.888451260 +0100
   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	2012-02-28 18:53:34.000000000 +0100
   756 +++ channels/chan_sip.c	2012-03-18 17:47:07.898462166 +0100
   757 @@ -12034,7 +12034,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	2012-03-18 17:47:07.898462166 +0100
   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	2012-01-14 17:40:17.000000000 +0100
   794 +++ configure	2012-03-18 17:47:32.518450837 +0100
   795 @@ -4716,11 +4716,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 @@ -18904,8 +18899,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 @@ -26681,7 +26676,7 @@
   819        	 pbxlibdir="-L${SQLITE_DIR}"
   820        fi
   821     fi
   822 -   pbxfuncname="sqlite_exec"
   823 +   pbxfuncname="sqlite3_exec"
   824     if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
   825        AST_SQLITE_FOUND=yes
   826     else
   827 Index: formats/format_pcm.c
   828 diff -Nau formats/format_pcm.c.orig formats/format_pcm.c
   829 --- formats/format_pcm.c.orig	2011-07-14 22:13:06.000000000 +0200
   830 +++ formats/format_pcm.c	2012-03-18 17:47:07.898462166 +0100
   831 @@ -354,6 +354,7 @@
   832  		ast_log(LOG_WARNING, "Unable to write header\n");
   833  		return -1;
   834  	}
   835 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
   836  	return 0;
   837  }
   839 Index: formats/format_wav.c
   840 diff -Nau formats/format_wav.c.orig formats/format_wav.c
   841 --- formats/format_wav.c.orig	2011-11-09 16:25:33.000000000 +0100
   842 +++ formats/format_wav.c	2012-03-18 17:47:07.898462166 +0100
   843 @@ -308,6 +308,7 @@
   844  		ast_log(LOG_WARNING, "Unable to write header\n");
   845  		return -1;
   846  	}
   847 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
   848  	return 0;
   849  }
   851 Index: formats/format_wav_gsm.c
   852 diff -Nau formats/format_wav_gsm.c.orig formats/format_wav_gsm.c
   853 --- formats/format_wav_gsm.c.orig	2011-07-14 22:13:06.000000000 +0200
   854 +++ formats/format_wav_gsm.c	2012-03-18 17:47:07.898462166 +0100
   855 @@ -366,6 +366,7 @@
   856  		ast_log(LOG_WARNING, "Unable to write header\n");
   857  		return -1;
   858  	}
   859 +    fflush(f);  /* issues.asterisk.org bug 0016610 */
   860  	return 0;
   861  }
   863 Index: main/db1-ast/hash/hash.h
   864 diff -Nau main/db1-ast/hash/hash.h.orig main/db1-ast/hash/hash.h
   865 --- main/db1-ast/hash/hash.h.orig	2006-08-21 04:11:39.000000000 +0200
   866 +++ main/db1-ast/hash/hash.h	2012-03-18 17:47:07.898462166 +0100
   867 @@ -36,6 +36,8 @@
   868   *	@(#)hash.h	8.3 (Berkeley) 5/31/94
   869   */
   871 +#include <stdint.h>
   872 +
   873  /* Operations */
   874  typedef enum {
   875  	HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
   876 Index: main/db1-ast/hash/ndbm.c
   877 diff -Nau main/db1-ast/hash/ndbm.c.orig main/db1-ast/hash/ndbm.c
   878 --- main/db1-ast/hash/ndbm.c.orig	2006-08-21 04:11:39.000000000 +0200
   879 +++ main/db1-ast/hash/ndbm.c	2012-03-18 17:47:07.898462166 +0100
   880 @@ -49,7 +49,8 @@
   881  #include <string.h>
   882  #include <stdlib.h>
   884 -#include <ndbm.h>
   885 +#include "../include/ndbm.h"
   886 +#include "../include/db.h"
   887  #include "hash.h"
   889  /*
   890 Index: main/features.c
   891 diff -Nau main/features.c.orig main/features.c
   892 --- main/features.c.orig	2012-01-23 21:30:21.000000000 +0100
   893 +++ main/features.c	2012-03-18 17:47:07.898462166 +0100
   894 @@ -2067,6 +2067,10 @@
   895  			snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
   896  		}
   898 +		for(x = 0; x < strlen(touch_filename); x++) {
   899 +			if (args[x] == '/')
   900 +				args[x] = '-';
   901 +		}
   902  		for(x = 0; x < strlen(args); x++) {
   903  			if (args[x] == '/')
   904  				args[x] = '-';
   905 @@ -2183,6 +2187,10 @@
   906  			snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav"));
   907  		}
   909 +		for( x = 0; x < strlen(touch_filename); x++) {
   910 +			if (args[x] == '/')
   911 +				args[x] = '-';
   912 +		}
   913  		for( x = 0; x < strlen(args); x++) {
   914  			if (args[x] == '/')
   915  				args[x] = '-';
   916 Index: main/file.c
   917 diff -Nau main/file.c.orig main/file.c
   918 --- main/file.c.orig	2012-01-05 23:06:46.000000000 +0100
   919 +++ main/file.c	2012-03-18 17:47:07.898462166 +0100
   920 @@ -256,7 +256,7 @@
   921  	char *fn = NULL;
   923  	if (!strcmp(ext, "wav49"))
   924 -		ext = "WAV";
   925 +		ext = "wav";
   927  	if (filename[0] == '/') {
   928  		if (asprintf(&fn, "%s.%s", filename, ext) < 0) {
   929 Index: main/Makefile
   930 diff -Nau main/Makefile.orig main/Makefile
   931 --- main/Makefile.orig	2011-09-19 22:27:03.000000000 +0200
   932 +++ main/Makefile	2012-03-18 17:47:07.898462166 +0100
   933 @@ -69,10 +69,7 @@
   934  endif
   936  ifeq ($(OSARCH),FreeBSD)
   937 -  # -V is understood by BSD Make, not by GNU make.
   938 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
   939 -  AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
   940 -  AST_LIBS+=-lcrypto
   941 +  AST_LIBS+=-lpthread -lcrypto
   942  endif
   944  ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
   945 Index: main/tcptls.c
   946 diff -Nau main/tcptls.c.orig main/tcptls.c
   947 --- main/tcptls.c.orig	2011-11-30 22:41:31.000000000 +0100
   948 +++ main/tcptls.c	2012-03-18 17:47:07.898462166 +0100
   949 @@ -372,6 +372,7 @@
   950  	if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) {
   951  		if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0)
   952  			ast_verb(0, "SSL CA file(%s)/path(%s) error\n", cfg->cafile, cfg->capath);
   953 +        SSL_CTX_set_client_CA_list(cfg->ssl_ctx, S_OR(cfg->cafile, NULL));
   954  	}
   956  	ast_verb(0, "SSL certificate ok\n");
   957 Index: main/udptl.c
   958 diff -Nau main/udptl.c.orig main/udptl.c
   959 --- main/udptl.c.orig	2011-10-06 19:49:38.000000000 +0200
   960 +++ main/udptl.c	2012-03-18 17:47:07.898462166 +0100
   961 @@ -98,6 +98,18 @@
   963  #define UDPTL_BUF_MASK              15
   965 +/*! Copied from chan_oss.c, corrects link errors:
   966 +udptl.o: In function `calculate_local_max_datagram':
   967 +main/udptl.c:740: undefined reference to `MIN'
   968 +udptl.o: In function `calculate_far_max_ifp':
   969 +main/udptl.c:770: undefined reference to `MAX' */
   970 +#ifndef MIN
   971 +#define MIN(a,b) ((a) < (b) ? (a) : (b))
   972 +#endif
   973 +#ifndef MAX
   974 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
   975 +#endif
   976 +
   977  typedef struct {
   978  	int buf_len;
   979  	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
   980 Index: Makefile
   981 diff -Nau Makefile.orig Makefile
   982 --- Makefile.orig	2011-10-05 00:54:15.000000000 +0200
   983 +++ Makefile	2012-03-18 17:47:07.898462166 +0100
   984 @@ -230,15 +230,6 @@
   985    _ASTCFLAGS+=-fsigned-char
   986  endif
   988 -ifeq ($(OSARCH),FreeBSD)
   989 -  ifeq ($(PROC),i386)
   990 -    _ASTCFLAGS+=-march=i686
   991 -  endif
   992 -  # -V is understood by BSD Make, not by GNU make.
   993 -  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
   994 -  _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
   995 -endif
   996 -
   997  ifeq ($(OSARCH),NetBSD)
   998    _ASTCFLAGS+=-pthread -I/usr/pkg/include
   999  endif

mercurial