1 |
chainsaw 10/12/01 17:54:28 |
2 |
|
3 |
Added: asterisk-1.4.33-inband-indications.patch |
4 |
asterisk-1.4.0-var_rundir.patch |
5 |
asterisk-1.4.33-gsm-pic.patch |
6 |
asterisk-1.4.0-uclibc.patch func_devstate-r6.c |
7 |
asterisk-1.4.37-imap-libs.patch asterisk.logrotate |
8 |
func_volume.c asterisk.confd asterisk.initd |
9 |
Log: |
10 |
Add 1.4 branch ebuild & patchset by Kerin Millar, who will be proxy maintaining. |
11 |
|
12 |
(Portage version: 2.1.9.25/cvs/Linux x86_64) |
13 |
|
14 |
Revision Changes Path |
15 |
1.1 net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch |
16 |
|
17 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch?rev=1.1&view=markup |
18 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch?rev=1.1&content-type=text/plain |
19 |
|
20 |
Index: asterisk-1.4.33-inband-indications.patch |
21 |
=================================================================== |
22 |
--- asterisk-1.4.33.orig/main/channel.c 2010-05-24 20:37:55.000000000 +0100 |
23 |
+++ asterisk-1.4.33/main/channel.c 2010-06-23 15:06:44.949805705 +0100 |
24 |
@@ -1767,6 +1767,8 @@ int ast_activate_generator(struct ast_ch |
25 |
chan->generator->release(chan, chan->generatordata); |
26 |
chan->generatordata = NULL; |
27 |
} |
28 |
+ |
29 |
+ ast_prod(chan); |
30 |
if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) { |
31 |
res = -1; |
32 |
} |
33 |
@@ -1776,8 +1778,6 @@ int ast_activate_generator(struct ast_ch |
34 |
} |
35 |
ast_channel_unlock(chan); |
36 |
|
37 |
- ast_prod(chan); |
38 |
- |
39 |
return res; |
40 |
} |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
1.1 net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch |
46 |
|
47 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch?rev=1.1&view=markup |
48 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch?rev=1.1&content-type=text/plain |
49 |
|
50 |
Index: asterisk-1.4.0-var_rundir.patch |
51 |
=================================================================== |
52 |
--- asterisk-1.4.0/Makefile.orig 2006-12-24 03:07:19.000000000 +0000 |
53 |
+++ asterisk-1.4.0/Makefile 2006-12-24 03:07:57.000000000 +0000 |
54 |
@@ -109,7 +109,7 @@ |
55 |
ASTSBINDIR=$(sbindir) |
56 |
ASTSPOOLDIR=$(localstatedir)/spool/asterisk |
57 |
ASTLOGDIR=$(localstatedir)/log/asterisk |
58 |
- ASTVARRUNDIR=$(localstatedir)/run |
59 |
+ ASTVARRUNDIR=$(localstatedir)/run/asterisk |
60 |
ASTMANDIR=$(mandir) |
61 |
ifeq ($(OSARCH),FreeBSD) |
62 |
ASTVARLIBDIR=$(prefix)/share/asterisk |
63 |
|
64 |
|
65 |
|
66 |
1.1 net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch |
67 |
|
68 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch?rev=1.1&view=markup |
69 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch?rev=1.1&content-type=text/plain |
70 |
|
71 |
Index: asterisk-1.4.33-gsm-pic.patch |
72 |
=================================================================== |
73 |
--- asterisk-1.4.33.orig/codecs/gsm/Makefile 2010-03-16 20:47:15.000000000 +0000 |
74 |
+++ asterisk-1.4.33/codecs/gsm/Makefile 2010-06-20 18:21:56.576515592 +0100 |
75 |
@@ -37,30 +37,6 @@ |
76 |
######### ppro's, etc, as well as the AMD K6 and K7. The compile will |
77 |
######### probably require gcc. |
78 |
|
79 |
-ifeq (,$(findstring $(shell uname -s),Darwin SunOS)) |
80 |
- ifeq (,$(findstring $(PROC),x86_64 amd64 ultrasparc sparc64 arm armv5b armeb hppa2.0 ppc powerpc ppc64 ia64 s390 bfin mipsel mips)) |
81 |
- ifeq (,$(findstring $(shell uname -m),ppc ppc64 alpha armv4l s390)) |
82 |
- OPTIMIZE+=-march=$(PROC) |
83 |
- endif |
84 |
- endif |
85 |
-else |
86 |
- ifneq (,$(findstring $(OSARCH),Darwin)) |
87 |
- ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6) |
88 |
- # Snow Leopard reports i386, even though it's really x86_64 |
89 |
- OPTIMIZE+=-mtune=native |
90 |
- endif |
91 |
- endif |
92 |
-endif |
93 |
- |
94 |
-#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. |
95 |
-#This works for even old (2.96) versions of gcc and provides a small boost either way. |
96 |
-#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it. |
97 |
-#So we go lowest common available by gcc and go a step down, still a step up from |
98 |
-#the default as we now have a better instruction set to work with. - Belgarath |
99 |
-ifeq ($(PROC),ultrasparc) |
100 |
-OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3 |
101 |
-endif |
102 |
- |
103 |
PG = |
104 |
#PG = -g -pg |
105 |
######### Profiling flags. If you don't know what that means, leave it blank. |
106 |
@@ -217,10 +193,12 @@ |
107 |
ifeq ($(OSARCH),linux-gnu) |
108 |
ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc s390 )) |
109 |
ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel mips )) |
110 |
+ifneq ($(K6OPT),) |
111 |
GSM_SOURCES+= $(SRC)/k6opt.s |
112 |
endif |
113 |
endif |
114 |
endif |
115 |
+endif |
116 |
|
117 |
TOAST_SOURCES = $(SRC)/toast.c \ |
118 |
$(SRC)/toast_lin.c \ |
119 |
@@ -269,10 +247,12 @@ |
120 |
ifeq ($(OSARCH),linux-gnu) |
121 |
ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc )) |
122 |
ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel mips )) |
123 |
+ifneq ($(K6OPT),) |
124 |
GSM_OBJECTS+= $(SRC)/k6opt.o |
125 |
endif |
126 |
endif |
127 |
endif |
128 |
+endif |
129 |
|
130 |
TOAST_OBJECTS = $(SRC)/toast.o \ |
131 |
$(SRC)/toast_lin.o \ |
132 |
|
133 |
|
134 |
|
135 |
1.1 net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch |
136 |
|
137 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch?rev=1.1&view=markup |
138 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch?rev=1.1&content-type=text/plain |
139 |
|
140 |
Index: asterisk-1.4.0-uclibc.patch |
141 |
=================================================================== |
142 |
--- Makefile.old 2007-01-05 10:12:48 +0000 |
143 |
+++ Makefile 2007-01-05 10:21:52 +0000 |
144 |
@@ -216,6 +216,10 @@ |
145 |
ASTCFLAGS+=-pthread |
146 |
endif |
147 |
|
148 |
+ifeq ($(OSARCH),linux-uclibc) |
149 |
+ AST_LIBS+=-lpthread -ldl |
150 |
+endif |
151 |
+ |
152 |
ifeq ($(OSARCH),SunOS) |
153 |
ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include |
154 |
endif |
155 |
|
156 |
|
157 |
|
158 |
1.1 net-misc/asterisk/files/1.4.0/func_devstate-r6.c |
159 |
|
160 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/func_devstate-r6.c?rev=1.1&view=markup |
161 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/func_devstate-r6.c?rev=1.1&content-type=text/plain |
162 |
|
163 |
Index: func_devstate-r6.c |
164 |
=================================================================== |
165 |
/* |
166 |
* Asterisk -- An open source telephony toolkit. |
167 |
* |
168 |
* Copyright (C) 2007, Digium, Inc. |
169 |
* |
170 |
* Russell Bryant <russell@××××××.com> |
171 |
* |
172 |
* See http://www.asterisk.org for more information about |
173 |
* the Asterisk project. Please do not directly contact |
174 |
* any of the maintainers of this project for assistance; |
175 |
* the project provides a web site, mailing lists and IRC |
176 |
* channels for your use. |
177 |
* |
178 |
* This program is free software, distributed under the terms of |
179 |
* the GNU General Public License Version 2. See the LICENSE file |
180 |
* at the top of the source tree. |
181 |
*/ |
182 |
|
183 |
/*! \file |
184 |
* |
185 |
* \brief Manually controlled blinky lights |
186 |
* |
187 |
* \author Russell Bryant <russell@××××××.com> |
188 |
* |
189 |
* \ingroup functions |
190 |
* |
191 |
* \note Props go out to Ahrimanes in #asterisk for requesting this at 4:30 AM |
192 |
* when I couldn't sleep. :) |
193 |
*/ |
194 |
|
195 |
#include "asterisk.h" |
196 |
|
197 |
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $") |
198 |
|
199 |
#include <stdlib.h> |
200 |
|
201 |
#include "asterisk/module.h" |
202 |
#include "asterisk/channel.h" |
203 |
#include "asterisk/pbx.h" |
204 |
#include "asterisk/utils.h" |
205 |
#include "asterisk/linkedlists.h" |
206 |
#include "asterisk/devicestate.h" |
207 |
#include "asterisk/cli.h" |
208 |
#include "asterisk/astdb.h" |
209 |
|
210 |
static const char astdb_family[] = "CustomDevstate"; |
211 |
|
212 |
static const char *ast_devstate_str(int state) |
213 |
{ |
214 |
const char *res = "UNKNOWN"; |
215 |
|
216 |
switch (state) { |
217 |
case AST_DEVICE_UNKNOWN: |
218 |
break; |
219 |
case AST_DEVICE_NOT_INUSE: |
220 |
res = "NOT_INUSE"; |
221 |
break; |
222 |
case AST_DEVICE_INUSE: |
223 |
res = "INUSE"; |
224 |
break; |
225 |
case AST_DEVICE_BUSY: |
226 |
res = "BUSY"; |
227 |
break; |
228 |
case AST_DEVICE_INVALID: |
229 |
res = "INVALID"; |
230 |
break; |
231 |
case AST_DEVICE_UNAVAILABLE: |
232 |
res = "UNAVAILABLE"; |
233 |
break; |
234 |
case AST_DEVICE_RINGING: |
235 |
res = "RINGING"; |
236 |
break; |
237 |
case AST_DEVICE_RINGINUSE: |
238 |
res = "RINGINUSE"; |
239 |
break; |
240 |
case AST_DEVICE_ONHOLD: |
241 |
res = "ONHOLD"; |
242 |
break; |
243 |
} |
244 |
|
245 |
return res; |
246 |
} |
247 |
|
248 |
static int ast_devstate_val(const char *val) |
249 |
{ |
250 |
if (!strcasecmp(val, "NOT_INUSE")) |
251 |
return AST_DEVICE_NOT_INUSE; |
252 |
else if (!strcasecmp(val, "INUSE")) |
253 |
return AST_DEVICE_INUSE; |
254 |
else if (!strcasecmp(val, "BUSY")) |
255 |
return AST_DEVICE_BUSY; |
256 |
else if (!strcasecmp(val, "INVALID")) |
257 |
return AST_DEVICE_INVALID; |
258 |
else if (!strcasecmp(val, "UNAVAILABLE")) |
259 |
return AST_DEVICE_UNAVAILABLE; |
260 |
else if (!strcasecmp(val, "RINGING")) |
261 |
return AST_DEVICE_RINGING; |
262 |
else if (!strcasecmp(val, "RINGINUSE")) |
263 |
return AST_DEVICE_RINGINUSE; |
264 |
else if (!strcasecmp(val, "ONHOLD")) |
265 |
return AST_DEVICE_ONHOLD; |
266 |
|
267 |
return AST_DEVICE_UNKNOWN; |
268 |
} |
269 |
|
270 |
static int devstate_read(struct ast_channel *chan, char *cmd, char *data, |
271 |
char *buf, size_t len) |
272 |
{ |
273 |
ast_copy_string(buf, ast_devstate_str(ast_device_state(data)), len); |
274 |
|
275 |
return 0; |
276 |
} |
277 |
|
278 |
static int devstate_write(struct ast_channel *chan, char *function, |
279 |
char *data, const char *value) |
280 |
{ |
281 |
size_t len = strlen("Custom:"); |
282 |
|
283 |
if (strncasecmp(data, "Custom:", len)) { |
284 |
ast_log(LOG_WARNING, "The DEVSTATE function can only be used to set 'Custom:' device state!\n"); |
285 |
return -1; |
286 |
} |
287 |
data += len; |
288 |
if (ast_strlen_zero(data)) { |
289 |
ast_log(LOG_WARNING, "DEVSTATE function called with no custom device name!\n"); |
290 |
return -1; |
291 |
} |
292 |
|
293 |
ast_db_put(astdb_family, data, (char *) value); |
294 |
|
295 |
ast_device_state_changed("Custom:%s", data); |
296 |
|
297 |
return 0; |
298 |
} |
299 |
|
300 |
static int custom_devstate_callback(const char *data) |
301 |
{ |
302 |
char buf[256] = ""; |
303 |
|
304 |
ast_db_get(astdb_family, data, buf, sizeof(buf)); |
305 |
|
306 |
return ast_devstate_val(buf); |
307 |
} |
308 |
|
309 |
static int cli_funcdevstate_list(int fd, int argc, char *argv[]) |
310 |
{ |
311 |
struct ast_db_entry *db_entry, *db_tree; |
312 |
|
313 |
if (argc != 2) |
314 |
return RESULT_SHOWUSAGE; |
315 |
|
316 |
ast_cli(fd, "\n" |
317 |
"---------------------------------------------------------------------\n" |
318 |
"--- Custom Device States --------------------------------------------\n" |
319 |
"---------------------------------------------------------------------\n" |
320 |
"---\n"); |
321 |
|
322 |
db_entry = db_tree = ast_db_gettree(astdb_family, NULL); |
323 |
for (; db_entry; db_entry = db_entry->next) { |
324 |
const char *dev_name = strrchr(db_entry->key, '/') + 1; |
325 |
if (dev_name <= (const char *) 1) |
326 |
continue; |
327 |
ast_cli(fd, "--- name: 'custom:%s' state: '%s'\n" |
328 |
"---\n", dev_name, db_entry->data); |
329 |
} |
330 |
ast_db_freetree(db_tree); |
331 |
db_tree = NULL; |
332 |
|
333 |
ast_cli(fd, |
334 |
"---------------------------------------------------------------------\n" |
335 |
"---------------------------------------------------------------------\n" |
336 |
"\n"); |
337 |
|
338 |
return RESULT_SUCCESS; |
339 |
} |
340 |
|
341 |
static struct ast_cli_entry cli_funcdevstate[] = { |
342 |
{ { "funcdevstate", "list", }, cli_funcdevstate_list, NULL, NULL }, |
343 |
}; |
344 |
|
345 |
static struct ast_custom_function devstate_function = { |
346 |
.name = "DEVSTATE", |
347 |
.synopsis = "Get or Set a device state", |
348 |
.syntax = "DEVSTATE(device)", |
349 |
.desc = |
350 |
" The DEVSTATE function can be used to retrieve the device state from any\n" |
351 |
"device state provider. For example:\n" |
352 |
" NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)})\n" |
353 |
" NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})\n" |
354 |
"\n" |
355 |
" The DEVSTATE function can also be used to set custom device state from\n" |
356 |
"the dialplan. The \"Custom:\" prefix must be used. For example:\n" |
357 |
" Set(DEVSTATE(Custom:lamp1)=BUSY)\n" |
358 |
" Set(DEVSTATE(Custom:lamp2)=NOT_INUSE)\n" |
359 |
"You can subscribe to the status of a custom device state using a hint in\n" |
360 |
"the dialplan:\n" |
361 |
" exten => 1234,hint,Custom:lamp1\n" |
362 |
"\n" |
363 |
" The possible values for both uses of this function are:\n" |
364 |
"UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING\n" |
365 |
"RINGINUSE | ONHOLD\n", |
366 |
.read = devstate_read, |
367 |
.write = devstate_write, |
368 |
}; |
369 |
|
370 |
static int unload_module(void) |
371 |
{ |
372 |
int res = 0; |
373 |
|
374 |
res |= ast_custom_function_unregister(&devstate_function); |
375 |
ast_devstate_prov_del("Custom"); |
376 |
ast_cli_unregister_multiple(cli_funcdevstate, ARRAY_LEN(cli_funcdevstate)); |
377 |
|
378 |
return res; |
379 |
} |
380 |
|
381 |
static int load_module(void) |
382 |
{ |
383 |
int res = 0; |
384 |
|
385 |
res |= ast_custom_function_register(&devstate_function); |
386 |
res |= ast_devstate_prov_add("Custom", custom_devstate_callback); |
387 |
ast_cli_register_multiple(cli_funcdevstate, ARRAY_LEN(cli_funcdevstate)); |
388 |
|
389 |
return res; |
390 |
} |
391 |
|
392 |
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Gets or sets a device state in the dialplan"); |
393 |
|
394 |
|
395 |
|
396 |
1.1 net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch |
397 |
|
398 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch?rev=1.1&view=markup |
399 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch?rev=1.1&content-type=text/plain |
400 |
|
401 |
Index: asterisk-1.4.37-imap-libs.patch |
402 |
=================================================================== |
403 |
--- asterisk-1.4.37.orig/configure.ac 2010-09-10 01:13:45.000000000 +0100 |
404 |
+++ asterisk-1.4.37/configure.ac 2010-11-27 14:37:29.379718734 +0000 |
405 |
@@ -1032,7 +1032,7 @@ |
406 |
CPPFLAGS="${saved_cppflags}" |
407 |
LIBS="${saved_libs}" |
408 |
imap_ldflags="" |
409 |
- imap_libs="-lc-client" |
410 |
+ imap_libs="-lc-client ${IMAP_LIBS}" |
411 |
imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first |
412 |
CPPFLAGS="${CPPFLAGS} ${imap_include}" |
413 |
LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}` |
414 |
|
415 |
|
416 |
|
417 |
1.1 net-misc/asterisk/files/1.4.0/asterisk.logrotate |
418 |
|
419 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.logrotate?rev=1.1&view=markup |
420 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.logrotate?rev=1.1&content-type=text/plain |
421 |
|
422 |
Index: asterisk.logrotate |
423 |
=================================================================== |
424 |
/var/log/asterisk/messages /var/log/asterisk/queue_log { |
425 |
missingok |
426 |
notifempty |
427 |
|
428 |
postrotate |
429 |
/usr/sbin/asterisk -rnx "logger reload" || /bin/true |
430 |
endscript |
431 |
} |
432 |
|
433 |
/var/log/asterisk/debug /var/log/asterisk/full { |
434 |
missingok |
435 |
notifempty |
436 |
daily |
437 |
|
438 |
postrotate |
439 |
/usr/sbin/asterisk -rnx "logger reload" || /bin/true |
440 |
endscript |
441 |
} |
442 |
|
443 |
/var/log/asterisk/cdr-csv/*.csv /var/log/asterisk/cdr-custom/*.csv { |
444 |
missingok |
445 |
notifempty |
446 |
weekly |
447 |
rotate 52 |
448 |
} |
449 |
|
450 |
|
451 |
|
452 |
1.1 net-misc/asterisk/files/1.4.0/func_volume.c |
453 |
|
454 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/func_volume.c?rev=1.1&view=markup |
455 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/func_volume.c?rev=1.1&content-type=text/plain |
456 |
|
457 |
Index: func_volume.c |
458 |
=================================================================== |
459 |
/* |
460 |
* Asterisk -- An open source telephony toolkit. |
461 |
* |
462 |
* Copyright (C) 2007, Digium, Inc. |
463 |
* |
464 |
* Joshua Colp <jcolp@××××××.com> |
465 |
* |
466 |
* See http://www.asterisk.org for more information about |
467 |
* the Asterisk project. Please do not directly contact |
468 |
* any of the maintainers of this project for assistance; |
469 |
* the project provides a web site, mailing lists and IRC |
470 |
* channels for your use. |
471 |
* |
472 |
* This program is free software, distributed under the terms of |
473 |
* the GNU General Public License Version 2. See the LICENSE file |
474 |
* at the top of the source tree. |
475 |
*/ |
476 |
|
477 |
/*! \file |
478 |
* |
479 |
* \brief Technology independent volume control |
480 |
* |
481 |
* \author Joshua Colp <jcolp@××××××.com> |
482 |
* |
483 |
* \ingroup functions |
484 |
* |
485 |
*/ |
486 |
|
487 |
#include "asterisk.h" |
488 |
|
489 |
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $") |
490 |
|
491 |
#include "asterisk/module.h" |
492 |
#include "asterisk/channel.h" |
493 |
#include "asterisk/pbx.h" |
494 |
#include "asterisk/utils.h" |
495 |
#include "asterisk/audiohook.h" |
496 |
|
497 |
struct volume_information { |
498 |
struct ast_audiohook audiohook; |
499 |
int tx_gain; |
500 |
int rx_gain; |
501 |
}; |
502 |
|
503 |
static void destroy_callback(void *data) |
504 |
{ |
505 |
struct volume_information *vi = data; |
506 |
|
507 |
/* Destroy the audiohook, and destroy ourselves */ |
508 |
ast_audiohook_destroy(&vi->audiohook); |
509 |
free(vi); |
510 |
|
511 |
return; |
512 |
} |
513 |
|
514 |
/*! \brief Static structure for datastore information */ |
515 |
static const struct ast_datastore_info volume_datastore = { |
516 |
.type = "volume", |
517 |
.destroy = destroy_callback |
518 |
}; |
519 |
|
520 |
static int volume_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction) |
521 |
{ |
522 |
struct ast_datastore *datastore = NULL; |
523 |
struct volume_information *vi = NULL; |
524 |
int *gain = NULL; |
525 |
|
526 |
/* If the audiohook is stopping it means the channel is shutting down.... but we let the datastore destroy take care of it */ |
527 |
if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE) |
528 |
return 0; |
529 |
|
530 |
/* Grab datastore which contains our gain information */ |
531 |
if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) |
532 |
return 0; |
533 |
|
534 |
vi = datastore->data; |
535 |
|
536 |
/* If this is DTMF then allow them to increase/decrease the gains */ |
537 |
if (frame->frametype == AST_FRAME_DTMF) { |
538 |
/* Only use DTMF coming from the source... not going to it */ |
539 |
if (direction != AST_AUDIOHOOK_DIRECTION_READ) |
540 |
return 0; |
541 |
if (frame->subclass == '*') { |
542 |
vi->tx_gain += 1; |
543 |
vi->rx_gain += 1; |
544 |
} else if (frame->subclass == '#') { |
545 |
vi->tx_gain -= 1; |
546 |
vi->rx_gain -= 1; |
547 |
} |
548 |
} else if (frame->frametype == AST_FRAME_VOICE) { |
549 |
/* Based on direction of frame grab the gain, and confirm it is applicable */ |
550 |
if (!(gain = (direction == AST_AUDIOHOOK_DIRECTION_READ) ? &vi->rx_gain : &vi->tx_gain) || !*gain) |
551 |
return 0; |
552 |
/* Apply gain to frame... easy as pi */ |
553 |
ast_frame_adjust_volume(frame, *gain); |
554 |
} |
555 |
|
556 |
return 0; |
557 |
} |
558 |
|
559 |
static int volume_write(struct ast_channel *chan, char *cmd, char *data, const char *value) |
560 |
{ |
561 |
struct ast_datastore *datastore = NULL; |
562 |
struct volume_information *vi = NULL; |
563 |
int is_new = 0; |
564 |
|
565 |
if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) { |
566 |
/* Allocate a new datastore to hold the reference to this volume and audiohook information */ |
567 |
if (!(datastore = ast_channel_datastore_alloc(&volume_datastore, NULL))) |
568 |
return 0; |
569 |
if (!(vi = ast_calloc(1, sizeof(*vi)))) { |
570 |
ast_channel_datastore_free(datastore); |
571 |
return 0; |
572 |
} |
573 |
ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume"); |
574 |
vi->audiohook.manipulate_callback = volume_callback; |
575 |
ast_set_flag(&vi->audiohook, AST_AUDIOHOOK_WANTS_DTMF); |
576 |
is_new = 1; |
577 |
} else { |
578 |
vi = datastore->data; |
579 |
} |
580 |
|
581 |
/* Adjust gain on volume information structure */ |
582 |
if (!strcasecmp(data, "tx")) |
583 |
vi->tx_gain = atoi(value); |
584 |
else if (!strcasecmp(data, "rx")) |
585 |
vi->rx_gain = atoi(value); |
586 |
|
587 |
if (is_new) { |
588 |
datastore->data = vi; |
589 |
ast_channel_datastore_add(chan, datastore); |
590 |
ast_audiohook_attach(chan, &vi->audiohook); |
591 |
} |
592 |
|
593 |
return 0; |
594 |
} |
595 |
|
596 |
static struct ast_custom_function volume_function = { |
597 |
.name = "VOLUME", |
598 |
.synopsis = "Set the TX or RX volume of a channel", |
599 |
.syntax = "VOLUME(TX|RX)", |
600 |
.desc = |
601 |
" The VOLUME function can be used to increase or decrease the tx or\n" |
602 |
"rx gain of any channel. For example:\n" |
603 |
" Set(VOLUME(TX)=3)\n" |
604 |
" Set(VOLUME(RX)=2)\n", |
605 |
.write = volume_write, |
606 |
}; |
607 |
|
608 |
static int unload_module(void) |
609 |
{ |
610 |
return ast_custom_function_unregister(&volume_function); |
611 |
} |
612 |
|
613 |
static int load_module(void) |
614 |
{ |
615 |
return ast_custom_function_register(&volume_function); |
616 |
} |
617 |
|
618 |
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Technology independent volume control"); |
619 |
|
620 |
|
621 |
|
622 |
1.1 net-misc/asterisk/files/1.4.0/asterisk.confd |
623 |
|
624 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.confd?rev=1.1&view=markup |
625 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.confd?rev=1.1&content-type=text/plain |
626 |
|
627 |
Index: asterisk.confd |
628 |
=================================================================== |
629 |
# Copyright 1999-2010 Gentoo Foundation |
630 |
# Distributed under the terms of the GNU General Public License v2 |
631 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.confd,v 1.1 2010/12/01 17:54:28 chainsaw Exp $ |
632 |
|
633 |
# |
634 |
# Additional options for asterisk |
635 |
# |
636 |
# see "asterisk -h" for a list of options |
637 |
# |
638 |
ASTERISK_OPTS="" |
639 |
|
640 |
# |
641 |
# User and group to run asterisk as |
642 |
# |
643 |
# Value: double-colon separated list of user and group, or empty to run as root: |
644 |
# |
645 |
# |
646 |
# "asterisk:asterisk" to run as user "asterisk" and group "asterisk" |
647 |
# |
648 |
# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of |
649 |
# |
650 |
# ":asterisk" to run as user "root" and group "asterisk" |
651 |
# |
652 |
# "" to run as user "root" and group "root" |
653 |
# |
654 |
ASTERISK_USER="asterisk" |
655 |
|
656 |
# |
657 |
# Nicelevel |
658 |
# |
659 |
# Set the priority of the asterisk process |
660 |
# |
661 |
# Value: (highest) -20..19 (lowest) |
662 |
# |
663 |
#ASTERISK_NICE="19" |
664 |
|
665 |
# |
666 |
# Wrapper script |
667 |
# |
668 |
# Value: yes or no/empty |
669 |
# |
670 |
ASTERISK_WRAPPER="no" |
671 |
|
672 |
############# Wrapper script settings ############# |
673 |
|
674 |
# |
675 |
# Send crash notifications emails to this address |
676 |
# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp)) |
677 |
# |
678 |
# Value: Email address or empty to disable |
679 |
# |
680 |
#ASTERISK_NOTIFY_EMAIL="root" |
681 |
|
682 |
# |
683 |
# Send asterisk's output to this terminal |
684 |
# |
685 |
# Value: Full path to device node or a number |
686 |
# |
687 |
#ASTERISK_TTY="/dev/tty9" |
688 |
|
689 |
# |
690 |
# Start an asterisk console on the terminal specified by ASTERISK_TTY |
691 |
# |
692 |
# Warning! Use only for debugging, this is a potential security issue! |
693 |
# |
694 |
# Value: yes or no/empty |
695 |
# |
696 |
ASTERISK_CONSOLE="no" |
697 |
|
698 |
# |
699 |
# Maximum size of core files. |
700 |
# |
701 |
# Value: Size in bytes, unlimited for no limit or empty to disable. |
702 |
# |
703 |
#ASTERISK_CORE_SIZE="unlimited" |
704 |
|
705 |
# |
706 |
# ASTERISK_CORE_DIR |
707 |
# |
708 |
# Value: Directory (will be created if non-existant), default is /tmp |
709 |
# |
710 |
ASTERISK_CORE_DIR="/var/lib/asterisk/coredump" |
711 |
|
712 |
# |
713 |
# Max number of filedescriptors |
714 |
# |
715 |
# Value: Number of descriptors |
716 |
# |
717 |
#ASTERISK_MAX_FD="1024" |
718 |
|
719 |
# |
720 |
# Kill these tasks after asterisk crashed (ASTERISK_WRAPPER=yes only!) |
721 |
# |
722 |
# Warning! This will kill _ALL_ tasks with the specified names! |
723 |
# |
724 |
# Value: Space separated list of names in double quotes (e.g. "mpg123 mad") |
725 |
# |
726 |
#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad" |
727 |
|
728 |
|
729 |
|
730 |
1.1 net-misc/asterisk/files/1.4.0/asterisk.initd |
731 |
|
732 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.initd?rev=1.1&view=markup |
733 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.initd?rev=1.1&content-type=text/plain |
734 |
|
735 |
Index: asterisk.initd |
736 |
=================================================================== |
737 |
#!/sbin/runscript |
738 |
# Copyright 1999-2010 Gentoo Foundation |
739 |
# Distributed under the terms of the GNU General Public License v2 |
740 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.initd,v 1.1 2010/12/01 17:54:28 chainsaw Exp $ |
741 |
|
742 |
opts="${opts} forcestop reload" |
743 |
|
744 |
depend() { |
745 |
need net |
746 |
use nscd dns dahdi mysql postgresql slapd capi |
747 |
} |
748 |
|
749 |
is_running() { |
750 |
if [ -z "`pidof asterisk`" ]; then |
751 |
return 1 |
752 |
else |
753 |
PID="`cat /var/run/asterisk/asterisk.pid`" |
754 |
for x in `pidof asterisk`; do |
755 |
if [ "${x}" = "${PID}" ]; then |
756 |
return 0 |
757 |
fi |
758 |
done |
759 |
fi |
760 |
|
761 |
return 1 |
762 |
} |
763 |
|
764 |
asterisk_run_loop() { |
765 |
logger -t asterisk_wrapper "Initializing asterisk wrapper" |
766 |
|
767 |
local OPTS ARGS MSG NICE="" |
768 |
local result=0 signal=0 |
769 |
|
770 |
# default options |
771 |
OPTS="-f" # don't fork / detach breaks wrapper script... |
772 |
|
773 |
# filter (redundant) arguments |
774 |
ARGS="`echo "${@}" | sed -e "s:-c\|-f::g"`" |
775 |
|
776 |
# mangle yes/no options |
777 |
ASTERISK_CONSOLE="`echo ${ASTERISK_CONSOLE} | tr '[:lower:]' '[:upper:]'`" |
778 |
|
779 |
if [ -n "${ASTERISK_CORE_SIZE}" ] && |
780 |
[ "${ASTERISK_CORE_SIZE}" != "0" ]; then |
781 |
ulimit -c ${ASTERISK_CORE_SIZE} |
782 |
|
783 |
if [ -n "${ASTERISK_CORE_DIR}" ] && \ |
784 |
[ ! -d "${ASTERISK_CORE_DIR}" ] |
785 |
then |
786 |
mkdir -m750 -p "${ASTERISK_CORE_DIR}" |
787 |
|
788 |
if [ -n "${ASTERISK_USER}" ]; then |
789 |
chown -R "${ASTERISK_USER}" "${ASTERISK_CORE_DIR}" |
790 |
fi |
791 |
fi |
792 |
ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" |
793 |
|
794 |
cd "${ASTERISK_CORE_DIR}" |
795 |
echo " Core dump size : ${ASTERISK_CORE_SIZE}" |
796 |
echo " Core dump location : ${ASTERISK_CORE_DIR}" |
797 |
fi |
798 |
|
799 |
if [ -n "${ASTERISK_MAX_FD}" ]; then |
800 |
ulimit -n ${ASTERISK_MAX_FD} |
801 |
echo " Max open filedescriptors : ${ASTERISK_MAX_FD}" |
802 |
fi |
803 |
|
804 |
if [ -n "${ASTERISK_NICE}" ]; then |
805 |
echo " Nice level : ${ASTERISK_NICE}" |
806 |
NICE="nice -n ${ASTERISK_NICE} --" |
807 |
fi |
808 |
|
809 |
if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then |
810 |
if [ -x /usr/sbin/sendmail ]; then |
811 |
echo " Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" |
812 |
else |
813 |
echo " Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" |
814 |
unset ASTERISK_NOTIFY_EMAIL |
815 |
fi |
816 |
fi |
817 |
|
818 |
if [ -n "${ASTERISK_TTY}" ]; then |
819 |
for x in ${ASTERISK_TTY} \ |
820 |
/dev/tty${ASTERISK_TTY} \ |
821 |
/dev/vc/${ASTERISK_TTY} |
822 |
do |
823 |
if [ -c "${x}" ]; then |
824 |
TTY="${x}" |
825 |
fi |
826 |
done |
827 |
[ -n "${TTY}" ] && \ |
828 |
echo " Messages are sent to : ${TTY}" |
829 |
fi |
830 |
|
831 |
if [ "${ASTERISK_CONSOLE}" = "YES" ] && [ -n "${TTY}" ]; then |
832 |
echo " Starting Asterisk console : ${ASTERISK_CONSOLE}" |
833 |
OPTS="${OPTS} -c" |
834 |
fi |
835 |
|
836 |
OPTS="${OPTS} ${ARGS}" |
837 |
|
838 |
trap "rm /var/run/asterisk/wrapper_loop.pid" EXIT |
839 |
cut -f4 -d' ' < /proc/self/stat > /var/run/asterisk/wrapper_loop.pid |
840 |
|
841 |
while :; do |
842 |
if [ -n "${TTY}" ]; then |
843 |
/usr/bin/stty -F ${TTY} sane |
844 |
${NICE} /usr/sbin/asterisk ${OPTS} >${TTY} 2>&1 <${TTY} |
845 |
result=$? |
846 |
else |
847 |
set -o pipefail |
848 |
${NICE} /usr/sbin/asterisk ${OPTS} 2>&1 >/dev/null | logger -t asterisk_wrapper |
849 |
result=$? |
850 |
set +o pipefail |
851 |
fi |
852 |
|
853 |
if [ $result -eq 0 ]; then |
854 |
logger -t asterisk_wrapper "Asterisk terminated normally" |
855 |
break |
856 |
else |
857 |
if [ $result -gt 128 ]; then |
858 |
signal=`expr $signal - 128` |
859 |
MSG="Asterisk terminated with Signal: $signal" |
860 |
|
861 |
CORE_TARGET="core-`date +%Y%m%d-%H%M%S`" |
862 |
|
863 |
local CORE_DUMPED=0 |
864 |
if [ -f "${ASTERISK_CORE_DIR}/core" ]; then |
865 |
mv "${ASTERISK_CORE_DIR}/core" \ |
866 |
"${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
867 |
CORE_DUMPED=1 |
868 |
|
869 |
elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then |
870 |
mv "${ASTERISK_CORE_DIR}/core.${PID}" \ |
871 |
"${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
872 |
CORE_DUMPED=1 |
873 |
|
874 |
fi |
875 |
|
876 |
[ $CORE_DUMPED -eq 1 ] && \ |
877 |
MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
878 |
else |
879 |
MSG="Asterisk terminated with return code: $result" |
880 |
fi |
881 |
|
882 |
# kill left-over tasks |
883 |
for X in ${ASTERISK_CLEANUP_ON_CRASH}; do |
884 |
kill -9 `pidof ${X}`; |
885 |
done |
886 |
fi |
887 |
|
888 |
[ -n "${TTY}" ] \ |
889 |
&& echo "${MSG}" >${TTY} \ |
890 |
|| logger -t asterisk_wrapper "${MSG}" |
891 |
|
892 |
|
893 |
if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \ |
894 |
[ -x /usr/sbin/sendmail ]; then |
895 |
echo -e -n "Subject: Asterisk crashed\n\r${MSG}\n\r" |\ |
896 |
/usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" |
897 |
fi |
898 |
sleep 5 |
899 |
logger -t asterisk_wrapper "Restarting Asterisk..." |
900 |
done |
901 |
return 0 |
902 |
} |
903 |
|
904 |
start() { |
905 |
local OPTS USER GROUP PID |
906 |
local tmp x |
907 |
|
908 |
if [ -n "${ASTERISK_NICE}" ]; then |
909 |
if [ ${ASTERISK_NICE} -ge -20 ] && \ |
910 |
[ ${ASTERISK_NICE} -le 19 ]; then |
911 |
OPTS="--nicelevel ${ASTERISK_NICE}" |
912 |
else |
913 |
eerror "Nice value must be between -20 and 19" |
914 |
return 1 |
915 |
fi |
916 |
fi |
917 |
|
918 |
if [ -n "${ASTERISK_USER}" ]; then |
919 |
USER=`echo $ASTERISK_USER | sed 's/:.*//'` |
920 |
GROUP=`echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }'` |
921 |
if [ -n "${USER}" ]; then |
922 |
ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}" |
923 |
fi |
924 |
if [ -n "${GROUP}" ]; then |
925 |
ASTERISK_OPTS="${ASTERISK_OPTS} -G ${GROUP}" |
926 |
GROUP=":${GROUP}" # make it look nice... |
927 |
fi |
928 |
for element in `find /var/{log,run}/asterisk`; do |
929 |
if [ `stat -c %U $element` != "${USER}" ]; then |
930 |
ewarn "${USER} is not the owner of $element, fixing." |
931 |
chown -R ${USER} /var/{log,run}/asterisk |
932 |
chmod -R u+r /var/{log,run}/asterisk |
933 |
chmod u+x /var/{log,run}/asterisk |
934 |
fi; |
935 |
done; |
936 |
ebegin "Starting asterisk PBX (as ${USER}${GROUP})" |
937 |
else |
938 |
ebegin "Starting asterisk PBX (as root)" |
939 |
fi |
940 |
|
941 |
if [ "`echo ${ASTERISK_WRAPPER} | tr '[:upper:]' '[:lower:]'`" != "yes" ]; then |
942 |
start-stop-daemon --start --exec /usr/sbin/asterisk \ |
943 |
${OPTS} -- ${ASTERISK_OPTS} |
944 |
result=$? |
945 |
else |
946 |
asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null & |
947 |
result=$? |
948 |
fi |
949 |
|
950 |
if [ $result -eq 0 ]; then |
951 |
# 2 seconds should be enough for asterisk to start |
952 |
sleep 2 |
953 |
is_running |
954 |
result=$? |
955 |
fi |
956 |
|
957 |
eend $result |
958 |
} |
959 |
|
960 |
forcestop() { |
961 |
ebegin "Stopping asterisk PBX" |
962 |
start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid |
963 |
eend $? |
964 |
} |
965 |
|
966 |
stop() { |
967 |
if ! is_running; then |
968 |
eerror "Asterisk is not running!" |
969 |
return 0 |
970 |
fi |
971 |
|
972 |
if [ -r /var/run/asterisk/wrapper_loop.pid ]; then |
973 |
ebegin "Killing wrapper script" |
974 |
kill `cat /var/run/asterisk/wrapper_loop.pid` |
975 |
eend $? |
976 |
fi |
977 |
|
978 |
ebegin "Stopping asterisk PBX gracefully" |
979 |
/usr/sbin/asterisk -r -x "stop gracefully" &>/dev/null |
980 |
# Now we have to wait until asterisk has _really_ stopped. |
981 |
sleep 1 |
982 |
if is_running; then |
983 |
einfon "Waiting for asterisk to shutdown ." |
984 |
local cnt=0 |
985 |
while is_running; do |
986 |
cnt=`expr $cnt + 1` |
987 |
if [ $cnt -gt 60 ] ; then |
988 |
# Waited 120 seconds now. Fail. |
989 |
echo |
990 |
eend 1 "Failed." |
991 |
return |
992 |
fi |
993 |
sleep 2 |
994 |
echo -n "." |
995 |
done |
996 |
echo |
997 |
fi |
998 |
eend 0 |
999 |
} |
1000 |
|
1001 |
reload() { |
1002 |
if is_running; then |
1003 |
ebegin "Forcing asterisk to reload configuration" |
1004 |
/usr/sbin/asterisk -r -x "reload" &>/dev/null |
1005 |
eend $? |
1006 |
else |
1007 |
eerror "Asterisk is not running!" |
1008 |
fi |
1009 |
} |