-diff -urN asterisk-1.2.7.1.orig/.version asterisk-1.2.7.1/.version
---- asterisk-1.2.7.1.orig/.version 2006-04-13 19:50:06.000000000 +0200
-+++ asterisk-1.2.7.1/.version 2006-04-18 14:39:46.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/.version asterisk-1.2.9.1/.version
+--- asterisk-1.2.9.1.orig/.version 2006-06-06 18:19:31.000000000 +0200
++++ asterisk-1.2.9.1/.version 2006-06-09 10:25:16.000000000 +0200
@@ -1 +1 @@
--1.2.7.1
-+1.2.7.1-BRIstuffed-0.3.0-PRE-1o-with-florz-patch-for-ipfire
-diff -urN asterisk-1.2.7.1.orig/HARDWARE asterisk-1.2.7.1/HARDWARE
---- asterisk-1.2.7.1.orig/HARDWARE 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/HARDWARE 2006-04-18 14:39:28.000000000 +0200
+-1.2.9.1
++1.2.9.1-BRIstuffed-0.3.0-PRE-1q
+diff -urN asterisk-1.2.9.1.orig/HARDWARE asterisk-1.2.9.1/HARDWARE
+--- asterisk-1.2.9.1.orig/HARDWARE 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/HARDWARE 2006-06-09 10:25:04.000000000 +0200
@@ -37,6 +37,19 @@
* Wildcard TE410P - Quad T1/E1 switchable interface. Supports PRI and
RBS signalling, as well as PPP, FR, and HDLC data modes.
Non-zaptel compatible hardware
==============================
-diff -urN asterisk-1.2.7.1.orig/LICENSE asterisk-1.2.7.1/LICENSE
---- asterisk-1.2.7.1.orig/LICENSE 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/LICENSE 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/LICENSE asterisk-1.2.9.1/LICENSE
+--- asterisk-1.2.9.1.orig/LICENSE 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/LICENSE 2006-06-09 10:25:04.000000000 +0200
@@ -1,7 +1,7 @@
-Asterisk is distributed under the GNU General Public License version 2
-and is also available under alternative licenses negotiated directly
except as defined below. The GPL (version 2) is included in this
source tree in the file COPYING.
-diff -urN asterisk-1.2.7.1.orig/Makefile asterisk-1.2.7.1/Makefile
---- asterisk-1.2.7.1.orig/Makefile 2006-04-11 23:58:47.000000000 +0200
-+++ asterisk-1.2.7.1/Makefile 2006-04-18 14:39:28.000000000 +0200
-@@ -760,6 +760,9 @@
+diff -urN asterisk-1.2.9.1.orig/Makefile asterisk-1.2.9.1/Makefile
+--- asterisk-1.2.9.1.orig/Makefile 2006-04-30 16:27:56.000000000 +0200
++++ asterisk-1.2.9.1/Makefile 2006-06-09 10:25:04.000000000 +0200
+@@ -761,6 +761,9 @@
echo ";astctlowner = root" ; \
echo ";astctlgroup = apache" ; \
echo ";astctl = asterisk.ctl" ; \
) > $(DESTDIR)$(ASTCONFPATH) ; \
else \
echo "Skipping asterisk.conf creation"; \
-diff -urN asterisk-1.2.7.1.orig/README asterisk-1.2.7.1/README
---- asterisk-1.2.7.1.orig/README 2006-03-03 09:12:33.000000000 +0100
-+++ asterisk-1.2.7.1/README 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/README asterisk-1.2.9.1/README
+--- asterisk-1.2.9.1.orig/README 2006-03-03 09:12:33.000000000 +0100
++++ asterisk-1.2.9.1/README 2006-06-09 10:25:04.000000000 +0200
@@ -4,6 +4,8 @@
Copyright (C) 2001-2005 Digium, Inc.
================================================================
* SECURITY
-diff -urN asterisk-1.2.7.1.orig/README.chan_capi asterisk-1.2.7.1/README.chan_capi
---- asterisk-1.2.7.1.orig/README.chan_capi 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/README.chan_capi 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/README.chan_capi asterisk-1.2.9.1/README.chan_capi
+--- asterisk-1.2.9.1.orig/README.chan_capi 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/README.chan_capi 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,146 @@
+(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
+(C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH
+
+
+
-diff -urN asterisk-1.2.7.1.orig/agi/Makefile asterisk-1.2.7.1/agi/Makefile
---- asterisk-1.2.7.1.orig/agi/Makefile 2006-03-28 22:22:05.000000000 +0200
-+++ asterisk-1.2.7.1/agi/Makefile 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/agi/Makefile asterisk-1.2.9.1/agi/Makefile
+--- asterisk-1.2.9.1.orig/agi/Makefile 2006-03-28 22:22:05.000000000 +0200
++++ asterisk-1.2.9.1/agi/Makefile 2006-06-09 10:25:04.000000000 +0200
@@ -11,7 +11,7 @@
# the GNU General Public License
#
%.so : %.o
$(CC) -shared -Xlinker -x -o $@ $<
-diff -urN asterisk-1.2.7.1.orig/agi/xagi-test.c asterisk-1.2.7.1/agi/xagi-test.c
---- asterisk-1.2.7.1.orig/agi/xagi-test.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/agi/xagi-test.c 2006-04-24 09:55:45.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/agi/xagi-test.c asterisk-1.2.9.1/agi/xagi-test.c
+--- asterisk-1.2.9.1.orig/agi/xagi-test.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/agi/xagi-test.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,175 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ return -1;
+ exit(0);
+}
-diff -urN asterisk-1.2.7.1.orig/apps/Makefile asterisk-1.2.7.1/apps/Makefile
---- asterisk-1.2.7.1.orig/apps/Makefile 2006-02-09 03:31:21.000000000 +0100
-+++ asterisk-1.2.7.1/apps/Makefile 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/Makefile asterisk-1.2.9.1/apps/Makefile
+--- asterisk-1.2.9.1.orig/apps/Makefile 2006-04-30 15:38:22.000000000 +0200
++++ asterisk-1.2.9.1/apps/Makefile 2006-06-09 10:25:04.000000000 +0200
@@ -28,8 +28,15 @@
app_test.so app_forkcdr.so app_math.so app_realtime.so \
app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
#
# Obsolete things...
-diff -urN asterisk-1.2.7.1.orig/apps/app_callingpres.c asterisk-1.2.7.1/apps/app_callingpres.c
---- asterisk-1.2.7.1.orig/apps/app_callingpres.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_callingpres.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_callingpres.c asterisk-1.2.9.1/apps/app_callingpres.c
+--- asterisk-1.2.9.1.orig/apps/app_callingpres.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_callingpres.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,70 @@
+/*
+ * An application to change the CallingPresentation for an Asterisk channel.
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_capiCD.c asterisk-1.2.7.1/apps/app_capiCD.c
---- asterisk-1.2.7.1.orig/apps/app_capiCD.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_capiCD.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_capiCD.c asterisk-1.2.9.1/apps/app_capiCD.c
+--- asterisk-1.2.9.1.orig/apps/app_capiCD.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_capiCD.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,172 @@
+/*
+ * (CAPI*)
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_capiECT.c asterisk-1.2.7.1/apps/app_capiECT.c
---- asterisk-1.2.7.1.orig/apps/app_capiECT.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_capiECT.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_capiECT.c asterisk-1.2.9.1/apps/app_capiECT.c
+--- asterisk-1.2.9.1.orig/apps/app_capiECT.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_capiECT.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,210 @@
+/*
+ * (CAPI*)
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_capiNoES.c asterisk-1.2.7.1/apps/app_capiNoES.c
---- asterisk-1.2.7.1.orig/apps/app_capiNoES.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_capiNoES.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_capiNoES.c asterisk-1.2.9.1/apps/app_capiNoES.c
+--- asterisk-1.2.9.1.orig/apps/app_capiNoES.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_capiNoES.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,96 @@
+/*
+ * (CAPI*)
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_chanisavail.c asterisk-1.2.7.1/apps/app_chanisavail.c
---- asterisk-1.2.7.1.orig/apps/app_chanisavail.c 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_chanisavail.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_chanisavail.c asterisk-1.2.9.1/apps/app_chanisavail.c
+--- asterisk-1.2.9.1.orig/apps/app_chanisavail.c 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_chanisavail.c 2006-06-09 10:25:04.000000000 +0200
@@ -118,7 +118,7 @@
snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
status = inuse = ast_device_state(trychan);
pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
/* Store the originally used channel too */
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
-diff -urN asterisk-1.2.7.1.orig/apps/app_devstate.c asterisk-1.2.7.1/apps/app_devstate.c
---- asterisk-1.2.7.1.orig/apps/app_devstate.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_devstate.c 2006-04-18 14:39:28.000000000 +0200
-@@ -0,0 +1,219 @@
+diff -urN asterisk-1.2.9.1.orig/apps/app_chanspy.c asterisk-1.2.9.1/apps/app_chanspy.c
+--- asterisk-1.2.9.1.orig/apps/app_chanspy.c 2006-01-03 18:24:56.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_chanspy.c 2006-06-09 10:25:04.000000000 +0200
+@@ -54,6 +54,7 @@
+
+ static const char *synopsis = "Listen to the audio of an active channel\n";
+ static const char *app = "ChanSpy";
++static const char *app2 = "ChanSpyChan";
+ static const char *desc =
+ " ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
+ "audio from an active Asterisk channel. This includes the audio coming in and\n"
+@@ -141,6 +142,19 @@
+ return ret;
+ }
+
++static struct ast_channel *local_get_channel_uniqueid(char *uniqueid)
++{
++ struct ast_channel *chan = NULL;
++ if (uniqueid) {
++ ast_mutex_lock(&modlock);
++ if ((chan = ast_get_channel_by_uniqueid_locked(uniqueid))) {
++ ast_mutex_unlock(&chan->lock);
++ }
++ ast_mutex_unlock(&modlock);
++ }
++ return chan;
++}
++
+ static void *spy_alloc(struct ast_channel *chan, void *data)
+ {
+ /* just store the data pointer in the channel structure */
+@@ -553,11 +567,87 @@
+ ALL_DONE(u, res);
+ }
+
++static int chanspychan_exec(struct ast_channel *chan, void *data)
++{
++ struct localuser *u;
++ struct ast_channel *peer=NULL;
++ char *args,
++ *uniqueid = NULL,
++ *argv[5];
++ int res = -1,
++ volfactor = 0,
++ argc = 0,
++ oldrf = 0,
++ oldwf = 0,
++ fd = 0;
++ signed char zero_volume = 0;
++
++ if (!(args = ast_strdupa((char *)data))) {
++ ast_log(LOG_ERROR, "Out of memory!\n");
++ return -1;
++ }
++
++ LOCAL_USER_ADD(u);
++
++ oldrf = chan->readformat;
++ oldwf = chan->writeformat;
++ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
++ ast_log(LOG_ERROR, "Could Not Set Read Format.\n");
++ LOCAL_USER_REMOVE(u);
++ return -1;
++ }
++
++ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
++ ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
++ LOCAL_USER_REMOVE(u);
++ return -1;
++ }
++
++
++ if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
++ uniqueid = argv[0];
++ if (ast_strlen_zero(uniqueid)) {
++ LOCAL_USER_REMOVE(u);
++ return -1;
++ }
++ }
++
++ ast_answer(chan);
++
++ ast_set_flag(chan, AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */
++
++ peer = local_get_channel_uniqueid(uniqueid);
++ if (peer && (peer != chan) && !ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
++ res = channel_spy(chan, peer, &volfactor, fd);
++ } else {
++ ast_log(LOG_NOTICE, "no channel found with uniqueid %s\n", uniqueid);
++ }
++
++ if (fd > 0) {
++ close(fd);
++ }
++
++ if (oldrf && ast_set_read_format(chan, oldrf) < 0) {
++ ast_log(LOG_ERROR, "Could Not Set Read Format.\n");
++ }
++
++ if (oldwf && ast_set_write_format(chan, oldwf) < 0) {
++ ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
++ }
++
++ ast_clear_flag(chan, AST_FLAG_SPYING);
++
++ ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
++
++ ALL_DONE(u, res);
++}
++
+ int unload_module(void)
+ {
+ int res;
+
+- res = ast_unregister_application(app);
++ ast_unregister_application(app);
++ res = ast_unregister_application(app2);
+
+ STANDARD_HANGUP_LOCALUSERS;
+
+@@ -566,7 +656,8 @@
+
+ int load_module(void)
+ {
+- return ast_register_application(app, chanspy_exec, synopsis, desc);
++ ast_register_application(app, chanspy_exec, synopsis, desc);
++ return ast_register_application(app2, chanspychan_exec, synopsis, desc);
+ }
+
+ char *description(void)
+diff -urN asterisk-1.2.9.1.orig/apps/app_devstate.c asterisk-1.2.9.1/apps/app_devstate.c
+--- asterisk-1.2.9.1.orig/apps/app_devstate.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_devstate.c 2006-06-09 10:25:04.000000000 +0200
+@@ -0,0 +1,225 @@
+/*
+ * Devstate application
+ *
+static int devstate_cli(int fd, int argc, char *argv[])
+{
+ char devName[128];
-+ if ((argc != 3) && (argc != 4))
++ if ((argc != 3) && (argc != 4) && (argc != 5))
+ return RESULT_SHOWUSAGE;
+
+ if (ast_db_put("DEVSTATES", argv[1], argv[2]))
+ if (argc == 4) {
+ ast_log(LOG_NOTICE, "devname %s cid %s\n", devName, argv[3]);
+ ast_device_state_changed_literal(devName, argv[3], NULL);
++ } else if (argc == 5) {
++ ast_log(LOG_NOTICE, "devname %s cid %s cidname %s\n", devName, argv[3], argv[4]);
++ ast_device_state_changed_literal(devName, argv[3], argv[4]);
+ } else {
+ ast_device_state_changed_literal(devName, NULL, NULL);
+ }
+ char *devstate = astman_get_header(m, "Devstate");
+ char *value = astman_get_header(m, "Value");
+ char *id = astman_get_header(m,"ActionID");
++ char *cid_num = astman_get_header(m, "CallerID");
++ char *cid_name = astman_get_header(m, "CallerIDName");
+ char devName[128];
+
+ if (!strlen(devstate)) {
+
+ if (!ast_db_put("DEVSTATES", devstate, value)) {
+ snprintf(devName, sizeof(devName), "DS/%s", devstate);
-+ ast_device_state_changed(devName);
++// ast_device_state_changed(devName);
++ ast_device_state_changed_literal(devName, cid_num, cid_name);
+ ast_cli(s->fd, "Response: Success\r\n");
+ } else {
+ ast_log(LOG_DEBUG, "ast_db_put failed\n");
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_dial.c asterisk-1.2.7.1/apps/app_dial.c
---- asterisk-1.2.7.1.orig/apps/app_dial.c 2006-04-12 00:39:59.000000000 +0200
-+++ asterisk-1.2.7.1/apps/app_dial.c 2006-04-18 14:40:13.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_dial.c asterisk-1.2.9.1/apps/app_dial.c
+--- asterisk-1.2.9.1.orig/apps/app_dial.c 2006-05-24 21:44:26.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_dial.c 2006-06-09 10:25:04.000000000 +0200
@@ -11,6 +11,10 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
-@@ -114,7 +118,8 @@
- " Otherwise, the current extension is used.\n"
+@@ -115,7 +119,8 @@
+ " action post answer options in conjunction with this option.\n"
" h - Allow the called party to hang up by sending the '*' DTMF digit.\n"
" H - Allow the calling party to hang up by hitting the '*' DTMF digit.\n"
-" j - Jump to priority n+101 if all of the requested channels were busy.\n"
" L(x[:y][:z]) - Limit the call to 'x' ms. Play a warning when 'y' ms are\n"
" left. Repeat the warning every 'z' ms. The following special\n"
" variables can be used with this option:\n"
-@@ -159,8 +164,11 @@
+@@ -162,8 +167,11 @@
" family/key is not specified.\n"
" r - Indicate ringing to the calling party. Pass no audio to the calling\n"
" party until the called channel has answered.\n"
" t - Allow the called party to transfer the calling party by sending the\n"
" DTMF sequence defined in features.conf.\n"
" T - Allow the calling party to transfer the called party by sending the\n"
-@@ -211,6 +219,8 @@
+@@ -214,6 +222,8 @@
OPT_CALLEE_MONITOR = (1 << 21),
OPT_CALLER_MONITOR = (1 << 22),
OPT_GOTO = (1 << 23),
} dial_exec_option_flags;
#define DIAL_STILLGOING (1 << 30)
-@@ -249,6 +259,8 @@
+@@ -252,6 +262,8 @@
AST_APP_OPTION('p', OPT_SCREENING),
AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
AST_APP_OPTION('r', OPT_RINGBACK),
AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP),
AST_APP_OPTION('t', OPT_CALLEE_TRANSFER),
AST_APP_OPTION('T', OPT_CALLER_TRANSFER),
-@@ -386,7 +398,7 @@
+@@ -389,7 +401,7 @@
char *context = NULL;
char cidname[AST_MAX_EXTENSION];
if (single) {
/* Turn off hold music, etc */
-@@ -465,7 +477,7 @@
+@@ -468,7 +480,7 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name);
/* Setup parameters */
+ o->chan = ast_request(tech, in->nativeformats, stuff, &cause, NULL);
if (!o->chan)
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
- } else {
-@@ -581,12 +593,18 @@
+ else
+@@ -586,12 +598,18 @@
HANDLE_CAUSE(AST_CAUSE_CONGESTION, in);
break;
case AST_CONTROL_RINGING:
break;
case AST_CONTROL_PROGRESS:
if (option_verbose > 2)
-@@ -761,6 +779,7 @@
+@@ -766,6 +784,7 @@
int digit = 0, result = 0;
time_t start_time, answer_time, end_time;
struct ast_app *app = NULL;
-+ char *aoceunits;
++/* char *aoceunits; */
char *parse;
AST_DECLARE_APP_ARGS(args,
-@@ -934,17 +953,24 @@
+@@ -939,13 +958,13 @@
}
if( privdb_val == AST_PRIVACY_DENY ) {
+- strcpy(status, "NOANSWER");
+ ast_copy_string(status, "NOANSWER", sizeof(status));
ast_verbose( VERBOSE_PREFIX_3 "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
res=0;
goto out;
}
else if( privdb_val == AST_PRIVACY_KILL ) {
-- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+- strcpy(status, "DONTCALL");
+ ast_copy_string(status, "DONTCALL", sizeof(status));
-+ if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
-+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
-+ }
- res = 0;
+ if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+ }
+@@ -953,7 +972,7 @@
goto out; /* Is this right? */
}
else if( privdb_val == AST_PRIVACY_TORTURE ) {
-- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+- strcpy(status, "TORTURE");
+ ast_copy_string(status, "TORTURE", sizeof(status));
-+ if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
-+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
-+ }
- res = 0;
- goto out; /* is this right??? */
-
-@@ -981,7 +1007,7 @@
+ if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+ }
+@@ -992,7 +1011,7 @@
/* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
cur = args.peers;
do {
/* Remember where to start next time */
-@@ -1023,7 +1049,7 @@
+@@ -1034,7 +1053,7 @@
ast_log(LOG_DEBUG, "Dialing by extension %s\n", numsubst);
}
/* Request the peer */
if (!tmp->chan) {
/* If we can't, just go on to the next call */
ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause));
-@@ -1054,7 +1080,7 @@
+@@ -1065,7 +1084,7 @@
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", chan->name, tech, stuff, tmp->chan->name);
ast_hangup(tmp->chan);
/* Setup parameters */
+ tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause, NULL);
if (!tmp->chan)
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
- } else {
-@@ -1173,8 +1199,11 @@
+ else
+@@ -1178,7 +1197,7 @@
+
+ if (outgoing) {
+ /* Our status will at least be NOANSWER */
+- strcpy(status, "NOANSWER");
++ ast_copy_string(status, "NOANSWER", sizeof(status));
+ if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
+ moh=1;
+ ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
+@@ -1186,8 +1205,11 @@
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;
}
- } else
+- strcpy(status, "CHANUNAVAIL");
+ } else {
- strcpy(status, "CHANUNAVAIL");
++ ast_copy_string(status, "CHANUNAVAIL", sizeof(status));
+ /* See if there is a special message */
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+ }
time(&start_time);
peer = wait_for_answer(chan, outgoing, &to, peerflags, &sentringing, status, sizeof(status), numbusy, numnochan, numcongestion, ast_test_flag(&opts, OPT_PRIORITY_JUMP), &result);
-@@ -1303,6 +1332,8 @@
- opt_args[OPT_ARG_PRIVACY], privcid);
- ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
- }
-+ ast_copy_string(status, "NOANSWER", sizeof(status));
-+
- if (ast_test_flag(&opts, OPT_MUSICBACK)) {
- ast_moh_stop(chan);
- } else if (ast_test_flag(&opts, OPT_RINGBACK)) {
-@@ -1585,7 +1616,16 @@
+@@ -1599,7 +1621,15 @@
}
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
-
+
+ /* forward AOC-E units from peer, if possible */
-+ aoceunits = pbx_builtin_getvar_helper(peer, "AOCEUNITS");
++/* aoceunits = pbx_builtin_getvar_helper(peer, "AOCEUNITS");
+
+ if (aoceunits) {
+ snprintf(toast, sizeof(toast), "%d", atoi(aoceunits));
-+ // ast_log(LOG_NOTICE, "AOCEUNITS %s\n" , toast);
+ pbx_builtin_setvar_helper(chan, "AOCEUNITS", toast);
-+ }
++ } */
+
if (res != AST_PBX_NO_HANGUP_PEER) {
if (!chan->_softhangup)
chan->hangupcause = peer->hangupcause;
-diff -urN asterisk-1.2.7.1.orig/apps/app_directed_pickup.c asterisk-1.2.7.1/apps/app_directed_pickup.c
---- asterisk-1.2.7.1.orig/apps/app_directed_pickup.c 2006-04-06 19:00:10.000000000 +0200
-+++ asterisk-1.2.7.1/apps/app_directed_pickup.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_directed_pickup.c asterisk-1.2.9.1/apps/app_directed_pickup.c
+--- asterisk-1.2.9.1.orig/apps/app_directed_pickup.c 2006-04-06 19:00:10.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_directed_pickup.c 2006-06-09 10:25:04.000000000 +0200
@@ -41,7 +41,7 @@
#include "asterisk/app.h"
static const char *synopsis = "Directed Call Pickup";
static const char *descrip =
" Pickup(extension[@context]): This application can pickup any ringing channel\n"
-diff -urN asterisk-1.2.7.1.orig/apps/app_meetme.c asterisk-1.2.7.1/apps/app_meetme.c
---- asterisk-1.2.7.1.orig/apps/app_meetme.c 2006-04-07 00:15:20.000000000 +0200
-+++ asterisk-1.2.7.1/apps/app_meetme.c 2006-04-18 14:39:28.000000000 +0200
-@@ -455,7 +455,7 @@
+diff -urN asterisk-1.2.9.1.orig/apps/app_meetme.c asterisk-1.2.9.1/apps/app_meetme.c
+--- asterisk-1.2.9.1.orig/apps/app_meetme.c 2006-05-25 22:03:11.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_meetme.c 2006-06-09 10:25:04.000000000 +0200
+@@ -453,7 +453,7 @@
ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
cnf->markedusers = 0;
if (cnf->chan) {
cnf->fd = cnf->chan->fds[0]; /* for use by conf_play() */
} else {
-@@ -825,8 +825,9 @@
+@@ -823,8 +823,9 @@
char exitcontext[AST_MAX_CONTEXT] = "";
char recordingtmp[AST_MAX_EXTENSION] = "";
int dtmf;
char *buf = __buf + AST_FRIENDLY_OFFSET;
if (!user) {
-@@ -992,7 +993,7 @@
+@@ -990,7 +991,7 @@
}
/* Setup buffering information */
memset(&bi, 0, sizeof(bi));
bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
bi.numbufs = audio_buffers;
-@@ -1277,6 +1278,14 @@
+@@ -1275,6 +1276,14 @@
f = ast_read(c);
if (!f)
break;
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
if (user->talk.actual)
ast_frame_adjust_volume(f, user->talk.actual);
-@@ -1508,7 +1517,7 @@
+@@ -1506,7 +1515,7 @@
}
ast_frfree(f);
} else if (outfd > -1) {
if (res > 0) {
memset(&fr, 0, sizeof(fr));
fr.frametype = AST_FRAME_VOICE;
-diff -urN asterisk-1.2.7.1.orig/apps/app_milliwatt.c asterisk-1.2.7.1/apps/app_milliwatt.c
---- asterisk-1.2.7.1.orig/apps/app_milliwatt.c 2006-01-19 05:17:45.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_milliwatt.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_milliwatt.c asterisk-1.2.9.1/apps/app_milliwatt.c
+--- asterisk-1.2.9.1.orig/apps/app_milliwatt.c 2006-01-19 05:17:45.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_milliwatt.c 2006-06-09 10:25:04.000000000 +0200
@@ -74,20 +74,28 @@
{
struct ast_frame wf;
wf.src = "app_milliwatt";
wf.delivery.tv_sec = 0;
wf.delivery.tv_usec = 0;
-diff -urN asterisk-1.2.7.1.orig/apps/app_page.c asterisk-1.2.7.1/apps/app_page.c
---- asterisk-1.2.7.1.orig/apps/app_page.c 2006-04-13 19:40:21.000000000 +0200
-+++ asterisk-1.2.7.1/apps/app_page.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_page.c asterisk-1.2.9.1/apps/app_page.c
+--- asterisk-1.2.9.1.orig/apps/app_page.c 2006-04-13 19:40:21.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_page.c 2006-06-09 10:25:04.000000000 +0200
@@ -85,7 +85,7 @@
{
struct calloutdata *cd = data;
free(cd);
return NULL;
}
-diff -urN asterisk-1.2.7.1.orig/apps/app_parkandannounce.c asterisk-1.2.7.1/apps/app_parkandannounce.c
---- asterisk-1.2.7.1.orig/apps/app_parkandannounce.c 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_parkandannounce.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_parkandannounce.c asterisk-1.2.9.1/apps/app_parkandannounce.c
+--- asterisk-1.2.9.1.orig/apps/app_parkandannounce.c 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_parkandannounce.c 2006-06-09 10:25:04.000000000 +0200
@@ -183,7 +183,7 @@
memset(&oh, 0, sizeof(oh));
if(dchan) {
if(dchan->_state == AST_STATE_UP) {
-diff -urN asterisk-1.2.7.1.orig/apps/app_pickup.c asterisk-1.2.7.1/apps/app_pickup.c
---- asterisk-1.2.7.1.orig/apps/app_pickup.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_pickup.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_pickup.c asterisk-1.2.9.1/apps/app_pickup.c
+--- asterisk-1.2.9.1.orig/apps/app_pickup.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_pickup.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,319 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_queue.c asterisk-1.2.7.1/apps/app_queue.c
---- asterisk-1.2.7.1.orig/apps/app_queue.c 2006-04-04 19:59:18.000000000 +0200
-+++ asterisk-1.2.7.1/apps/app_queue.c 2006-04-18 14:39:28.000000000 +0200
-@@ -501,7 +501,7 @@
+diff -urN asterisk-1.2.9.1.orig/apps/app_queue.c asterisk-1.2.9.1/apps/app_queue.c
+--- asterisk-1.2.9.1.orig/apps/app_queue.c 2006-06-04 05:43:35.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_queue.c 2006-06-09 10:25:04.000000000 +0200
+@@ -526,7 +526,7 @@
return NULL;
}
{
/* Avoid potential for deadlocks by spawning a new thread to handle
the event */
-@@ -1386,7 +1386,7 @@
+@@ -1512,7 +1512,7 @@
location = "";
/* Request the peer */
if (!tmp->chan) { /* If we can't, just go on to the next call */
#if 0
ast_log(LOG_NOTICE, "Unable to create channel of type '%s' for Queue\n", cur->tech);
-@@ -1692,7 +1692,7 @@
+@@ -1819,7 +1819,7 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name);
/* Setup parameters */
if (status != o->oldstatus)
update_dial_status(qe->parent, o->member, status);
if (!o->chan) {
-diff -urN asterisk-1.2.7.1.orig/apps/app_readfile.c asterisk-1.2.7.1/apps/app_readfile.c
---- asterisk-1.2.7.1.orig/apps/app_readfile.c 2006-03-23 21:13:48.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_readfile.c 2006-04-18 14:39:28.000000000 +0200
+@@ -2363,14 +2363,14 @@
+ else
+ which = peer;
+ if (monitorfilename)
+- ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1 );
++ ast_monitor_start(which, qe->parent->monfmt, monitorfilename, NULL, NULL, 1 );
+ else if (qe->chan->cdr)
+- ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1 );
++ ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, NULL, NULL, 1 );
+ else {
+ /* Last ditch effort -- no CDR, make up something */
+ char tmpid[256];
+ snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
+- ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
++ ast_monitor_start(which, qe->parent->monfmt, tmpid, NULL, NULL, 1 );
+ }
+ if (qe->parent->monjoin)
+ ast_monitor_setjoinfiles(which, 1);
+diff -urN asterisk-1.2.9.1.orig/apps/app_readfile.c asterisk-1.2.9.1/apps/app_readfile.c
+--- asterisk-1.2.9.1.orig/apps/app_readfile.c 2006-03-23 21:13:48.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_readfile.c 2006-06-09 10:25:04.000000000 +0200
@@ -40,7 +40,7 @@
#include "asterisk/app.h"
#include "asterisk/module.h"
static char *app_readfile = "ReadFile";
-diff -urN asterisk-1.2.7.1.orig/apps/app_segfault.c asterisk-1.2.7.1/apps/app_segfault.c
---- asterisk-1.2.7.1.orig/apps/app_segfault.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_segfault.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/apps/app_segfault.c asterisk-1.2.9.1/apps/app_segfault.c
+--- asterisk-1.2.9.1.orig/apps/app_segfault.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/apps/app_segfault.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,75 @@
+/*
+ * Segfault application
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/apps/app_sms.c asterisk-1.2.7.1/apps/app_sms.c
---- asterisk-1.2.7.1.orig/apps/app_sms.c 2005-12-26 19:19:12.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_sms.c 2006-04-18 14:39:28.000000000 +0200
-@@ -1179,32 +1179,31 @@
- {
- struct ast_frame f = { 0 };
- unsigned char waste[AST_FRIENDLY_OFFSET];
-+#define MAXSAMPLES (800)
- #ifdef OUTALAW
-- unsigned char buf[800];
-+ unsigned char buf[MAXSAMPLES];
- #else
-- signed short buf[800];
-+ signed short buf[MAXSAMPLES];
- #endif
-+#define SAMPLE2LEN (sizeof (buf[0]))
- sms_t *h = data;
- int i;
-
-- if (len > sizeof (buf)) {
-- ast_log (LOG_WARNING, "Only doing %d bytes (%d bytes requested)\n", (int)(sizeof (buf) / sizeof (signed short)), len);
-- len = sizeof (buf);
--#ifdef OUTALAW
-- samples = len;
--#else
-- samples = len / 2;
--#endif
-+ if (samples > MAXSAMPLES) {
-+ ast_log (LOG_WARNING, "Only doing %d samples (%d requested)\n",
-+ MAXSAMPLES, samples);
-+ samples = MAXSAMPLES;
- }
-- waste[0] = 0; /* make compiler happy */
-+ len = samples * SAMPLE2LEN;
-+
-+ waste[0] = 0; /* make compiler happy */
- f.frametype = AST_FRAME_VOICE;
- #ifdef OUTALAW
- f.subclass = AST_FORMAT_ALAW;
-- f.datalen = samples;
- #else
- f.subclass = AST_FORMAT_SLINEAR;
-- f.datalen = samples * 2;
- #endif
-+ f.datalen = len;
- f.offset = AST_FRIENDLY_OFFSET;
- f.mallocd = 0;
- f.data = buf;
-@@ -1256,6 +1255,8 @@
- return -1;
- }
- return 0;
-+#undef SAMPLE2LEN
-+#undef MAXSAMPLES
- }
-
- static void sms_process (sms_t * h, int samples, signed short *data)
-diff -urN asterisk-1.2.7.1.orig/apps/app_zapras.c asterisk-1.2.7.1/apps/app_zapras.c
---- asterisk-1.2.7.1.orig/apps/app_zapras.c 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/apps/app_zapras.c 2006-04-18 14:39:28.000000000 +0200
-@@ -182,7 +182,7 @@
+diff -urN asterisk-1.2.9.1.orig/apps/app_zapras.c asterisk-1.2.9.1/apps/app_zapras.c
+--- asterisk-1.2.9.1.orig/apps/app_zapras.c 2006-05-01 22:44:24.000000000 +0200
++++ asterisk-1.2.9.1/apps/app_zapras.c 2006-06-09 10:25:04.000000000 +0200
+@@ -186,7 +186,7 @@
}
}
/* Throw back into audio mode */
ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
/* Restore saved values */
-diff -urN asterisk-1.2.7.1.orig/asterisk.c asterisk-1.2.7.1/asterisk.c
---- asterisk-1.2.7.1.orig/asterisk.c 2006-04-11 23:55:51.000000000 +0200
-+++ asterisk-1.2.7.1/asterisk.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/asterisk.c asterisk-1.2.9.1/asterisk.c
+--- asterisk-1.2.9.1.orig/asterisk.c 2006-05-19 21:01:17.000000000 +0200
++++ asterisk-1.2.9.1/asterisk.c 2006-06-13 10:10:50.000000000 +0200
@@ -228,6 +228,7 @@
char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH] = "\0";
char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
static char *_argv[256];
static int shuttingdown = 0;
-@@ -1887,6 +1888,7 @@
+@@ -1893,6 +1894,7 @@
ast_copy_string(ast_config_AST_PID, AST_PID, sizeof(ast_config_AST_PID));
ast_copy_string(ast_config_AST_SOCKET, AST_SOCKET, sizeof(ast_config_AST_SOCKET));
ast_copy_string(ast_config_AST_RUN_DIR, AST_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
/* no asterisk.conf? no problem, use buildtime config! */
if (!cfg) {
-@@ -1926,6 +1928,8 @@
- ast_copy_string(ast_config_AST_RUN_DIR, v->value, sizeof(ast_config_AST_RUN_DIR));
- } else if (!strcasecmp(v->name, "astmoddir")) {
- ast_copy_string(ast_config_AST_MODULE_DIR, v->value, sizeof(ast_config_AST_MODULE_DIR));
+@@ -2007,6 +2009,8 @@
+ /* What group to run as */
+ } else if (!strcasecmp(v->name, "rungroup")) {
+ ast_copy_string(ast_config_AST_RUN_GROUP, v->value, sizeof(ast_config_AST_RUN_GROUP));
+ } else if (!strcasecmp(v->name, "uniquename")) {
+ strncpy(ast_config_AST_SYMBOLIC_NAME,v->value,sizeof(ast_config_AST_SYMBOLIC_NAME));
}
v = v->next;
}
-diff -urN asterisk-1.2.7.1.orig/build_tools/make_defaults_h asterisk-1.2.7.1/build_tools/make_defaults_h
---- asterisk-1.2.7.1.orig/build_tools/make_defaults_h 2005-06-20 19:26:08.000000000 +0200
-+++ asterisk-1.2.7.1/build_tools/make_defaults_h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/build_tools/make_defaults_h asterisk-1.2.9.1/build_tools/make_defaults_h
+--- asterisk-1.2.9.1.orig/build_tools/make_defaults_h 2005-06-20 19:26:08.000000000 +0200
++++ asterisk-1.2.9.1/build_tools/make_defaults_h 2006-06-09 10:25:04.000000000 +0200
@@ -16,6 +16,7 @@
#define AST_KEY_DIR "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
#define AST_DB "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
#define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
-diff -urN asterisk-1.2.7.1.orig/channel.c asterisk-1.2.7.1/channel.c
---- asterisk-1.2.7.1.orig/channel.c 2006-04-11 23:35:52.000000000 +0200
-+++ asterisk-1.2.7.1/channel.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channel.c asterisk-1.2.9.1/channel.c
+--- asterisk-1.2.9.1.orig/channel.c 2006-06-01 22:27:50.000000000 +0200
++++ asterisk-1.2.9.1/channel.c 2006-06-09 10:25:04.000000000 +0200
@@ -94,8 +94,8 @@
*/
static int shutting_down = 0;
}
int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
-@@ -2362,7 +2391,7 @@
+@@ -2364,7 +2393,7 @@
&chan->writetrans, 1);
}
{
int state = 0;
int cause = 0;
-@@ -2370,7 +2399,7 @@
+@@ -2372,7 +2401,7 @@
struct ast_frame *f;
int res = 0;
if (chan) {
if (oh) {
if (oh->vars)
-@@ -2384,6 +2413,7 @@
+@@ -2386,6 +2415,7 @@
}
ast_set_callerid(chan, cid_num, cid_name, cid_num);
if (!ast_call(chan, data, 0)) {
res = 1; /* in case chan->_state is already AST_STATE_UP */
while (timeout && (chan->_state != AST_STATE_UP)) {
-@@ -2407,6 +2437,7 @@
+@@ -2409,6 +2439,7 @@
if (f->subclass == AST_CONTROL_RINGING)
state = AST_CONTROL_RINGING;
else if ((f->subclass == AST_CONTROL_BUSY) || (f->subclass == AST_CONTROL_CONGESTION)) {
state = f->subclass;
ast_frfree(f);
break;
-@@ -2476,12 +2507,12 @@
+@@ -2478,12 +2509,12 @@
return chan;
}
{
struct chanlist *chan;
struct ast_channel *c;
-@@ -2518,6 +2549,7 @@
+@@ -2520,6 +2551,7 @@
if (!(c = chan->tech->requester(type, capabilities, data, cause)))
return NULL;
if (c->_state == AST_STATE_DOWN) {
manager_event(EVENT_FLAG_CALL, "Newchannel",
"Channel: %s\r\n"
-@@ -2765,6 +2797,29 @@
+@@ -2775,6 +2807,29 @@
return res;
}
void ast_change_name(struct ast_channel *chan, char *newname)
{
char tmp[256];
-@@ -3131,15 +3186,14 @@
+@@ -2914,7 +2969,7 @@
+ ast_copy_string(clone->name, masqn, sizeof(clone->name));
+
+ /* Notify any managers of the change, first the masq then the other */
+- manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clone->uniqueid);
++ manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\nNewUniqueid: %s\r\n", newn, masqn, clone->uniqueid, original->uniqueid);
+ manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
+
+ /* Swap the technlogies */
+@@ -3141,15 +3196,14 @@
);
}
manager_event(EVENT_FLAG_CALL,
(oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
"Channel: %s\r\n"
-@@ -3155,6 +3209,10 @@
+@@ -3165,6 +3219,10 @@
return 0;
}
/*--- Find bridged channel */
struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
{
-@@ -3332,6 +3390,7 @@
+@@ -3342,6 +3400,7 @@
char callee_warning = 0;
int to;
if (c0->_bridge) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
c0->name, c0->_bridge->name);
-@@ -3342,6 +3401,10 @@
+@@ -3352,6 +3411,10 @@
c1->name, c1->_bridge->name);
return -1;
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
-diff -urN asterisk-1.2.7.1.orig/channels/Makefile asterisk-1.2.7.1/channels/Makefile
---- asterisk-1.2.7.1.orig/channels/Makefile 2005-12-15 11:52:30.000000000 +0100
-+++ asterisk-1.2.7.1/channels/Makefile 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/Makefile asterisk-1.2.9.1/channels/Makefile
+--- asterisk-1.2.9.1.orig/channels/Makefile 2006-04-30 16:27:56.000000000 +0200
++++ asterisk-1.2.9.1/channels/Makefile 2006-06-09 10:25:04.000000000 +0200
@@ -102,6 +102,11 @@
ZAPR2=-lmfcr2
endif
chan_vpb.o: chan_vpb.c
$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
-diff -urN asterisk-1.2.7.1.orig/channels/chan_agent.c asterisk-1.2.7.1/channels/chan_agent.c
---- asterisk-1.2.7.1.orig/channels/chan_agent.c 2006-02-15 02:21:33.000000000 +0100
-+++ asterisk-1.2.7.1/channels/chan_agent.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/chan_agent.c asterisk-1.2.9.1/channels/chan_agent.c
+--- asterisk-1.2.9.1.orig/channels/chan_agent.c 2006-05-08 16:12:20.000000000 +0200
++++ asterisk-1.2.9.1/channels/chan_agent.c 2006-06-09 10:25:04.000000000 +0200
+@@ -440,7 +440,7 @@
+ if ((pointer = strchr(filename, '.')))
+ *pointer = '-';
+ snprintf(tmp, sizeof(tmp), "%s%s",savecallsin ? savecallsin : "", filename);
+- ast_monitor_start(ast, recordformat, tmp, needlock);
++ ast_monitor_start(ast, recordformat, tmp, NULL, NULL, needlock);
+ ast_monitor_setjoinfiles(ast, 1);
+ snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
+ #if 0
@@ -1331,7 +1331,7 @@
chan = agent_new(p, AST_STATE_DOWN);
} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
if (p->chan)
chan = agent_new(p, AST_STATE_DOWN);
}
-diff -urN asterisk-1.2.7.1.orig/channels/chan_capi.c asterisk-1.2.7.1/channels/chan_capi.c
---- asterisk-1.2.7.1.orig/channels/chan_capi.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/channels/chan_capi.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/chan_capi.c asterisk-1.2.9.1/channels/chan_capi.c
+--- asterisk-1.2.9.1.orig/channels/chan_capi.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/channels/chan_capi.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,2888 @@
+/*
+ * (CAPI*)
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/channels/chan_features.c asterisk-1.2.7.1/channels/chan_features.c
---- asterisk-1.2.7.1.orig/channels/chan_features.c 2006-01-25 19:39:44.000000000 +0100
-+++ asterisk-1.2.7.1/channels/chan_features.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/chan_features.c asterisk-1.2.9.1/channels/chan_features.c
+--- asterisk-1.2.9.1.orig/channels/chan_features.c 2006-01-25 19:39:44.000000000 +0100
++++ asterisk-1.2.9.1/channels/chan_features.c 2006-06-09 10:25:04.000000000 +0200
@@ -438,7 +438,7 @@
}
ast_mutex_unlock(&featurelock);
if (!chan) {
ast_log(LOG_NOTICE, "Unable to allocate subchannel '%s/%s'\n", tech, dest);
return NULL;
-diff -urN asterisk-1.2.7.1.orig/channels/chan_iax2.c asterisk-1.2.7.1/channels/chan_iax2.c
---- asterisk-1.2.7.1.orig/channels/chan_iax2.c 2006-03-31 21:11:26.000000000 +0200
-+++ asterisk-1.2.7.1/channels/chan_iax2.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/chan_iax2.c asterisk-1.2.9.1/channels/chan_iax2.c
+--- asterisk-1.2.9.1.orig/channels/chan_iax2.c 2006-06-06 17:48:00.000000000 +0200
++++ asterisk-1.2.9.1/channels/chan_iax2.c 2006-06-09 10:25:04.000000000 +0200
@@ -11,6 +11,9 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
-@@ -3065,7 +3068,7 @@
+@@ -3068,7 +3071,7 @@
memset(&ied, 0, sizeof(ied));
ast_mutex_lock(&iaxsl[callno]);
if (callno && iaxs[callno]) {
alreadygone = ast_test_flag(iaxs[callno], IAX_ALREADYGONE);
/* Send the hangup unless we have had a transmission error or are already gone */
iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause);
-@@ -3117,7 +3120,8 @@
+@@ -3120,7 +3123,8 @@
static struct ast_frame *iax2_read(struct ast_channel *c)
{
static struct ast_frame f = { AST_FRAME_NULL, };
return &f;
}
-@@ -6702,7 +6706,7 @@
- }
- if (f.frametype == AST_FRAME_IAX) {
- if (iaxs[fr.callno]->initid > -1) {
-- /* Don't auto congest anymore since we've gotten something usefulb ack */
-+ /* Don't auto congest anymore since we've gotten something useful back */
- ast_sched_del(sched, iaxs[fr.callno]->initid);
- iaxs[fr.callno]->initid = -1;
- }
-diff -urN asterisk-1.2.7.1.orig/channels/chan_sip.c asterisk-1.2.7.1/channels/chan_sip.c
---- asterisk-1.2.7.1.orig/channels/chan_sip.c 2006-04-07 16:16:41.000000000 +0200
-+++ asterisk-1.2.7.1/channels/chan_sip.c 2006-04-25 13:23:13.000000000 +0200
-@@ -596,6 +596,7 @@
+diff -urN asterisk-1.2.9.1.orig/channels/chan_sip.c asterisk-1.2.9.1/channels/chan_sip.c
+--- asterisk-1.2.9.1.orig/channels/chan_sip.c 2006-05-25 19:18:01.000000000 +0200
++++ asterisk-1.2.9.1/channels/chan_sip.c 2006-06-09 10:25:04.000000000 +0200
+@@ -603,6 +603,7 @@
unsigned int flags; /*!< SIP_ flags */
int timer_t1; /*!< SIP timer T1, ms rtt */
unsigned int sipoptions; /*!< Supported SIP sipoptions on the other end */
int capability; /*!< Special capability (codec) */
int jointcapability; /*!< Supported capability at both ends (codecs ) */
int peercapability; /*!< Supported peer capability */
-@@ -619,6 +620,7 @@
+@@ -626,6 +627,7 @@
char refer_to[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO extension */
char referred_by[AST_MAX_EXTENSION]; /*!< Place to store REFERRED-BY extension */
- char refer_contact[AST_MAX_EXTENSION]; /*!< Place to store Contact info from a REFER extension */
+ char refer_contact[SIP_LEN_CONTACT]; /*!< Place to store Contact info from a REFER extension */
+ char refer_replaces[AST_MAX_EXTENSION]; /*!< Place to store Replaces header of REFER-TO header */
struct sip_pvt *refer_call; /*!< Call we are referring */
struct sip_route *route; /*!< Head of linked list of routing steps (fm Record-Route) */
int route_persistant; /*!< Is this the "real" route? */
-@@ -638,6 +640,7 @@
+@@ -645,6 +647,7 @@
char peername[256]; /*!< [peer] name, not set if [user] */
char authname[256]; /*!< Who we use for authentication */
char uri[256]; /*!< Original requested URI */
-+ char origuri[256]; /*!< REAL! Original requested URI */
- char okcontacturi[256]; /*!< URI from the 200 OK on INVITE */
++ char origuri[SIP_LEN_CONTACT]; /*!< REAL! Original requested URI */
+ char okcontacturi[SIP_LEN_CONTACT]; /*!< URI from the 200 OK on INVITE */
char peersecret[256]; /*!< Password */
char peermd5secret[256];
-@@ -921,7 +924,7 @@
+@@ -768,6 +771,9 @@
+ int callingpres; /*!< Calling id presentation */
+ int inUse; /*!< Number of calls in use */
+ int call_limit; /*!< Limit of concurrent calls */
++ int max_regs; /*!< Limit of concurrent registrations */
++ int subpeer; /*!< Peer entry used for multiple registrations */
++ char reg_callid[80]; /*!< Call-ID used for registration */
+ char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
+ char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
+ char language[MAX_LANGUAGE]; /*!< Default language for prompts */
+@@ -928,7 +934,7 @@
static int determine_firstline_parts(struct sip_request *req);
static void sip_dump_history(struct sip_pvt *dialog); /* Dump history to LOG_DEBUG at end of dialog, before destroying data */
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
/*! \brief Definition of this channel for PBX channel registration */
-@@ -1304,7 +1307,7 @@
+@@ -1311,7 +1317,7 @@
/* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) {
p->subscribed = TIMEOUT;
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
return 10000; /* Reschedule this destruction so that we know that it's gone */
-@@ -3124,16 +3127,30 @@
+@@ -3150,16 +3156,30 @@
/*! \brief find_call: Connect incoming SIP message to current dialog or create new dialog structure */
/* Called by handle_request, sipsock_read */
if (pedanticsipchecking) {
/* In principle Call-ID's uniquely identify a call, but with a forking SIP proxy
we need more to identify a branch - so we have to check branch, from
-@@ -4058,6 +4075,7 @@
+@@ -4141,6 +4161,7 @@
if (sipmethod == SIP_CANCEL) {
c = p->initreq.rlPart2; /* Use original URI */
} else if (sipmethod == SIP_ACK) {
/* Use URI from Contact: in 200 OK (if INVITE)
(we only have the contacturi on INVITEs) */
if (!ast_strlen_zero(p->okcontacturi))
-@@ -4824,13 +4842,15 @@
+@@ -4907,13 +4928,15 @@
ast_build_string(&invite, &invite_max, ";%s", p->options->uri_options);
ast_copy_string(p->uri, invite_buf, sizeof(p->uri));
} else {
snprintf(to, sizeof(to), "<%s>", p->uri);
}
-@@ -4887,6 +4907,11 @@
+@@ -4970,6 +4993,11 @@
if (!ast_strlen_zero(p->referred_by))
add_header(&req, "Referred-By", p->referred_by);
}
#ifdef OSP_SUPPORT
if ((req.method != SIP_OPTIONS) && p->options && !ast_strlen_zero(p->options->osptoken)) {
ast_log(LOG_DEBUG,"Adding OSP Token: %s\n", p->options->osptoken);
-@@ -4961,8 +4986,7 @@
+@@ -5044,8 +5072,7 @@
}
/*! \brief transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
char tmp[4000], from[256], to[256];
char *t = tmp, *c, *a, *mfrom, *mto;
size_t maxbytes = sizeof(tmp);
-@@ -5106,10 +5130,19 @@
+@@ -5189,10 +5216,19 @@
case DIALOG_INFO_XML: /* SNOM subscribes in this format */
ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\"?>\n");
ast_build_string(&t, &maxbytes, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full":"partial", mto);
ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
break;
-@@ -6321,7 +6354,7 @@
+@@ -6019,8 +6055,10 @@
+ p->expire = -1;
+ pvt->expiry = expiry;
+ snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(iabuf, sizeof(iabuf), p->addr.sin_addr), ntohs(p->addr.sin_port), expiry, p->username, p->fullcontact);
+- if (!ast_test_flag((&p->flags_page2), SIP_PAGE2_RT_FROMCONTACT))
++ if (!ast_test_flag((&p->flags_page2), SIP_PAGE2_RT_FROMCONTACT)) {
++ // ast_log(LOG_NOTICE, "updating SIP/Registry for peer %s with data %s\n", p->name, data);
+ ast_db_put("SIP/Registry", p->name, data);
++ }
+ manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Registered\r\n", p->name);
+ if (inaddrcmp(&p->addr, &oldsin)) {
+ sip_poke_peer(p);
+@@ -6411,7 +6449,7 @@
/*! \brief cb_extensionstate: Callback for the devicestate notification (SUBSCRIBE) support subsystem ---*/
/* If you add an "hint" priority to the extension in the dial plan,
you will get notifications on device state changes */
{
struct sip_pvt *p = data;
-@@ -6340,7 +6373,7 @@
+@@ -6430,7 +6468,7 @@
p->laststate = state;
break;
}
if (option_debug > 1)
ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
-@@ -8607,6 +8640,7 @@
+@@ -6456,7 +6494,13 @@
+ char *name, *c;
+ char *t;
+ char *domain;
+-
++ char *callid;
++ struct sip_peer *clone;
++ char clone_name[256];
++ int found = 0;
++ struct sip_peer *recycle_peer = NULL;
++ char peer_name[256];
++
+ /* Terminate URI */
+ t = uri;
+ while(*t && (*t > 32) && (*t != ';'))
+@@ -6505,9 +6549,68 @@
+ if (!ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)) {
+ ast_log(LOG_ERROR, "Peer '%s' is trying to register, but not configured as host=dynamic\n", peer->name);
+ } else {
++ callid = get_header(req, "Call-ID");
++ ast_copy_string(peer_name, peer->name, sizeof(peer_name));
++ if (peer->max_regs > 1) {
++ int i = 0;
++ /* check if peer matches callid */
++ if ((peer->expire > -1) && (!strncmp(peer->reg_callid, callid, strlen(callid)))) {
++ // ast_log(LOG_NOTICE, "peer->reg_callid %s, req->callid %s found in peer\n", peer->reg_callid, callid);
++ found++;
++ } else {
++ /* otherwise check subpeers for callid */
++ for (i=0; i<peer->max_regs - 1; i++) {
++ snprintf(clone_name, sizeof(clone_name), "%s@%d", peer->name, i);
++ // ast_log(LOG_NOTICE, "checking subpeer %s\n", clone_name);
++ clone = find_peer(clone_name, NULL, 1);
++ if (clone && (clone->expire > -1)) {
++ if (!strncmp(clone->reg_callid, callid, strlen(callid))) {
++ // ast_log(LOG_NOTICE, "clone->reg_callid %s, req->callid %s found in subpeer\n", clone->reg_callid, callid);
++ found++;
++ peer = clone;
++ break;
++ }
++ }
++ }
++ }
++ if (!found) {
++ // ast_log(LOG_NOTICE, "did not find callid in peer or subpeer\n");
++ /* choose the next best peer or subpeer (that means: find the peer with the smalles expiry time */
++ if (peer->expire == -1) {
++ recycle_peer = peer;
++ // ast_log(LOG_NOTICE, "peer %s expiry %d\n", peer->name, peer->expire);
++ } else {
++ for (i=0; i<peer->max_regs - 1; i++) {
++ snprintf(clone_name, sizeof(clone_name), "%s@%d", peer->name, i);
++ clone = find_peer(clone_name, NULL, 1);
++ if (clone) {
++ if (clone->expire == -1) {
++ recycle_peer = clone;
++ break;
++ }
++ // ast_log(LOG_NOTICE, "clone %s expiry %d\n", clone->name, clone->expire);
++ }
++ }
++ }
++ if (recycle_peer) {
++ peer = recycle_peer;
++ ast_copy_string(peer_name, peer->name, sizeof(peer_name));
++ // ast_log(LOG_NOTICE, "recycling peer %s\n", peer->name);
++ if (peer->subpeer) {
++ i = strchr(peer_name, '@') - peer_name;
++ if (i < sizeof(peer_name))
++ peer_name[i] = '\0';
++ // ast_log(LOG_NOTICE, "i = %d\n", i);
++ }
++ } else {
++ /* deny registration */
++ peer_name[0] = '\0';
++ }
++ }
++ }
+ ast_copy_flags(p, peer, SIP_NAT);
+ transmit_response(p, "100 Trying", req);
+- if (!(res = check_auth(p, req, p->randdata, sizeof(p->randdata), peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, 0, ignore))) {
++ if (!(res = check_auth(p, req, p->randdata, sizeof(p->randdata), peer_name, peer->secret, peer->md5secret, SIP_REGISTER, uri, 0, ignore))) {
+ sip_cancel_destroy(p);
+ switch (parse_register_contact(p, peer, req)) {
+ case PARSE_REGISTER_FAILED:
+@@ -6527,6 +6630,7 @@
+ transmit_response_with_date(p, "200 OK", req);
+ peer->lastmsgssent = -1;
+ res = 0;
++ ast_copy_string(peer->reg_callid, callid, sizeof(peer->reg_callid));
+ break;
+ }
+ }
+@@ -6872,6 +6976,11 @@
+ /* XXX The refer_to could contain a call on an entirely different machine, requiring an
+ INVITE with a replaces header -anthm XXX */
+ /* The only way to find out is to use the dialplan - oej */
++ ast_copy_string(sip_pvt->refer_to, refer_to, sizeof(sip_pvt->refer_to));
++ ast_copy_string(sip_pvt->referred_by, referred_by, sizeof(sip_pvt->referred_by));
++ ast_copy_string(sip_pvt->refer_contact, h_contact, sizeof(sip_pvt->refer_contact));
++ ast_copy_string(sip_pvt->refer_replaces, replace_callid, sizeof(sip_pvt->referred_by));
++ return 2;
+ }
+ } else if (ast_exists_extension(NULL, transfercontext, refer_to, 1, NULL) || !strcmp(refer_to, ast_parking_ext())) {
+ /* This is an unsupervised transfer (blind transfer) */
+@@ -7592,6 +7701,8 @@
+ int peers_offline = 0;
+ char *id;
+ char idtext[256] = "";
++ char *tmp;
++ int i = 0;
+
+ if (s) { /* Manager - get ActionID */
+ id = astman_get_header(m,"ActionID");
+@@ -7634,6 +7745,7 @@
+ else
+ ast_copy_string(name, iterator->name, sizeof(name));
+
++ if ((iterator->expire != -1) || (iterator->subpeer != 1)) {
+ pstatus = peer_status(iterator, status, sizeof(status));
+ if (pstatus)
+ peers_online++;
+@@ -7650,14 +7762,24 @@
+ }
+ }
+
+- snprintf(srch, sizeof(srch), FORMAT, name,
++ }
++ /* multiple registration, peer used ? */
++ if ((iterator->expire != -1) || (iterator->subpeer != 1)) {
++ snprintf(srch, sizeof(srch), FORMAT, name,
+ iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
+ ast_test_flag(&iterator->flags_page2, SIP_PAGE2_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
+ (ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? " N " : " ", /* NAT=yes? */
+ iterator->ha ? " A " : " ", /* permit/deny */
+ ntohs(iterator->addr.sin_port), status);
++ }
+
+ if (!s) {/* Normal CLI list */
++ if ((iterator->expire != -1) || (iterator->subpeer != 1)) {
++ if (iterator->subpeer == 1) {
++ tmp = strchr(name, '@');
++ i = tmp - name;
++ name[i] = '\0';
++ }
+ ast_cli(fd, FORMAT, name,
+ iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
+ ast_test_flag(&iterator->flags_page2, SIP_PAGE2_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
+@@ -7665,6 +7787,7 @@
+ iterator->ha ? " A " : " ", /* permit/deny */
+
+ ntohs(iterator->addr.sin_port), status);
++ }
+ } else { /* Manager format */
+ /* The names here need to be the same as other channels */
+ ast_cli(fd,
+@@ -7690,7 +7813,9 @@
+
+ ASTOBJ_UNLOCK(iterator);
+
+- total_peers++;
++ if ((iterator->expire != -1) || (iterator->subpeer != 1)) {
++ total_peers++;
++ }
+ } while(0) );
+
+ if (!s) {
+@@ -8725,6 +8850,7 @@
char buf[1024];
unsigned int event;
char *c;
/* Need to check the media/type */
if (!strcasecmp(get_header(req, "Content-Type"), "application/dtmf-relay") ||
-@@ -8670,6 +8704,19 @@
+@@ -8788,6 +8914,19 @@
ast_queue_control(p->owner, AST_CONTROL_VIDUPDATE);
transmit_response(p, "200 OK", req);
return;
} else if ((c = get_header(req, "X-ClientCode"))) {
/* Client code (from SNOM phone) */
if (ast_test_flag(p, SIP_USECLIENTCODE)) {
-@@ -8769,12 +8816,63 @@
+@@ -8887,12 +9026,63 @@
return RESULT_SUCCESS;
}
if (argc < 4)
return RESULT_SHOWUSAGE;
-@@ -8791,41 +8889,13 @@
+@@ -8909,41 +9099,13 @@
}
for (i = 3; i < argc; i++) {
/*! \brief sip_do_history: Enable SIP History logging (CLI) ---*/
static int sip_do_history(int fd, int argc, char *argv[])
{
-@@ -9468,12 +9538,13 @@
- case 100: /* Trying */
- sip_cancel_destroy(p);
+@@ -9597,12 +9759,13 @@
+ check_pendings(p);
+ ast_set_flag(p, SIP_CAN_BYE);
break;
+ case 183:
case 180: /* 180 Ringing */
- ast_setstate(p->owner, AST_STATE_RINGING);
+ ast_setstate_and_cid(p->owner, AST_STATE_RINGING, p->owner->cid.cid_num, p->owner->cid.cid_name);
}
- if (!strcasecmp(get_header(req, "Content-Type"), "application/sdp")) {
+ if (find_sdp(req)) {
process_sdp(p, req);
-@@ -9483,17 +9554,17 @@
- }
- }
+@@ -9616,21 +9779,6 @@
+ check_pendings(p);
+ ast_set_flag(p, SIP_CAN_BYE);
break;
- case 183: /* Session progress */
-+/* case 183: // Session progress
- sip_cancel_destroy(p);
+- sip_cancel_destroy(p);
- /* Ignore 183 Session progress without SDP */
-+ // Ignore 183 Session progress without SDP
- if (!strcasecmp(get_header(req, "Content-Type"), "application/sdp")) {
- process_sdp(p, req);
- if (!ignore && p->owner) {
+- if (find_sdp(req)) {
+- process_sdp(p, req);
+- if (!ignore && p->owner) {
- /* Queue a progress frame */
-+ // Queue a progress frame
- ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
- }
- }
+- ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+- }
+- }
+- /* must call check_pendings before setting CAN_BYE, so that
+- if PENDINGBYE is set it will know to send CANCEL instead */
+- check_pendings(p);
+- ast_set_flag(p, SIP_CAN_BYE);
- break;
-+ break; */
case 200: /* 200 OK on invite - someone's answering our call */
sip_cancel_destroy(p);
p->authtries = 0;
-@@ -10287,6 +10358,7 @@
+@@ -10424,9 +10572,18 @@
/* This is a call to ourself. Send ourselves an error code and stop
processing immediately, as SIP really has no good mechanism for
being able to call yourself */
-+ast_log(LOG_NOTICE, "to: %s uri: %s\n", get_header(req, "To"), p->origuri);
- transmit_response(p, "482 Loop Detected", req);
- /* We do NOT destroy p here, so that our response will be accepted */
- return 0;
-@@ -10836,7 +10908,7 @@
+- transmit_response(p, "482 Loop Detected", req);
+- /* We do NOT destroy p here, so that our response will be accepted */
+- return 0;
++/* char tmp[256] = "", *uri;
++ if (req->rlPart2)
++ ast_copy_string(tmp, req->rlPart2, sizeof(tmp));
++ uri = get_in_brackets(tmp);
++ if (strcmp(p->uri, uri)) {
++ ast_log(LOG_NOTICE, "SPIRAL DETECTED p->uri: %s uri: %s\n", p->uri, uri);
++ } else {
++ ast_log(LOG_NOTICE, "LOOP DETECTED p->uri: %s uri: %s\n", p->uri, uri);*/
++ transmit_response(p, "482 Loop Detected", req);
++ /* We do NOT destroy p here, so that our response will be accepted */
++ return 0;
++/* }*/
+ }
+ if (!ignore) {
+ /* Use this as the basis */
+@@ -10658,6 +10815,7 @@
+ struct ast_channel *c=NULL;
+ int res;
+ struct ast_channel *transfer_to;
++ struct sip_pvt *rp; /* replace call */
+
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "SIP call transfer received for call %s (REFER)!\n", p->callid);
+@@ -10666,9 +10824,74 @@
+ res = get_refer_info(p, req);
+ if (res < 0)
+ transmit_response_with_allow(p, "404 Not Found", req, 1);
+- else if (res > 0)
++ else if (res == 1)
+ transmit_response_with_allow(p, "484 Address Incomplete", req, 1);
+- else {
++ else if (res == 2) {
++ transmit_response(p, "202 Accepted", req);
++ rp = sip_alloc(NULL, NULL, 0, SIP_INVITE);
++ if (!rp) {
++ return -1;
++ }
++ rp->capability = global_capability;
++
++ build_route(rp, req, 0);
++ if (option_verbose > 3)
++ ast_log(LOG_NOTICE, "got REFER for callid %s TO %s CONTACT %s replacing callid %s (tohost %s, p->route %s, rp->route %s)\n", p->callid, p->refer_to, p->refer_contact, p->refer_replaces, p->tohost, p->route->hop, rp->route->hop);
++ if (create_addr(rp, p->tohost)) {
++ sip_destroy(rp);
++ return -1;
++ }
++
++ if (ast_sip_ouraddrfor(&rp->sa.sin_addr,&rp->ourip)) {
++ memcpy(&rp->ourip, &__ourip, sizeof(rp->ourip));
++ }
++ build_via(rp, rp->via, sizeof(rp->via));
++ build_callid(rp->callid, sizeof(rp->callid) - 1, rp->ourip, rp->fromdomain);
++
++ ast_log(LOG_NOTICE, "1\n");
++ rp->prefcodec = p->prefcodec;
++ rp->jointcapability = rp->capability;
++ rp->rtp = p->rtp;
++ p->rtp = NULL;
++ if (!ast_strlen_zero(p->refer_to)) {
++ ast_copy_string(rp->username, p->refer_to, sizeof(rp->username));
++ rp->fullcontact[0] = '\0';
++ }
++ if (!ast_strlen_zero(p->refer_replaces)) {
++ ast_copy_string(rp->refer_replaces, p->refer_replaces, sizeof(rp->refer_replaces));
++ }
++ ast_log(LOG_NOTICE, "2\n");
++ ast_set_flag(rp, SIP_OUTGOING);
++
++ ast_log(LOG_NOTICE, "3\n");
++
++ if (p->owner) {
++ c = p->owner;
++// ast_copy_string(rp->cid_num, c->cid.cid_num, sizeof(rp->cid_num));
++// ast_copy_string(rp->cid_name, c->cid.cid_name, sizeof(rp->cid_name));
++ ast_log(LOG_NOTICE, "4\n");
++ c->tech_pvt = rp;
++ rp->owner = c;
++ ast_log(LOG_NOTICE, "5\n");
++ ast_mutex_unlock(&c->lock);
++ }
++ p->owner = NULL;
++ ast_log(LOG_NOTICE, "6\n");
++
++ transmit_invite(rp, SIP_INVITE, 1, 2);
++ if (rp->maxtime) {
++ /* Initialize auto-congest time */
++ rp->initid = ast_sched_add(sched, rp->maxtime * 4, auto_congest, rp);
++ }
++
++ transmit_notify_with_sipfrag(p, seqno);
++
++ /* Always increment on a BYE */
++ transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
++ ast_set_flag(p, SIP_ALREADYGONE);
++ return 0;
++
++ } else { /* res == 0 */
+ int nobye = 0;
+ if (!ignore) {
+ if (p->refer_call) {
+@@ -10993,7 +11216,7 @@
struct sip_pvt *p_old;
transmit_response(p, "200 OK", req);
append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
/* remove any old subscription from this peer for the same exten/context,
-@@ -11148,7 +11220,7 @@
+@@ -11187,6 +11410,8 @@
+ res = handle_request_options(p, req, debug);
+ break;
+ case SIP_INVITE:
++ /* XXX quick fix for xfers */
++ ast_copy_string(p->tohost, ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), sizeof(p->tohost));
+ res = handle_request_invite(p, req, debug, ignore, seqno, sin, recount, e);
+ break;
+ case SIP_REFER:
+@@ -11307,7 +11532,7 @@
/* Process request, with netlock held */
retrylock:
ast_mutex_lock(&netlock);
if (p) {
/* Go ahead and lock the owner if it has one -- we may need it */
if (p->owner && ast_mutex_trylock(&p->owner->lock)) {
-@@ -11468,6 +11540,52 @@
+@@ -11634,6 +11859,52 @@
return 0;
}
/*! \brief sip_devicestate: Part of PBX channel interface ---*/
/* Return values:---
-@@ -13167,6 +13285,8 @@
+@@ -12171,6 +12442,7 @@
+
+ peer->expire = -1;
+ peer->pokeexpire = -1;
++ peer->max_regs = 1;
+ ast_copy_string(peer->name, name, sizeof(peer->name));
+ ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY);
+ strcpy(peer->context, default_context);
+@@ -12216,7 +12488,9 @@
+
+ if (peer) {
+ /* Already in the list, remove it and it will be added back (or FREE'd) */
+- found++;
++ if (peer->max_regs == 1) {
++ found++;
++ }
+ } else {
+ peer = malloc(sizeof(*peer));
+ if (peer) {
+@@ -12228,6 +12502,7 @@
+ ASTOBJ_INIT(peer);
+ peer->expire = -1;
+ peer->pokeexpire = -1;
++ peer->max_regs = 1;
+ } else {
+ ast_log(LOG_WARNING, "Can't allocate SIP peer memory\n");
+ }
+@@ -12373,6 +12648,10 @@
+ peer->call_limit = atoi(v->value);
+ if (peer->call_limit < 0)
+ peer->call_limit = 0;
++ } else if (!strcasecmp(v->name, "registrations")) {
++ peer->max_regs = atoi(v->value);
++ if (peer->max_regs < 0)
++ peer->max_regs = 0;
+ } else if (!strcasecmp(v->name, "amaflags")) {
+ format = ast_cdr_amaflags2int(v->value);
+ if (format < 0) {
+@@ -12768,8 +13047,24 @@
+ if (!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend")) {
+ peer = build_peer(cat, ast_variable_browse(cfg, cat), 0);
+ if (peer) {
+- ASTOBJ_CONTAINER_LINK(&peerl,peer);
+- ASTOBJ_UNREF(peer, sip_destroy_peer);
++ if (peer->max_regs > 1) {
++ int i = 0;
++ int clones = peer->max_regs - 1;
++ struct sip_peer *clone = NULL;
++ char clone_name[sizeof(clone->name)];
++ /* clone clone clone */
++ for (i=0;i<clones;i++) {
++ snprintf(clone_name, sizeof(clone_name), "%s@%d", cat, i);
++ clone = build_peer(clone_name, ast_variable_browse(cfg, cat), 0);
++ if (clone) {
++ clone->subpeer = 1;
++ ASTOBJ_CONTAINER_LINK(&peerl,clone);
++ ASTOBJ_UNREF(clone, sip_destroy_peer);
++ }
++ }
++ }
++ ASTOBJ_CONTAINER_LINK(&peerl,peer);
++ ASTOBJ_UNREF(peer, sip_destroy_peer);
+ }
+ } else if (strcasecmp(utype, "user")) {
+ ast_log(LOG_WARNING, "Unknown type '%s' for '%s' in %s\n", utype, cat, "sip.conf");
+@@ -13359,6 +13654,8 @@
"List SIP peers (text format)", mandescr_show_peers);
ast_manager_register2("SIPshowpeer", EVENT_FLAG_SYSTEM, manager_sip_show_peer,
"Show SIP peer (text format)", mandescr_show_peer);
sip_poke_all_peers();
sip_send_all_registers();
-@@ -13197,6 +13317,7 @@
+@@ -13389,6 +13686,7 @@
ast_rtp_proto_unregister(&sip_rtp);
ast_manager_unregister("SIPpeers");
ast_manager_unregister("SIPshowpeer");
-diff -urN asterisk-1.2.7.1.orig/channels/chan_zap.c asterisk-1.2.7.1/channels/chan_zap.c
---- asterisk-1.2.7.1.orig/channels/chan_zap.c 2006-04-04 20:28:14.000000000 +0200
-+++ asterisk-1.2.7.1/channels/chan_zap.c 2006-04-25 14:21:48.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/channels/chan_zap.c asterisk-1.2.9.1/channels/chan_zap.c
+--- asterisk-1.2.9.1.orig/channels/chan_zap.c 2006-05-31 22:26:17.000000000 +0200
++++ asterisk-1.2.9.1/channels/chan_zap.c 2006-06-15 16:09:02.000000000 +0200
@@ -11,6 +11,10 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
+ else
+ c = dest;
+ ast_mutex_lock(&p->gsm.lock);
-+ if (gsm_dial(p->gsm.modul, 0, c)) {
++ if (gsm_dial(p->gsm.modul, p->use_callingpres ? ast->cid.cid_pres : 0, c)) {
+ ast_log(LOG_WARNING, "dialing failed on channel %d\n", p->channel);
+ ast_mutex_unlock(&p->gsm.lock);
+ ast_mutex_unlock(&p->lock);
if (p->pri->facilityenable)
pri_facility_enable(p->pri->pri);
-@@ -2287,8 +2503,10 @@
+@@ -2286,8 +2502,10 @@
}
if (newslot < 0) {
newslot = 0;
}
if (old && (oldslot != newslot))
ast_log(LOG_NOTICE, "Switching from from d-channel %d to channel %d!\n",
-@@ -2344,8 +2562,7 @@
+@@ -2343,8 +2561,7 @@
ast_log(LOG_DEBUG, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
p->channel, index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
if (index > -1) {
/* Real channel, do some fixup */
p->subs[index].owner = NULL;
-@@ -2442,6 +2659,7 @@
+@@ -2441,6 +2658,7 @@
if (!p->subs[SUB_REAL].owner && !p->subs[SUB_CALLWAIT].owner && !p->subs[SUB_THREEWAY].owner) {
p->owner = NULL;
p->ringt = 0;
p->distinctivering = 0;
-@@ -2478,19 +2696,61 @@
+@@ -2477,19 +2695,61 @@
if (p->call && (!p->bearer || (p->bearer->call == p->call))) {
if (!pri_grab(p, p->pri)) {
if (p->alreadyhungup) {
ast_log(LOG_DEBUG, "Not yet hungup... Calling hangup once with icause, and clearing call\n");
#ifdef SUPPORT_USERUSER
-@@ -2504,7 +2764,28 @@
+@@ -2503,7 +2763,28 @@
if (atoi(cause))
icause = atoi(cause);
}
}
if (res < 0)
ast_log(LOG_WARNING, "pri_disconnect failed\n");
-@@ -2532,7 +2813,13 @@
+@@ -2531,7 +2812,13 @@
}
#endif
res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
-@@ -2701,10 +2988,14 @@
+@@ -2700,10 +2987,14 @@
p->proceeding = 1;
res = pri_answer(p->pri->pri, p->call, 0, !p->digital);
pri_rel(p->pri);
break;
#endif
#ifdef ZAPATA_R2
-@@ -2714,6 +3005,13 @@
+@@ -2713,6 +3004,13 @@
ast_log(LOG_WARNING, "R2 Answer call failed :( on %s\n", ast->name);
break;
#endif
case 0:
ast_mutex_unlock(&p->lock);
return 0;
-@@ -3274,6 +3572,15 @@
+@@ -3273,6 +3571,15 @@
{
struct zt_pvt *p = newchan->tech_pvt;
int x;
ast_mutex_lock(&p->lock);
ast_log(LOG_DEBUG, "New owner for channel %d is %s\n", p->channel, newchan->name);
if (p->owner == oldchan) {
-@@ -3637,7 +3944,7 @@
+@@ -3636,7 +3943,7 @@
if (p->call) {
if (p->pri && p->pri->pri) {
if (!pri_grab(p, p->pri)) {
pri_destroycall(p->pri->pri, p->call);
p->call = NULL;
pri_rel(p->pri);
-@@ -4600,7 +4907,7 @@
+@@ -4599,7 +4906,7 @@
p->subs[index].f.data = NULL;
p->subs[index].f.datalen= 0;
}
/* Perform busy detection. etc on the zap line */
f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
if (f) {
-@@ -4612,8 +4919,9 @@
+@@ -4611,8 +4918,9 @@
}
} else if (f->frametype == AST_FRAME_DTMF) {
#ifdef ZAPATA_PRI
f->frametype = AST_FRAME_NULL;
f->subclass = 0;
}
-@@ -4661,8 +4969,10 @@
+@@ -4660,8 +4968,10 @@
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
if (ast_async_goto(ast, target_context, "fax", 1))
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context);
} else
ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
} else
-@@ -4748,7 +5058,9 @@
+@@ -4747,7 +5057,9 @@
#endif
/* Write a frame of (presumably voice) data */
if (frame->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
return 0;
}
-@@ -4819,7 +5131,7 @@
+@@ -4818,7 +5130,7 @@
switch(condition) {
case AST_CONTROL_BUSY:
#ifdef ZAPATA_PRI
chan->hangupcause = AST_CAUSE_USER_BUSY;
chan->_softhangup |= AST_SOFTHANGUP_DEV;
res = 0;
-@@ -4901,7 +5213,7 @@
+@@ -4900,7 +5212,7 @@
case AST_CONTROL_CONGESTION:
chan->hangupcause = AST_CAUSE_CONGESTION;
#ifdef ZAPATA_PRI
chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
chan->_softhangup |= AST_SOFTHANGUP_DEV;
res = 0;
-@@ -5086,8 +5398,12 @@
+@@ -5085,8 +5397,12 @@
if (state == AST_STATE_RING)
tmp->rings = 1;
tmp->tech_pvt = i;
tmp->callgroup = i->callgroup;
tmp->pickupgroup = i->pickupgroup;
}
-@@ -5217,6 +5533,7 @@
+@@ -5216,6 +5532,7 @@
int len = 0;
int res;
int index;
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s'\n", chan->name);
index = zt_get_index(chan, p, 1);
-@@ -5235,10 +5552,17 @@
+@@ -5234,10 +5551,17 @@
len = strlen(exten);
res = 0;
while((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
timeout = matchdigittimeout;
else
-@@ -6719,6 +7043,8 @@
+@@ -6724,6 +7048,8 @@
} else {
if (si->totalchans == 31) { /* if it's an E1 */
pris[*span].dchannels[0] = 16 + offset;
} else {
pris[*span].dchannels[0] = 24 + offset;
}
-@@ -6806,6 +7132,10 @@
+@@ -6811,6 +7137,10 @@
#endif
static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_pri *pri, int reloading)
{
/* Make a zt_pvt structure for this interface (or CRV if "pri" is specified) */
-@@ -6964,6 +7294,11 @@
+@@ -6969,6 +7299,11 @@
destroy_zt_pvt(&tmp);
return NULL;
}
if (!ast_strlen_zero(pris[span].idledial) && strcmp(pris[span].idledial, idledial)) {
ast_log(LOG_ERROR, "Span %d already has idledial '%s'.\n", span + 1, idledial);
destroy_zt_pvt(&tmp);
-@@ -6991,6 +7326,17 @@
+@@ -6996,6 +7331,17 @@
return NULL;
}
pris[span].nodetype = pritype;
pris[span].switchtype = myswitchtype;
pris[span].nsf = nsf;
pris[span].dialplan = dialplan;
-@@ -6999,9 +7345,14 @@
+@@ -7004,9 +7350,14 @@
pris[span].minunused = minunused;
pris[span].minidle = minidle;
pris[span].overlapdial = overlapdial;
ast_copy_string(pris[span].internationalprefix, internationalprefix, sizeof(pris[span].internationalprefix));
ast_copy_string(pris[span].nationalprefix, nationalprefix, sizeof(pris[span].nationalprefix));
ast_copy_string(pris[span].localprefix, localprefix, sizeof(pris[span].localprefix));
-@@ -7022,6 +7373,36 @@
+@@ -7027,6 +7378,36 @@
tmp->prioffset = 0;
}
#endif
#ifdef ZAPATA_R2
if (signalling == SIG_R2) {
if (r2prot < 0) {
-@@ -7155,6 +7536,7 @@
+@@ -7160,6 +7541,7 @@
tmp->restrictcid = restrictcid;
tmp->use_callingpres = use_callingpres;
tmp->priindication_oob = priindication_oob;
tmp->priexclusive = cur_priexclusive;
if (tmp->usedistinctiveringdetection) {
if (!tmp->use_callerid) {
-@@ -7428,7 +7810,7 @@
+@@ -7433,7 +7815,7 @@
break;
if (!backwards && (x >= pri->numchans))
break;
ast_log(LOG_DEBUG, "Found empty available channel %d/%d\n",
pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
return x;
-@@ -7475,7 +7857,7 @@
+@@ -7480,7 +7862,7 @@
end = ifend;
/* We do signed linear */
oldformat = format;
if (!format) {
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
return NULL;
-@@ -7635,6 +8017,11 @@
+@@ -7640,6 +8022,11 @@
p->digital = 1;
if (tmp)
tmp->transfercapability = AST_TRANS_CAP_DIGITAL;
} else {
ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
}
-@@ -7674,6 +8061,164 @@
+@@ -7679,6 +8066,164 @@
return tmp;
}
#ifdef ZAPATA_PRI
static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
-@@ -7688,6 +8233,57 @@
+@@ -7693,6 +8238,57 @@
return NULL;
}
static int pri_find_principle(struct zt_pri *pri, int channel)
{
-@@ -7720,7 +8316,9 @@
+@@ -7725,7 +8321,9 @@
static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
{
int x;
if (!c) {
if (principle < 0)
return -1;
-@@ -7734,6 +8332,7 @@
+@@ -7739,6 +8337,7 @@
/* First, check for other bearers */
for (x=0;x<pri->numchans;x++) {
if (!pri->pvts[x]) continue;
if (pri->pvts[x]->call == c) {
/* Found our call */
if (principle != x) {
-@@ -7747,19 +8346,56 @@
+@@ -7752,19 +8351,56 @@
}
/* Fix it all up now */
pri->pvts[principle]->owner = pri->pvts[x]->owner;
}
return principle;
}
-@@ -7788,7 +8424,9 @@
+@@ -7793,7 +8429,9 @@
}
crv = crv->next;
}
return -1;
}
-@@ -7850,86 +8488,33 @@
+@@ -7855,86 +8493,33 @@
#ifndef PRI_RESTART
#error "Upgrade your libpri"
#endif
static int pri_check_restart(struct zt_pri *pri)
{
-+ if ((pri->nodetype != PRI_NETWORK) || (pri->nodetype != PRI_CPE)) {
++ if ((pri->nodetype != PRI_NETWORK) && (pri->nodetype != PRI_CPE)) {
+ return 0;
+ }
do {
pri->resetpos++;
} while((pri->resetpos < pri->numchans) &&
-@@ -8012,6 +8597,32 @@
+@@ -8017,6 +8602,32 @@
}
}
static void *pri_dchannel(void *vpri)
{
struct zt_pri *pri = vpri;
-@@ -8103,6 +8714,8 @@
+@@ -8108,6 +8719,8 @@
} else if (pri->pvts[x] && pri->pvts[x]->owner && pri->pvts[x]->isidlecall)
activeidles++;
}
#if 0
printf("nextidle: %d, haveidles: %d, minunsed: %d\n",
nextidle, haveidles, minunused);
-@@ -8204,9 +8817,36 @@
+@@ -8209,9 +8822,36 @@
if (x == ZT_EVENT_ALARM) {
pri->dchanavail[which] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
pri_find_dchan(pri);
}
if (option_debug)
-@@ -8218,8 +8858,7 @@
+@@ -8223,8 +8863,7 @@
break;
}
} else if (errno != EINTR)
if (e) {
if (pri->debug)
pri_dump_event(pri->dchans[which], e);
-@@ -8227,32 +8866,102 @@
+@@ -8232,32 +8871,102 @@
pri->dchanavail[which] |= DCHAN_UP;
switch(e->e) {
case PRI_EVENT_DCHAN_UP:
pri->resetting = 0;
/* Hangup active channels and put them in alarm mode */
for (i=0; i<pri->numchans; i++) {
-@@ -8260,19 +8969,29 @@
+@@ -8265,19 +8974,29 @@
if (p) {
if (p->call) {
if (p->pri && p->pri->pri) {
}
break;
case PRI_EVENT_RESTART:
-@@ -8307,8 +9026,8 @@
+@@ -8312,8 +9031,8 @@
pri_destroycall(pri->pri, pri->pvts[x]->call);
pri->pvts[x]->call = NULL;
}
else if (pri->pvts[x]->owner)
pri->pvts[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_mutex_unlock(&pri->pvts[x]->lock);
-@@ -8342,7 +9061,6 @@
+@@ -8347,7 +9066,6 @@
}
}
break;
case PRI_EVENT_INFO_RECEIVED:
chanpos = pri_find_principle(pri, e->ring.channel);
if (chanpos < 0) {
-@@ -8351,9 +9069,11 @@
+@@ -8356,9 +9074,11 @@
} else {
chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
if (chanpos > -1) {
/* how to do that */
int digitlen = strlen(e->ring.callednum);
char digit;
-@@ -8365,6 +9085,14 @@
+@@ -8370,6 +9090,14 @@
zap_queue_frame(pri->pvts[chanpos], &f, pri);
}
}
}
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
-@@ -8372,39 +9100,55 @@
+@@ -8377,39 +9105,58 @@
break;
case PRI_EVENT_RING:
crv = NULL;
- pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
- ast_mutex_unlock(&pri->pvts[chanpos]->lock);
- chanpos = -1;
-- }
-- }
-- if (chanpos > -1)
- ast_mutex_unlock(&pri->pvts[chanpos]->lock);
++ ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+ chanpos = -1;
+ break;
+ } else {
+ ast_log(LOG_WARNING, "Ring requested on channel %d/%d already in use on span %d. Hanging up owner.\n",
+ PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
-+ if (pri->pvts[chanpos]->realcall)
++ if (pri->pvts[chanpos]->realcall) {
+ pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
-+ else
++ } else {
+ pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-+ ast_mutex_unlock(&pri->pvts[chanpos]->lock);
++ /* XXX destroy the call here, so we can accept the retransmission as a new call */
++ pri_destroycall(pri->pri, e->ring.call);
+ }
+- }
+- if (chanpos > -1)
+ ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+ chanpos = -1;
+ break;
+ }
if (pri->switchtype == PRI_SWITCH_GR303_TMC) {
/* Should be safe to lock CRV AFAIK while bearer is still locked */
crv = pri_find_crv(pri, pri_get_crv(pri->pri, e->ring.call, NULL));
-@@ -8418,13 +9162,14 @@
+@@ -8423,13 +9170,14 @@
ast_log(LOG_WARNING, "Call received for busy CRV %d on span %d\n", pri_get_crv(pri->pri, e->ring.call, NULL), pri->span);
} else
ast_log(LOG_NOTICE, "Call received for unconfigured CRV %d on span %d\n", pri_get_crv(pri->pri, e->ring.call, NULL), pri->span);
pri->pvts[chanpos]->call = e->ring.call;
apply_plan_to_number(plancallingnum, sizeof(plancallingnum), pri, e->ring.callingnum, e->ring.callingplan);
if (pri->pvts[chanpos]->use_callerid) {
-@@ -8449,29 +9194,78 @@
+@@ -8454,29 +9202,78 @@
}
apply_plan_to_number(pri->pvts[chanpos]->rdnis, sizeof(pri->pvts[chanpos]->rdnis), pri,
e->ring.redirectingnum, e->ring.callingplanrdnis);
/* Make sure extension exists (or in overlap dial mode, can exist) */
if ((pri->overlapdial && ast_canmatch_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) ||
ast_exists_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
-@@ -8490,22 +9284,38 @@
+@@ -8495,22 +9292,38 @@
res = zt_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel);
if (pri->overlapdial && ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
/* Release the PRI lock while we create the channel */
ast_mutex_unlock(&pri->lock);
-@@ -8513,14 +9323,31 @@
+@@ -8518,14 +9331,31 @@
/* Set bearer and such */
pri_assign_bearer(crv, pri, pri->pvts[chanpos]);
c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
if(e->ring.ani2 >= 0) {
snprintf(ani2str, 5, "%.2d", e->ring.ani2);
pbx_builtin_setvar_helper(c, "ANI2", ani2str);
-@@ -8540,8 +9367,8 @@
+@@ -8545,8 +9375,8 @@
ast_mutex_lock(&pri->lock);
if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
if (option_verbose > 2)
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
} else {
ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n",
-@@ -8549,14 +9376,18 @@
+@@ -8554,14 +9384,18 @@
if (c)
ast_hangup(c);
else {
ast_mutex_lock(&pri->lock);
if (c) {
char calledtonstr[10];
-@@ -8577,23 +9408,40 @@
+@@ -8582,23 +9416,40 @@
snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
if (option_verbose > 2)
pri->pvts[chanpos]->call = NULL;
pri->pvts[chanpos]->exten[0] = '\0';
}
-@@ -8601,7 +9449,7 @@
+@@ -8606,7 +9457,7 @@
ast_mutex_unlock(&crv->lock);
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
} else
break;
case PRI_EVENT_RINGING:
chanpos = pri_find_principle(pri, e->ringing.channel);
-@@ -8619,7 +9467,7 @@
+@@ -8624,7 +9475,7 @@
} else {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
pri->pvts[chanpos]->alerting = 1;
} else
-@@ -8648,9 +9496,15 @@
+@@ -8653,9 +9504,15 @@
}
break;
case PRI_EVENT_PROGRESS:
#ifdef PRI_PROGRESS_MASK
if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
#else
-@@ -8697,6 +9551,12 @@
+@@ -8702,6 +9559,12 @@
case PRI_EVENT_PROCEEDING:
chanpos = pri_find_principle(pri, e->proceeding.channel);
if (chanpos > -1) {
if (!pri->pvts[chanpos]->proceeding) {
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
-@@ -8747,6 +9607,295 @@
+@@ -8752,6 +9615,295 @@
}
}
break;
case PRI_EVENT_ANSWER:
chanpos = pri_find_principle(pri, e->answer.channel);
if (chanpos < 0) {
-@@ -8762,6 +9911,7 @@
+@@ -8767,6 +9919,7 @@
chanpos = -1;
} else {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
/* Now we can do call progress detection */
/* We changed this so it turns on the DSP no matter what... progress or no progress.
-@@ -8791,11 +9941,15 @@
+@@ -8796,11 +9949,16 @@
ast_log(LOG_DEBUG, "Sent deferred digit string: %s\n", pri->pvts[chanpos]->dop.dialstr);
pri->pvts[chanpos]->dop.dialstr[0] = '\0';
} else if (pri->pvts[chanpos]->confirmanswer) {
- ast_log(LOG_DEBUG, "Waiting on answer confirmation on channel %d!\n", pri->pvts[chanpos]->channel);
+ ast_log(LOG_DEBUG, "Waiting for answer confirmation on channel %d!\n", pri->pvts[chanpos]->channel);
++ enable_dtmf_detect(pri->pvts[chanpos]);
} else {
+ pri->pvts[chanpos]->dialing = 0;
pri->pvts[chanpos]->subs[SUB_REAL].needanswer =1;
}
#ifdef SUPPORT_USERUSER
-@@ -8844,23 +9998,32 @@
+@@ -8849,23 +10007,32 @@
}
}
if (option_verbose > 2)
#ifdef SUPPORT_USERUSER
if (!ast_strlen_zero(e->hangup.useruserinfo)) {
-@@ -8870,8 +10033,20 @@
+@@ -8875,8 +10042,20 @@
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
} else {
}
}
break;
-@@ -8881,17 +10056,25 @@
+@@ -8886,17 +10065,25 @@
case PRI_EVENT_HANGUP_REQ:
chanpos = pri_find_principle(pri, e->hangup.channel);
if (chanpos < 0) {
pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
switch(e->hangup.cause) {
case PRI_CAUSE_USER_BUSY:
-@@ -8910,20 +10093,87 @@
+@@ -8915,20 +10102,87 @@
}
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
}
#ifdef SUPPORT_USERUSER
-@@ -8934,9 +10184,36 @@
+@@ -8939,9 +10193,36 @@
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
} else {
break;
case PRI_EVENT_HANGUP_ACK:
chanpos = pri_find_principle(pri, e->hangup.channel);
-@@ -8950,6 +10227,7 @@
+@@ -8955,6 +10236,7 @@
if (chanpos > -1) {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
pri->pvts[chanpos]->call = NULL;
pri->pvts[chanpos]->resetting = 0;
if (pri->pvts[chanpos]->owner) {
if (option_verbose > 2)
-@@ -8963,7 +10241,9 @@
+@@ -8968,7 +10250,9 @@
#endif
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
break;
case PRI_EVENT_CONFIG_ERR:
-@@ -9030,7 +10310,7 @@
- ast_log(LOG_WARNING, "Received SETUP_ACKNOWLEDGE on unconfigured channel %d/%d span %d\n",
- PRI_SPAN(e->setup_ack.channel), PRI_CHANNEL(e->setup_ack.channel), pri->span);
- } else {
-- chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
-+ chanpos = pri_fixup_principle(pri, chanpos, e->setup_ack.call);
- if (chanpos > -1) {
- ast_mutex_lock(&pri->pvts[chanpos]->lock);
- pri->pvts[chanpos]->setup_ack = 1;
-@@ -9055,10 +10335,22 @@
+@@ -9060,10 +10344,22 @@
ast_mutex_lock(&pri->pvts[chanpos]->lock);
switch(e->notify.info) {
case PRI_NOTIFY_REMOTE_HOLD:
f.subclass = AST_CONTROL_UNHOLD;
zap_queue_frame(pri->pvts[chanpos], &f, pri);
break;
-@@ -9066,6 +10358,77 @@
+@@ -9071,6 +10367,77 @@
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
break;
default:
ast_log(LOG_DEBUG, "Event: %d\n", e->e);
}
-@@ -9127,7 +10490,7 @@
+@@ -9132,7 +10499,7 @@
pri->fds[i] = -1;
return -1;
}
/* Force overlap dial if we're doing GR-303! */
if (pri->switchtype == PRI_SWITCH_GR303_TMC)
pri->overlapdial = 1;
-@@ -9196,39 +10559,77 @@
+@@ -9201,39 +10568,77 @@
static int handle_pri_set_debug_file(int fd, int argc, char **argv)
{
}
return RESULT_SUCCESS;
-@@ -9260,6 +10661,7 @@
+@@ -9265,6 +10670,7 @@
static int handle_pri_no_debug(int fd, int argc, char *argv[])
{
int span;
-@@ -9366,36 +10768,6 @@
+@@ -9371,36 +10777,6 @@
return RESULT_SUCCESS;
}
static char pri_debug_help[] =
"Usage: pri debug span <span>\n"
" Enables debugging on a given PRI span\n";
-@@ -9412,6 +10784,18 @@
+@@ -9417,6 +10793,18 @@
"Usage: pri show span <span>\n"
" Displays PRI Information\n";
static struct ast_cli_entry zap_pri_cli[] = {
{ { "pri", "debug", "span", NULL }, handle_pri_debug,
"Enables PRI debugging on a span", pri_debug_help, complete_span_4 },
-@@ -9419,19 +10803,207 @@
+@@ -9424,19 +10812,218 @@
"Disables PRI debugging on a span", pri_no_debug_help, complete_span_5 },
{ { "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug,
"Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span_5 },
"Ends PRI debug output to file" },
};
++static char *zapCD_tdesc = "Call Deflection";
++static char *zapCD_app = "zapCD";
++static char *zapCD_synopsis = "Call Deflection";
++
+static int app_zapCD(struct ast_channel *chan, void *data)
+{
+ struct zt_pvt *p = chan->tech_pvt;
+ return pri_deflect(p->pri->pri, p->call, data);
+}
+
-+static char *zapCD_tdesc = "Call Deflection";
-+static char *zapCD_app = "zapCD";
-+static char *zapCD_synopsis = "Call Deflection";
++static char *zapInband_tdesc = "Inband Call Progress (pre-answer)";
++static char *zapInband_app = "zapInband";
++static char *zapInband_synopsis = "Inband Call Progress";
++
++static int app_zapInband(struct ast_channel *chan, void *data)
++{
++ struct zt_pvt *p = chan->tech_pvt;
++
++ return pri_acknowledge(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 1);
++}
#endif /* ZAPATA_PRI */
#ifdef ZAPATA_R2
static int handle_r2_no_debug(int fd, int argc, char *argv[])
{
-@@ -10044,6 +11616,11 @@
+@@ -10048,6 +11635,13 @@
+ pthread_cancel(pris[i].master);
}
ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
- #endif
++ ast_unregister_application(zapCD_app);
++ ast_unregister_application(zapInband_app);
++#endif
+#ifdef ZAPATA_GSM
+ ast_cli_unregister(&gsm_send_sms);
+ ast_cli_unregister(&gsm_send_pdu);
+ ast_cli_unregister(&gsm_show_status);
-+#endif
+ #endif
#ifdef ZAPATA_R2
ast_cli_unregister_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
- #endif
-@@ -10054,6 +11631,7 @@
+@@ -10059,6 +11653,7 @@
ast_manager_unregister( "ZapDNDoff" );
ast_manager_unregister( "ZapDNDon" );
ast_manager_unregister("ZapShowChannels");
ast_channel_unregister(&zap_tech);
if (!ast_mutex_lock(&iflock)) {
/* Hangup all interfaces if they have an owner */
-@@ -10412,8 +11990,8 @@
+@@ -10417,8 +12012,8 @@
}
} else if (!strcasecmp(v->name, "echotraining")) {
if (sscanf(v->value, "%d", &y) == 1) {
} else {
echotraining = y;
}
-@@ -10599,12 +12177,33 @@
+@@ -10604,12 +12199,33 @@
cur_signalling = SIG_GR303FXSKS;
cur_radio = 0;
pritype = PRI_CPE;
} else {
ast_log(LOG_ERROR, "Unknown signalling method '%s'\n", v->value);
}
-@@ -10687,8 +12286,20 @@
+@@ -10692,8 +12308,20 @@
priindication_oob = 1;
else if (!strcasecmp(v->value, "inband"))
priindication_oob = 0;
v->value, v->lineno);
} else if (!strcasecmp(v->name, "priexclusive")) {
cur_priexclusive = ast_true(v->value);
-@@ -10702,6 +12313,14 @@
+@@ -10707,6 +12335,14 @@
ast_copy_string(privateprefix, v->value, sizeof(privateprefix));
} else if (!strcasecmp(v->name, "unknownprefix")) {
ast_copy_string(unknownprefix, v->value, sizeof(unknownprefix));
} else if (!strcasecmp(v->name, "resetinterval")) {
if (!strcasecmp(v->value, "never"))
resetinterval = -1;
-@@ -10716,6 +12335,8 @@
+@@ -10723,6 +12359,8 @@
ast_copy_string(idleext, v->value, sizeof(idleext));
} else if (!strcasecmp(v->name, "idledial")) {
ast_copy_string(idledial, v->value, sizeof(idledial));
} else if (!strcasecmp(v->name, "overlapdial")) {
overlapdial = ast_true(v->value);
} else if (!strcasecmp(v->name, "pritimer")) {
-@@ -10901,6 +12522,7 @@
+@@ -10908,6 +12546,7 @@
#ifdef ZAPATA_PRI
if (!reload) {
for (x=0;x<NUM_SPANS;x++) {
if (pris[x].pvts[0]) {
if (start_pri(pris + x)) {
ast_log(LOG_ERROR, "Unable to start D-channel on span %d\n", x + 1);
-@@ -10933,6 +12555,10 @@
+@@ -10940,6 +12579,10 @@
pri_set_error(zt_pri_error);
pri_set_message(zt_pri_message);
#endif
res = setup_zap(0);
/* Make sure we can register our Zap channel type */
if(res) {
-@@ -10950,6 +12576,11 @@
+@@ -10957,6 +12600,11 @@
ast_cli_register_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
#endif
ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
memset(round_robin, 0, sizeof(round_robin));
ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
-@@ -10958,11 +12589,46 @@
+@@ -10965,11 +12613,47 @@
ast_manager_register( "ZapDNDon", 0, action_zapdndon, "Toggle Zap channel Do Not Disturb status ON" );
ast_manager_register( "ZapDNDoff", 0, action_zapdndoff, "Toggle Zap channel Do Not Disturb status OFF" );
ast_manager_register("ZapShowChannels", 0, action_zapshowchannels, "Show status zapata channels");
+ ast_register_application(zapEC_app, app_zapEC, zapEC_synopsis, zapEC_tdesc);
+#ifdef ZAPATA_PRI
+ ast_register_application(zapCD_app, app_zapCD, zapCD_synopsis, zapCD_tdesc);
++ ast_register_application(zapInband_app, app_zapInband, zapInband_synopsis, zapInband_tdesc);
+#endif
return res;
}
{
#define END_SILENCE_LEN 400
#define HEADER_MS 50
-@@ -10981,6 +12647,7 @@
+@@ -10988,6 +12672,7 @@
float scont = 0.0;
int index;
index = zt_get_index(c, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "Huh? I don't exist?\n");
-diff -urN asterisk-1.2.7.1.orig/codecs/codec_ilbc.c asterisk-1.2.7.1/codecs/codec_ilbc.c
---- asterisk-1.2.7.1.orig/codecs/codec_ilbc.c 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/codecs/codec_ilbc.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/codecs/codec_ilbc.c asterisk-1.2.9.1/codecs/codec_ilbc.c
+--- asterisk-1.2.9.1.orig/codecs/codec_ilbc.c 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/codecs/codec_ilbc.c 2006-06-09 10:25:04.000000000 +0200
@@ -49,7 +49,7 @@
#include "slin_ilbc_ex.h"
#include "ilbc_slin_ex.h"
#define ILBC_MS 30
/* #define ILBC_MS 20 */
-diff -urN asterisk-1.2.7.1.orig/configs/capi.conf.sample asterisk-1.2.7.1/configs/capi.conf.sample
---- asterisk-1.2.7.1.orig/configs/capi.conf.sample 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/configs/capi.conf.sample 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/configs/capi.conf.sample asterisk-1.2.9.1/configs/capi.conf.sample
+--- asterisk-1.2.9.1.orig/configs/capi.conf.sample 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/configs/capi.conf.sample 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,44 @@
+;
+; CAPI config
+;msn=55512
+;controller=2
+;devices => 30
-diff -urN asterisk-1.2.7.1.orig/configs/modules.conf.sample asterisk-1.2.7.1/configs/modules.conf.sample
---- asterisk-1.2.7.1.orig/configs/modules.conf.sample 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/configs/modules.conf.sample 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/configs/modules.conf.sample asterisk-1.2.9.1/configs/modules.conf.sample
+--- asterisk-1.2.9.1.orig/configs/modules.conf.sample 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/configs/modules.conf.sample 2006-06-09 10:25:04.000000000 +0200
@@ -51,3 +51,4 @@
; exported to modules loaded after them.
;
[global]
+chan_capi.so=yes
-diff -urN asterisk-1.2.7.1.orig/configs/watchdog.conf.sample asterisk-1.2.7.1/configs/watchdog.conf.sample
---- asterisk-1.2.7.1.orig/configs/watchdog.conf.sample 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/configs/watchdog.conf.sample 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/configs/watchdog.conf.sample asterisk-1.2.9.1/configs/watchdog.conf.sample
+--- asterisk-1.2.9.1.orig/configs/watchdog.conf.sample 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/configs/watchdog.conf.sample 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,22 @@
+;
+; Configuration file for res_watchdog
+;device = /dev/watchdog
+;interval = 100
+
-diff -urN asterisk-1.2.7.1.orig/configs/zapata.conf.sample asterisk-1.2.7.1/configs/zapata.conf.sample
---- asterisk-1.2.7.1.orig/configs/zapata.conf.sample 2006-03-06 03:32:35.000000000 +0100
-+++ asterisk-1.2.7.1/configs/zapata.conf.sample 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/configs/zapata.conf.sample asterisk-1.2.9.1/configs/zapata.conf.sample
+--- asterisk-1.2.9.1.orig/configs/zapata.conf.sample 2006-04-28 18:40:32.000000000 +0200
++++ asterisk-1.2.9.1/configs/zapata.conf.sample 2006-06-09 10:25:04.000000000 +0200
@@ -121,9 +121,20 @@
;
; outofband: Signal Busy/Congestion out of band with RELEASE/DISCONNECT
; If you need to override the existing channels selection routine and force all
; PRI channels to be marked as exclusively selected, set this to yes.
; priexclusive = yes
-diff -urN asterisk-1.2.7.1.orig/db.c asterisk-1.2.7.1/db.c
---- asterisk-1.2.7.1.orig/db.c 2006-01-09 19:09:53.000000000 +0100
-+++ asterisk-1.2.7.1/db.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/db.c asterisk-1.2.9.1/db.c
+--- asterisk-1.2.9.1.orig/db.c 2006-01-09 19:09:53.000000000 +0100
++++ asterisk-1.2.9.1/db.c 2006-06-09 10:25:04.000000000 +0200
@@ -516,11 +516,18 @@
struct ast_cli_entry cli_database_deltree =
{ { "database", "deltree", NULL }, database_deltree, "Removes database keytree/values", database_deltree_usage };
+ ast_manager_register("DBdel", EVENT_FLAG_SYSTEM, manager_dbdel, mandescr_dbdel);
return 0;
}
-diff -urN asterisk-1.2.7.1.orig/devicestate.c asterisk-1.2.7.1/devicestate.c
---- asterisk-1.2.7.1.orig/devicestate.c 2006-02-10 21:38:59.000000000 +0100
-+++ asterisk-1.2.7.1/devicestate.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/devicestate.c asterisk-1.2.9.1/devicestate.c
+--- asterisk-1.2.9.1.orig/devicestate.c 2006-02-10 21:38:59.000000000 +0100
++++ asterisk-1.2.9.1/devicestate.c 2006-06-09 10:25:04.000000000 +0200
@@ -62,6 +62,8 @@
struct state_change {
free(cur);
AST_LIST_LOCK(&state_changes);
} else {
-diff -urN asterisk-1.2.7.1.orig/doc/README.asterisk.conf asterisk-1.2.7.1/doc/README.asterisk.conf
---- asterisk-1.2.7.1.orig/doc/README.asterisk.conf 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/doc/README.asterisk.conf 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/doc/README.asterisk.conf asterisk-1.2.9.1/doc/README.asterisk.conf
+--- asterisk-1.2.9.1.orig/doc/README.asterisk.conf 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/doc/README.asterisk.conf 2006-06-09 10:25:04.000000000 +0200
@@ -62,6 +62,7 @@
maxcalls = 255 ; The maximum number of concurrent calls you want to allow
execincludes = yes | no ; Allow #exec entries in configuration files
[files]
; Changing the following lines may compromise your security
-diff -urN asterisk-1.2.7.1.orig/editline/cygdef.h asterisk-1.2.7.1/editline/cygdef.h
---- asterisk-1.2.7.1.orig/editline/cygdef.h 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/editline/cygdef.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/editline/cygdef.h asterisk-1.2.9.1/editline/cygdef.h
+--- asterisk-1.2.9.1.orig/editline/cygdef.h 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/editline/cygdef.h 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,11 @@
+/* cygdef.h. Generated automatically by configure. */
+#ifndef _CYGDEF_H_
+
+
+#endif /* _CYGDEF_H_ */
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/agi.h asterisk-1.2.7.1/include/asterisk/agi.h
---- asterisk-1.2.7.1.orig/include/asterisk/agi.h 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/agi.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/agi.h asterisk-1.2.9.1/include/asterisk/agi.h
+--- asterisk-1.2.9.1.orig/include/asterisk/agi.h 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/agi.h 2006-06-09 10:25:04.000000000 +0200
@@ -29,7 +29,8 @@
typedef struct agi_state {
int ctrl; /* FD for input control */
} AGI;
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/chan_capi.h asterisk-1.2.7.1/include/asterisk/chan_capi.h
---- asterisk-1.2.7.1.orig/include/asterisk/chan_capi.h 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/chan_capi.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/chan_capi.h asterisk-1.2.9.1/include/asterisk/chan_capi.h
+--- asterisk-1.2.9.1.orig/include/asterisk/chan_capi.h 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/chan_capi.h 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,276 @@
+/*
+ * (CAPI*)
+#define CAPI_ETSI_NPLAN_INTERNAT 0x10
+
+#endif
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/chan_capi_app.h asterisk-1.2.7.1/include/asterisk/chan_capi_app.h
---- asterisk-1.2.7.1.orig/include/asterisk/chan_capi_app.h 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/chan_capi_app.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/chan_capi_app.h asterisk-1.2.9.1/include/asterisk/chan_capi_app.h
+--- asterisk-1.2.9.1.orig/include/asterisk/chan_capi_app.h 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/chan_capi_app.h 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,30 @@
+/*
+ * (CAPI*)
+extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
+
+#endif
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/channel.h asterisk-1.2.7.1/include/asterisk/channel.h
---- asterisk-1.2.7.1.orig/include/asterisk/channel.h 2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/channel.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/channel.h asterisk-1.2.9.1/include/asterisk/channel.h
+--- asterisk-1.2.9.1.orig/include/asterisk/channel.h 2006-06-01 22:27:50.000000000 +0200
++++ asterisk-1.2.9.1/include/asterisk/channel.h 2006-06-09 10:25:04.000000000 +0200
@@ -86,6 +86,9 @@
#ifndef _ASTERISK_CHANNEL_H
#define _ASTERISK_CHANNEL_H
#include <unistd.h>
#include <setjmp.h>
#ifdef POLLCOMPAT
-@@ -380,7 +383,7 @@
+@@ -381,7 +384,7 @@
unsigned int fout;
/* Unique Channel Identifier */
/* Why is the channel hanged up */
int hangupcause;
-@@ -397,6 +400,12 @@
+@@ -398,6 +401,12 @@
/*! ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */
unsigned short transfercapability;
struct ast_frame *readq;
int alertpipe[2];
/*! Write translation path */
-@@ -533,6 +542,11 @@
+@@ -534,6 +543,11 @@
#define AST_STATE_MUTE (1 << 16)
/*! @} */
/*! \brief Change the state of a channel */
int ast_setstate(struct ast_channel *chan, int state);
-@@ -569,7 +583,7 @@
+@@ -570,7 +584,7 @@
* by the low level module
* \return Returns an ast_channel on success, NULL on failure.
*/
/*!
* \brief Request a channel of a given type, with data as optional information used
-@@ -584,9 +598,9 @@
+@@ -585,9 +599,9 @@
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
* to know if the call was answered or not.
*/
/*!\brief Register a channel technology (a new channel driver)
* Called by a channel module to register the kind of channels it supports.
-@@ -839,6 +853,10 @@
+@@ -840,6 +854,10 @@
/*--- ast_get_channel_by_exten_locked: Get channel by exten (and optionally context) and lock it */
struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const char *context);
/*! Waits for a digit */
/*!
* \param c channel to wait for a digit on
-@@ -909,6 +927,9 @@
+@@ -910,6 +928,9 @@
p->owner pointer) that is affected by the change. The physical layer of the original
channel is hung up. */
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone);
/*! Gives the string form of a given cause code */
/*!
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/devicestate.h asterisk-1.2.7.1/include/asterisk/devicestate.h
---- asterisk-1.2.7.1.orig/include/asterisk/devicestate.h 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/devicestate.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/devicestate.h asterisk-1.2.9.1/include/asterisk/devicestate.h
+--- asterisk-1.2.9.1.orig/include/asterisk/devicestate.h 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/devicestate.h 2006-06-09 10:25:04.000000000 +0200
@@ -42,7 +42,7 @@
/*! Device is ringing */
#define AST_DEVICE_RINGING 6
/*! \brief Registers a device state change callback
* \param callback Callback
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/features.h asterisk-1.2.7.1/include/asterisk/features.h
---- asterisk-1.2.7.1.orig/include/asterisk/features.h 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/features.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/features.h asterisk-1.2.9.1/include/asterisk/features.h
+--- asterisk-1.2.9.1.orig/include/asterisk/features.h 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/features.h 2006-06-09 10:25:04.000000000 +0200
@@ -45,6 +45,8 @@
};
+extern struct ast_call_feature *ast_find_builtin_feature(char *name);
+
#endif /* _AST_FEATURES_H */
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/pbx.h asterisk-1.2.7.1/include/asterisk/pbx.h
---- asterisk-1.2.7.1.orig/include/asterisk/pbx.h 2006-03-29 21:11:18.000000000 +0200
-+++ asterisk-1.2.7.1/include/asterisk/pbx.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/monitor.h asterisk-1.2.9.1/include/asterisk/monitor.h
+--- asterisk-1.2.9.1.orig/include/asterisk/monitor.h 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/monitor.h 2006-06-09 10:25:04.000000000 +0200
+@@ -35,6 +35,8 @@
+ char write_filename[FILENAME_MAX];
+ char filename_base[FILENAME_MAX];
+ int filename_changed;
++ char target_url[FILENAME_MAX];
++ char target_script[FILENAME_MAX];
+ char *format;
+ int joinfiles;
+ int (*stop)(struct ast_channel *chan, int need_lock);
+@@ -42,7 +44,7 @@
+
+ /* Start monitoring a channel */
+ int ast_monitor_start(struct ast_channel *chan, const char *format_spec,
+- const char *fname_base, int need_lock );
++ const char *fname_base, const char *target_url, const char *target_script, int need_lock );
+
+ /* Stop monitoring a channel */
+ int ast_monitor_stop(struct ast_channel *chan, int need_lock);
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/pbx.h asterisk-1.2.9.1/include/asterisk/pbx.h
+--- asterisk-1.2.9.1.orig/include/asterisk/pbx.h 2006-03-29 21:11:18.000000000 +0200
++++ asterisk-1.2.9.1/include/asterisk/pbx.h 2006-06-09 10:25:04.000000000 +0200
@@ -57,7 +57,7 @@
AST_EXTENSION_BUSY = 1 << 1,
/*! All devices UNAVAILABLE/UNREGISTERED */
#if defined(__cplusplus) || defined(c_plusplus)
}
-diff -urN asterisk-1.2.7.1.orig/include/asterisk/xlaw.h asterisk-1.2.7.1/include/asterisk/xlaw.h
---- asterisk-1.2.7.1.orig/include/asterisk/xlaw.h 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk/xlaw.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk/xlaw.h asterisk-1.2.9.1/include/asterisk/xlaw.h
+--- asterisk-1.2.9.1.orig/include/asterisk/xlaw.h 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk/xlaw.h 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,1665 @@
+#ifndef _ASTERISK_XLAW_H
+#define _ASTERISK_XLAW_H
+#endif // CAPI_ULAW
+#endif
+
-diff -urN asterisk-1.2.7.1.orig/include/asterisk.h asterisk-1.2.7.1/include/asterisk.h
---- asterisk-1.2.7.1.orig/include/asterisk.h 2005-11-30 04:37:37.000000000 +0100
-+++ asterisk-1.2.7.1/include/asterisk.h 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/include/asterisk.h asterisk-1.2.9.1/include/asterisk.h
+--- asterisk-1.2.9.1.orig/include/asterisk.h 2005-11-30 04:37:37.000000000 +0100
++++ asterisk-1.2.9.1/include/asterisk.h 2006-06-09 10:25:04.000000000 +0200
@@ -36,6 +36,7 @@
extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
-diff -urN asterisk-1.2.7.1.orig/manager.c asterisk-1.2.7.1/manager.c
---- asterisk-1.2.7.1.orig/manager.c 2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.7.1/manager.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/manager.c asterisk-1.2.9.1/manager.c
+--- asterisk-1.2.9.1.orig/manager.c 2006-02-11 19:15:00.000000000 +0100
++++ asterisk-1.2.9.1/manager.c 2006-06-09 10:25:04.000000000 +0200
@@ -11,6 +11,9 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
- if (!ast_strlen_zero(name2))
+ if (!ast_strlen_zero(uniqueid2)) {
+ chan2 = ast_get_channel_by_uniqueid_locked(uniqueid2);
-+ if (!ast_strlen_zero(priority2) && (sscanf(priority, "%d", &pi2) != 1)) {
++ if (!ast_strlen_zero(priority2) && (sscanf(priority2, "%d", &pi2) != 1)) {
+ astman_send_error(s, m, "Invalid priority2\n");
+ return 0;
+ }
return 0;
}
-diff -urN asterisk-1.2.7.1.orig/pbx/pbx_spool.c asterisk-1.2.7.1/pbx/pbx_spool.c
---- asterisk-1.2.7.1.orig/pbx/pbx_spool.c 2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.7.1/pbx/pbx_spool.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/pbx/pbx_spool.c asterisk-1.2.9.1/pbx/pbx_spool.c
+--- asterisk-1.2.9.1.orig/pbx/pbx_spool.c 2006-02-11 19:15:00.000000000 +0100
++++ asterisk-1.2.9.1/pbx/pbx_spool.c 2006-06-09 10:25:04.000000000 +0200
@@ -259,11 +259,11 @@
if (!ast_strlen_zero(o->app)) {
if (option_verbose > 2)
}
if (res) {
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
-diff -urN asterisk-1.2.7.1.orig/pbx.c asterisk-1.2.7.1/pbx.c
---- asterisk-1.2.7.1.orig/pbx.c 2006-04-13 17:56:35.000000000 +0200
-+++ asterisk-1.2.7.1/pbx.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/pbx.c asterisk-1.2.9.1/pbx.c
+--- asterisk-1.2.9.1.orig/pbx.c 2006-05-23 19:15:23.000000000 +0200
++++ asterisk-1.2.9.1/pbx.c 2006-06-09 10:25:04.000000000 +0200
@@ -353,7 +353,8 @@
{ "Hangup", pbx_builtin_hangup,
},
{ "NoOp", pbx_builtin_noop,
-@@ -1880,7 +1881,7 @@
+@@ -1883,7 +1884,7 @@
return ast_extension_state2(e); /* Check all devices in the hint */
}
{
struct ast_hint *hint;
struct ast_state_cb *cblist;
-@@ -1908,11 +1909,11 @@
+@@ -1911,11 +1912,11 @@
/* For general callbacks */
for (cblist = statecbs; cblist; cblist = cblist->next)
hint->laststate = state;
break;
-@@ -2153,7 +2154,7 @@
+@@ -2156,7 +2157,7 @@
/* Notify with -1 and remove all callbacks */
cbprev = cblist;
cblist = cblist->next;
free(cbprev);
}
list->callbacks = NULL;
-@@ -3774,7 +3775,7 @@
+@@ -3778,7 +3779,7 @@
while (thiscb) {
prevcb = thiscb;
thiscb = thiscb->next;
free(prevcb);
}
} else {
-@@ -4976,7 +4977,7 @@
+@@ -4980,7 +4981,7 @@
return 0; /* success */
}
{
struct ast_channel *chan;
struct async_stat *as;
-@@ -4986,7 +4987,7 @@
+@@ -4990,7 +4991,7 @@
if (sync) {
LOAD_OH(oh);
if (channel) {
*channel = chan;
if (chan)
-@@ -5088,7 +5089,7 @@
+@@ -5092,7 +5093,7 @@
goto outgoing_exten_cleanup;
}
memset(as, 0, sizeof(struct async_stat));
if (channel) {
*channel = chan;
if (chan)
-@@ -5134,7 +5135,7 @@
+@@ -5138,7 +5139,7 @@
pthread_t t;
};
{
struct app_tmp *tmp = data;
struct ast_app *app;
-@@ -5150,7 +5151,7 @@
+@@ -5154,7 +5155,7 @@
return NULL;
}
{
struct ast_channel *chan;
struct async_stat *as;
-@@ -5170,7 +5171,7 @@
+@@ -5174,7 +5175,7 @@
goto outgoing_app_cleanup;
}
if (sync) {
if (chan) {
if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
-@@ -5257,7 +5258,8 @@
+@@ -5261,7 +5262,8 @@
goto outgoing_app_cleanup;
}
memset(as, 0, sizeof(struct async_stat));
if (!chan) {
free(as);
res = -1;
-@@ -5544,6 +5546,9 @@
+@@ -5548,6 +5550,9 @@
*/
static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
{
/* Just return non-zero and it will hang up */
if (!chan->hangupcause)
chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
-@@ -6200,6 +6205,9 @@
+@@ -6204,6 +6209,9 @@
return -1;
}
}
return res = ast_say_number(chan, atoi((char *) tmp), "", chan->language, options);
}
-@@ -6207,8 +6215,12 @@
+@@ -6211,8 +6219,12 @@
{
int res = 0;
return res;
}
-@@ -6216,8 +6228,12 @@
+@@ -6220,8 +6232,12 @@
{
int res = 0;
return res;
}
-@@ -6225,8 +6241,12 @@
+@@ -6229,8 +6245,12 @@
{
int res = 0;
return res;
}
-diff -urN asterisk-1.2.7.1.orig/res/Makefile asterisk-1.2.7.1/res/Makefile
---- asterisk-1.2.7.1.orig/res/Makefile 2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.7.1/res/Makefile 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/res/Makefile asterisk-1.2.9.1/res/Makefile
+--- asterisk-1.2.9.1.orig/res/Makefile 2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.9.1/res/Makefile 2006-06-09 10:25:04.000000000 +0200
@@ -11,7 +11,7 @@
# the GNU General Public License
#
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
ifneq (${OSARCH},FreeBSD)
-diff -urN asterisk-1.2.7.1.orig/res/res_agi.c asterisk-1.2.7.1/res/res_agi.c
---- asterisk-1.2.7.1.orig/res/res_agi.c 2006-02-28 19:31:04.000000000 +0100
-+++ asterisk-1.2.7.1/res/res_agi.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/res/res_agi.c asterisk-1.2.9.1/res/res_agi.c
+--- asterisk-1.2.9.1.orig/res/res_agi.c 2006-06-01 01:50:00.000000000 +0200
++++ asterisk-1.2.9.1/res/res_agi.c 2006-06-09 10:25:04.000000000 +0200
@@ -11,6 +11,9 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
"Use the CLI command 'show agi' to list available agi commands\n";
static int agidebug = 0;
-@@ -220,13 +228,14 @@
+@@ -225,13 +233,14 @@
return 0;
}
int x;
int res;
sigset_t signal_set;
-@@ -271,6 +280,33 @@
+@@ -276,6 +285,33 @@
return -1;
}
}
pid = fork();
if (pid < 0) {
ast_log(LOG_WARNING, "Failed to fork(): %s\n", strerror(errno));
-@@ -285,15 +321,19 @@
+@@ -290,15 +326,19 @@
} else {
close(STDERR_FILENO + 1);
}
close(x);
/* Don't run AGI scripts with realtime priority -- it causes audio stutter */
-@@ -312,6 +352,9 @@
+@@ -317,6 +357,9 @@
if (efd) {
*efd = audio[1];
}
/* close what we're not using in the parent */
close(toast[1]);
close(fromast[0]);
-@@ -320,6 +363,9 @@
+@@ -325,6 +368,9 @@
/* [PHM 12/18/03] */
close(audio[0]);
}
*opid = pid;
return 0;
-@@ -350,7 +396,7 @@
+@@ -355,7 +401,7 @@
fdprintf(fd, "agi_context: %s\n", chan->context);
fdprintf(fd, "agi_extension: %s\n", chan->exten);
fdprintf(fd, "agi_priority: %d\n", chan->priority);
/* User information */
fdprintf(fd, "agi_accountcode: %s\n", chan->accountcode ? chan->accountcode : "");
-@@ -382,7 +428,7 @@
+@@ -387,7 +433,7 @@
return RESULT_SHOWUSAGE;
if (sscanf(argv[3], "%d", &to) != 1)
return RESULT_SHOWUSAGE;
fdprintf(agi->fd, "200 result=%d\n", res);
if (res >= 0)
return RESULT_SUCCESS;
-@@ -558,7 +604,7 @@
+@@ -563,7 +609,7 @@
else
return RESULT_FAILURE;
}
/* this is to check for if ast_waitstream closed the stream, we probably are at
* the end of the stream, return that amount, else check for the amount */
sample_offset = (chan->stream) ? ast_tellstream(fs) : max_length;
-@@ -618,7 +664,7 @@
+@@ -623,7 +669,7 @@
else
return RESULT_FAILURE;
}
/* this is to check for if ast_waitstream closed the stream, we probably are at
* the end of the stream, return that amount, else check for the amount */
sample_offset = (chan->stream)?ast_tellstream(fs):max_length;
-@@ -630,7 +676,7 @@
+@@ -635,7 +681,7 @@
/* If the user didnt press a key, wait for digitTimeout*/
if (res == 0 ) {
/* Make sure the new result is in the escape digits of the GET OPTION */
if ( !strchr(edigits,res) )
res=0;
-@@ -657,7 +703,7 @@
+@@ -662,7 +708,7 @@
return RESULT_SHOWUSAGE;
if (sscanf(argv[2], "%d", &num) != 1)
return RESULT_SHOWUSAGE;
if (res == 1)
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-@@ -677,7 +723,7 @@
+@@ -682,7 +728,7 @@
if (sscanf(argv[2], "%d", &num) != 1)
return RESULT_SHOWUSAGE;
if (res == 1) /* New command */
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-@@ -694,7 +740,7 @@
+@@ -699,7 +745,7 @@
if (argc != 4)
return RESULT_SHOWUSAGE;
if (res == 1) /* New command */
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-@@ -784,7 +830,7 @@
+@@ -789,7 +835,7 @@
if (argc != 4)
return RESULT_SHOWUSAGE;
if (res == 1) /* New command */
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-@@ -811,7 +857,7 @@
+@@ -816,7 +862,7 @@
max = atoi(argv[4]);
else
max = 1024;
if (res == 2) /* New command */
return RESULT_SUCCESS;
else if (res == 1)
-@@ -1849,7 +1895,12 @@
+@@ -1860,7 +1906,12 @@
int ms;
int returnstatus = 0;
struct ast_frame *f;
FILE *readf;
/* how many times we'll retry if ast_waitfor_nandfs will return without either
channel or file descriptor in case select is interrupted by a system call (EINTR) */
-@@ -1863,10 +1914,22 @@
+@@ -1874,10 +1925,22 @@
return -1;
}
setlinebuf(readf);
if (c) {
retry = RETRY;
/* Idle the channel until we get a command */
-@@ -1877,13 +1940,24 @@
+@@ -1888,13 +1951,24 @@
break;
} else {
/* If it's voice, write it to the audio pipe */
retry = RETRY;
if (!fgets(buf, sizeof(buf), readf)) {
/* Program terminated */
-@@ -1905,6 +1979,7 @@
+@@ -1916,6 +1990,7 @@
if ((returnstatus < 0) || (returnstatus == AST_PBX_KEEPALIVE)) {
break;
}
} else {
if (--retry <= 0) {
ast_log(LOG_WARNING, "No channel, no fd?\n");
-@@ -2011,6 +2086,7 @@
+@@ -2022,6 +2097,7 @@
int argc = 0;
int fds[2];
int efd = -1;
int pid;
char *stringp;
AGI agi;
-@@ -2036,15 +2112,18 @@
+@@ -2047,15 +2123,18 @@
}
}
#endif
}
LOCAL_USER_REMOVE(u);
return res;
-@@ -2078,6 +2157,35 @@
+@@ -2089,6 +2168,35 @@
return res;
}
static int deadagi_exec(struct ast_channel *chan, void *data)
{
return agi_exec_full(chan, data, 0, 1);
-@@ -2107,6 +2215,7 @@
+@@ -2118,6 +2226,7 @@
ast_cli_unregister(&dumpagihtml);
ast_cli_unregister(&cli_debug);
ast_cli_unregister(&cli_no_debug);
ast_unregister_application(eapp);
ast_unregister_application(deadapp);
return ast_unregister_application(app);
-@@ -2120,6 +2229,7 @@
+@@ -2131,6 +2240,7 @@
ast_cli_register(&cli_no_debug);
ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
ast_register_application(eapp, eagi_exec, esynopsis, descrip);
return ast_register_application(app, agi_exec, synopsis, descrip);
}
-diff -urN asterisk-1.2.7.1.orig/res/res_features.c asterisk-1.2.7.1/res/res_features.c
---- asterisk-1.2.7.1.orig/res/res_features.c 2006-04-10 19:29:51.000000000 +0200
-+++ asterisk-1.2.7.1/res/res_features.c 2006-04-18 14:39:28.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/res/res_features.c asterisk-1.2.9.1/res/res_features.c
+--- asterisk-1.2.9.1.orig/res/res_features.c 2006-05-23 19:15:23.000000000 +0200
++++ asterisk-1.2.9.1/res/res_features.c 2006-06-09 10:25:04.000000000 +0200
@@ -11,6 +11,10 @@
* the project provides a web site, mailing lists and IRC
* channels for your use.
/* exec an app by feature */
static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
{
-@@ -1014,7 +1092,7 @@
+@@ -1018,7 +1096,7 @@
return res;
while ((tok = strsep(&tmp, "#")) != NULL) {
if (feature) {
/* Feature is up for consideration */
-@@ -1064,7 +1142,7 @@
+@@ -1071,7 +1149,7 @@
/* while we have a feature */
while (NULL != (tok = strsep(&tmp, "#"))) {
if (ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
if (ast_test_flag(feature, AST_FEATURE_FLAG_CALLER))
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
-@@ -1089,7 +1167,7 @@
+@@ -1096,7 +1174,7 @@
struct ast_frame *f = NULL;
int res = 0, ready = 0;
ast_set_callerid(chan, cid_num, cid_name, cid_num);
ast_channel_inherit_variables(caller, chan);
if (!ast_call(chan, data, timeout)) {
-@@ -1541,9 +1619,10 @@
+@@ -1549,9 +1627,10 @@
"Channel: %s\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n"
);
if (option_verbose > 1)
-@@ -1586,9 +1665,10 @@
+@@ -1594,9 +1673,10 @@
"Channel: %s\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n"
);
/* There's a problem, hang them up*/
-@@ -1675,6 +1755,280 @@
+@@ -1683,6 +1763,280 @@
return res;
}
static int park_exec(struct ast_channel *chan, void *data)
{
int res=0;
-@@ -1723,9 +2077,10 @@
+@@ -1731,9 +2085,10 @@
"From: %s\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n"
);
free(pu);
-@@ -1893,12 +2248,13 @@
+@@ -1901,12 +2256,13 @@
"Timeout: %ld\r\n"
"CallerID: %s\r\n"
"CallerIDName: %s\r\n"
,idText);
cur = cur->next;
-@@ -1914,6 +2270,386 @@
+@@ -1922,6 +2278,386 @@
return RESULT_SUCCESS;
}
int ast_pickup_call(struct ast_channel *chan)
{
-@@ -2068,7 +2804,7 @@
+@@ -2076,7 +2812,7 @@
}
{
int mallocd=0;
if (!feature) {
-@@ -2144,14 +2880,22 @@
+@@ -2151,14 +2887,22 @@
if ((res = load_config()))
return res;
ast_cli_register(&showparked);
return res;
}
-@@ -2162,7 +2906,11 @@
+@@ -2169,7 +2913,11 @@
ast_manager_unregister("ParkedCalls");
ast_cli_unregister(&showfeatures);
ast_unregister_application(parkcall);
return ast_unregister_application(parkedcall);
}
-diff -urN asterisk-1.2.7.1.orig/res/res_watchdog.c asterisk-1.2.7.1/res/res_watchdog.c
---- asterisk-1.2.7.1.orig/res/res_watchdog.c 1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.7.1/res/res_watchdog.c 2006-04-24 09:39:12.000000000 +0200
+diff -urN asterisk-1.2.9.1.orig/res/res_monitor.c asterisk-1.2.9.1/res/res_monitor.c
+--- asterisk-1.2.9.1.orig/res/res_monitor.c 2006-03-02 20:05:40.000000000 +0100
++++ asterisk-1.2.9.1/res/res_monitor.c 2006-06-09 10:25:04.000000000 +0200
+@@ -90,7 +90,7 @@
+
+ /* Start monitoring a channel */
+ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
+- const char *fname_base, int need_lock)
++ const char *fname_base, const char *target_url, const char *target_script, int need_lock)
+ {
+ int res = 0;
+ char tmp[256];
+@@ -122,6 +122,11 @@
+ }
+ memset(monitor, 0, sizeof(struct ast_channel_monitor));
+
++ if (target_url)
++ ast_copy_string(monitor->target_url, target_url, sizeof(monitor->target_url));
++ if (target_script)
++ ast_copy_string(monitor->target_script, target_script, sizeof(monitor->target_script));
++
+ /* Determine file names */
+ if (!ast_strlen_zero(fname_base)) {
+ int directory = strchr(fname_base, '/') ? 1 : 0;
+@@ -257,6 +262,8 @@
+ if (chan->monitor->joinfiles && !ast_strlen_zero(chan->monitor->filename_base)) {
+ char tmp[1024];
+ char tmp2[1024];
++ char tmp3[1024];
++ int result;
+ char *format = !strcasecmp(chan->monitor->format,"wav49") ? "WAV" : chan->monitor->format;
+ char *name = chan->monitor->filename_base;
+ int directory = strchr(name, '/') ? 1 : 0;
+@@ -278,9 +285,19 @@
+ snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s/%s-\"* ) &",tmp, dir ,name); /* remove legs when done mixing */
+ ast_copy_string(tmp, tmp2, sizeof(tmp));
+ }
+- ast_log(LOG_DEBUG,"monitor executing %s\n",tmp);
+- if (ast_safe_system(tmp) == -1)
++ if (!ast_strlen_zero(chan->monitor->target_script) && !ast_strlen_zero(chan->monitor->target_url)) {
++ snprintf(tmp3,sizeof(tmp3), "( %s& nice -19 %s \"%s/%s.%s\" \"%s\" ) &",tmp, chan->monitor->target_script , dir, name, format, chan->monitor->target_url);
++ ast_copy_string(tmp, tmp3, sizeof(tmp));
++ }
++ ast_log(LOG_NOTICE,"monitor executing %s\n",tmp);
++ result = ast_safe_system(tmp);
++ if (result == -1)
+ ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
++ manager_event(EVENT_FLAG_CALL, "MonitorStopped",
++ "Channel: %s\r\n"
++ "Uniqueid: %s\r\n"
++ "Result: %d\r\n"
++ ,chan->name, chan->uniqueid, result);
+ }
+
+ free(chan->monitor->format);
+@@ -392,7 +409,7 @@
+ return 0;
+ }
+
+- res = ast_monitor_start(chan, format, fname_base, 1);
++ res = ast_monitor_start(chan, format, fname_base, NULL, NULL, 1);
+ if (res < 0)
+ res = ast_monitor_change_fname(chan, fname_base, 1);
+ ast_monitor_setjoinfiles(chan, joinfiles);
+@@ -428,19 +445,30 @@
+ {
+ struct ast_channel *c = NULL;
+ char *name = astman_get_header(m, "Channel");
++ char *uniqueid = astman_get_header(m, "Uniqueid");
+ char *fname = astman_get_header(m, "File");
+ char *format = astman_get_header(m, "Format");
+ char *mix = astman_get_header(m, "Mix");
++ char *target_url = astman_get_header(m, "TargetURL");
++ char *target_script = astman_get_header(m, "TargetScript");
+ char *d;
+
+- if (ast_strlen_zero(name)) {
+- astman_send_error(s, m, "No channel specified");
++ if (ast_strlen_zero(name) && ast_strlen_zero(uniqueid)) {
++ astman_send_error(s, m, "No channel/uniqueid specified");
+ return 0;
+ }
+- c = ast_get_channel_by_name_locked(name);
+- if (!c) {
++ if (!ast_strlen_zero(uniqueid)) {
++ c = ast_get_channel_by_uniqueid_locked(uniqueid);
++ if (!c) {
++ astman_send_error(s, m, "No such uniqueid");
++ return 0;
++ }
++ } else {
++ c = ast_get_channel_by_name_locked(name);
++ if (!c) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
++ }
+ }
+
+ if (ast_strlen_zero(fname)) {
+@@ -457,7 +485,7 @@
+ if ((d=strchr(fname, '/'))) *d='-';
+ }
+
+- if (ast_monitor_start(c, format, fname, 1)) {
++ if (ast_monitor_start(c, format, fname, target_url, target_script, 1)) {
+ if (ast_monitor_change_fname(c, fname, 1)) {
+ astman_send_error(s, m, "Could not start monitoring channel");
+ ast_mutex_unlock(&c->lock);
+@@ -483,16 +511,26 @@
+ {
+ struct ast_channel *c = NULL;
+ char *name = astman_get_header(m, "Channel");
++ char *uniqueid = astman_get_header(m, "Uniqueid");
+ int res;
+- if (ast_strlen_zero(name)) {
+- astman_send_error(s, m, "No channel specified");
++ if (ast_strlen_zero(name) && ast_strlen_zero(uniqueid)) {
++ astman_send_error(s, m, "No channel/uniqueid specified");
+ return 0;
+ }
+- c = ast_get_channel_by_name_locked(name);
+- if (!c) {
++ if (!ast_strlen_zero(uniqueid)) {
++ c = ast_get_channel_by_uniqueid_locked(uniqueid);
++ if (!c) {
++ astman_send_error(s, m, "No such uniqueid");
++ return 0;
++ }
++ } else {
++ c = ast_get_channel_by_name_locked(name);
++ if (!c) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
++ }
+ }
++
+ res = ast_monitor_stop(c, 1);
+ ast_mutex_unlock(&c->lock);
+ if (res) {
+diff -urN asterisk-1.2.9.1.orig/res/res_watchdog.c asterisk-1.2.9.1/res/res_watchdog.c
+--- asterisk-1.2.9.1.orig/res/res_watchdog.c 1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.9.1/res/res_watchdog.c 2006-06-09 10:25:04.000000000 +0200
@@ -0,0 +1,149 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+{
+ return ASTERISK_GPL_KEY;
+}
-diff -urN asterisk-1.2.7.1.orig/rtp.c asterisk-1.2.7.1/rtp.c
---- asterisk-1.2.7.1.orig/rtp.c 2006-03-15 19:07:06.000000000 +0100
-+++ asterisk-1.2.7.1/rtp.c 2006-04-18 14:39:28.000000000 +0200
-@@ -442,6 +442,11 @@
+diff -urN asterisk-1.2.9.1.orig/rtp.c asterisk-1.2.9.1/rtp.c
+--- asterisk-1.2.9.1.orig/rtp.c 2006-06-01 00:26:38.000000000 +0200
++++ asterisk-1.2.9.1/rtp.c 2006-06-09 10:25:04.000000000 +0200
+@@ -444,6 +444,11 @@
struct rtpPayloadType rtpPT;
len = sizeof(sin);
-diff -urN libpri-1.2.2.orig/Makefile libpri-1.2.2/Makefile
---- libpri-1.2.2.orig/Makefile 2006-01-10 21:19:14.000000000 +0100
-+++ libpri-1.2.2/Makefile 2006-01-18 12:28:07.000000000 +0100
-@@ -38,7 +38,7 @@
+diff -urN libpri-1.2.3.orig/Makefile libpri-1.2.3/Makefile
+--- libpri-1.2.3.orig/Makefile 2006-04-30 17:17:47.000000000 +0200
++++ libpri-1.2.3/Makefile 2006-06-09 10:18:25.000000000 +0200
+@@ -27,6 +27,9 @@
+ # Uncomment if you want libpri to count number of Q921/Q931 sent/received
+ #LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
+
++# Uncomment if you want libpri to always keep layer 2 up
++#LAYER2ALWAYSUP=-DLAYER2ALWAYSUP
++
+ CC=gcc
+
+ OSARCH=$(shell uname -s)
+@@ -38,7 +41,7 @@
DYNAMIC_LIBRARY=libpri.so.1.0
STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
-CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS)
-+CFLAGS=-Wall -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS) -DRELAX_TRB
- INSTALL_PREFIX?=
++CFLAGS=-Wall -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS) $(LAYER2ALWAYSUP) -DRELAX_TRB
+ INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr
SOFLAGS = -Wl,-hlibpri.so.1.0
-diff -urN libpri-1.2.2.orig/README libpri-1.2.2/README
---- libpri-1.2.2.orig/README 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/README 2006-01-18 12:28:07.000000000 +0100
+diff -urN libpri-1.2.3.orig/README libpri-1.2.3/README
+--- libpri-1.2.3.orig/README 2006-02-15 18:59:38.000000000 +0100
++++ libpri-1.2.3/README 2006-01-18 12:28:07.000000000 +0100
@@ -1,6 +1,7 @@
--libpri: An implementation of Primate Rate ISDN
+-libpri: An implementation of Primary Rate ISDN
-
-Written by Mark Spencer <markster@digium.com>
+libpri: An implementation of Primate Rate ISDN (and BRI ISDN)
How do I report bugs or contribute?
-diff -urN libpri-1.2.2.orig/TODO libpri-1.2.2/TODO
---- libpri-1.2.2.orig/TODO 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/TODO 2006-01-18 12:28:07.000000000 +0100
+diff -urN libpri-1.2.3.orig/TODO libpri-1.2.3/TODO
+--- libpri-1.2.3.orig/TODO 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/TODO 2006-01-18 12:28:07.000000000 +0100
@@ -2,9 +2,7 @@
-- D-Channel Backup
-- Test against 4e
+-- Locking Shift IE (you did that already, didnt you??)
+-- Implement the 10 missing Q.931 timers
+-- more facilities
-diff -urN libpri-1.2.2.orig/libpri.h libpri-1.2.2/libpri.h
---- libpri-1.2.2.orig/libpri.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/libpri.h 2006-04-15 21:56:47.000000000 +0200
+diff -urN libpri-1.2.3.orig/libpri.h libpri-1.2.3/libpri.h
+--- libpri-1.2.3.orig/libpri.h 2006-04-27 18:08:39.000000000 +0200
++++ libpri-1.2.3/libpri.h 2006-06-06 14:28:32.000000000 +0200
@@ -5,6 +5,8 @@
*
* Copyright (C) 2001, Linux Support Services, Inc.
q931_call *call; /* Opaque call pointer */
long aoc_units; /* Advise of Charge number of charged units */
char useruserinfo[260]; /* User->User info */
-@@ -359,6 +381,7 @@
- typedef struct pri_event_setup_ack {
- int e;
- int channel;
-+ q931_call *call; /* Opaque call pointer */
- } pri_event_setup_ack;
-
- typedef struct pri_event_notify {
-@@ -374,20 +397,80 @@
+@@ -375,20 +397,80 @@
char digits[64];
} pri_event_keypad_digit;
pri_event_keypad_digit digit; /* Digits that come during a call */
} pri_event;
-@@ -402,7 +485,9 @@
+@@ -403,7 +485,9 @@
channel operating in HDLC mode with FCS computed by the fd's driver. Also it
must be NON-BLOCKING! Frames received on the fd should include FCS. Nodetype
must be one of PRI_NETWORK or PRI_CPE. switchtype should be PRI_SWITCH_* */
/* Create D-channel just as above with user defined I/O callbacks and data */
extern struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata);
-@@ -426,6 +511,9 @@
+@@ -427,6 +511,9 @@
/* Enable transmission support of Facility IEs on the pri */
extern void pri_facility_enable(struct pri *pri);
/* Run PRI on the given D-channel, taking care of any events that
need to be handled. If block is set, it will block until an event
occurs which needs to be handled */
-@@ -462,6 +550,12 @@
+@@ -463,6 +550,12 @@
/* Send a digit in overlap mode */
extern int pri_information(struct pri *pri, q931_call *call, char digit);
/* Answer the incomplete(call without called number) call on the given channel.
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
extern int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
-@@ -470,6 +564,35 @@
+@@ -471,6 +564,35 @@
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
extern int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
/* Set CRV reference for GR-303 calls */
-@@ -478,14 +601,14 @@
+@@ -479,14 +601,14 @@
/* backwards compatibility for those who don't use asterisk with libpri */
#define pri_release(a,b,c) \
#define PRI_DESTROYCALL
extern void pri_destroycall(struct pri *pri, q931_call *call);
-@@ -518,14 +641,13 @@
+@@ -519,14 +641,13 @@
extern void pri_sr_free(struct pri_sr *sr);
extern int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn);
extern void pri_call_set_useruser(q931_call *sr, char *userchars);
extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
-@@ -546,8 +668,8 @@
+@@ -547,8 +668,8 @@
/* Override message and error stuff */
#define PRI_NEW_SET_API
/* Set overlap mode */
#define PRI_SET_OVERLAPDIAL
-diff -urN libpri-1.2.2.orig/pri.c libpri-1.2.2/pri.c
---- libpri-1.2.2.orig/pri.c 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri.c 2006-04-15 21:57:09.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri.c libpri-1.2.3/pri.c
+--- libpri-1.2.3.orig/pri.c 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri.c 2006-06-09 10:17:29.000000000 +0200
@@ -1,24 +1,14 @@
/*
* libpri: An implementation of Primary Rate ISDN
return 0;
}
-@@ -851,3 +979,10 @@
+@@ -851,3 +979,12 @@
sr->redirectingreason = reason;
return 0;
}
+
+void pri_shutdown(struct pri *pri)
+{
++#ifndef LAYER2ALWAYSUP
+ if ((pri->localtype == BRI_NETWORK) || (pri->localtype == BRI_CPE) || (pri->localtype == BRI_CPE_PTMP)) {
+ q921_reset(pri, pri->tei, 1);
+ }
++#endif
+}
-diff -urN libpri-1.2.2.orig/pri_facility.c libpri-1.2.2/pri_facility.c
---- libpri-1.2.2.orig/pri_facility.c 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_facility.c 2006-04-15 21:56:10.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri_facility.c libpri-1.2.3/pri_facility.c
+--- libpri-1.2.3.orig/pri_facility.c 2006-02-14 00:06:02.000000000 +0100
++++ libpri-1.2.3/pri_facility.c 2006-06-06 14:26:01.000000000 +0200
@@ -1,26 +1,17 @@
-/*
- * libpri: An implementation of Primary Rate ISDN
}
return 0;
-@@ -1148,13 +1216,15 @@
+@@ -1152,13 +1220,15 @@
NEXT_COMPONENT(comp, i);
/* No argument - return with error */
if (pri->debug & PRI_DEBUG_APDU)
pri_message(pri, " [ Handling operation %d ]\n", operation_tag);
-@@ -1178,7 +1248,11 @@
+@@ -1182,7 +1252,11 @@
case ROSE_DIVERTING_LEG_INFORMATION2:
if (pri->debug & PRI_DEBUG_APDU)
pri_message(pri, " Handle DivertingLegInformation2\n");
case ROSE_AOC_NO_CHARGING_INFO_AVAILABLE:
if (pri->debug & PRI_DEBUG_APDU) {
pri_message(pri, "ROSE %i: AOC No Charging Info Available - not handled!", operation_tag);
-@@ -1206,6 +1280,7 @@
+@@ -1210,6 +1284,7 @@
}
return -1;
case ROSE_AOC_AOCD_CHARGING_UNIT:
if (pri->debug & PRI_DEBUG_APDU) {
pri_message(pri, "ROSE %i: AOC-D Charging Unit - not handled!", operation_tag);
dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
-@@ -1220,7 +1295,7 @@
+@@ -1224,7 +1299,7 @@
case ROSE_AOC_AOCE_CHARGING_UNIT:
return aoc_aoce_charging_unit_decode(pri, call, (u_int8_t *)comp, comp->len + 2);
if (0) { /* the following function is currently not used - just to make the compiler happy */
return 0;
}
case ROSE_AOC_IDENTIFICATION_OF_CHARGE:
-@@ -1229,6 +1304,22 @@
+@@ -1233,6 +1308,22 @@
dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
}
return -1;
default:
if (pri->debug & PRI_DEBUG_APDU) {
pri_message(pri, "!! Unable to handle ROSE operation %d", operation_tag);
-diff -urN libpri-1.2.2.orig/pri_facility.h libpri-1.2.2/pri_facility.h
---- libpri-1.2.2.orig/pri_facility.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_facility.h 2006-04-15 21:35:05.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri_facility.h libpri-1.2.3/pri_facility.h
+--- libpri-1.2.3.orig/pri_facility.h 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri_facility.h 2006-04-15 21:35:05.000000000 +0200
@@ -34,7 +34,7 @@
/* Operation ID values */
/* Q.952 ROSE operations (Diverting) */
+extern int aoc_aoce_charging_unit_encode(struct pri *pri, q931_call *c, long chargedunits, int send_facility_message);
+
#endif /* _PRI_FACILITY_H */
-diff -urN libpri-1.2.2.orig/pri_internal.h libpri-1.2.2/pri_internal.h
---- libpri-1.2.2.orig/pri_internal.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_internal.h 2006-04-15 21:57:19.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri_internal.h libpri-1.2.3/pri_internal.h
+--- libpri-1.2.3.orig/pri_internal.h 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri_internal.h 2006-04-15 21:57:19.000000000 +0200
@@ -5,6 +5,8 @@
*
* Copyright (C) 2001, Linux Support Services, Inc.
extern void pri_error(struct pri *pri, char *fmt, ...);
void libpri_copy_string(char *dst, const char *src, size_t size);
-diff -urN libpri-1.2.2.orig/pri_q921.h libpri-1.2.2/pri_q921.h
---- libpri-1.2.2.orig/pri_q921.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_q921.h 2006-04-15 21:57:24.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri_q921.h libpri-1.2.3/pri_q921.h
+--- libpri-1.2.3.orig/pri_q921.h 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri_q921.h 2006-04-15 21:57:24.000000000 +0200
@@ -5,6 +5,8 @@
*
* Copyright (C) 2001, Linux Support Services, Inc.
+extern int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr, int tei);
#endif
-diff -urN libpri-1.2.2.orig/pri_q931.h libpri-1.2.2/pri_q931.h
---- libpri-1.2.2.orig/pri_q931.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_q931.h 2006-04-15 21:57:29.000000000 +0200
+diff -urN libpri-1.2.3.orig/pri_q931.h libpri-1.2.3/pri_q931.h
+--- libpri-1.2.3.orig/pri_q931.h 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri_q931.h 2006-04-15 21:57:29.000000000 +0200
@@ -5,6 +5,8 @@
*
* Copyright (C) 2001, Linux Support Services, Inc.
+//extern int q931_facility(struct pri *pri, q931_call *c, int operation, char *arguments);
+
#endif
-diff -urN libpri-1.2.2.orig/pri_timers.h libpri-1.2.2/pri_timers.h
---- libpri-1.2.2.orig/pri_timers.h 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_timers.h 2006-01-18 12:28:07.000000000 +0100
+diff -urN libpri-1.2.3.orig/pri_timers.h libpri-1.2.3/pri_timers.h
+--- libpri-1.2.3.orig/pri_timers.h 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pri_timers.h 2006-01-18 12:28:07.000000000 +0100
@@ -27,17 +27,17 @@
/* -1 means we dont currently support the timer/counter */
-1, /* T304 */ \
30000, /* T305 */ \
-1, /* T306 */ \
-diff -urN libpri-1.2.2.orig/pridump.c libpri-1.2.2/pridump.c
---- libpri-1.2.2.orig/pridump.c 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pridump.c 2006-01-18 12:28:07.000000000 +0100
+diff -urN libpri-1.2.3.orig/pridump.c libpri-1.2.3/pridump.c
+--- libpri-1.2.3.orig/pridump.c 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pridump.c 2006-01-18 12:28:07.000000000 +0100
@@ -1,9 +1,9 @@
/*
* libpri: An implementation of Primary Rate ISDN
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
-diff -urN libpri-1.2.2.orig/prisched.c libpri-1.2.2/prisched.c
---- libpri-1.2.2.orig/prisched.c 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/prisched.c 2006-04-15 21:57:42.000000000 +0200
+diff -urN libpri-1.2.3.orig/prisched.c libpri-1.2.3/prisched.c
+--- libpri-1.2.3.orig/prisched.c 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/prisched.c 2006-04-15 21:57:42.000000000 +0200
@@ -1,10 +1,12 @@
/*
* libpri: An implementation of Primary Rate ISDN
+ pri->pri_sched[id].callback2 = NULL;
}
+
-diff -urN libpri-1.2.2.orig/pritest.c libpri-1.2.2/pritest.c
---- libpri-1.2.2.orig/pritest.c 2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pritest.c 2006-01-18 12:28:07.000000000 +0100
+diff -urN libpri-1.2.3.orig/pritest.c libpri-1.2.3/pritest.c
+--- libpri-1.2.3.orig/pritest.c 2005-11-29 19:39:18.000000000 +0100
++++ libpri-1.2.3/pritest.c 2006-01-18 12:28:07.000000000 +0100
@@ -1,9 +1,9 @@
/*
* libpri: An implementation of Primary Rate ISDN
default:
fprintf(stderr, "--!! Unknown PRI event %d\n", e->e);
}
-diff -urN libpri-1.2.2.orig/q921.c libpri-1.2.2/q921.c
---- libpri-1.2.2.orig/q921.c 2005-12-06 22:35:50.000000000 +0100
-+++ libpri-1.2.2/q921.c 2006-04-24 13:44:24.000000000 +0200
+diff -urN libpri-1.2.3.orig/q921.c libpri-1.2.3/q921.c
+--- libpri-1.2.3.orig/q921.c 2005-12-06 22:35:50.000000000 +0100
++++ libpri-1.2.3/q921.c 2006-06-15 14:55:46.000000000 +0200
@@ -1,10 +1,12 @@
/*
* libpri: An implementation of Primary Rate ISDN
+ q921_rr(pri, h->s.p_f, 0, h->h.tei);
+// }
+ }
- }
-- pri->busy = 1;
-- break;
++ }
+ pri->busy[teio] = 1;
+ if (pri->t200_timer[teio]) {
+ pri_schedule_del(pri, pri->t200_timer[teio]);
+ pri->t200_timer[teio] = 0;
-+ }
+ }
+- pri->busy = 1;
+- break;
+ pri->t200_timer[teio] = pri_schedule_event2(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri, h->h.tei);
+ break;
case 2:
return ev;
} else {
-@@ -830,21 +1602,144 @@
+@@ -830,21 +1602,148 @@
pri_message(pri, "-- Ignoring unsolicited DM with p/f set to 0\n");
#if 0
/* Requesting that we start */
+ }
+ break;
+ case Q931_PROTOCOL_DISCRIMINATOR:
-+ if (pri->localtype == BRI_CPE_PTMP) {
-+ res = q931_receive(pri, (q931_h *)h->u.data, len-3, h->h.tei);
-+ /* Send an RR if one wasn't sent already */
-+ if (pri->v_na[teio] != pri->v_r[teio])
-+ q921_rr(pri, 0, 0, pri->tei);
-+ if (res == -1) {
-+ return NULL;
-+ }
-+ if (res & Q931_RES_HAVEEVENT)
-+ return &pri->ev;
++ if ((pri->localtype == BRI_CPE_PTMP) || (pri->localtype == BRI_CPE)){
++ res = q931_receive(pri, (q931_h *)h->u.data, len-3, h->h.tei);
++ /* Send an RR if one wasn't sent already */
++ if (pri->v_na[teio] != pri->v_r[teio])
++ q921_rr(pri, 0, 0, pri->tei);
++ if (res == -1) {
++ return NULL;
++ }
++ if (res & Q931_RES_HAVEEVENT)
++ return &pri->ev;
+ }
+ break;
+ }
- q921_start(pri, 0);
+ q921_send_ua(pri, h->u.p_f, h->h.tei);
+ ev = q921_dchannel_down(pri, h->h.tei);
++#ifndef LAYER2ALWAYSUP
+ if ((pri->localtype == BRI_CPE_PTMP) || (pri->localtype == BRI_CPE) || (pri->localtype == BRI_NETWORK)) {
+ /* release layer 2 */
+ return NULL;
+ }
+ if ((pri->localtype == PRI_NETWORK) || (pri->localtype == PRI_CPE)){
++#endif
+ q921_start(pri, 0, 0);
++#ifndef LAYER2ALWAYSUP
+ }
++#endif
return ev;
case 3:
if (h->u.m2 == 3) {
-@@ -866,17 +1761,28 @@
+@@ -866,17 +1765,28 @@
}
}
/* Send Unnumbered Acknowledgement */
} else
pri_error(pri, "!! Weird frame received (m3=3, m2 = %d)\n", h->u.m2);
break;
-@@ -901,19 +1807,42 @@
+@@ -901,19 +1811,42 @@
/* Discard FCS */
len -= 2;
#ifdef PROCESS_SUBCHANNELS
/* If it's not us, try any subchannels we have */
if (pri->subchannel)
-@@ -921,10 +1850,16 @@
+@@ -921,10 +1854,16 @@
else
#endif
return NULL;
return ev;
}
-@@ -938,14 +1873,58 @@
+@@ -938,14 +1877,58 @@
return e;
}
- /* Do the SABME XXX Maybe we should implement T_WAIT? XXX */
- q921_send_sabme(pri, now);
}
-diff -urN libpri-1.2.2.orig/q931.c libpri-1.2.2/q931.c
---- libpri-1.2.2.orig/q931.c 2006-01-17 14:43:18.000000000 +0100
-+++ libpri-1.2.2/q931.c 2006-04-24 10:35:43.000000000 +0200
+diff -urN libpri-1.2.3.orig/q931.c libpri-1.2.3/q931.c
+--- libpri-1.2.3.orig/q931.c 2006-04-27 18:08:39.000000000 +0200
++++ libpri-1.2.3/q931.c 2006-06-13 10:53:33.000000000 +0200
@@ -1,10 +1,12 @@
/*
* libpri: An implementation of Primary Rate ISDN
pri_error(pri, "!! No channel map, no channel, and no ds1? What am I supposed to identify?\n");
return -1;
}
-@@ -734,8 +797,12 @@
+@@ -734,9 +797,13 @@
return code2str(pres, press, sizeof(press) / sizeof(press[0]));
}
-static void q931_get_number(unsigned char *num, int maxlen, unsigned char *src, int len)
+static void q931_get_number(char *num, int maxlen, unsigned char *src, int len)
{
+- if ((len < 0) || (len > maxlen - 1)) {
+ if (len < 0) {
+ pri_error(NULL, "q931_get_number received invalid len = %d\n", len);
+ return;
+ }
- if (len > maxlen - 1) {
++ if (len > maxlen - 1) {
num[0] = 0;
return;
+ }
@@ -746,50 +813,75 @@
static FUNC_DUMP(dump_called_party_number)
static FUNC_DUMP(dump_calling_party_subaddr)
{
- unsigned char cnum[256];
-- q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
+- q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
- pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n",
- prefix, len, ie->data[0] >> 7,
- subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
- (ie->data[0] & 0x08) >> 3, cnum);
+ char cnum[256];
+ if (len >= 4) {
-+ q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
++ q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
+ pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n",
+ prefix, len, ie->data[0] >> 7,
+ subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
static FUNC_RECV(receive_calling_party_subaddr)
{
/* copy digits to call->callingsubaddr */
-- q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
+- q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
+ if (len >= 4) {
-+ q931_get_number(call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
++ q931_get_number(call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
+ } else {
+ pri_error(call->pri, "Calling Party Subaddress (len=%2d) too short.\n", len);
+ }
if (channel) {
c->ds1no = (channel & 0xff00) >> 8;
c->ds1explicit = (channel & 0x10000) >> 16;
-@@ -2569,9 +3351,36 @@
+@@ -2566,12 +3348,40 @@
+ c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
+ } else
+ c->progressmask = 0;
++c->progressmask = PRI_PROG_INBAND_AVAILABLE;
c->ourcallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING;
c->alive = 1;
static void pri_connect_timeout(void *data)
{
struct q931_call *c = data;
-@@ -2624,6 +3433,7 @@
+@@ -2624,6 +3434,7 @@
int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
{
if (channel) {
c->ds1no = (channel & 0xff00) >> 8;
c->ds1explicit = (channel & 0x10000) >> 16;
-@@ -2638,22 +3448,37 @@
+@@ -2638,22 +3449,37 @@
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
} else
c->progressmask = 0;
c->ourcallstate = Q931_CALL_STATE_RELEASE_REQUEST;
/* c->peercallstate stays the same */
if (c->alive) {
-@@ -2669,7 +3494,14 @@
+@@ -2669,7 +3495,14 @@
} else {
c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T308], pri_release_finaltimeout, c);
}
} else
return send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies); /* Yes, release_ies, not release_complete_ies */
} else
-@@ -2681,7 +3513,7 @@
+@@ -2681,7 +3514,7 @@
int q931_restart(struct pri *pri, int channel)
{
struct q931_call *c;
if (!c)
return -1;
if (!channel)
-@@ -2698,10 +3530,12 @@
+@@ -2698,10 +3531,12 @@
return send_message(pri, c, Q931_RESTART, restart_ies);
}
c->ourcallstate = Q931_CALL_STATE_DISCONNECT_REQUEST;
c->peercallstate = Q931_CALL_STATE_DISCONNECT_INDICATION;
if (c->alive) {
-@@ -2713,14 +3547,27 @@
+@@ -2713,14 +3548,27 @@
if (c->retranstimer)
pri_schedule_del(pri, c->retranstimer);
c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T305], pri_disconnect_timeout, c);
static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
static int cis_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_CALLED_PARTY_NUMBER, -1 };
-@@ -2728,7 +3575,12 @@
+@@ -2728,7 +3576,12 @@
int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
{
int res;
c->transcapability = req->transmode;
c->transmoderate = TRANS_MODE_64_CIRCUIT;
-@@ -2753,6 +3605,7 @@
+@@ -2753,6 +3606,7 @@
c->chanflags = FLAG_EXCLUSIVE;
else if (c->channelno)
c->chanflags = FLAG_PREFERRED;
if (req->caller) {
libpri_copy_string(c->callernum, req->caller, sizeof(c->callernum));
c->callerplan = req->callerplan;
-@@ -2812,14 +3665,19 @@
+@@ -2812,14 +3666,19 @@
res = send_message(pri, c, Q931_SETUP, gr303_setup_ies);
else if (c->justsignalling)
res = send_message(pri, c, Q931_SETUP, cis_setup_ies);
}
return res;
-@@ -2835,7 +3693,11 @@
+@@ -2835,7 +3694,11 @@
if (cause > -1) {
c->cause = cause;
c->causecode = CODE_CCITT;
/* release_ies has CAUSE in it */
res = send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies);
} else
-@@ -2860,6 +3722,117 @@
+@@ -2860,6 +3723,117 @@
return 0;
}
int q931_hangup(struct pri *pri, q931_call *c, int cause)
{
int disconnect = 1;
-@@ -2871,7 +3844,7 @@
+@@ -2871,7 +3845,7 @@
/* If mandatory IE was missing, insist upon that cause code */
if (c->cause == PRI_CAUSE_MANDATORY_IE_MISSING)
cause = c->cause;
/* We'll send RELEASE_COMPLETE with these causes */
disconnect = 0;
release_compl = 1;
-@@ -2885,7 +3858,7 @@
+@@ -2885,7 +3859,7 @@
case Q931_CALL_STATE_NULL:
if (c->peercallstate == Q931_CALL_STATE_NULL)
/* free the resources if we receive or send REL_COMPL */
else if (c->peercallstate == Q931_CALL_STATE_RELEASE_REQUEST)
q931_release_complete(pri,c,cause);
break;
-@@ -2911,6 +3884,11 @@
+@@ -2911,6 +3885,11 @@
/* received SETUP_ACKNOWLEDGE */
/* send DISCONNECT in general */
if (c->peercallstate != Q931_CALL_STATE_NULL && c->peercallstate != Q931_CALL_STATE_DISCONNECT_REQUEST && c->peercallstate != Q931_CALL_STATE_DISCONNECT_INDICATION && c->peercallstate != Q931_CALL_STATE_RELEASE_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART) {
if (disconnect)
q931_disconnect(pri,c,cause);
else if (release_compl)
-@@ -2926,8 +3904,14 @@
+@@ -2926,8 +3905,14 @@
break;
case Q931_CALL_STATE_DISCONNECT_INDICATION:
/* received DISCONNECT */
q931_release(pri,c,cause);
}
break;
-@@ -2941,19 +3925,17 @@
+@@ -2941,19 +3926,17 @@
pri_error(pri, "q931_hangup shouldn't be called in this state, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
break;
default:
q931_call *c;
q931_ie *ie;
unsigned int x;
-@@ -2965,6 +3947,7 @@
+@@ -2965,6 +3948,7 @@
int codeset, cur_codeset;
int last_ie[8];
struct apdu_event *cur = NULL;
memset(last_ie, 0, sizeof(last_ie));
if (pri->debug & PRI_DEBUG_Q931_DUMP)
-@@ -2978,13 +3961,13 @@
+@@ -2978,13 +3962,13 @@
KLUDGE this by changing byte 4 from a 0xf (SERVICE)
to a 0x7 (SERVICE ACKNOWLEDGE) */
h->raw[h->crlen + 2] -= 0x8;
if (!c) {
pri_error(pri, "Unable to locate call %d\n", q931_cr(h));
return -1;
-@@ -3007,6 +3990,7 @@
+@@ -3007,6 +3991,7 @@
case Q931_SETUP:
if (pri->debug & PRI_DEBUG_Q931_STATE)
pri_message(pri, "-- Processing Q.931 Call Setup\n");
c->channelno = -1;
c->slotmap = -1;
c->chanflags = 0;
-@@ -3027,28 +4011,44 @@
+@@ -3027,28 +4012,44 @@
c->callername[0] = '\0';
c->callerani[0] = '\0';
c->callerplanani = -1;
c->progress = -1;
c->progressmask = 0;
break;
-@@ -3059,20 +4059,22 @@
+@@ -3059,20 +4060,22 @@
break;
case Q931_RELEASE:
case Q931_DISCONNECT:
case Q931_STATUS:
c->cause = -1;
c->causecode = -1;
-@@ -3089,22 +4091,32 @@
+@@ -3089,22 +4092,32 @@
case Q931_STATUS_ENQUIRY:
break;
case Q931_SETUP_ACKNOWLEDGE:
case Q931_SUSPEND_ACKNOWLEDGE:
case Q931_SUSPEND_REJECT:
pri_error(pri, "!! Not yet handling pre-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
-@@ -3113,7 +4125,7 @@
+@@ -3113,7 +4126,7 @@
pri_error(pri, "!! Don't know how to post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST);
if (c->newcall)
return -1;
}
memset(mandies, 0, sizeof(mandies));
-@@ -3193,12 +4205,19 @@
+@@ -3193,12 +4206,19 @@
missingmand = 0;
for (x=0;x<MAX_MAND_IES;x++) {
if (mandies[x]) {
}
}
-@@ -3207,7 +4226,7 @@
+@@ -3207,7 +4227,7 @@
case Q931_RESTART:
if (missingmand) {
q931_status(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING);
break;
}
c->ourcallstate = Q931_CALL_STATE_RESTART;
-@@ -3225,6 +4244,7 @@
+@@ -3225,6 +4245,7 @@
}
/* Must be new call */
if (!c->newcall) {
break;
}
if (c->progressmask & PRI_PROG_CALLER_NOT_ISDN)
-@@ -3242,16 +4262,20 @@
+@@ -3242,16 +4263,20 @@
pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.ring.callingpres = c->callerpres;
pri->ev.ring.callingplan = c->callerplan;
libpri_copy_string(pri->ev.ring.origcalledname, c->origcalledname, sizeof(pri->ev.ring.origcalledname));
libpri_copy_string(pri->ev.ring.origcallednum, c->origcallednum, sizeof(pri->ev.ring.origcallednum));
libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum));
-@@ -3261,11 +4285,13 @@
+@@ -3261,11 +4286,13 @@
pri->ev.ring.redirectingreason = c->redirectingreason;
pri->ev.ring.origredirectingreason = c->origredirectingreason;
pri->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE);
pri->ev.ring.redirectingreason = c->redirectingreason;
pri->ev.ring.progress = c->progress;
pri->ev.ring.progressmask = c->progressmask;
-@@ -3275,6 +4301,9 @@
+@@ -3275,6 +4302,9 @@
q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
break;
}
c->ourcallstate = Q931_CALL_STATE_CALL_DELIVERED;
c->peercallstate = Q931_CALL_STATE_CALL_RECEIVED;
pri->ev.e = PRI_EVENT_RINGING;
-@@ -3295,17 +4324,24 @@
+@@ -3295,17 +4325,24 @@
q931_status(pri, c, PRI_CAUSE_WRONG_MESSAGE);
break;
}
if (c->justsignalling) { /* Make sure WE release when we initiatie a signalling only connection */
q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING);
break;
-@@ -3313,23 +4349,43 @@
+@@ -3313,23 +4350,43 @@
return Q931_RES_HAVEEVENT;
case Q931_FACILITY:
if (c->newcall) {
break;
}
pri->ev.e = PRI_EVENT_PROGRESS;
-@@ -3347,6 +4403,11 @@
+@@ -3347,6 +4404,11 @@
q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
break;
}
pri->ev.proceeding.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
if (mh->msg == Q931_CALL_PROCEEDING) {
pri->ev.e = PRI_EVENT_PROCEEDING;
-@@ -3364,16 +4425,21 @@
+@@ -3364,16 +4426,21 @@
break;
}
if (c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) {
break;
}
if (c->newcall) {
-@@ -3410,31 +4476,69 @@
+@@ -3410,31 +4477,69 @@
if (res)
return res;
}
break;
case Q931_RELEASE:
if (missingmand) {
-@@ -3450,6 +4554,7 @@
+@@ -3450,6 +4555,7 @@
pri->ev.e = PRI_EVENT_HANGUP;
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
-@@ -3478,9 +4583,16 @@
+@@ -3478,9 +4584,16 @@
pri->ev.e = PRI_EVENT_HANGUP_REQ;
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cref = c->cr;
if (c->alive)
return Q931_RES_HAVEEVENT;
else
-@@ -3511,7 +4623,7 @@
+@@ -3511,7 +4624,7 @@
pri->ev.e = PRI_EVENT_INFO_RECEIVED;
pri->ev.ring.call = c;
pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
libpri_copy_string(pri->ev.ring.callingsubaddr, c->callingsubaddr, sizeof(pri->ev.ring.callingsubaddr));
pri->ev.ring.complete = c->complete; /* this covers IE 33 (Sending Complete) */
return Q931_RES_HAVEEVENT;
-@@ -3530,7 +4642,7 @@
- c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
+@@ -3531,7 +4644,6 @@
pri->ev.e = PRI_EVENT_SETUP_ACK;
pri->ev.setup_ack.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
+ pri->ev.setup_ack.call = c;
-
-+ pri->ev.setup_ack.call = c;
cur = c->apdus;
while (cur) {
if (!cur->sent && cur->message == Q931_FACILITY) {
-@@ -3546,19 +4658,53 @@
+@@ -3547,19 +4659,53 @@
pri->ev.notify.channel = c->channelno;
pri->ev.notify.info = c->notify;
return Q931_RES_HAVEEVENT;
case Q931_SUSPEND_ACKNOWLEDGE:
case Q931_SUSPEND_REJECT:
pri_error(pri, "!! Not yet handling post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
-@@ -3568,7 +4714,7 @@
+@@ -3569,7 +4715,7 @@
pri_error(pri, "!! Don't know how to post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST);
if (c->newcall)