Tue, 08 Jan 2013 20:08:32 +0100
Update to new vendor version (chan_capi as well) and adapt patch logic,
introducing a new variable to control build time SMS call centre channel.
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 @@ -2527,7 +2528,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 @@ -6193,6 +6194,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 @@ -6208,10 +6210,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 @@ -7290,7 +7306,11 @@
303 int oldmsgs;
304 int newmsgs;
305 int capacity;
306 - if (inboxcount(s, &newmsgs, &oldmsgs)) {
307 + char *msgcnt = 0;
308 + msgcnt = ast_strdupa(s); /* inboxcount needs username copy */
309 + strcat(msgcnt, "@"); /* because internally it inspects */
310 + strcat(msgcnt, context); /* the context which is not in 's' */
311 + if (inboxcount(msgcnt, &newmsgs, &oldmsgs)) {
312 ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", s);
313 /* Shouldn't happen, but allow trying another extension if it does */
314 res = ast_play_and_wait(chan, "pbx-invalid");
315 @@ -10281,7 +10301,7 @@
317 case '5': /* Leave VoiceMail */
318 if (ast_test_flag(vmu, VM_SVMAIL)) {
319 - cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain, 0);
320 + cmd = forward_message(chan, vmu->context, &vms, vmu, vmfmts, 1, record_gain, 0);
321 if (cmd == ERROR_LOCK_PATH || cmd == OPERATOR_EXIT) {
322 res = cmd;
323 goto out;
324 @@ -10464,7 +10484,7 @@
326 case '8': /* Forward the current message */
327 if (vms.lastmsg > -1) {
328 - cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
329 + cmd = forward_message(chan, vmu->context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
330 if (cmd == ERROR_LOCK_PATH) {
331 res = cmd;
332 goto out;
333 @@ -10517,6 +10537,10 @@
334 #ifndef IMAP_STORAGE
335 } else if (!cmd) {
336 vms.deleted[vms.curmsg] = 1;
337 +#else
338 + } else if (!cmd && (folder_int(vms.curbox) > 1 || box > 1)) {
339 + vms.deleted[vms.curmsg] = 1; /* Enforce deletion after */
340 + deleted = 1; /* successful copy op */
341 #endif
342 } else {
343 vms.deleted[vms.curmsg] = 0;
344 @@ -12046,6 +12070,15 @@
345 } else {
346 ast_copy_string(imapfolder, "INBOX", sizeof(imapfolder));
347 }
348 + /* IMAP saved (sub)folder location policy */
349 + if ((val = ast_variable_retrieve(cfg, "general", "imapsubfold"))) {
350 + if (ast_false(val))
351 + imapsubfold = 0;
352 + else
353 + imapsubfold = 1;
354 + } else {
355 + imapsubfold = 0;
356 + }
357 if ((val = ast_variable_retrieve(cfg, "general", "imapparentfolder"))) {
358 ast_copy_string(imapparentfolder, val, sizeof(imapparentfolder));
359 }
360 Index: cdr/cdr_radius.c
361 diff -Nau cdr/cdr_radius.c.orig cdr/cdr_radius.c
362 --- cdr/cdr_radius.c.orig 2011-07-14 22:13:06.000000000 +0200
363 +++ cdr/cdr_radius.c 2012-03-18 17:47:07.888451260 +0100
364 @@ -106,10 +106,18 @@
365 if (!rc_avpair_add(rh, tosend, PW_AST_SRC, &cdr->src, strlen(cdr->src), VENDOR_CODE))
366 return -1;
368 + /* RADIUS standard identifier patch */
369 + if (!rc_avpair_add(rh, tosend, PW_CALLING_STATION_ID, &cdr->src, strlen(cdr->src), 0))
370 + return -1;
371 +
372 /* Destination */
373 if (!rc_avpair_add(rh, tosend, PW_AST_DST, &cdr->dst, strlen(cdr->dst), VENDOR_CODE))
374 return -1;
376 + /* RADIUS standard identifier patch */
377 + if (!rc_avpair_add(rh, tosend, PW_CALLED_STATION_ID, &cdr->dst, strlen(cdr->dst), 0))
378 + return -1;
379 +
380 /* Destination context */
381 if (!rc_avpair_add(rh, tosend, PW_AST_DST_CTX, &cdr->dcontext, strlen(cdr->dcontext), VENDOR_CODE))
382 return -1;
383 @@ -164,6 +172,10 @@
384 if (!rc_avpair_add(rh, tosend, PW_AST_BILL_SEC, &cdr->billsec, 0, VENDOR_CODE))
385 return -1;
387 + /* RADIUS standard identifier patch */
388 + if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_TIME, &cdr->billsec, 0, 0))
389 + return -1;
390 +
391 /* Disposition */
392 tmp = ast_cdr_disp2str(cdr->disposition);
393 if (!rc_avpair_add(rh, tosend, PW_AST_DISPOSITION, tmp, strlen(tmp), VENDOR_CODE))
394 @@ -187,10 +199,14 @@
395 }
397 /* Setting Acct-Session-Id & User-Name attributes for proper generation
398 - of Acct-Unique-Session-Id on server side */
399 - /* Channel */
400 - if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->channel, strlen(cdr->channel), 0))
401 - return -1;
402 + of Acct-Unique-Session-Id on server side Channel */
403 + {
404 + char szChanuser[PATH_MAX] = {0};
405 + strncpy(szChanuser, &cdr->channel, PATH_MAX-1);
406 + *(strrchr(szChanuser, '-')) = 0;
407 + if (!rc_avpair_add(rh, tosend, PW_USER_NAME, szChanuser, strlen(cdr->channel), 0))
408 + return -1;
409 + }
411 /* Unique ID */
412 if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_ID, &cdr->uniqueid, strlen(cdr->uniqueid), 0))
413 Index: chan_capi-1.1.6/chan_capi20.h
414 diff -Nau chan_capi-1.1.6/chan_capi20.h.orig chan_capi-1.1.6/chan_capi20.h
415 --- chan_capi-1.1.6/chan_capi20.h.orig 2005-09-20 20:33:40.000000000 +0200
416 +++ chan_capi-1.1.6/chan_capi20.h 2012-03-18 17:47:07.888451260 +0100
417 @@ -4,10 +4,13 @@
418 * first. Else the checks below will fail.
419 */
421 +#include <stddef.h>
422 #include <capi20.h>
424 #undef CAPI_OS_HINT
426 +#ifndef USE_OWN_LIBCAPI
427 +
428 #if (defined(__FreeBSD__) || defined(__OpenBSD__) || \
429 defined(__NetBSD__) || defined(__APPLE__))
431 @@ -29,6 +32,8 @@
432 #include <capiutils.h>
433 #endif /* BSD */
435 +#endif
436 +
437 #ifndef HEADER_CID
438 #define HEADER_CID(x) ((x)->adr.adrNCCI)
439 #endif
440 Index: chan_capi-1.1.6/chan_capi_utils.c
441 diff -Nau chan_capi-1.1.6/chan_capi_utils.c.orig chan_capi-1.1.6/chan_capi_utils.c
442 --- chan_capi-1.1.6/chan_capi_utils.c.orig 2011-08-07 16:31:05.000000000 +0200
443 +++ chan_capi-1.1.6/chan_capi_utils.c 2012-03-18 17:47:07.888451260 +0100
444 @@ -1160,6 +1160,9 @@
445 {
446 MESSAGE_EXCHANGE_ERROR error;
447 int waitcount = 50;
448 +#ifndef CAPI_MANUFACTURER_LEN
449 +#define CAPI_MANUFACTURER_LEN 64
450 +#endif
451 unsigned char manbuf[CAPI_MANUFACTURER_LEN];
452 _cmsg CMSG;
454 Index: chan_capi-1.1.6/libcapi20/capi20.c
455 diff -Nau chan_capi-1.1.6/libcapi20/capi20.c.orig chan_capi-1.1.6/libcapi20/capi20.c
456 --- chan_capi-1.1.6/libcapi20/capi20.c.orig 2010-02-17 20:10:53.000000000 +0100
457 +++ chan_capi-1.1.6/libcapi20/capi20.c 2012-03-18 17:47:07.888451260 +0100
458 @@ -19,8 +19,10 @@
459 #include <stdio.h>
460 #include <ctype.h>
461 #include <assert.h>
462 +#ifdef __linux__
463 #define _LINUX_LIST_H
464 #include <linux/capi.h>
465 +#endif
467 #include <sys/socket.h>
468 #include <netinet/in.h>
469 @@ -48,17 +50,23 @@
471 #define SEND_BUFSIZ (128+2048)
473 +#if 0
474 static char capidevname[] = "/dev/capi20";
475 static char capidevnamenew[] = "/dev/isdn/capi20";
476 +#endif
478 static int capi_fd = -1;
479 +#if 0
480 static capi_ioctl_struct ioctl_data;
481 +#endif
483 static int remote_capi;
484 +#if 0
485 static char *globalconfigfilename = "/etc/capi20.conf";
486 static char *userconfigfilename = ".capi20rc";
487 static unsigned short int port;
488 static char hostname[1024];
489 +#endif
490 static int tracelevel;
491 static char *tracefile;
493 @@ -77,17 +85,21 @@
494 #define RCAPI_AUTH_USER_REQ CAPICMD(0xff, 0x00)
495 #define RCAPI_AUTH_USER_CONF CAPICMD(0xff, 0x01)
497 +#if 0
498 static char *skip_whitespace(char *s)
499 {
500 while (*s && isspace(*s)) s++;
501 return s;
502 }
503 +#endif
505 +#if 0
506 static char *skip_nonwhitespace(char *s)
507 {
508 while (*s && !isspace(*s)) s++;
509 return s;
510 }
511 +#endif
513 static unsigned char get_byte(unsigned char **p)
514 {
515 @@ -95,10 +107,12 @@
516 return((unsigned char)*(*p - 1));
517 }
519 +#if 0
520 static unsigned short get_word(unsigned char **p)
521 {
522 return(get_byte(p) | (get_byte(p) << 8));
523 }
524 +#endif
526 static unsigned short get_netword(unsigned char **p)
527 {
528 @@ -144,6 +158,7 @@
529 * read config file
530 */
532 +#if 0
533 static int read_config(void)
534 {
535 FILE *fp = NULL;
536 @@ -197,11 +212,13 @@
537 fclose(fp);
538 return(1);
539 }
540 +#endif
542 /*
543 * socket function
544 */
546 +#if 0
547 static int open_socket(void)
548 {
549 int fd;
550 @@ -225,6 +242,7 @@
551 close(fd);
552 return(-1);
553 }
554 +#endif
556 static int socket_read(int fd, unsigned char *buf, int l)
557 {
558 @@ -328,6 +346,8 @@
559 if (likely(capi_fd >= 0))
560 return CapiNoError;
562 +#if 0
563 +
564 /*----- open managment link -----*/
565 if (read_config() && (remote_capi)) {
566 capi_fd = open_socket();
567 @@ -347,6 +367,8 @@
568 if (ioctl(capi_fd, CAPI_INSTALLED, 0) == 0)
569 return CapiNoError;
571 +#endif
572 +
573 return CapiRegNotInstalled;
574 }
576 @@ -421,6 +443,7 @@
577 unsigned char *bufferstart;
578 };
580 +#if 0
581 static struct applinfo *alloc_buffers(
582 unsigned MaxB3Connection,
583 unsigned MaxB3Blks,
584 @@ -459,6 +482,7 @@
585 ap->lastfree->next = 0;
586 return ap;
587 }
588 +#endif
590 static void free_buffers(struct applinfo *ap)
591 {
592 @@ -576,14 +600,17 @@
593 unsigned MaxSizeB3,
594 unsigned *ApplID)
595 {
596 +#if 0
597 int applid = 0;
598 char buf[PATH_MAX];
599 int i, fd = -1;
601 *ApplID = 0;
602 +#endif
604 if (capi20_isinstalled() != CapiNoError)
605 return CapiRegNotInstalled;
606 +#if 0
607 if ((!remote_capi) || ((remote_capi) && ((fd = open_socket()) < 0))) {
608 if ((fd = open(capidevname, O_RDWR|O_NONBLOCK, 0666)) < 0 &&
609 (errno == ENOENT)) {
610 @@ -621,6 +648,8 @@
611 close(fd);
612 return(errcode);
613 }
614 + }
615 +#if 0
616 } else if ((applid = ioctl(fd, CAPI_REGISTER, &ioctl_data)) < 0) {
617 if (errno == EIO) {
618 if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
619 @@ -666,6 +695,7 @@
620 applid = alloc_applid(fd);
621 } // end old driver compatibility
622 }
623 +#endif
624 if (remember_applid(applid, fd) < 0) {
625 close(fd);
626 return CapiRegOSResourceErr;
627 @@ -676,6 +706,7 @@
628 return CapiRegOSResourceErr;
629 }
630 *ApplID = applid;
631 +#endif
632 return CapiNoError;
633 }
635 @@ -784,11 +815,15 @@
636 ret = CapiIllAppNr;
637 break;
638 case EIO:
639 +#if 0
640 if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0) {
641 +#endif
642 ret = CapiMsgOSResourceErr;
643 +#if 0
644 } else {
645 ret = (unsigned)ioctl_data.errcode;
646 }
647 +#endif
648 break;
649 default:
650 ret = CapiMsgOSResourceErr;
651 @@ -842,7 +877,7 @@
652 rcvbuf[15] = (data >> 24) & 0xff;
653 } else {
654 u_int64_t data;
655 - ulong radr = (ulong)rcvbuf;
656 + unsigned long radr = (unsigned long)rcvbuf;
657 if (CAPIMSG_LEN(rcvbuf) < 30) {
658 /*
659 * grr, 64bit arch, but no data64 included,
660 @@ -899,6 +934,9 @@
661 {
662 if (capi20_isinstalled() != CapiNoError)
663 return 0;
664 +#ifndef CAPI_MANUFACTURER_LEN
665 +#define CAPI_MANUFACTURER_LEN 64
666 +#endif
668 if (remote_capi) {
669 unsigned char buf[100];
670 @@ -911,15 +949,19 @@
671 return Buf;
672 }
674 +#if 0
675 ioctl_data.contr = Ctrl;
677 if (ioctl(capi_fd, CAPI_GET_MANUFACTURER, &ioctl_data) < 0)
678 +#endif
679 return 0;
681 +#if 0
682 memcpy(Buf, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN);
683 Buf[CAPI_MANUFACTURER_LEN-1] = 0;
685 return Buf;
686 +#endif
687 }
689 unsigned char *
690 @@ -934,16 +976,20 @@
691 set_rcapicmd_header(&p, 14, RCAPI_GET_VERSION_REQ, Ctrl);
692 if(!(remote_command(capi_fd, buf, 14, RCAPI_GET_VERSION_CONF)))
693 return 0;
694 - memcpy(Buf, buf + 1, sizeof(capi_version));
695 + memcpy(Buf, buf + 1, 128 /* sizeof(capi_version) */);
696 return Buf;
697 }
699 +#if 0
700 ioctl_data.contr = Ctrl;
701 if (ioctl(capi_fd, CAPI_GET_VERSION, &ioctl_data) < 0) {
702 +#endif
703 return 0;
704 +#if 0
705 }
706 memcpy(Buf, &ioctl_data.version, sizeof(capi_version));
707 return Buf;
708 +#endif
709 }
711 unsigned char *
712 @@ -952,6 +998,10 @@
713 if (capi20_isinstalled() != CapiNoError)
714 return 0;
716 +#ifndef CAPI_SERIAL_LEN
717 +#define CAPI_SERIAL_LEN 8
718 +#endif
719 +
720 if (remote_capi) {
721 unsigned char buf[100];
722 unsigned char *p = buf;
723 @@ -963,15 +1013,19 @@
724 return Buf;
725 }
727 +#if 0
728 ioctl_data.contr = Ctrl;
730 if (ioctl(capi_fd, CAPI_GET_SERIAL, &ioctl_data) < 0)
731 +#endif
732 return 0;
734 +#if 0
735 memcpy(Buf, &ioctl_data.serial, CAPI_SERIAL_LEN);
736 Buf[CAPI_SERIAL_LEN-1] = 0;
738 return Buf;
739 +#endif
740 }
742 unsigned
743 @@ -1018,6 +1072,7 @@
744 sizeof(ioctl_data.profile.ncontroller));
745 }
746 return CapiNoError;
747 +#endif
748 }
749 /*
750 * functions added to the CAPI2.0 spec
751 Index: chan_capi-1.1.6/libcapi20/convert.c
752 diff -Nau chan_capi-1.1.6/libcapi20/convert.c.orig chan_capi-1.1.6/libcapi20/convert.c
753 --- chan_capi-1.1.6/libcapi20/convert.c.orig 2010-09-14 21:54:25.000000000 +0200
754 +++ chan_capi-1.1.6/libcapi20/convert.c 2012-03-18 17:47:07.888451260 +0100
755 @@ -11,7 +11,14 @@
756 #include <stddef.h>
757 #include <time.h>
758 #include <ctype.h>
759 +#ifdef __FreeBSD__
760 +#include <sys/endian.h>
761 +#define bswap_16 bswap16
762 +#define bswap_32 bswap32
763 +#define bswap_64 bswap64
764 +#else
765 #include <byteswap.h>
766 +#endif
768 #include "capi20.h"
770 Index: chan_capi-1.1.6/Makefile
771 diff -Nau chan_capi-1.1.6/Makefile.orig chan_capi-1.1.6/Makefile
772 --- chan_capi-1.1.6/Makefile.orig 2011-02-04 18:41:46.000000000 +0100
773 +++ chan_capi-1.1.6/Makefile 2012-03-18 17:47:07.888451260 +0100
774 @@ -115,6 +115,9 @@
775 CFLAGS+=-O2
776 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
777 CFLAGS+=$(shell if uname -m | grep -q "ppc\|arm\|s390"; then echo "-fsigned-char"; fi)
778 +ifeq (${USE_OWN_LIBCAPI},yes)
779 +CFLAGS+=-DUSE_OWN_LIBCAPI
780 +endif
781 ifeq (${DIVA_STREAMING},1)
782 CFLAGS += -DDIVA_STREAMING=1
783 endif
784 Index: channels/chan_sip.c
785 diff -Nau channels/chan_sip.c.orig channels/chan_sip.c
786 --- channels/chan_sip.c.orig 2012-02-28 18:53:34.000000000 +0100
787 +++ channels/chan_sip.c 2012-03-18 17:47:07.898462166 +0100
788 @@ -12150,7 +12150,16 @@
789 } else {
790 if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) {
791 /* If this is a NOTIFY, use the From: tag in the subscribe (RFC 3265) */
792 - snprintf(to, sizeof(to), "<%s%s>;tag=%s", (strncasecmp(p->uri, "sip:", 4) ? "sip:" : ""), p->uri, p->theirtag);
793 + if (strncasecmp(p->uri, "sip:", strlen("sip:")))
794 + if (strncasecmp(p->uri, "sips:", strlen("sips:")))
795 + if (p->socket.type == SIP_TRANSPORT_TLS)
796 + snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
797 + else
798 + snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag);
799 + else /* if (strncasecmp(p->uri, "sips:"... */
800 + snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
801 + else /* if (strncasecmp(p->uri, "sip:"... */
802 + snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag);
803 } else if (p->options && p->options->vxml_url) {
804 /* If there is a VXML URL append it to the SIP URL */
805 snprintf(to, sizeof(to), "<%s>;%s", p->uri, p->options->vxml_url);
806 Index: channels/console_video.h
807 diff -Nau channels/console_video.h.orig channels/console_video.h
808 --- channels/console_video.h.orig 2008-06-30 17:45:15.000000000 +0200
809 +++ channels/console_video.h 2012-03-18 17:47:07.898462166 +0100
810 @@ -28,10 +28,7 @@
811 "console {device}"
812 #else
814 -#include <ffmpeg/avcodec.h>
815 -#ifndef OLD_FFMPEG
816 -#include <ffmpeg/swscale.h> /* requires a recent ffmpeg */
817 -#endif
818 +#include <libavcoded/avcodec.h>
820 #define CONSOLE_VIDEO_CMDS \
821 "console {videodevice|videocodec" \
822 Index: configure
823 diff -Nau configure.orig configure
824 --- configure.orig 2012-01-14 17:40:17.000000000 +0100
825 +++ configure 2012-03-18 17:47:32.518450837 +0100
826 @@ -4711,11 +4711,6 @@
827 esac
829 case "${host_os}" in
830 - freebsd*)
831 - ac_default_prefix=/usr/local
832 - CPPFLAGS=-I/usr/local/include
833 - LDFLAGS=-L/usr/local/lib
834 - ;;
835 openbsd*)
836 ac_default_prefix=/usr/local
837 if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
838 @@ -18994,8 +18989,8 @@
839 if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
840 imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
841 fi
842 - imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
843 - imap_include="-I${IMAP_TK_DIR}/c-client"
844 + imap_libs="-limap -lssl -lcrypto -lcrypt"
845 + imap_include="-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap"
846 CPPFLAGS="${CPPFLAGS} ${imap_include}"
847 LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
848 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
849 @@ -26771,7 +26766,7 @@
850 pbxlibdir="-L${SQLITE_DIR}"
851 fi
852 fi
853 - pbxfuncname="sqlite_exec"
854 + pbxfuncname="sqlite3_exec"
855 if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
856 AST_SQLITE_FOUND=yes
857 else
858 Index: formats/format_pcm.c
859 diff -Nau formats/format_pcm.c.orig formats/format_pcm.c
860 --- formats/format_pcm.c.orig 2011-07-14 22:13:06.000000000 +0200
861 +++ formats/format_pcm.c 2012-03-18 17:47:07.898462166 +0100
862 @@ -376,6 +376,7 @@
863 ast_log(LOG_WARNING, "Unable to write header\n");
864 return -1;
865 }
866 + fflush(f); /* issues.asterisk.org bug 0016610 */
867 return 0;
868 }
870 Index: formats/format_wav.c
871 diff -Nau formats/format_wav.c.orig formats/format_wav.c
872 --- formats/format_wav.c.orig 2011-11-09 16:25:33.000000000 +0100
873 +++ formats/format_wav.c 2012-03-18 17:47:07.898462166 +0100
874 @@ -310,6 +310,7 @@
875 ast_log(LOG_WARNING, "Unable to write header\n");
876 return -1;
877 }
878 + fflush(f); /* issues.asterisk.org bug 0016610 */
879 return 0;
880 }
882 Index: formats/format_wav_gsm.c
883 diff -Nau formats/format_wav_gsm.c.orig formats/format_wav_gsm.c
884 --- formats/format_wav_gsm.c.orig 2011-07-14 22:13:06.000000000 +0200
885 +++ formats/format_wav_gsm.c 2012-03-18 17:47:07.898462166 +0100
886 @@ -366,6 +366,7 @@
887 ast_log(LOG_WARNING, "Unable to write header\n");
888 return -1;
889 }
890 + fflush(f); /* issues.asterisk.org bug 0016610 */
891 return 0;
892 }
894 Index: main/db1-ast/hash/hash.h
895 diff -Nau main/db1-ast/hash/hash.h.orig main/db1-ast/hash/hash.h
896 --- main/db1-ast/hash/hash.h.orig 2006-08-21 04:11:39.000000000 +0200
897 +++ main/db1-ast/hash/hash.h 2012-03-18 17:47:07.898462166 +0100
898 @@ -36,6 +36,8 @@
899 * @(#)hash.h 8.3 (Berkeley) 5/31/94
900 */
902 +#include <stdint.h>
903 +
904 /* Operations */
905 typedef enum {
906 HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
907 Index: main/db1-ast/hash/ndbm.c
908 diff -Nau main/db1-ast/hash/ndbm.c.orig main/db1-ast/hash/ndbm.c
909 --- main/db1-ast/hash/ndbm.c.orig 2006-08-21 04:11:39.000000000 +0200
910 +++ main/db1-ast/hash/ndbm.c 2012-03-18 17:47:07.898462166 +0100
911 @@ -49,7 +49,8 @@
912 #include <string.h>
913 #include <stdlib.h>
915 -#include <ndbm.h>
916 +#include "../include/ndbm.h"
917 +#include "../include/db.h"
918 #include "hash.h"
920 /*
921 Index: main/features.c
922 diff -Nau main/features.c.orig main/features.c
923 --- main/features.c.orig 2012-01-23 21:30:21.000000000 +0100
924 +++ main/features.c 2012-03-18 17:47:07.898462166 +0100
925 @@ -2158,6 +2158,10 @@
926 snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
927 }
929 + for(x = 0; x < strlen(touch_filename); x++) {
930 + if (args[x] == '/')
931 + args[x] = '-';
932 + }
933 for(x = 0; x < strlen(args); x++) {
934 if (args[x] == '/')
935 args[x] = '-';
936 @@ -2270,6 +2274,10 @@
937 snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav"));
938 }
940 + for( x = 0; x < strlen(touch_filename); x++) {
941 + if (args[x] == '/')
942 + args[x] = '-';
943 + }
944 for( x = 0; x < strlen(args); x++) {
945 if (args[x] == '/')
946 args[x] = '-';
947 Index: main/file.c
948 diff -Nau main/file.c.orig main/file.c
949 --- main/file.c.orig 2012-01-05 23:06:46.000000000 +0100
950 +++ main/file.c 2012-03-18 17:47:07.898462166 +0100
951 @@ -260,7 +260,7 @@
952 char *fn = NULL;
954 if (!strcmp(ext, "wav49"))
955 - ext = "WAV";
956 + ext = "wav";
958 if (filename[0] == '/') {
959 if (asprintf(&fn, "%s.%s", filename, ext) < 0) {
960 Index: main/Makefile
961 diff -Nau main/Makefile.orig main/Makefile
962 --- main/Makefile.orig 2011-09-19 22:27:03.000000000 +0200
963 +++ main/Makefile 2012-03-18 17:47:07.898462166 +0100
964 @@ -66,10 +66,7 @@
965 endif
967 ifeq ($(OSARCH),FreeBSD)
968 - # -V is understood by BSD Make, not by GNU make.
969 - BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
970 - AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
971 - AST_LIBS+=-lcrypto
972 + AST_LIBS+=-lpthread -lcrypto
973 endif
975 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
976 Index: main/tcptls.c
977 diff -Nau main/tcptls.c.orig main/tcptls.c
978 --- main/tcptls.c.orig 2011-11-30 22:41:31.000000000 +0100
979 +++ main/tcptls.c 2012-03-18 17:47:07.898462166 +0100
980 @@ -391,6 +391,7 @@
981 if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) {
982 if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0)
983 ast_verb(0, "SSL CA file(%s)/path(%s) error\n", cfg->cafile, cfg->capath);
984 + SSL_CTX_set_client_CA_list(cfg->ssl_ctx, S_OR(cfg->cafile, NULL));
985 }
987 ast_verb(0, "SSL certificate ok\n");
988 Index: main/udptl.c
989 diff -Nau main/udptl.c.orig main/udptl.c
990 --- main/udptl.c.orig 2011-10-06 19:49:38.000000000 +0200
991 +++ main/udptl.c 2012-03-18 17:47:07.898462166 +0100
992 @@ -101,6 +101,18 @@
994 #define UDPTL_BUF_MASK 15
996 +/*! Copied from chan_oss.c, corrects link errors:
997 +udptl.o: In function `calculate_local_max_datagram':
998 +main/udptl.c:740: undefined reference to `MIN'
999 +udptl.o: In function `calculate_far_max_ifp':
1000 +main/udptl.c:770: undefined reference to `MAX' */
1001 +#ifndef MIN
1002 +#define MIN(a,b) ((a) < (b) ? (a) : (b))
1003 +#endif
1004 +#ifndef MAX
1005 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
1006 +#endif
1007 +
1008 typedef struct {
1009 int buf_len;
1010 uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
1011 Index: Makefile
1012 diff -Nau Makefile.orig Makefile
1013 --- Makefile.orig 2011-10-05 00:54:15.000000000 +0200
1014 +++ Makefile 2012-03-18 17:47:07.898462166 +0100
1015 @@ -186,12 +186,6 @@
1016 _ASTCFLAGS+=-isystem /usr/local/include
1017 endif
1019 -ifeq ($(OSARCH),FreeBSD)
1020 - # -V is understood by BSD Make, not by GNU make.
1021 - BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
1022 - _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
1023 -endif
1024 -
1025 ifeq ($(OSARCH),NetBSD)
1026 _ASTCFLAGS+=-pthread -I/usr/pkg/include
1027 endif