[Pkg-voip-commits] r2623 - in asterisk: branches/sarge/debian branches/sarge/debian/patches trunk/debian

Kilian Krause kilian at costa.debian.org
Tue Oct 24 06:51:29 UTC 2006


Author: kilian
Date: 2006-10-24 06:51:26 +0000 (Tue, 24 Oct 2006)
New Revision: 2623

Added:
   asterisk/branches/sarge/debian/patches/cdr_sqlite3_custom.dpatch
   asterisk/branches/sarge/debian/patches/zapbri.dpatch
Modified:
   asterisk/branches/sarge/debian/changelog
   asterisk/branches/sarge/debian/patches/00list
   asterisk/branches/sarge/debian/patches/bristuff.dpatch
   asterisk/branches/sarge/debian/rules
   asterisk/branches/sarge/debian/watch
   asterisk/trunk/debian/changelog
Log:
backports and changelog fixup


Modified: asterisk/branches/sarge/debian/changelog
===================================================================
--- asterisk/branches/sarge/debian/changelog	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/branches/sarge/debian/changelog	2006-10-24 06:51:26 UTC (rev 2623)
@@ -1,15 +1,41 @@
+asterisk (1:1.2.13~dfsg-1) UNRELEASED; urgency=high
+
+  [ Kilian Krause ]
+  * Fixup dfsg versions with increased upstream build count.
+
+  [ Santiago Ruano Rincón ]
+  * Added cdr_sqlite3_custom dpatch
+
+  [ Mark Purcell ]
+  * New upstream release
+    - Remote compromise (Closes: #394025)
+    - Urgency high as this fixes remote compromise security issue
+  * Update debian/patches/bristuff.dpatch
+
+  * TODO: fixup
+    chan_sip.c: In function 'handle_request_refer':
+    chan_sip.c:10907: error: 'rp' undeclared (first use in this function)
+    chan_sip.c:10907: error: (Each undeclared identifier is reported only once
+    chan_sip.c:10907: error: for each function it appears in.)
+    chan_sip.c:10940: warning: type defaults to 'int' in declaration of '__p'
+    chan_sip.c:10940: warning: comparison of distinct pointer types lacks a cast
+    chan_sip.c: In function 'sipsock_read':
+    chan_sip.c:11618: error: too many arguments to function 'find_call'
+
+ -- Kilian Krause <kilian at debian.org>  Tue, 24 Oct 2006 08:50:43 +0200
+
 asterisk (1:1.2.12.1.dfsg-1) unstable; urgency=low
 
   [ Tzafrir Cohen ]
-  * NOT RELEASED YET
   * New upstream release
   * bristuff.dpatch: version adapted.
   * apprecord_sprintf.dpatch removed: already applied.
 
   [ Mark Purcell ]
   * binary blob in asterisk-classic package (Closes: #386361)
+  * Cleanup bristuff.dpatch
 
- -- Mark Purcell <msp at debian.org>  Wed, 13 Sep 2006 08:55:36 +0100
+ -- Mark Purcell <msp at debian.org>  Sun, 24 Sep 2006 14:45:58 +0100
 
 asterisk (1:1.2.11.dfsg-1) unstable; urgency=high
 
@@ -24,6 +50,7 @@
   * Please package Asterisk 1.2.11 and Zaptel 1.2.8 (Closes: #384283)
   * Better error handling on init.d reload, if asterisk isn't running
   * Lintian cleanup: not-binnmuable-any-depends-all
+  * Lintian cleanup: not-binnmuable-all-depends-any
   * Use restart in asterisk_fix
 
  -- Mark Purcell <msp at debian.org>  Sat,  2 Sep 2006 13:01:02 +0100
@@ -46,9 +73,8 @@
   [ Tzafrir Cohen]
   * New upstream release (Closes: #385060).
   * bristuff 0.3.0-PRE-1s (adapted to asterisk 1.2.11).
-  * apprecord_sprintf.dpatch: fix format string issue in app_record.so .
 
- -- Kilian Krause <kilian at debian.org>  Thu,  3 Aug 2006 12:04:00 +0200
+ -- Mark Purcell <msp at debian.org>  Thu, 17 Aug 2006 20:31:02 +0100
 
 asterisk (1:1.2.10.dfsg-2) unstable; urgency=high
 

Modified: asterisk/branches/sarge/debian/patches/00list
===================================================================
--- asterisk/branches/sarge/debian/patches/00list	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/branches/sarge/debian/patches/00list	2006-10-24 06:51:26 UTC (rev 2623)
@@ -17,3 +17,4 @@
 correct_pid_display
 zap_restart
 backport_playdtmf
+cdr_sqlite3_custom

Modified: asterisk/branches/sarge/debian/patches/bristuff.dpatch
===================================================================
--- asterisk/branches/sarge/debian/patches/bristuff.dpatch	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/branches/sarge/debian/patches/bristuff.dpatch	2006-10-24 06:51:26 UTC (rev 2623)
@@ -6,15 +6,9 @@
 ## DP: cygdef.h removed ;-)
 
 @DPATCH@
-diff -urN asterisk-1.2.10.orig/.version asterisk-1.2.10/.version
---- asterisk-1.2.10.orig/.version	2006-07-14 23:29:33.000000000 +0200
-+++ asterisk-1.2.10/.version	2006-07-31 14:13:27.000000000 +0200
-@@ -1 +1 @@
--1.2.12.1
-+1.2.12.1-BRIstuffed-0.3.0-PRE-1s
-diff -urN asterisk-1.2.10.orig/HARDWARE asterisk-1.2.10/HARDWARE
---- asterisk-1.2.10.orig/HARDWARE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/HARDWARE	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/HARDWARE asterisk-1.2.13.dfsg/HARDWARE
+--- asterisk-1.2.13.dfsg~/HARDWARE	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/HARDWARE	2006-10-23 22:22:34.000000000 +0100
 @@ -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.
@@ -35,9 +29,9 @@
  Non-zaptel compatible hardware
  ==============================
  
-diff -urN asterisk-1.2.10.orig/LICENSE asterisk-1.2.10/LICENSE
---- asterisk-1.2.10.orig/LICENSE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/LICENSE	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/LICENSE asterisk-1.2.13.dfsg/LICENSE
+--- asterisk-1.2.13.dfsg~/LICENSE	2006-10-17 18:22:01.000000000 +0100
++++ asterisk-1.2.13.dfsg/LICENSE	2006-10-23 22:22:34.000000000 +0100
 @@ -1,7 +1,7 @@
 -Asterisk is distributed under the GNU General Public License version 2
 -and is also available under alternative licenses negotiated directly
@@ -50,9 +44,9 @@
  except as defined below. The GPL (version 2) is included in this
  source tree in the file COPYING.
  
-diff -urN asterisk-1.2.10.orig/Makefile asterisk-1.2.10/Makefile
---- asterisk-1.2.10.orig/Makefile	2006-06-29 21:23:18.000000000 +0200
-+++ asterisk-1.2.10/Makefile	2006-08-10 11:07:53.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/Makefile asterisk-1.2.13.dfsg/Makefile
+--- asterisk-1.2.13.dfsg~/Makefile	2006-09-06 21:09:10.000000000 +0100
++++ asterisk-1.2.13.dfsg/Makefile	2006-10-23 22:22:34.000000000 +0100
 @@ -772,6 +772,9 @@
  		echo ";astctlowner = root" ; \
  		echo ";astctlgroup = apache" ; \
@@ -63,9 +57,9 @@
  		) > $(DESTDIR)$(ASTCONFPATH) ; \
  	else \
  		echo "Skipping asterisk.conf creation"; \
-diff -urN asterisk-1.2.10.orig/README asterisk-1.2.10/README
---- asterisk-1.2.10.orig/README	2006-03-03 09:12:33.000000000 +0100
-+++ asterisk-1.2.10/README	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/README asterisk-1.2.13.dfsg/README
+--- asterisk-1.2.13.dfsg~/README	2006-03-03 08:12:33.000000000 +0000
++++ asterisk-1.2.13.dfsg/README	2006-10-23 22:22:34.000000000 +0100
 @@ -4,6 +4,8 @@
  
  Copyright (C) 2001-2005 Digium, Inc.
@@ -75,9 +69,9 @@
  ================================================================
  
  * SECURITY
-diff -urN asterisk-1.2.10.orig/README.chan_capi asterisk-1.2.10/README.chan_capi
---- asterisk-1.2.10.orig/README.chan_capi	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/README.chan_capi	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/README.chan_capi asterisk-1.2.13.dfsg/README.chan_capi
+--- asterisk-1.2.13.dfsg~/README.chan_capi	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/README.chan_capi	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,146 @@
 +(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
 +(C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH 
@@ -225,9 +219,9 @@
 +	
 +
 +
-diff -urN asterisk-1.2.10.orig/agi/Makefile asterisk-1.2.10/agi/Makefile
---- asterisk-1.2.10.orig/agi/Makefile	2006-03-28 22:22:05.000000000 +0200
-+++ asterisk-1.2.10/agi/Makefile	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/agi/Makefile asterisk-1.2.13.dfsg/agi/Makefile
+--- asterisk-1.2.13.dfsg~/agi/Makefile	2006-03-28 21:22:05.000000000 +0100
++++ asterisk-1.2.13.dfsg/agi/Makefile	2006-10-23 22:22:34.000000000 +0100
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -246,9 +240,9 @@
  
  %.so : %.o
  	$(CC) -shared -Xlinker -x -o $@ $<
-diff -urN asterisk-1.2.10.orig/agi/xagi-test.c asterisk-1.2.10/agi/xagi-test.c
---- asterisk-1.2.10.orig/agi/xagi-test.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/agi/xagi-test.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/agi/xagi-test.c asterisk-1.2.13.dfsg/agi/xagi-test.c
+--- asterisk-1.2.13.dfsg~/agi/xagi-test.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/agi/xagi-test.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,175 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -425,9 +419,9 @@
 +		return -1;
 +	exit(0);
 +}
-diff -urN asterisk-1.2.10.orig/apps/Makefile asterisk-1.2.10/apps/Makefile
---- asterisk-1.2.10.orig/apps/Makefile	2006-04-30 15:38:22.000000000 +0200
-+++ asterisk-1.2.10/apps/Makefile	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/Makefile asterisk-1.2.13.dfsg/apps/Makefile
+--- asterisk-1.2.13.dfsg~/apps/Makefile	2006-04-30 14:38:22.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/Makefile	2006-10-23 22:22:34.000000000 +0100
 @@ -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 \
@@ -445,9 +439,9 @@
  
  #
  # Obsolete things...
-diff -urN asterisk-1.2.10.orig/apps/app_callingpres.c asterisk-1.2.10/apps/app_callingpres.c
---- asterisk-1.2.10.orig/apps/app_callingpres.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_callingpres.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_callingpres.c asterisk-1.2.13.dfsg/apps/app_callingpres.c
+--- asterisk-1.2.13.dfsg~/apps/app_callingpres.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_callingpres.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,70 @@
 +/*
 + * An application to change the CallingPresentation for an Asterisk channel.
@@ -519,9 +513,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_capiCD.c asterisk-1.2.10/apps/app_capiCD.c
---- asterisk-1.2.10.orig/apps/app_capiCD.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_capiCD.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_capiCD.c asterisk-1.2.13.dfsg/apps/app_capiCD.c
+--- asterisk-1.2.13.dfsg~/apps/app_capiCD.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_capiCD.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,172 @@
 +/*
 + * (CAPI*)
@@ -695,9 +689,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_capiECT.c asterisk-1.2.10/apps/app_capiECT.c
---- asterisk-1.2.10.orig/apps/app_capiECT.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_capiECT.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_capiECT.c asterisk-1.2.13.dfsg/apps/app_capiECT.c
+--- asterisk-1.2.13.dfsg~/apps/app_capiECT.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_capiECT.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,210 @@
 +/*
 + * (CAPI*)
@@ -909,9 +903,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_capiNoES.c asterisk-1.2.10/apps/app_capiNoES.c
---- asterisk-1.2.10.orig/apps/app_capiNoES.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_capiNoES.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_capiNoES.c asterisk-1.2.13.dfsg/apps/app_capiNoES.c
+--- asterisk-1.2.13.dfsg~/apps/app_capiNoES.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_capiNoES.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,96 @@
 +/*
 + * (CAPI*)
@@ -1009,9 +1003,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_chanisavail.c asterisk-1.2.10/apps/app_chanisavail.c
---- asterisk-1.2.10.orig/apps/app_chanisavail.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/apps/app_chanisavail.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_chanisavail.c asterisk-1.2.13.dfsg/apps/app_chanisavail.c
+--- asterisk-1.2.13.dfsg~/apps/app_chanisavail.c	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/apps/app_chanisavail.c	2006-10-23 22:22:34.000000000 +0100
 @@ -118,7 +118,7 @@
  				snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
  				status = inuse = ast_device_state(trychan);
@@ -1021,9 +1015,9 @@
  					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.10.orig/apps/app_chanspy.c asterisk-1.2.10/apps/app_chanspy.c
---- asterisk-1.2.10.orig/apps/app_chanspy.c	2006-06-14 16:07:53.000000000 +0200
-+++ asterisk-1.2.10/apps/app_chanspy.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_chanspy.c asterisk-1.2.13.dfsg/apps/app_chanspy.c
+--- asterisk-1.2.13.dfsg~/apps/app_chanspy.c	2006-10-13 18:01:22.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_chanspy.c	2006-10-23 22:22:34.000000000 +0100
 @@ -55,6 +55,7 @@
  
  static const char *synopsis = "Listen to the audio of an active channel\n";
@@ -1052,7 +1046,7 @@
  static void *spy_alloc(struct ast_channel *chan, void *data)
  {
  	/* just store the data pointer in the channel structure */
-@@ -554,11 +568,87 @@
+@@ -548,11 +562,87 @@
  	ALL_DONE(u, res);
  }
  
@@ -1141,7 +1135,7 @@
  
  	STANDARD_HANGUP_LOCALUSERS;
  
-@@ -567,7 +657,8 @@
+@@ -561,7 +651,8 @@
  
  int load_module(void)
  {
@@ -1151,9 +1145,9 @@
  }
  
  char *description(void)
-diff -urN asterisk-1.2.10.orig/apps/app_devstate.c asterisk-1.2.10/apps/app_devstate.c
---- asterisk-1.2.10.orig/apps/app_devstate.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_devstate.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_devstate.c asterisk-1.2.13.dfsg/apps/app_devstate.c
+--- asterisk-1.2.13.dfsg~/apps/app_devstate.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_devstate.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,225 @@
 +/*
 + * Devstate application
@@ -1380,9 +1374,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_dial.c asterisk-1.2.10/apps/app_dial.c
---- asterisk-1.2.10.orig/apps/app_dial.c	2006-06-09 20:08:00.000000000 +0200
-+++ asterisk-1.2.10/apps/app_dial.c	2006-08-04 11:23:28.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_dial.c asterisk-1.2.13.dfsg/apps/app_dial.c
+--- asterisk-1.2.13.dfsg~/apps/app_dial.c	2006-09-19 17:21:08.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_dial.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -1394,7 +1388,7 @@
   * 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.
-@@ -55,6 +59,7 @@
+@@ -56,6 +60,7 @@
  #include "asterisk/causes.h"
  #include "asterisk/manager.h"
  #include "asterisk/privacy.h"
@@ -1402,7 +1396,7 @@
  
  static char *tdesc = "Dialing Application";
  
-@@ -115,7 +120,8 @@
+@@ -116,7 +121,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"
@@ -1412,7 +1406,7 @@
  "    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"
-@@ -162,8 +168,11 @@
+@@ -163,8 +169,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"
@@ -1425,7 +1419,7 @@
  "    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"
-@@ -214,6 +223,8 @@
+@@ -215,6 +224,8 @@
  	OPT_CALLEE_MONITOR = (1 << 21),
  	OPT_CALLER_MONITOR = (1 << 22),
  	OPT_GOTO = (1 << 23),
@@ -1434,7 +1428,7 @@
  } dial_exec_option_flags;
  
  #define DIAL_STILLGOING			(1 << 30)
-@@ -252,6 +263,8 @@
+@@ -253,6 +264,8 @@
  	AST_APP_OPTION('p', OPT_SCREENING),
  	AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
  	AST_APP_OPTION('r', OPT_RINGBACK),
@@ -1443,7 +1437,7 @@
  	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),
-@@ -389,7 +402,7 @@
+@@ -390,7 +403,7 @@
  	char *context = NULL;
  	char cidname[AST_MAX_EXTENSION];
  
@@ -1452,7 +1446,7 @@
  	
  	if (single) {
  		/* Turn off hold music, etc */
-@@ -468,7 +481,7 @@
+@@ -469,7 +482,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 */
@@ -1461,7 +1455,7 @@
  						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
-@@ -586,12 +599,18 @@
+@@ -587,12 +600,18 @@
  							HANDLE_CAUSE(AST_CAUSE_CONGESTION, in);
  							break;
  						case AST_CONTROL_RINGING:
@@ -1486,7 +1480,7 @@
  							break;
  						case AST_CONTROL_PROGRESS:
  							if (option_verbose > 2)
-@@ -766,6 +785,7 @@
+@@ -767,6 +786,7 @@
  	int digit = 0, result = 0;
  	time_t start_time, answer_time, end_time;
  	struct ast_app *app = NULL;
@@ -1494,7 +1488,7 @@
  
  	char *parse;
  	AST_DECLARE_APP_ARGS(args,
-@@ -939,13 +959,13 @@
+@@ -940,13 +960,13 @@
  		}
  		
  		if( privdb_val == AST_PRIVACY_DENY ) {
@@ -1510,7 +1504,7 @@
  			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 +973,7 @@
+@@ -954,7 +974,7 @@
  			goto out; /* Is this right? */
  		}
  		else if( privdb_val == AST_PRIVACY_TORTURE ) {
@@ -1519,7 +1513,7 @@
  			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
  				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
  			}
-@@ -1001,7 +1021,7 @@
+@@ -1008,7 +1028,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");
  
@@ -1528,7 +1522,7 @@
  	cur = args.peers;
  	do {
  		/* Remember where to start next time */
-@@ -1043,7 +1063,7 @@
+@@ -1050,7 +1070,7 @@
  				ast_log(LOG_DEBUG, "Dialing by extension %s\n", numsubst);
  		}
  		/* Request the peer */
@@ -1537,7 +1531,7 @@
  		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));
-@@ -1074,7 +1094,7 @@
+@@ -1081,7 +1101,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 */
@@ -1546,7 +1540,7 @@
  				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
-@@ -1187,7 +1207,7 @@
+@@ -1194,7 +1214,7 @@
  
  	if (outgoing) {
  		/* Our status will at least be NOANSWER */
@@ -1555,7 +1549,7 @@
  		if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
  			moh=1;
  			ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
-@@ -1195,8 +1215,11 @@
+@@ -1202,8 +1222,11 @@
  			ast_indicate(chan, AST_CONTROL_RINGING);
  			sentringing++;
  		}
@@ -1569,7 +1563,7 @@
  
  	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);
-@@ -1561,18 +1584,22 @@
+@@ -1568,18 +1591,22 @@
  				ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);
  			if (play_to_callee)
  				ast_set_flag(&(config.features_callee), AST_FEATURE_PLAY_WARNING);
@@ -1598,7 +1592,7 @@
  
  			config.timelimit = timelimit;
  			config.play_warning = play_warning;
-@@ -1608,7 +1635,15 @@
+@@ -1615,7 +1642,15 @@
  		}
  		snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
  		pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
@@ -1615,9 +1609,9 @@
  		if (res != AST_PBX_NO_HANGUP_PEER) {
  			if (!chan->_softhangup)
  				chan->hangupcause = peer->hangupcause;
-diff -urN asterisk-1.2.10.orig/apps/app_directed_pickup.c asterisk-1.2.10/apps/app_directed_pickup.c
---- asterisk-1.2.10.orig/apps/app_directed_pickup.c	2006-04-06 19:00:10.000000000 +0200
-+++ asterisk-1.2.10/apps/app_directed_pickup.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_directed_pickup.c asterisk-1.2.13.dfsg/apps/app_directed_pickup.c
+--- asterisk-1.2.13.dfsg~/apps/app_directed_pickup.c	2006-04-06 18:00:10.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_directed_pickup.c	2006-10-23 22:22:34.000000000 +0100
 @@ -41,7 +41,7 @@
  #include "asterisk/app.h"
  
@@ -1627,10 +1621,10 @@
  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.10.orig/apps/app_meetme.c asterisk-1.2.10/apps/app_meetme.c
---- asterisk-1.2.10.orig/apps/app_meetme.c	2006-06-11 23:08:04.000000000 +0200
-+++ asterisk-1.2.10/apps/app_meetme.c	2006-07-31 14:13:08.000000000 +0200
-@@ -453,7 +453,7 @@
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_meetme.c asterisk-1.2.13.dfsg/apps/app_meetme.c
+--- asterisk-1.2.13.dfsg~/apps/app_meetme.c	2006-09-28 17:13:55.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_meetme.c	2006-10-23 22:22:34.000000000 +0100
+@@ -458,7 +458,7 @@
  			ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
  			ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
  			cnf->markedusers = 0;
@@ -1639,18 +1633,19 @@
  			if (cnf->chan) {
  				cnf->fd = cnf->chan->fds[0];	/* for use by conf_play() */
  			} else {
-@@ -823,8 +823,9 @@
+@@ -828,9 +828,10 @@
  	char exitcontext[AST_MAX_CONTEXT] = "";
  	char recordingtmp[AST_MAX_EXTENSION] = "";
- 	int dtmf;
+ 	int dtmf, opt_waitmarked_timeout = 0;
 +	int dyna_buff = CONF_SIZE;
+ 	time_t timeout = 0;
  	ZT_BUFFERINFO bi;
 -	char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
 +	char __buf[ZT_MAX_BUF_SPACE / ZT_DEFAULT_NUM_BUFS + AST_FRIENDLY_OFFSET];
  	char *buf = __buf + AST_FRIENDLY_OFFSET;
  	
  	if (!user) {
-@@ -990,7 +991,7 @@
+@@ -1007,7 +1008,7 @@
  		}
  		/* Setup buffering information */
  		memset(&bi, 0, sizeof(bi));
@@ -1659,7 +1654,7 @@
  		bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
  		bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
  		bi.numbufs = audio_buffers;
-@@ -1275,6 +1276,14 @@
+@@ -1297,6 +1298,14 @@
  				f = ast_read(c);
  				if (!f)
  					break;
@@ -1674,7 +1669,7 @@
  				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
  					if (user->talk.actual)
  						ast_frame_adjust_volume(f, user->talk.actual);
-@@ -1509,7 +1518,7 @@
+@@ -1531,7 +1540,7 @@
  				}
  				ast_frfree(f);
  			} else if (outfd > -1) {
@@ -1683,9 +1678,9 @@
  				if (res > 0) {
  					memset(&fr, 0, sizeof(fr));
  					fr.frametype = AST_FRAME_VOICE;
-diff -urN asterisk-1.2.10.orig/apps/app_milliwatt.c asterisk-1.2.10/apps/app_milliwatt.c
---- asterisk-1.2.10.orig/apps/app_milliwatt.c	2006-01-19 05:17:45.000000000 +0100
-+++ asterisk-1.2.10/apps/app_milliwatt.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_milliwatt.c asterisk-1.2.13.dfsg/apps/app_milliwatt.c
+--- asterisk-1.2.13.dfsg~/apps/app_milliwatt.c	2006-01-19 04:17:45.000000000 +0000
++++ asterisk-1.2.13.dfsg/apps/app_milliwatt.c	2006-10-23 22:22:34.000000000 +0100
 @@ -74,20 +74,28 @@
  {
  	struct ast_frame wf;
@@ -1721,9 +1716,9 @@
  	wf.src = "app_milliwatt";
  	wf.delivery.tv_sec = 0;
  	wf.delivery.tv_usec = 0;
-diff -urN asterisk-1.2.10.orig/apps/app_page.c asterisk-1.2.10/apps/app_page.c
---- asterisk-1.2.10.orig/apps/app_page.c	2006-04-13 19:40:21.000000000 +0200
-+++ asterisk-1.2.10/apps/app_page.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_page.c asterisk-1.2.13.dfsg/apps/app_page.c
+--- asterisk-1.2.13.dfsg~/apps/app_page.c	2006-09-11 22:47:23.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_page.c	2006-10-23 22:22:34.000000000 +0100
 @@ -85,7 +85,7 @@
  {
  	struct calloutdata *cd = data;
@@ -1733,9 +1728,9 @@
  	free(cd);
  	return NULL;
  }
-diff -urN asterisk-1.2.10.orig/apps/app_parkandannounce.c asterisk-1.2.10/apps/app_parkandannounce.c
---- asterisk-1.2.10.orig/apps/app_parkandannounce.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/apps/app_parkandannounce.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_parkandannounce.c asterisk-1.2.13.dfsg/apps/app_parkandannounce.c
+--- asterisk-1.2.13.dfsg~/apps/app_parkandannounce.c	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/apps/app_parkandannounce.c	2006-10-23 22:22:34.000000000 +0100
 @@ -183,7 +183,7 @@
  
  	memset(&oh, 0, sizeof(oh));
@@ -1745,9 +1740,9 @@
  
  	if(dchan) {
  		if(dchan->_state == AST_STATE_UP) {
-diff -urN asterisk-1.2.10.orig/apps/app_pickup.c asterisk-1.2.10/apps/app_pickup.c
---- asterisk-1.2.10.orig/apps/app_pickup.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_pickup.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_pickup.c asterisk-1.2.13.dfsg/apps/app_pickup.c
+--- asterisk-1.2.13.dfsg~/apps/app_pickup.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_pickup.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,319 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -2068,10 +2063,10 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_queue.c asterisk-1.2.10/apps/app_queue.c
---- asterisk-1.2.10.orig/apps/app_queue.c	2006-06-23 13:30:17.000000000 +0200
-+++ asterisk-1.2.10/apps/app_queue.c	2006-07-31 14:13:08.000000000 +0200
-@@ -526,7 +526,7 @@
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_queue.c asterisk-1.2.13.dfsg/apps/app_queue.c
+--- asterisk-1.2.13.dfsg~/apps/app_queue.c	2006-10-03 21:14:13.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_queue.c	2006-10-23 22:22:34.000000000 +0100
+@@ -543,7 +543,7 @@
  	return NULL;
  }
  
@@ -2080,7 +2075,7 @@
  {
  	/* Avoid potential for deadlocks by spawning a new thread to handle
  	   the event */
-@@ -1509,7 +1509,7 @@
+@@ -1526,7 +1526,7 @@
  		location = "";
  
  	/* Request the peer */
@@ -2089,7 +2084,7 @@
  	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);
-@@ -1816,7 +1816,7 @@
+@@ -1838,7 +1838,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 */
@@ -2098,7 +2093,7 @@
  					if (status != o->oldstatus) 
  						update_dial_status(qe->parent, o->member, status);						
  					if (!o->chan) {
-@@ -2360,14 +2360,14 @@
+@@ -2382,14 +2382,14 @@
  			else
  				which = peer;
  			if (monitorfilename)
@@ -2116,9 +2111,9 @@
  			}
  			if (qe->parent->monjoin)
  				ast_monitor_setjoinfiles(which, 1);
-diff -urN asterisk-1.2.10.orig/apps/app_readfile.c asterisk-1.2.10/apps/app_readfile.c
---- asterisk-1.2.10.orig/apps/app_readfile.c	2006-03-23 21:13:48.000000000 +0100
-+++ asterisk-1.2.10/apps/app_readfile.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_readfile.c asterisk-1.2.13.dfsg/apps/app_readfile.c
+--- asterisk-1.2.13.dfsg~/apps/app_readfile.c	2006-03-23 20:13:48.000000000 +0000
++++ asterisk-1.2.13.dfsg/apps/app_readfile.c	2006-10-23 22:22:34.000000000 +0100
 @@ -40,7 +40,7 @@
  #include "asterisk/app.h"
  #include "asterisk/module.h"
@@ -2128,9 +2123,9 @@
  
  static char *app_readfile = "ReadFile";
  
-diff -urN asterisk-1.2.10.orig/apps/app_segfault.c asterisk-1.2.10/apps/app_segfault.c
---- asterisk-1.2.10.orig/apps/app_segfault.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_segfault.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_segfault.c asterisk-1.2.13.dfsg/apps/app_segfault.c
+--- asterisk-1.2.13.dfsg~/apps/app_segfault.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_segfault.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,75 @@
 +/*
 + * Segfault application
@@ -2207,9 +2202,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/apps/app_zapras.c asterisk-1.2.10/apps/app_zapras.c
---- asterisk-1.2.10.orig/apps/app_zapras.c	2006-07-12 15:54:10.000000000 +0200
-+++ asterisk-1.2.10/apps/app_zapras.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_zapras.c asterisk-1.2.13.dfsg/apps/app_zapras.c
+--- asterisk-1.2.13.dfsg~/apps/app_zapras.c	2006-07-12 14:54:10.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_zapras.c	2006-10-23 22:22:34.000000000 +0100
 @@ -180,7 +180,7 @@
  				}
  			}
@@ -2219,9 +2214,9 @@
  			ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
  
  			/* Restore saved values */
-diff -urN asterisk-1.2.10.orig/apps/app_zapras.c.orig asterisk-1.2.10/apps/app_zapras.c.orig
---- asterisk-1.2.10.orig/apps/app_zapras.c.orig	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/apps/app_zapras.c.orig	2006-07-12 15:54:10.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/apps/app_zapras.c.orig asterisk-1.2.13.dfsg/apps/app_zapras.c.orig
+--- asterisk-1.2.13.dfsg~/apps/app_zapras.c.orig	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/apps/app_zapras.c.orig	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,274 @@
 +/*
 + * Asterisk -- An open source telephony toolkit.
@@ -2497,9 +2492,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/asterisk.c asterisk-1.2.10/asterisk.c
---- asterisk-1.2.10.orig/asterisk.c	2006-07-12 15:54:10.000000000 +0200
-+++ asterisk-1.2.10/asterisk.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/asterisk.c asterisk-1.2.13.dfsg/asterisk.c
+--- asterisk-1.2.13.dfsg~/asterisk.c	2006-09-26 21:49:21.000000000 +0100
++++ asterisk-1.2.13.dfsg/asterisk.c	2006-10-23 22:22:34.000000000 +0100
 @@ -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";
@@ -2525,9 +2520,9 @@
  		}
  		v = v->next;
  	}
-diff -urN asterisk-1.2.10.orig/build_tools/make_defaults_h asterisk-1.2.10/build_tools/make_defaults_h
---- asterisk-1.2.10.orig/build_tools/make_defaults_h	2005-06-20 19:26:08.000000000 +0200
-+++ asterisk-1.2.10/build_tools/make_defaults_h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/build_tools/make_defaults_h asterisk-1.2.13.dfsg/build_tools/make_defaults_h
+--- asterisk-1.2.13.dfsg~/build_tools/make_defaults_h	2005-06-20 18:26:08.000000000 +0100
++++ asterisk-1.2.13.dfsg/build_tools/make_defaults_h	2006-10-23 22:22:34.000000000 +0100
 @@ -16,6 +16,7 @@
  #define AST_KEY_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
  #define AST_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
@@ -2536,9 +2531,9 @@
  
  #define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
  
-diff -urN asterisk-1.2.10.orig/channel.c asterisk-1.2.10/channel.c
---- asterisk-1.2.10.orig/channel.c	2006-07-10 23:01:35.000000000 +0200
-+++ asterisk-1.2.10/channel.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channel.c asterisk-1.2.13.dfsg/channel.c
+--- asterisk-1.2.13.dfsg~/channel.c	2006-09-27 17:54:30.000000000 +0100
++++ asterisk-1.2.13.dfsg/channel.c	2006-10-23 22:22:34.000000000 +0100
 @@ -94,8 +94,8 @@
   */
  static int shutting_down = 0;
@@ -2651,14 +2646,14 @@
  {
 -	return channel_find_locked(NULL, NULL, 0, context, exten);
 +	return channel_find_locked(NULL, NULL, 0, context, exten, NULL);
- }
- 
++}
++
 +struct ast_channel *ast_get_channel_by_uniqueid_locked(const char *uniqueid)
 +{
 +	return channel_find_locked(NULL, NULL, 0, NULL, NULL, uniqueid);
-+}
+ }
+ 
 +
-+
  /*--- ast_safe_sleep_conditional: Wait, look for hangups and condition arg */
  int ast_safe_sleep_conditional(	struct ast_channel *chan, int ms,
  	int (*cond)(void*), void *data )
@@ -2688,7 +2683,7 @@
  }
  
  int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
-@@ -2377,7 +2406,7 @@
+@@ -2423,7 +2452,7 @@
  			  &chan->writetrans, 1);
  }
  
@@ -2697,7 +2692,7 @@
  {
  	int state = 0;
  	int cause = 0;
-@@ -2385,7 +2414,7 @@
+@@ -2431,7 +2460,7 @@
  	struct ast_frame *f;
  	int res = 0;
  	
@@ -2706,7 +2701,7 @@
  	if (chan) {
  		if (oh) {
  			if (oh->vars)	
-@@ -2399,6 +2428,7 @@
+@@ -2445,6 +2474,7 @@
  		}
  		ast_set_callerid(chan, cid_num, cid_name, cid_num);
  
@@ -2714,7 +2709,7 @@
  		if (!ast_call(chan, data, 0)) {
  			res = 1;	/* in case chan->_state is already AST_STATE_UP */
  			while (timeout && (chan->_state != AST_STATE_UP)) {
-@@ -2422,6 +2452,7 @@
+@@ -2468,6 +2498,7 @@
  					if (f->subclass == AST_CONTROL_RINGING)
  						state = AST_CONTROL_RINGING;
  					else if ((f->subclass == AST_CONTROL_BUSY) || (f->subclass == AST_CONTROL_CONGESTION)) {
@@ -2722,7 +2717,7 @@
  						state = f->subclass;
  						ast_frfree(f);
  						break;
-@@ -2491,12 +2522,12 @@
+@@ -2537,12 +2568,12 @@
  	return chan;
  }
  
@@ -2738,7 +2733,7 @@
  {
  	struct chanlist *chan;
  	struct ast_channel *c;
-@@ -2533,6 +2564,7 @@
+@@ -2579,6 +2610,7 @@
  		if (!(c = chan->tech->requester(type, capabilities, data, cause)))
  			return NULL;
  
@@ -2746,7 +2741,7 @@
  		if (c->_state == AST_STATE_DOWN) {
  			manager_event(EVENT_FLAG_CALL, "Newchannel",
  				      "Channel: %s\r\n"
-@@ -2808,6 +2840,29 @@
+@@ -2854,6 +2886,29 @@
  	return res;
  }
  
@@ -2776,7 +2771,7 @@
  void ast_change_name(struct ast_channel *chan, char *newname)
  {
  	char tmp[256];
-@@ -2947,7 +3002,7 @@
+@@ -2995,7 +3050,7 @@
  	ast_copy_string(clone->name, masqn, sizeof(clone->name));
  	
  	/* Notify any managers of the change, first the masq then the other */
@@ -2785,7 +2780,7 @@
  	manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
  
  	/* Swap the technlogies */	
-@@ -3174,15 +3229,14 @@
+@@ -3243,15 +3298,14 @@
  				);
  }
  
@@ -2803,7 +2798,7 @@
  	manager_event(EVENT_FLAG_CALL,
  		      (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
  		      "Channel: %s\r\n"
-@@ -3198,6 +3252,10 @@
+@@ -3267,6 +3321,10 @@
  	return 0;
  }
  
@@ -2814,15 +2809,15 @@
  /*--- Find bridged channel */
  struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
  {
-@@ -3375,6 +3433,7 @@
+@@ -3443,6 +3501,7 @@
+ 	char caller_warning = 0;
  	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);
-@@ -3385,6 +3444,10 @@
+@@ -3453,6 +3512,10 @@
  			c1->name, c1->_bridge->name);
  		return -1;
  	}
@@ -2833,9 +2828,9 @@
  	
  	/* 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.10.orig/channels/Makefile asterisk-1.2.10/channels/Makefile
---- asterisk-1.2.10.orig/channels/Makefile	2006-04-30 16:27:56.000000000 +0200
-+++ asterisk-1.2.10/channels/Makefile	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/Makefile asterisk-1.2.13.dfsg/channels/Makefile
+--- asterisk-1.2.13.dfsg~/channels/Makefile	2006-08-17 22:57:19.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/Makefile	2006-10-23 22:22:34.000000000 +0100
 @@ -102,6 +102,11 @@
    ZAPR2=-lmfcr2
  endif
@@ -2903,9 +2898,9 @@
  chan_vpb.o: chan_vpb.c
  	$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
  
-diff -urN asterisk-1.2.10.orig/channels/chan_agent.c asterisk-1.2.10/channels/chan_agent.c
---- asterisk-1.2.10.orig/channels/chan_agent.c	2006-07-06 22:38:45.000000000 +0200
-+++ asterisk-1.2.10/channels/chan_agent.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_agent.c asterisk-1.2.13.dfsg/channels/chan_agent.c
+--- asterisk-1.2.13.dfsg~/channels/chan_agent.c	2006-09-06 19:16:41.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_agent.c	2006-10-23 22:22:34.000000000 +0100
 @@ -440,7 +440,7 @@
  		if ((pointer = strchr(filename, '.')))
  			*pointer = '-';
@@ -2915,7 +2910,7 @@
  		ast_monitor_setjoinfiles(ast, 1);
  		snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
  #if 0
-@@ -1323,7 +1323,7 @@
+@@ -1336,7 +1336,7 @@
  						chan = agent_new(p, AST_STATE_DOWN);
  					} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
  						/* Adjustable agent */
@@ -2924,9 +2919,9 @@
  						if (p->chan)
  							chan = agent_new(p, AST_STATE_DOWN);
  					}
-diff -urN asterisk-1.2.10.orig/channels/chan_capi.c asterisk-1.2.10/channels/chan_capi.c
---- asterisk-1.2.10.orig/channels/chan_capi.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/channels/chan_capi.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_capi.c asterisk-1.2.13.dfsg/channels/chan_capi.c
+--- asterisk-1.2.13.dfsg~/channels/chan_capi.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_capi.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,2888 @@
 +/*
 + * (CAPI*)
@@ -5816,9 +5811,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/channels/chan_features.c asterisk-1.2.10/channels/chan_features.c
---- asterisk-1.2.10.orig/channels/chan_features.c	2006-07-03 06:19:09.000000000 +0200
-+++ asterisk-1.2.10/channels/chan_features.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_features.c asterisk-1.2.13.dfsg/channels/chan_features.c
+--- asterisk-1.2.13.dfsg~/channels/chan_features.c	2006-08-30 19:59:44.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_features.c	2006-10-23 22:22:34.000000000 +0100
 @@ -427,7 +427,7 @@
  	}
  	ast_mutex_unlock(&featurelock);
@@ -5828,9 +5823,9 @@
  		if (!chan) {
  			ast_log(LOG_NOTICE, "Unable to allocate subchannel '%s/%s'\n", tech, dest);
  			return NULL;
-diff -urN asterisk-1.2.10.orig/channels/chan_iax2.c asterisk-1.2.10/channels/chan_iax2.c
---- asterisk-1.2.10.orig/channels/chan_iax2.c	2006-07-12 17:23:59.000000000 +0200
-+++ asterisk-1.2.10/channels/chan_iax2.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_iax2.c asterisk-1.2.13.dfsg/channels/chan_iax2.c
+--- asterisk-1.2.13.dfsg~/channels/chan_iax2.c	2006-10-13 17:18:08.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_iax2.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -5841,7 +5836,7 @@
   * 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.
-@@ -3089,7 +3092,7 @@
+@@ -3101,7 +3104,7 @@
   	memset(&ied, 0, sizeof(ied));
  	ast_mutex_lock(&iaxsl[callno]);
  	if (callno && iaxs[callno]) {
@@ -5850,7 +5845,7 @@
  		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);
-@@ -3141,7 +3144,8 @@
+@@ -3153,7 +3156,8 @@
  static struct ast_frame *iax2_read(struct ast_channel *c) 
  {
  	static struct ast_frame f = { AST_FRAME_NULL, };
@@ -5860,10 +5855,10 @@
  	return &f;
  }
  
-diff -urN asterisk-1.2.10.orig/channels/chan_sip.c asterisk-1.2.10/channels/chan_sip.c
---- asterisk-1.2.10.orig/channels/chan_sip.c	2006-07-13 18:44:23.000000000 +0200
-+++ asterisk-1.2.10/channels/chan_sip.c	2006-07-31 14:53:09.000000000 +0200
-@@ -603,6 +603,7 @@
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_sip.c asterisk-1.2.13.dfsg/channels/chan_sip.c
+--- asterisk-1.2.13.dfsg~/channels/chan_sip.c	2006-10-17 21:37:17.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_sip.c	2006-10-23 22:22:34.000000000 +0100
+@@ -605,6 +605,7 @@
  	unsigned int flags;			/*!< SIP_ flags */	
  	int timer_t1;				/*!< SIP timer T1, ms rtt */
  	unsigned int sipoptions;		/*!< Supported SIP sipoptions on the other end */
@@ -5871,7 +5866,7 @@
  	int capability;				/*!< Special capability (codec) */
  	int jointcapability;			/*!< Supported capability at both ends (codecs ) */
  	int peercapability;			/*!< Supported peer capability */
-@@ -626,6 +627,7 @@
+@@ -628,6 +629,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[SIP_LEN_CONTACT];	/*!< Place to store Contact info from a REFER extension */
@@ -5879,7 +5874,7 @@
  	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? */
-@@ -645,6 +647,7 @@
+@@ -647,6 +649,7 @@
  	char peername[256];			/*!< [peer] name, not set if [user] */
  	char authname[256];			/*!< Who we use for authentication */
  	char uri[256];				/*!< Original requested URI */
@@ -5887,7 +5882,7 @@
  	char okcontacturi[SIP_LEN_CONTACT];	/*!< URI from the 200 OK on INVITE */
  	char peersecret[256];			/*!< Password */
  	char peermd5secret[256];
-@@ -768,6 +771,9 @@
+@@ -770,6 +773,9 @@
  	int callingpres;		/*!< Calling id presentation */
  	int inUse;			/*!< Number of calls in use */
  	int call_limit;			/*!< Limit of concurrent calls */
@@ -5897,7 +5892,7 @@
  	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 @@
+@@ -930,7 +936,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);
@@ -5906,7 +5901,7 @@
  static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
  
  /*! \brief Definition of this channel for PBX channel registration */
-@@ -1311,7 +1317,7 @@
+@@ -1322,7 +1328,7 @@
  	/* If this is a subscription, tell the phone that we got a timeout */
  	if (p->subscribed) {
  		p->subscribed = TIMEOUT;
@@ -5915,39 +5910,7 @@
  		p->subscribed = NONE;
  		append_history(p, "Subscribestatus", "timeout");
  		return 10000;	/* Reschedule this destruction so that we know that it's gone */
-@@ -3144,16 +3150,30 @@
- 
- /*! \brief  find_call: Connect incoming SIP message to current dialog or create new dialog structure */
- /*               Called by handle_request, sipsock_read */
--static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method)
-+static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method, const int replaces_callid)
- {
- 	struct sip_pvt *p;
- 	char *callid;
- 	char *tag = "";
-+	char *replaces;
- 	char totag[128];
- 	char fromtag[128];
-+	char *c;
- 
- 	callid = get_header(req, "Call-ID");
- 
-+	if (replaces_callid) {
-+	    replaces = get_header(req, "Replaces");
-+	    c = strchr(replaces, ';');
-+	    if (c)
-+		*c = '\0';
-+	    if (!ast_strlen_zero(replaces)) {
-+		callid = replaces;
-+	    } else {
-+		return NULL;
-+	    }
-+	}
-+
- 	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
-@@ -4135,6 +4155,7 @@
+@@ -4166,6 +4172,7 @@
  	if (sipmethod == SIP_CANCEL) {
  		c = p->initreq.rlPart2;	/* Use original URI */
  	} else if (sipmethod == SIP_ACK) {
@@ -5955,7 +5918,7 @@
  		/* Use URI from Contact: in 200 OK (if INVITE) 
  		(we only have the contacturi on INVITEs) */
  		if (!ast_strlen_zero(p->okcontacturi))
-@@ -4901,13 +4922,15 @@
+@@ -4964,13 +4971,15 @@
  		ast_build_string(&invite, &invite_max, ";%s", p->options->uri_options);
  
  	ast_copy_string(p->uri, invite_buf, sizeof(p->uri));
@@ -5972,7 +5935,7 @@
  	} else {
  		snprintf(to, sizeof(to), "<%s>", p->uri);
  	}
-@@ -4964,6 +4987,11 @@
+@@ -5027,6 +5036,11 @@
  		if (!ast_strlen_zero(p->referred_by))
  			add_header(&req, "Referred-By", p->referred_by);
  	}
@@ -5984,7 +5947,7 @@
  #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);
-@@ -5038,8 +5066,7 @@
+@@ -5101,8 +5115,7 @@
  }
  
  /*! \brief  transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
@@ -5994,7 +5957,7 @@
  	char tmp[4000], from[256], to[256];
  	char *t = tmp, *c, *a, *mfrom, *mto;
  	size_t maxbytes = sizeof(tmp);
-@@ -5183,10 +5210,19 @@
+@@ -5246,10 +5259,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);
@@ -6017,7 +5980,7 @@
  		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
  		ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
  		break;
-@@ -6013,8 +6049,10 @@
+@@ -6076,8 +6098,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);
@@ -6029,7 +5992,7 @@
  	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);
-@@ -6405,7 +6443,7 @@
+@@ -6468,7 +6492,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 */
@@ -6038,16 +6001,16 @@
  {
  	struct sip_pvt *p = data;
  
-@@ -6424,7 +6462,7 @@
+@@ -6487,7 +6511,7 @@
  		p->laststate = state;
  		break;
  	}
 -	transmit_state_notify(p, state, 1, 1);
 +	transmit_state_notify(p, state, 1, 1, cid_num, cid_name);
  
- 	if (option_debug > 1)
+ 	if (option_verbose > 1)
  		ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
-@@ -6450,7 +6488,13 @@
+@@ -6513,7 +6537,13 @@
  	char *name, *c;
  	char *t;
  	char *domain;
@@ -6062,7 +6025,7 @@
  	/* Terminate URI */
  	t = uri;
  	while(*t && (*t > 32) && (*t != ';'))
-@@ -6499,9 +6543,68 @@
+@@ -6562,9 +6592,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 {
@@ -6132,7 +6095,7 @@
  				sip_cancel_destroy(p);
  				switch (parse_register_contact(p, peer, req)) {
  				case PARSE_REGISTER_FAILED:
-@@ -6521,6 +6624,7 @@
+@@ -6584,6 +6673,7 @@
  					transmit_response_with_date(p, "200 OK", req);
  					peer->lastmsgssent = -1;
  					res = 0;
@@ -6140,7 +6103,7 @@
  					break;
  				}
  			} 
-@@ -6866,6 +6970,11 @@
+@@ -6931,6 +7021,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 */
@@ -6150,9 +6113,9 @@
 +			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())) {
+ 	} else if (ast_exists_extension(NULL, *transfercontext, refer_to, 1, NULL) || !strcmp(refer_to, ast_parking_ext())) {
  		/* This is an unsupervised transfer (blind transfer) */
-@@ -7586,6 +7695,8 @@
+@@ -7652,6 +7747,8 @@
  	int peers_offline = 0;
  	char *id;
  	char idtext[256] = "";
@@ -6161,7 +6124,7 @@
  
  	if (s) {	/* Manager - get ActionID */
  		id = astman_get_header(m,"ActionID");
-@@ -7628,6 +7739,7 @@
+@@ -7694,6 +7791,7 @@
  		else
  			ast_copy_string(name, iterator->name, sizeof(name));
  
@@ -6169,7 +6132,7 @@
  		pstatus = peer_status(iterator, status, sizeof(status));
  		if (pstatus) 	
  			peers_online++;
-@@ -7644,14 +7756,24 @@
+@@ -7710,14 +7808,24 @@
  			}
  		}			
  		
@@ -6195,7 +6158,7 @@
  			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? */
-@@ -7659,6 +7781,7 @@
+@@ -7725,6 +7833,7 @@
  			iterator->ha ? " A " : "   ",       /* permit/deny */
  			
  			ntohs(iterator->addr.sin_port), status);
@@ -6203,7 +6166,7 @@
  		} else {	/* Manager format */
  			/* The names here need to be the same as other channels */
  			ast_cli(fd, 
-@@ -7684,7 +7807,9 @@
+@@ -7750,7 +7859,9 @@
  
  		ASTOBJ_UNLOCK(iterator);
  
@@ -6214,7 +6177,7 @@
  	} while(0) );
  
  	if (!s) {
-@@ -8719,6 +8844,7 @@
+@@ -8785,6 +8896,7 @@
  	char buf[1024];
  	unsigned int event;
  	char *c;
@@ -6222,7 +6185,7 @@
  	
  	/* Need to check the media/type */
  	if (!strcasecmp(get_header(req, "Content-Type"), "application/dtmf-relay") ||
-@@ -8782,6 +8908,19 @@
+@@ -8848,6 +8960,19 @@
  			ast_queue_control(p->owner, AST_CONTROL_VIDUPDATE);
  		transmit_response(p, "200 OK", req);
  		return;
@@ -6242,7 +6205,7 @@
  	} else if ((c = get_header(req, "X-ClientCode"))) {
  		/* Client code (from SNOM phone) */
  		if (ast_test_flag(p, SIP_USECLIENTCODE)) {
-@@ -8881,12 +9020,63 @@
+@@ -8947,12 +9072,63 @@
  	return RESULT_SUCCESS;
  }
  
@@ -6307,7 +6270,7 @@
  	if (argc < 4)
  		return RESULT_SHOWUSAGE;
  
-@@ -8903,41 +9093,13 @@
+@@ -8969,41 +9145,13 @@
  	}
  
  	for (i = 3; i < argc; i++) {
@@ -6329,15 +6292,15 @@
 -		}
 -
 -		initreqprep(&req, p, SIP_NOTIFY);
+-
+-		for (var = varlist; var; var = var->next)
+-			add_header(&req, var->name, var->value);
 +		if (sip_send_notify(fd, argv[2], argv[i]) == RESULT_FAILURE) 
 +		    res = RESULT_FAILURE;
 +    	}
 +	return res;
 +}
  
--		for (var = varlist; var; var = var->next)
--			add_header(&req, var->name, var->value);
- 
 -		add_blank_header(&req);
 -		/* Recalculate our side, and recalculate Call ID */
 -		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip))
@@ -6348,13 +6311,13 @@
 -		transmit_sip_request(p, &req);
 -		sip_scheddestroy(p, 15000);
 -	}
--
+ 
 -	return RESULT_SUCCESS;
 -}
  /*! \brief  sip_do_history: Enable SIP History logging (CLI) ---*/
  static int sip_do_history(int fd, int argc, char *argv[])
  {
-@@ -9598,7 +9760,7 @@
+@@ -9668,7 +9816,7 @@
  		if (!ignore && p->owner) {
  			ast_queue_control(p->owner, AST_CONTROL_RINGING);
  			if (p->owner->_state != AST_STATE_UP)
@@ -6363,7 +6326,7 @@
  		}
  		if (find_sdp(req)) {
  			process_sdp(p, req);
-@@ -10423,9 +10585,18 @@
+@@ -10498,9 +10646,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 */
@@ -6385,16 +6348,8 @@
  	}
  	if (!ignore) {
  		/* Use this as the basis */
-@@ -10657,6 +10828,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);
-@@ -10665,9 +10837,73 @@
- 	res = get_refer_info(p, req);
+@@ -10743,9 +10900,73 @@
+ 		transfercontext = p->context;
  	if (res < 0)
  		transmit_response(p, "603 Declined", req);
 -	else if (res > 0)
@@ -6469,7 +6424,7 @@
  		int nobye = 0;
  		if (!ignore) {
  			if (p->refer_call) {
-@@ -10995,7 +11231,7 @@
+@@ -11081,7 +11302,7 @@
  			struct sip_pvt *p_old;
  
  			transmit_response(p, "200 OK", req);
@@ -6478,7 +6433,7 @@
  			append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
  
  			/* remove any old subscription from this peer for the same exten/context,
-@@ -11189,6 +11425,8 @@
+@@ -11275,6 +11496,8 @@
  		res = handle_request_options(p, req, debug);
  		break;
  	case SIP_INVITE:
@@ -6487,7 +6442,7 @@
  		res = handle_request_invite(p, req, debug, ignore, seqno, sin, recount, e);
  		break;
  	case SIP_REFER:
-@@ -11309,7 +11547,7 @@
+@@ -11392,7 +11615,7 @@
  	/* Process request, with netlock held */
  retrylock:
  	ast_mutex_lock(&netlock);
@@ -6496,7 +6451,7 @@
  	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)) {
-@@ -11636,6 +11874,52 @@
+@@ -11733,6 +11956,52 @@
  	return 0;
  }
  
@@ -6549,7 +6504,7 @@
  /*! \brief  sip_devicestate: Part of PBX channel interface ---*/
  
  /* Return values:---
-@@ -12173,6 +12457,7 @@
+@@ -12270,6 +12539,7 @@
  
  	peer->expire = -1;
  	peer->pokeexpire = -1;
@@ -6557,7 +6512,7 @@
  	ast_copy_string(peer->name, name, sizeof(peer->name));
  	ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY);
  	strcpy(peer->context, default_context);
-@@ -12218,7 +12503,9 @@
+@@ -12315,7 +12585,9 @@
  
  	if (peer) {
  		/* Already in the list, remove it and it will be added back (or FREE'd)  */
@@ -6568,7 +6523,7 @@
   	} else {
  		peer = malloc(sizeof(*peer));
  		if (peer) {
-@@ -12230,6 +12517,7 @@
+@@ -12327,6 +12599,7 @@
  			ASTOBJ_INIT(peer);
  			peer->expire = -1;
  			peer->pokeexpire = -1;
@@ -6576,7 +6531,7 @@
  		} else {
  			ast_log(LOG_WARNING, "Can't allocate SIP peer memory\n");
  		}
-@@ -12375,6 +12663,10 @@
+@@ -12472,6 +12745,10 @@
  			peer->call_limit = atoi(v->value);
  			if (peer->call_limit < 0)
  				peer->call_limit = 0;
@@ -6587,7 +6542,7 @@
  		} else if (!strcasecmp(v->name, "amaflags")) {
  			format = ast_cdr_amaflags2int(v->value);
  			if (format < 0) {
-@@ -12770,8 +13062,24 @@
+@@ -12867,8 +13144,24 @@
  				if (!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend")) {
  					peer = build_peer(cat, ast_variable_browse(cfg, cat), 0);
  					if (peer) {
@@ -6614,7 +6569,7 @@
  					}
  				} else if (strcasecmp(utype, "user")) {
  					ast_log(LOG_WARNING, "Unknown type '%s' for '%s' in %s\n", utype, cat, "sip.conf");
-@@ -13361,6 +13669,8 @@
+@@ -13469,6 +13762,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);
@@ -6623,7 +6578,7 @@
  
  	sip_poke_all_peers();	
  	sip_send_all_registers();
-@@ -13391,6 +13701,7 @@
+@@ -13499,6 +13794,7 @@
  
  	ast_rtp_proto_unregister(&sip_rtp);
  
@@ -6631,9 +6586,78 @@
  	ast_manager_unregister("SIPpeers");
  	ast_manager_unregister("SIPshowpeer");
  
-diff -urN asterisk-1.2.10.orig/channels/chan_zap.c asterisk-1.2.10/channels/chan_zap.c
---- asterisk-1.2.10.orig/channels/chan_zap.c	2006-07-12 15:54:10.000000000 +0200
-+++ asterisk-1.2.10/channels/chan_zap.c	2006-08-09 16:15:04.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_sip.c.rej asterisk-1.2.13.dfsg/channels/chan_sip.c.rej
+--- asterisk-1.2.13.dfsg~/channels/chan_sip.c.rej	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_sip.c.rej	2006-10-23 22:22:34.000000000 +0100
+@@ -0,0 +1,65 @@
++***************
++*** 3171,3186 ****
++  
++  /*! \brief  find_call: Connect incoming SIP message to current dialog or create new dialog structure */
++  /*               Called by handle_request, sipsock_read */
++- static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method)
++  {
++  	struct sip_pvt *p;
++  	char *callid;
++  	char *tag = "";
++  	char totag[128];
++  	char fromtag[128];
++  
++  	callid = get_header(req, "Call-ID");
++  
++  	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
++--- 3177,3206 ----
++  
++  /*! \brief  find_call: Connect incoming SIP message to current dialog or create new dialog structure */
++  /*               Called by handle_request, sipsock_read */
+++ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method, const int replaces_callid)
++  {
++  	struct sip_pvt *p;
++  	char *callid;
++  	char *tag = "";
+++ 	char *replaces;
++  	char totag[128];
++  	char fromtag[128];
+++ 	char *c;
++  
++  	callid = get_header(req, "Call-ID");
++  
+++ 	if (replaces_callid) {
+++ 	    replaces = get_header(req, "Replaces");
+++ 	    c = strchr(replaces, ';');
+++ 	    if (c)
+++ 		*c = '\0';
+++ 	    if (!ast_strlen_zero(replaces)) {
+++ 		callid = replaces;
+++ 	    } else {
+++ 		return NULL;
+++ 	    }
+++ 	}
+++ 
++  	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
++***************
++*** 10732,10737 ****
++  	struct ast_channel *c=NULL;
++  	int res;
++  	struct ast_channel *transfer_to;
++  
++  	if (option_debug > 2)
++  		ast_log(LOG_DEBUG, "SIP call transfer received for call %s (REFER)!\n", p->callid);
++--- 10903,10909 ----
++  	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);
+diff -urNad asterisk-1.2.13.dfsg~/channels/chan_zap.c asterisk-1.2.13.dfsg/channels/chan_zap.c
+--- asterisk-1.2.13.dfsg~/channels/chan_zap.c	2006-09-14 23:16:31.000000000 +0100
++++ asterisk-1.2.13.dfsg/channels/chan_zap.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -6884,7 +6908,7 @@
  static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
  {
  	int res;
-@@ -779,6 +849,112 @@
+@@ -777,6 +847,112 @@
  #define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
  #define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
  
@@ -6997,7 +7021,7 @@
  static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
  {
  	int res;
-@@ -1181,6 +1357,8 @@
+@@ -1179,6 +1355,8 @@
  		return "GR-303 Signalling with FXOKS";
  	case SIG_GR303FXSKS:
  		return "GR-303 Signalling with FXSKS";
@@ -7006,7 +7030,7 @@
  	case 0:
  		return "Pseudo Signalling";
  	default:
-@@ -1381,12 +1559,16 @@
+@@ -1379,12 +1557,16 @@
  	int res;
  	if (!p)
  		return;
@@ -7024,7 +7048,7 @@
  		return;
  	}
  	if (p->echocancel) {
-@@ -1412,7 +1594,7 @@
+@@ -1410,7 +1592,7 @@
  {
  	int x;
  	int res;
@@ -7033,7 +7057,7 @@
  		x = p->echotraining;
  		res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
  		if (res) 
-@@ -1592,7 +1774,7 @@
+@@ -1590,7 +1772,7 @@
  {
  	int x, y, res;
  	x = muted;
@@ -7042,7 +7066,7 @@
  		y = 1;
  		res = ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &y);
  		if (res)
-@@ -1774,7 +1956,12 @@
+@@ -1772,7 +1954,12 @@
  		ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", p->channel);
  	p->outgoing = 1;
  
@@ -7056,7 +7080,7 @@
  
  	switch(p->sig) {
  	case SIG_FXOLS:
-@@ -1998,6 +2185,26 @@
+@@ -1996,6 +2183,26 @@
  	case SIG_PRI:
  		/* We'll get it in a moment -- but use dialdest to store pre-setup_ack digits */
  		p->dialdest[0] = '\0';
@@ -7083,7 +7107,7 @@
  		break;
  	default:
  		ast_log(LOG_DEBUG, "not yet implemented\n");
-@@ -2016,6 +2223,12 @@
+@@ -2014,6 +2221,12 @@
  		int ldp_strip;
  		int exclusive;
  
@@ -7096,7 +7120,7 @@
  		c = strchr(dest, '/');
  		if (c)
  			c++;
-@@ -2033,6 +2246,7 @@
+@@ -2031,6 +2244,7 @@
  			ast_mutex_unlock(&p->lock);
  			return -1;
  		}
@@ -7104,7 +7128,7 @@
  		if (p->sig != SIG_FXSKS) {
  			p->dop.op = ZT_DIAL_OP_REPLACE;
  			s = strchr(c + p->stripmsd, 'w');
-@@ -2056,6 +2270,8 @@
+@@ -2054,6 +2268,8 @@
  			pri_rel(p->pri);
  			ast_mutex_unlock(&p->lock);
  			return -1;
@@ -7113,7 +7137,7 @@
  		}
  		if (!(sr = pri_sr_new())) {
  			ast_log(LOG_WARNING, "Failed to allocate setup request channel %d\n", p->channel);
-@@ -2085,7 +2301,7 @@
+@@ -2083,7 +2299,7 @@
  		pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
  		pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability, 
  					(p->digital ? -1 : 
@@ -7122,7 +7146,7 @@
  		if (p->pri->facilityenable)
  			pri_facility_enable(p->pri->pri);
  
-@@ -2286,8 +2502,10 @@
+@@ -2284,8 +2500,10 @@
  	}
  	if (newslot < 0) {
  		newslot = 0;
@@ -7134,7 +7158,7 @@
  	}
  	if (old && (oldslot != newslot))
  		ast_log(LOG_NOTICE, "Switching from from d-channel %d to channel %d!\n",
-@@ -2343,8 +2561,7 @@
+@@ -2341,8 +2559,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);
@@ -7144,7 +7168,7 @@
  	if (index > -1) {
  		/* Real channel, do some fixup */
  		p->subs[index].owner = NULL;
-@@ -2441,6 +2658,7 @@
+@@ -2439,6 +2656,7 @@
  
  
  	if (!p->subs[SUB_REAL].owner && !p->subs[SUB_CALLWAIT].owner && !p->subs[SUB_THREEWAY].owner) {
@@ -7152,7 +7176,7 @@
  		p->owner = NULL;
  		p->ringt = 0;
  		p->distinctivering = 0;
-@@ -2477,19 +2695,61 @@
+@@ -2475,19 +2693,61 @@
  			if (p->call && (!p->bearer || (p->bearer->call == p->call))) {
  				if (!pri_grab(p, p->pri)) {
  					if (p->alreadyhungup) {
@@ -7215,7 +7239,7 @@
  						ast_log(LOG_DEBUG, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
  
  #ifdef SUPPORT_USERUSER
-@@ -2503,7 +2763,28 @@
+@@ -2501,7 +2761,28 @@
  							if (atoi(cause))
  								icause = atoi(cause);
  						}
@@ -7245,7 +7269,7 @@
  					}
  					if (res < 0) 
  						ast_log(LOG_WARNING, "pri_disconnect failed\n");
-@@ -2531,7 +2812,13 @@
+@@ -2529,7 +2810,13 @@
  
  		}
  #endif
@@ -7260,7 +7284,7 @@
  			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);
-@@ -2700,10 +2987,14 @@
+@@ -2698,10 +2985,14 @@
  			p->proceeding = 1;
  			res = pri_answer(p->pri->pri, p->call, 0, !p->digital);
  			pri_rel(p->pri);
@@ -7275,7 +7299,7 @@
  		break;
  #endif
  #ifdef ZAPATA_R2
-@@ -2713,6 +3004,13 @@
+@@ -2711,6 +3002,13 @@
  			ast_log(LOG_WARNING, "R2 Answer call failed :( on %s\n", ast->name);
  		break;
  #endif			
@@ -7289,7 +7313,7 @@
  	case 0:
  		ast_mutex_unlock(&p->lock);
  		return 0;
-@@ -3273,6 +3571,15 @@
+@@ -3277,6 +3575,15 @@
  {
  	struct zt_pvt *p = newchan->tech_pvt;
  	int x;
@@ -7305,7 +7329,7 @@
  	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) {
-@@ -3633,7 +3940,7 @@
+@@ -3637,7 +3944,7 @@
  			if (p->call) {
  				if (p->pri && p->pri->pri) {
  					if (!pri_grab(p, p->pri)) {
@@ -7314,7 +7338,7 @@
  						pri_destroycall(p->pri->pri, p->call);
  						p->call = NULL;
  						pri_rel(p->pri);
-@@ -4596,7 +4903,7 @@
+@@ -4600,7 +4907,7 @@
  		p->subs[index].f.data = NULL;
  		p->subs[index].f.datalen= 0;
  	}
@@ -7323,7 +7347,7 @@
  		/* Perform busy detection. etc on the zap line */
  		f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
  		if (f) {
-@@ -4608,8 +4915,9 @@
+@@ -4612,8 +4919,9 @@
  				}
  			} else if (f->frametype == AST_FRAME_DTMF) {
  #ifdef ZAPATA_PRI
@@ -7335,7 +7359,7 @@
  					f->frametype = AST_FRAME_NULL;
  					f->subclass = 0;
  				}
-@@ -4657,8 +4965,10 @@
+@@ -4661,8 +4969,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);
@@ -7348,7 +7372,7 @@
  				} else
  					ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
  			} else
-@@ -4744,7 +5054,9 @@
+@@ -4748,7 +5058,9 @@
  #endif
  	/* Write a frame of (presumably voice) data */
  	if (frame->frametype != AST_FRAME_VOICE) {
@@ -7359,7 +7383,7 @@
  			ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
  		return 0;
  	}
-@@ -4815,7 +5127,7 @@
+@@ -4819,7 +5131,7 @@
  		switch(condition) {
  		case AST_CONTROL_BUSY:
  #ifdef ZAPATA_PRI
@@ -7368,7 +7392,7 @@
  				chan->hangupcause = AST_CAUSE_USER_BUSY;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -4897,7 +5209,7 @@
+@@ -4901,7 +5213,7 @@
  		case AST_CONTROL_CONGESTION:
  			chan->hangupcause = AST_CAUSE_CONGESTION;
  #ifdef ZAPATA_PRI
@@ -7377,7 +7401,7 @@
  				chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -5082,8 +5394,12 @@
+@@ -5086,8 +5398,12 @@
  		if (state == AST_STATE_RING)
  			tmp->rings = 1;
  		tmp->tech_pvt = i;
@@ -7392,7 +7416,7 @@
  			tmp->callgroup = i->callgroup;
  			tmp->pickupgroup = i->pickupgroup;
  		}
-@@ -5213,6 +5529,7 @@
+@@ -5229,6 +5545,7 @@
  	int len = 0;
  	int res;
  	int index;
@@ -7400,7 +7424,7 @@
  	if (option_verbose > 2) 
  		ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s'\n", chan->name);
  	index = zt_get_index(chan, p, 1);
-@@ -5231,10 +5548,17 @@
+@@ -5247,10 +5564,17 @@
  		len = strlen(exten);
  		res = 0;
  		while((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
@@ -7421,7 +7445,7 @@
  			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
  				timeout = matchdigittimeout;
  			else
-@@ -6327,18 +6651,44 @@
+@@ -6345,18 +6669,44 @@
  		break;
  	case ZT_EVENT_NOALARM:
  		i->inalarm = 0;
@@ -7466,7 +7490,7 @@
  		/* fall thru intentionally */
  	case ZT_EVENT_ONHOOK:
  		if (i->radio) break;
-@@ -6378,8 +6728,10 @@
+@@ -6396,8 +6746,10 @@
  			zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
  			break;
  		case SIG_PRI:
@@ -7479,7 +7503,7 @@
  			break;
  		default:
  			ast_log(LOG_WARNING, "Don't know how to handle on hook with signalling %s on channel %d\n", sig2str(i->sig), i->channel);
-@@ -6702,6 +7054,8 @@
+@@ -6720,6 +7072,8 @@
  		} else {
  			if (si->totalchans == 31) { /* if it's an E1 */
  				pris[*span].dchannels[0] = 16 + offset;
@@ -7488,7 +7512,7 @@
  			} else {
  				pris[*span].dchannels[0] = 24 + offset;
  			}
-@@ -6789,6 +7143,10 @@
+@@ -6807,6 +7161,10 @@
  
  #endif
  
@@ -7499,7 +7523,7 @@
  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) */
-@@ -6947,6 +7305,11 @@
+@@ -6965,6 +7323,11 @@
  							destroy_zt_pvt(&tmp);
  							return NULL;
  						}
@@ -7511,7 +7535,7 @@
  						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);
-@@ -6974,6 +7337,17 @@
+@@ -6992,6 +7355,17 @@
  							return NULL;
  						}
  						pris[span].nodetype = pritype;
@@ -7529,7 +7553,7 @@
  						pris[span].switchtype = myswitchtype;
  						pris[span].nsf = nsf;
  						pris[span].dialplan = dialplan;
-@@ -6982,9 +7356,14 @@
+@@ -7000,9 +7374,14 @@
  						pris[span].minunused = minunused;
  						pris[span].minidle = minidle;
  						pris[span].overlapdial = overlapdial;
@@ -7544,7 +7568,7 @@
  						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));
-@@ -7005,6 +7384,36 @@
+@@ -7023,6 +7402,36 @@
  				tmp->prioffset = 0;
  			}
  #endif
@@ -7581,7 +7605,7 @@
  #ifdef ZAPATA_R2
  			if (signalling == SIG_R2) {
  				if (r2prot < 0) {
-@@ -7138,6 +7547,7 @@
+@@ -7156,6 +7565,7 @@
  		tmp->restrictcid = restrictcid;
  		tmp->use_callingpres = use_callingpres;
  		tmp->priindication_oob = priindication_oob;
@@ -7589,7 +7613,7 @@
  		tmp->priexclusive = cur_priexclusive;
  		if (tmp->usedistinctiveringdetection) {
  			if (!tmp->use_callerid) {
-@@ -7411,7 +7821,7 @@
+@@ -7429,7 +7839,7 @@
  			break;
  		if (!backwards && (x >= pri->numchans))
  			break;
@@ -7598,7 +7622,7 @@
  			ast_log(LOG_DEBUG, "Found empty available channel %d/%d\n", 
  				pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
  			return x;
-@@ -7458,7 +7868,7 @@
+@@ -7476,7 +7886,7 @@
  	end = ifend;
  	/* We do signed linear */
  	oldformat = format;
@@ -7607,7 +7631,7 @@
  	if (!format) {
  		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
  		return NULL;
-@@ -7618,6 +8028,11 @@
+@@ -7636,6 +8046,11 @@
  					p->digital = 1;
  					if (tmp)
  						tmp->transfercapability = AST_TRANS_CAP_DIGITAL;
@@ -7619,7 +7643,7 @@
  				} else {
  					ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
  				}
-@@ -7651,12 +8066,174 @@
+@@ -7669,12 +8084,174 @@
  				*cause = AST_CAUSE_BUSY;
  		} else if (groupmatched) {
  			*cause = AST_CAUSE_CONGESTION;
@@ -7794,7 +7818,7 @@
  
  #ifdef ZAPATA_PRI
  static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
-@@ -7671,6 +8248,57 @@
+@@ -7689,6 +8266,57 @@
  	return NULL;
  }
  
@@ -7852,7 +7876,7 @@
  
  static int pri_find_principle(struct zt_pri *pri, int channel)
  {
-@@ -7703,7 +8331,9 @@
+@@ -7721,7 +8349,9 @@
  static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
  {
  	int x;
@@ -7862,7 +7886,7 @@
  	if (!c) {
  		if (principle < 0)
  			return -1;
-@@ -7717,6 +8347,7 @@
+@@ -7735,6 +8365,7 @@
  	/* First, check for other bearers */
  	for (x=0;x<pri->numchans;x++) {
  		if (!pri->pvts[x]) continue;
@@ -7870,7 +7894,7 @@
  		if (pri->pvts[x]->call == c) {
  			/* Found our call */
  			if (principle != x) {
-@@ -7730,19 +8361,56 @@
+@@ -7748,19 +8379,56 @@
  				}
  				/* Fix it all up now */
  				pri->pvts[principle]->owner = pri->pvts[x]->owner;
@@ -7928,7 +7952,7 @@
  			}
  			return principle;
  		}
-@@ -7771,7 +8439,9 @@
+@@ -7789,7 +8457,9 @@
  		}
  		crv = crv->next;
  	}
@@ -7939,7 +7963,7 @@
  	return -1;
  }
  
-@@ -7830,86 +8500,33 @@
+@@ -7848,86 +8518,33 @@
  #ifndef PRI_RESTART
  #error "Upgrade your libpri"
  #endif
@@ -7990,9 +8014,7 @@
 -	int x, y;
 -	int dchan = -1, span = -1;
 -	int dchancount = 0;
-+	ast_log(LOG_WARNING, "%d %s", span, s);
-+}
- 
+-
 -	if (pri) {
 -		for (x = 0; x < NUM_SPANS; x++) {
 -			for (y = 0; y < NUM_DCHANS; y++) {
@@ -8019,7 +8041,9 @@
 -		ast_log(LOG_WARNING, "%s", s);
 -
 -	ast_mutex_lock(&pridebugfdlock);
--
++	ast_log(LOG_WARNING, "%d %s", span, s);
++}
+ 
 -	if (pridebugfd >= 0)
 -		write(pridebugfd, s, strlen(s));
 +#ifdef ZAPATA_GSM
@@ -8043,7 +8067,7 @@
  	do {
  		pri->resetpos++;
  	} while((pri->resetpos < pri->numchans) &&
-@@ -7992,6 +8609,32 @@
+@@ -8010,6 +8627,32 @@
  	}
  }
  
@@ -8076,7 +8100,7 @@
  static void *pri_dchannel(void *vpri)
  {
  	struct zt_pri *pri = vpri;
-@@ -8172,15 +8815,44 @@
+@@ -8190,15 +8833,44 @@
  					/* Check for an event */
  					x = 0;
  					res = ioctl(pri->fds[which], ZT_GETEVENT, &x);
@@ -8124,7 +8148,7 @@
  					}
  				
  					if (option_debug)
-@@ -8192,8 +8864,7 @@
+@@ -8210,8 +8882,7 @@
  					break;
  			}
  		} else if (errno != EINTR)
@@ -8134,7 +8158,7 @@
  		if (e) {
  			if (pri->debug)
  				pri_dump_event(pri->dchans[which], e);
-@@ -8201,32 +8872,102 @@
+@@ -8219,32 +8890,102 @@
  				pri->dchanavail[which] |= DCHAN_UP;
  			switch(e->e) {
  			case PRI_EVENT_DCHAN_UP:
@@ -8261,7 +8285,7 @@
  					pri->resetting = 0;
  					/* Hangup active channels and put them in alarm mode */
  					for (i=0; i<pri->numchans; i++) {
-@@ -8234,19 +8975,29 @@
+@@ -8252,19 +8993,29 @@
  						if (p) {
  							if (p->call) {
  								if (p->pri && p->pri->pri) {
@@ -8298,7 +8322,7 @@
  				}
  				break;
  			case PRI_EVENT_RESTART:
-@@ -8281,8 +9032,8 @@
+@@ -8299,8 +9050,8 @@
  								pri_destroycall(pri->pri, pri->pvts[x]->call);
  								pri->pvts[x]->call = NULL;
  							}
@@ -8309,7 +8333,7 @@
   							else if (pri->pvts[x]->owner)
  								pri->pvts[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
  							ast_mutex_unlock(&pri->pvts[x]->lock);
-@@ -8316,7 +9067,6 @@
+@@ -8334,7 +9085,6 @@
  					}
  				}
  				break;
@@ -8317,7 +8341,7 @@
  			case PRI_EVENT_INFO_RECEIVED:
  				chanpos = pri_find_principle(pri, e->ring.channel);
  				if (chanpos < 0) {
-@@ -8325,9 +9075,11 @@
+@@ -8343,9 +9093,11 @@
  				} else {
  					chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
  					if (chanpos > -1) {
@@ -8330,7 +8354,7 @@
  							/* how to do that */
  							int digitlen = strlen(e->ring.callednum);
  							char digit;
-@@ -8339,6 +9091,14 @@
+@@ -8357,6 +9109,14 @@
  									zap_queue_frame(pri->pvts[chanpos], &f, pri);
  								}
  							}
@@ -8345,7 +8369,7 @@
  						}
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					}
-@@ -8346,39 +9106,58 @@
+@@ -8364,39 +9124,58 @@
  				break;
  			case PRI_EVENT_RING:
  				crv = NULL;
@@ -8425,7 +8449,7 @@
  					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));
-@@ -8392,13 +9171,14 @@
+@@ -8410,13 +9189,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);
@@ -8441,7 +8465,7 @@
  					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) {
-@@ -8423,29 +9203,78 @@
+@@ -8441,29 +9221,78 @@
  					}
  					apply_plan_to_number(pri->pvts[chanpos]->rdnis, sizeof(pri->pvts[chanpos]->rdnis), pri,
  							     e->ring.redirectingnum, e->ring.callingplanrdnis);
@@ -8502,7 +8526,6 @@
  							ast_verbose(VERBOSE_PREFIX_3 "Going to extension s|1 because of Complete received\n");
  						pri->pvts[chanpos]->exten[0] = 's';
  						pri->pvts[chanpos]->exten[1] = '\0';
--					}
 + 					    }
 +  					} else {
 +  						/* Get called number */
@@ -8525,7 +8548,7 @@
 +  							}
 +  						    }
 +  						}
-+					}
+ 					}
 +  					/* Part 3: create channel, setup audio... */
 + 					/* Set DNID on all incoming calls -- even immediate */
 + 					if (!ast_strlen_zero(e->ring.callednum))
@@ -8533,7 +8556,7 @@
  					/* 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)) {
-@@ -8464,23 +9293,39 @@
+@@ -8482,23 +9311,39 @@
  						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);
@@ -8549,7 +8572,7 @@
 + 						if ((pri->nodetype != BRI_NETWORK_PTMP) && (pri->nodetype != BRI_NETWORK)) {
 +  						    if (e->ring.complete || !pri->overlapdial) {
  							/* Just announce proceeding */
-							pri->pvts[chanpos]->proceeding = 1;
+ 							pri->pvts[chanpos]->proceeding = 1;
  							pri_proceeding(pri->pri, e->ring.call, PVT_TO_CHANNEL(pri->pvts[chanpos]), 0);
 -						} else  {
 + 						//	pri->pvts[chanpos]->ignoredtmf = 0;
@@ -8580,7 +8603,7 @@
  						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);
-@@ -8487,14 +9332,31 @@
+@@ -8506,14 +9351,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);
@@ -8612,7 +8635,7 @@
  							if(e->ring.ani2 >= 0) {
  								snprintf(ani2str, 5, "%.2d", e->ring.ani2);
  								pbx_builtin_setvar_helper(c, "ANI2", ani2str);
-@@ -8514,8 +9376,8 @@
+@@ -8533,8 +9395,8 @@
  							ast_mutex_lock(&pri->lock);
  							if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
  								if (option_verbose > 2)
@@ -8623,7 +8646,7 @@
  										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", 
-@@ -8523,14 +9385,18 @@
+@@ -8542,14 +9404,18 @@
  								if (c)
  									ast_hangup(c);
  								else {
@@ -8643,7 +8666,7 @@
  							ast_mutex_lock(&pri->lock);
  							if (c) {
  								char calledtonstr[10];
-@@ -8551,23 +9417,40 @@
+@@ -8570,23 +9436,40 @@
  								snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
  								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
  								if (option_verbose > 2)
@@ -8688,7 +8711,7 @@
  						pri->pvts[chanpos]->call = NULL;
  						pri->pvts[chanpos]->exten[0] = '\0';
  					}
-@@ -8575,7 +9458,7 @@
+@@ -8594,7 +9477,7 @@
  						ast_mutex_unlock(&crv->lock);
  					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  				} else 
@@ -8697,7 +8720,7 @@
  				break;
  			case PRI_EVENT_RINGING:
  				chanpos = pri_find_principle(pri, e->ringing.channel);
-@@ -8593,7 +9476,7 @@
+@@ -8612,7 +9495,7 @@
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
@@ -8706,7 +8729,7 @@
  							pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
  							pri->pvts[chanpos]->alerting = 1;
  						} else
-@@ -8622,9 +9505,16 @@
+@@ -8641,9 +9524,16 @@
  				}
  				break;
  			case PRI_EVENT_PROGRESS:
@@ -8724,7 +8747,7 @@
  #ifdef PRI_PROGRESS_MASK
  					if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
  #else
-@@ -8671,6 +9561,12 @@
+@@ -8690,6 +9580,12 @@
  			case PRI_EVENT_PROCEEDING:
  				chanpos = pri_find_principle(pri, e->proceeding.channel);
  				if (chanpos > -1) {
@@ -8737,7 +8760,7 @@
  					if (!pri->pvts[chanpos]->proceeding) {
  						struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
  						
-@@ -8721,6 +9617,295 @@
+@@ -8740,6 +9636,295 @@
  					}
  				}
  				break;				
@@ -9033,7 +9056,7 @@
  			case PRI_EVENT_ANSWER:
  				chanpos = pri_find_principle(pri, e->answer.channel);
  				if (chanpos < 0) {
-@@ -8736,6 +9921,7 @@
+@@ -8755,6 +9940,7 @@
  						chanpos = -1;
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -9041,7 +9064,7 @@
  						/* Now we can do call progress detection */
  
  						/* We changed this so it turns on the DSP no matter what... progress or no progress.
-@@ -8765,11 +9951,16 @@
+@@ -8784,11 +9970,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) {
@@ -9059,7 +9082,7 @@
  						}
  
  #ifdef SUPPORT_USERUSER
-@@ -8818,23 +10009,32 @@
+@@ -8837,23 +10028,32 @@
  								}
  							}
  							if (option_verbose > 2) 
@@ -9099,7 +9122,7 @@
  
  #ifdef SUPPORT_USERUSER
  						if (!ast_strlen_zero(e->hangup.useruserinfo)) {
-@@ -8844,8 +10044,20 @@
+@@ -8863,8 +10063,20 @@
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
@@ -9122,7 +9145,7 @@
  					}
  				} 
  				break;
-@@ -8855,17 +10067,25 @@
+@@ -8874,17 +10086,25 @@
  			case PRI_EVENT_HANGUP_REQ:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
  				if (chanpos < 0) {
@@ -9151,7 +9174,7 @@
  							pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
  							switch(e->hangup.cause) {
  							case PRI_CAUSE_USER_BUSY:
-@@ -8884,20 +10104,87 @@
+@@ -8903,20 +10123,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);
@@ -9249,7 +9272,7 @@
  						}
  
  #ifdef SUPPORT_USERUSER
-@@ -8908,9 +10195,37 @@
+@@ -8927,9 +10214,37 @@
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
@@ -9288,7 +9311,7 @@
  				break;
  			case PRI_EVENT_HANGUP_ACK:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
-@@ -8924,6 +10239,7 @@
+@@ -8943,6 +10258,7 @@
  					if (chanpos > -1) {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						pri->pvts[chanpos]->call = NULL;
@@ -9296,7 +9319,7 @@
  						pri->pvts[chanpos]->resetting = 0;
  						if (pri->pvts[chanpos]->owner) {
  							if (option_verbose > 2) 
-@@ -8937,7 +10253,9 @@
+@@ -8956,7 +10272,9 @@
  #endif
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -9306,7 +9329,7 @@
  				}
  				break;
  			case PRI_EVENT_CONFIG_ERR:
-@@ -9029,10 +10347,22 @@
+@@ -9048,10 +10366,22 @@
  					ast_mutex_lock(&pri->pvts[chanpos]->lock);
  					switch(e->notify.info) {
  					case PRI_NOTIFY_REMOTE_HOLD:
@@ -9329,7 +9352,7 @@
  						f.subclass = AST_CONTROL_UNHOLD;
  						zap_queue_frame(pri->pvts[chanpos], &f, pri);
  						break;
-@@ -9040,6 +10370,77 @@
+@@ -9059,6 +10389,77 @@
  					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  				}
  				break;
@@ -9407,7 +9430,7 @@
  			default:
  				ast_log(LOG_DEBUG, "Event: %d\n", e->e);
  			}
-@@ -9101,7 +10502,7 @@
+@@ -9120,7 +10521,7 @@
  			pri->fds[i] = -1;
  			return -1;
  		}
@@ -9416,7 +9439,7 @@
  		/* Force overlap dial if we're doing GR-303! */
  		if (pri->switchtype == PRI_SWITCH_GR303_TMC)
  			pri->overlapdial = 1;
-@@ -9170,39 +10571,77 @@
+@@ -9189,39 +10590,77 @@
  
  static int handle_pri_set_debug_file(int fd, int argc, char **argv)
  {
@@ -9516,7 +9539,7 @@
  	}
  
  	return RESULT_SUCCESS;
-@@ -9234,6 +10673,7 @@
+@@ -9253,6 +10692,7 @@
  
  
  
@@ -9524,7 +9547,7 @@
  static int handle_pri_no_debug(int fd, int argc, char *argv[])
  {
  	int span;
-@@ -9340,36 +10780,6 @@
+@@ -9359,36 +10799,6 @@
  	return RESULT_SUCCESS;
  }
  
@@ -9561,7 +9584,7 @@
  static char pri_debug_help[] = 
  	"Usage: pri debug span <span>\n"
  	"       Enables debugging on a given PRI span\n";
-@@ -9386,6 +10796,18 @@
+@@ -9405,6 +10815,18 @@
  	"Usage: pri show span <span>\n"
  	"       Displays PRI Information\n";
  
@@ -9580,7 +9603,7 @@
  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 },
-@@ -9393,19 +10815,282 @@
+@@ -9412,19 +10834,282 @@
  	  "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 },
@@ -9866,7 +9889,7 @@
  #ifdef ZAPATA_R2
  static int handle_r2_no_debug(int fd, int argc, char *argv[])
  {
-@@ -10017,6 +11702,14 @@
+@@ -10036,6 +11721,14 @@
  			pthread_cancel(pris[i].master);
  	}
  	ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
@@ -9881,7 +9904,7 @@
  #endif
  #ifdef ZAPATA_R2
  	ast_cli_unregister_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
-@@ -10028,6 +11721,7 @@
+@@ -10047,6 +11740,7 @@
  	ast_manager_unregister( "ZapDNDoff" );
  	ast_manager_unregister( "ZapDNDon" );
  	ast_manager_unregister("ZapShowChannels");
@@ -9889,7 +9912,7 @@
  	ast_channel_unregister(&zap_tech);
  	if (!ast_mutex_lock(&iflock)) {
  		/* Hangup all interfaces if they have an owner */
-@@ -10386,8 +12080,8 @@
+@@ -10405,8 +12099,8 @@
  			}
  		} else if (!strcasecmp(v->name, "echotraining")) {
  			if (sscanf(v->value, "%d", &y) == 1) {
@@ -9900,7 +9923,7 @@
  				} else {
  					echotraining = y;
  				}
-@@ -10573,12 +12267,33 @@
+@@ -10592,12 +12286,33 @@
  					cur_signalling = SIG_GR303FXSKS;
  					cur_radio = 0;
  					pritype = PRI_CPE;
@@ -9934,13 +9957,14 @@
  				} else {
  					ast_log(LOG_ERROR, "Unknown signalling method '%s'\n", v->value);
  				}
-@@ -10661,8 +12376,20 @@
+@@ -10680,8 +12395,20 @@
  					priindication_oob = 1;
  				else if (!strcasecmp(v->value, "inband"))
  					priindication_oob = 0;
 +				else if (!strcasecmp(v->value, "passthrough"))
 +					priindication_oob = 2;
-+				else
+ 				else
+-					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d\n",
 +					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' , 'outofband' or 'passthrough' at line %d\n",
 +						v->value, v->lineno);
 +			} else if (!strcasecmp(v->name, "pritransfer")) {
@@ -9950,13 +9974,12 @@
 +					pritransfer = 1;
 +				else if (!strcasecmp(v->value, "hangup"))
 +					pritransfer = 2;
- 				else
--					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d\n",
++				else
 +					ast_log(LOG_WARNING, "'%s' is not a valid pri transfer value, should be 'no' , 'ect' or 'hangup' at line %d\n",
  						v->value, v->lineno);
  			} else if (!strcasecmp(v->name, "priexclusive")) {
  				cur_priexclusive = ast_true(v->value);
-@@ -10676,6 +12403,14 @@
+@@ -10695,6 +12422,14 @@
  				ast_copy_string(privateprefix, v->value, sizeof(privateprefix));
  			} else if (!strcasecmp(v->name, "unknownprefix")) {
  				ast_copy_string(unknownprefix, v->value, sizeof(unknownprefix));
@@ -9971,7 +9994,7 @@
  			} else if (!strcasecmp(v->name, "resetinterval")) {
  				if (!strcasecmp(v->value, "never"))
  					resetinterval = -1;
-@@ -10692,6 +12427,8 @@
+@@ -10711,6 +12446,8 @@
  				ast_copy_string(idleext, v->value, sizeof(idleext));
  			} else if (!strcasecmp(v->name, "idledial")) {
  				ast_copy_string(idledial, v->value, sizeof(idledial));
@@ -9980,7 +10003,7 @@
  			} else if (!strcasecmp(v->name, "overlapdial")) {
  				overlapdial = ast_true(v->value);
  			} else if (!strcasecmp(v->name, "pritimer")) {
-@@ -10877,6 +12614,7 @@
+@@ -10896,6 +12633,7 @@
  #ifdef ZAPATA_PRI
  	if (!reload) {
  		for (x=0;x<NUM_SPANS;x++) {
@@ -9988,7 +10011,7 @@
  			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);
-@@ -10909,6 +12647,10 @@
+@@ -10928,6 +12666,10 @@
  	pri_set_error(zt_pri_error);
  	pri_set_message(zt_pri_message);
  #endif
@@ -9999,7 +10022,7 @@
  	res = setup_zap(0);
  	/* Make sure we can register our Zap channel type */
  	if(res) {
-@@ -10926,6 +12668,12 @@
+@@ -10945,6 +12687,12 @@
  	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]));
@@ -10012,7 +10035,7 @@
  	
  	memset(round_robin, 0, sizeof(round_robin));
  	ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
-@@ -10934,11 +12682,47 @@
+@@ -10953,11 +12701,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");
@@ -10061,7 +10084,7 @@
  {
  #define	END_SILENCE_LEN 400
  #define	HEADER_MS 50
-@@ -10957,6 +12741,7 @@
+@@ -10976,6 +12760,7 @@
  	float scont = 0.0;
  	int index;
  
@@ -10069,9 +10092,9 @@
  	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.10.orig/codecs/codec_ilbc.c asterisk-1.2.10/codecs/codec_ilbc.c
---- asterisk-1.2.10.orig/codecs/codec_ilbc.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/codecs/codec_ilbc.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/codecs/codec_ilbc.c asterisk-1.2.13.dfsg/codecs/codec_ilbc.c
+--- asterisk-1.2.13.dfsg~/codecs/codec_ilbc.c	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/codecs/codec_ilbc.c	2006-10-23 22:22:34.000000000 +0100
 @@ -49,7 +49,7 @@
  #include "slin_ilbc_ex.h"
  #include "ilbc_slin_ex.h"
@@ -10081,9 +10104,9 @@
  #define ILBC_MS 			30
  /* #define ILBC_MS			20 */
  
-diff -urN asterisk-1.2.10.orig/configs/capi.conf.sample asterisk-1.2.10/configs/capi.conf.sample
---- asterisk-1.2.10.orig/configs/capi.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/configs/capi.conf.sample	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/configs/capi.conf.sample asterisk-1.2.13.dfsg/configs/capi.conf.sample
+--- asterisk-1.2.13.dfsg~/configs/capi.conf.sample	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/configs/capi.conf.sample	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,44 @@
 +;
 +; CAPI config
@@ -10129,17 +10152,17 @@
 +;msn=55512
 +;controller=2
 +;devices => 30
-diff -urN asterisk-1.2.10.orig/configs/modules.conf.sample asterisk-1.2.10/configs/modules.conf.sample
---- asterisk-1.2.10.orig/configs/modules.conf.sample	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/configs/modules.conf.sample	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/configs/modules.conf.sample asterisk-1.2.13.dfsg/configs/modules.conf.sample
+--- asterisk-1.2.13.dfsg~/configs/modules.conf.sample	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/configs/modules.conf.sample	2006-10-23 22:22:34.000000000 +0100
 @@ -51,3 +51,4 @@
  ; exported to modules loaded after them.
  ;
  [global]
 +chan_capi.so=yes
-diff -urN asterisk-1.2.10.orig/configs/watchdog.conf.sample asterisk-1.2.10/configs/watchdog.conf.sample
---- asterisk-1.2.10.orig/configs/watchdog.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/configs/watchdog.conf.sample	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/configs/watchdog.conf.sample asterisk-1.2.13.dfsg/configs/watchdog.conf.sample
+--- asterisk-1.2.13.dfsg~/configs/watchdog.conf.sample	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/configs/watchdog.conf.sample	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,22 @@
 +;
 +; Configuration file for res_watchdog
@@ -10163,10 +10186,10 @@
 +;device = /dev/watchdog
 +;interval = 100
 +
-diff -urN asterisk-1.2.10.orig/configs/zapata.conf.sample asterisk-1.2.10/configs/zapata.conf.sample
---- asterisk-1.2.10.orig/configs/zapata.conf.sample	2006-04-28 18:40:32.000000000 +0200
-+++ asterisk-1.2.10/configs/zapata.conf.sample	2006-07-31 14:13:08.000000000 +0200
-@@ -121,9 +121,20 @@
+diff -urNad asterisk-1.2.13.dfsg~/configs/zapata.conf.sample asterisk-1.2.13.dfsg/configs/zapata.conf.sample
+--- asterisk-1.2.13.dfsg~/configs/zapata.conf.sample	2006-09-18 16:05:56.000000000 +0100
++++ asterisk-1.2.13.dfsg/configs/zapata.conf.sample	2006-10-23 22:22:34.000000000 +0100
+@@ -123,9 +123,20 @@
  ; 
  ; outofband:      Signal Busy/Congestion out of band with RELEASE/DISCONNECT
  ; inband:         Signal Busy/Congestion using in-band tones
@@ -10187,9 +10210,9 @@
  ; 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.10.orig/db.c asterisk-1.2.10/db.c
---- asterisk-1.2.10.orig/db.c	2006-01-09 19:09:53.000000000 +0100
-+++ asterisk-1.2.10/db.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/db.c asterisk-1.2.13.dfsg/db.c
+--- asterisk-1.2.13.dfsg~/db.c	2006-01-09 18:09:53.000000000 +0000
++++ asterisk-1.2.13.dfsg/db.c	2006-10-23 22:22:34.000000000 +0100
 @@ -516,11 +516,18 @@
  struct ast_cli_entry cli_database_deltree =
  { { "database", "deltree", NULL }, database_deltree, "Removes database keytree/values", database_deltree_usage };
@@ -10283,9 +10306,9 @@
 +	ast_manager_register("DBdel", EVENT_FLAG_SYSTEM, manager_dbdel, mandescr_dbdel);
  	return 0;
  }
-diff -urN asterisk-1.2.10.orig/devicestate.c asterisk-1.2.10/devicestate.c
---- asterisk-1.2.10.orig/devicestate.c	2006-02-10 21:38:59.000000000 +0100
-+++ asterisk-1.2.10/devicestate.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/devicestate.c asterisk-1.2.13.dfsg/devicestate.c
+--- asterisk-1.2.13.dfsg~/devicestate.c	2006-02-10 20:38:59.000000000 +0000
++++ asterisk-1.2.13.dfsg/devicestate.c	2006-10-23 22:22:34.000000000 +0100
 @@ -62,6 +62,8 @@
  
  struct state_change {
@@ -10377,9 +10400,9 @@
  			free(cur);
  			AST_LIST_LOCK(&state_changes);
  		} else {
-diff -urN asterisk-1.2.10.orig/doc/README.asterisk.conf asterisk-1.2.10/doc/README.asterisk.conf
---- asterisk-1.2.10.orig/doc/README.asterisk.conf	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/doc/README.asterisk.conf	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/doc/README.asterisk.conf asterisk-1.2.13.dfsg/doc/README.asterisk.conf
+--- asterisk-1.2.13.dfsg~/doc/README.asterisk.conf	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/doc/README.asterisk.conf	2006-10-23 22:22:34.000000000 +0100
 @@ -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
@@ -10388,9 +10411,24 @@
  
  [files]
  ; Changing the following lines may compromise your security
-diff -urN asterisk-1.2.10.orig/include/asterisk/agi.h asterisk-1.2.10/include/asterisk/agi.h
---- asterisk-1.2.10.orig/include/asterisk/agi.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/agi.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/editline/cygdef.h asterisk-1.2.13.dfsg/editline/cygdef.h
+--- asterisk-1.2.13.dfsg~/editline/cygdef.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/editline/cygdef.h	2006-10-23 22:22:34.000000000 +0100
+@@ -0,0 +1,11 @@
++/* cygdef.h. Generated automatically by configure. */ 
++#ifndef _CYGDEF_H_
++#define _CYGDEF_H_ 1
++#include <sys/ioctl.h>
++#define __linux__ 1
++ 
++
++typedef void (*sig_t)(int);
++ 
++
++#endif /* _CYGDEF_H_ */
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/agi.h asterisk-1.2.13.dfsg/include/asterisk/agi.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/agi.h	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk/agi.h	2006-10-23 22:22:34.000000000 +0100
 @@ -29,7 +29,8 @@
  
  typedef struct agi_state {
@@ -10401,9 +10439,9 @@
  	int ctrl;	/* FD for input control */
  } AGI;
  
-diff -urN asterisk-1.2.10.orig/include/asterisk/chan_capi.h asterisk-1.2.10/include/asterisk/chan_capi.h
---- asterisk-1.2.10.orig/include/asterisk/chan_capi.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/chan_capi.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/chan_capi.h asterisk-1.2.13.dfsg/include/asterisk/chan_capi.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/chan_capi.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/include/asterisk/chan_capi.h	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,276 @@
 +/*
 + * (CAPI*)
@@ -10681,9 +10719,9 @@
 +#define CAPI_ETSI_NPLAN_INTERNAT	0x10
 +
 +#endif
-diff -urN asterisk-1.2.10.orig/include/asterisk/chan_capi_app.h asterisk-1.2.10/include/asterisk/chan_capi_app.h
---- asterisk-1.2.10.orig/include/asterisk/chan_capi_app.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/chan_capi_app.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/chan_capi_app.h asterisk-1.2.13.dfsg/include/asterisk/chan_capi_app.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/chan_capi_app.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/include/asterisk/chan_capi_app.h	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,30 @@
 +/*
 + * (CAPI*)
@@ -10715,9 +10753,9 @@
 +extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
 +
 +#endif
-diff -urN asterisk-1.2.10.orig/include/asterisk/channel.h asterisk-1.2.10/include/asterisk/channel.h
---- asterisk-1.2.10.orig/include/asterisk/channel.h	2006-06-01 22:27:50.000000000 +0200
-+++ asterisk-1.2.10/include/asterisk/channel.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/channel.h asterisk-1.2.13.dfsg/include/asterisk/channel.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/channel.h	2006-09-26 21:38:06.000000000 +0100
++++ asterisk-1.2.13.dfsg/include/asterisk/channel.h	2006-10-23 22:22:34.000000000 +0100
 @@ -86,6 +86,9 @@
  #ifndef _ASTERISK_CHANNEL_H
  #define _ASTERISK_CHANNEL_H
@@ -10804,9 +10842,9 @@
  
  /*! Gives the string form of a given cause code */
  /*! 
-diff -urN asterisk-1.2.10.orig/include/asterisk/devicestate.h asterisk-1.2.10/include/asterisk/devicestate.h
---- asterisk-1.2.10.orig/include/asterisk/devicestate.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/devicestate.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/devicestate.h asterisk-1.2.13.dfsg/include/asterisk/devicestate.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/devicestate.h	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk/devicestate.h	2006-10-23 22:22:34.000000000 +0100
 @@ -42,7 +42,7 @@
  /*! Device is ringing */
  #define AST_DEVICE_RINGING	6
@@ -10825,9 +10863,9 @@
  
  /*! \brief Registers a device state change callback 
   * \param callback Callback
-diff -urN asterisk-1.2.10.orig/include/asterisk/features.h asterisk-1.2.10/include/asterisk/features.h
---- asterisk-1.2.10.orig/include/asterisk/features.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/features.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/features.h asterisk-1.2.13.dfsg/include/asterisk/features.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/features.h	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk/features.h	2006-10-23 22:22:34.000000000 +0100
 @@ -45,6 +45,8 @@
  };
  
@@ -10870,9 +10908,9 @@
 +extern struct ast_call_feature *ast_find_builtin_feature(char *name);
 +
  #endif /* _AST_FEATURES_H */
-diff -urN asterisk-1.2.10.orig/include/asterisk/manager.h asterisk-1.2.10/include/asterisk/manager.h
---- asterisk-1.2.10.orig/include/asterisk/manager.h	2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/manager.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/manager.h asterisk-1.2.13.dfsg/include/asterisk/manager.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/manager.h	2006-02-11 18:15:00.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk/manager.h	2006-10-23 22:22:34.000000000 +0100
 @@ -54,6 +54,7 @@
  #define EVENT_FLAG_COMMAND		(1 << 4) /* Ability to read/set commands */
  #define EVENT_FLAG_AGENT		(1 << 5) /* Ability to read/set agent info */
@@ -10881,9 +10919,9 @@
  
  /* Export manager structures */
  #define AST_MAX_MANHEADERS 80
-diff -urN asterisk-1.2.10.orig/include/asterisk/monitor.h asterisk-1.2.10/include/asterisk/monitor.h
---- asterisk-1.2.10.orig/include/asterisk/monitor.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/monitor.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/monitor.h asterisk-1.2.13.dfsg/include/asterisk/monitor.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/monitor.h	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk/monitor.h	2006-10-23 22:22:34.000000000 +0100
 @@ -35,6 +35,8 @@
  	char write_filename[FILENAME_MAX];
  	char filename_base[FILENAME_MAX];
@@ -10902,9 +10940,9 @@
  
  /* Stop monitoring a channel */
  int ast_monitor_stop(struct ast_channel *chan, int need_lock);
-diff -urN asterisk-1.2.10.orig/include/asterisk/pbx.h asterisk-1.2.10/include/asterisk/pbx.h
---- asterisk-1.2.10.orig/include/asterisk/pbx.h	2006-03-29 21:11:18.000000000 +0200
-+++ asterisk-1.2.10/include/asterisk/pbx.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/pbx.h asterisk-1.2.13.dfsg/include/asterisk/pbx.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/pbx.h	2006-03-29 20:11:18.000000000 +0100
++++ asterisk-1.2.13.dfsg/include/asterisk/pbx.h	2006-10-23 22:22:34.000000000 +0100
 @@ -57,7 +57,7 @@
  	AST_EXTENSION_BUSY = 1 << 1,
  	/*! All devices UNAVAILABLE/UNREGISTERED */
@@ -10955,9 +10993,9 @@
  
  #if defined(__cplusplus) || defined(c_plusplus)
  }
-diff -urN asterisk-1.2.10.orig/include/asterisk/xlaw.h asterisk-1.2.10/include/asterisk/xlaw.h
---- asterisk-1.2.10.orig/include/asterisk/xlaw.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk/xlaw.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk/xlaw.h asterisk-1.2.13.dfsg/include/asterisk/xlaw.h
+--- asterisk-1.2.13.dfsg~/include/asterisk/xlaw.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/include/asterisk/xlaw.h	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,1665 @@
 +#ifndef _ASTERISK_XLAW_H
 +#define _ASTERISK_XLAW_H
@@ -12624,9 +12662,9 @@
 +#endif // CAPI_ULAW
 +#endif
 +
-diff -urN asterisk-1.2.10.orig/include/asterisk.h asterisk-1.2.10/include/asterisk.h
---- asterisk-1.2.10.orig/include/asterisk.h	2005-11-30 04:37:37.000000000 +0100
-+++ asterisk-1.2.10/include/asterisk.h	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/include/asterisk.h asterisk-1.2.13.dfsg/include/asterisk.h
+--- asterisk-1.2.13.dfsg~/include/asterisk.h	2005-11-30 03:37:37.000000000 +0000
++++ asterisk-1.2.13.dfsg/include/asterisk.h	2006-10-23 22:22:34.000000000 +0100
 @@ -36,6 +36,7 @@
  extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
  extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
@@ -12635,9 +12673,9 @@
  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.10.orig/manager.c asterisk-1.2.10/manager.c
---- asterisk-1.2.10.orig/manager.c	2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.10/manager.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/manager.c asterisk-1.2.13.dfsg/manager.c
+--- asterisk-1.2.13.dfsg~/manager.c	2006-02-11 18:15:00.000000000 +0000
++++ asterisk-1.2.13.dfsg/manager.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -12900,9 +12938,9 @@
  	return 0;
  }
  
-diff -urN asterisk-1.2.10.orig/pbx/pbx_spool.c asterisk-1.2.10/pbx/pbx_spool.c
---- asterisk-1.2.10.orig/pbx/pbx_spool.c	2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.10/pbx/pbx_spool.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/pbx/pbx_spool.c asterisk-1.2.13.dfsg/pbx/pbx_spool.c
+--- asterisk-1.2.13.dfsg~/pbx/pbx_spool.c	2006-02-11 18:15:00.000000000 +0000
++++ asterisk-1.2.13.dfsg/pbx/pbx_spool.c	2006-10-23 22:22:34.000000000 +0100
 @@ -259,11 +259,11 @@
  	if (!ast_strlen_zero(o->app)) {
  		if (option_verbose > 2)
@@ -12917,9 +12955,9 @@
  	}
  	if (res) {
  		ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
-diff -urN asterisk-1.2.10.orig/pbx.c asterisk-1.2.10/pbx.c
---- asterisk-1.2.10.orig/pbx.c	2006-06-18 23:03:58.000000000 +0200
-+++ asterisk-1.2.10/pbx.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/pbx.c asterisk-1.2.13.dfsg/pbx.c
+--- asterisk-1.2.13.dfsg~/pbx.c	2006-09-27 20:35:09.000000000 +0100
++++ asterisk-1.2.13.dfsg/pbx.c	2006-10-23 22:22:34.000000000 +0100
 @@ -353,7 +353,8 @@
  	
  	{ "Hangup", pbx_builtin_hangup,
@@ -12971,7 +13009,7 @@
  				free(prevcb);
  	    		}
  		} else {
-@@ -4981,7 +4982,7 @@
+@@ -4982,7 +4983,7 @@
  	return 0;  /* success */
  }
  
@@ -12980,7 +13018,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -4991,7 +4992,7 @@
+@@ -4992,7 +4993,7 @@
  
  	if (sync) {
  		LOAD_OH(oh);
@@ -12989,7 +13027,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5093,7 +5094,7 @@
+@@ -5094,7 +5095,7 @@
  			goto outgoing_exten_cleanup;
  		}	
  		memset(as, 0, sizeof(struct async_stat));
@@ -12998,7 +13036,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5139,7 +5140,7 @@
+@@ -5140,7 +5141,7 @@
  	pthread_t t;
  };
  
@@ -13007,7 +13045,7 @@
  {
  	struct app_tmp *tmp = data;
  	struct ast_app *app;
-@@ -5155,7 +5156,7 @@
+@@ -5156,7 +5157,7 @@
  	return NULL;
  }
  
@@ -13016,7 +13054,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -5175,7 +5176,7 @@
+@@ -5176,7 +5177,7 @@
  		goto outgoing_app_cleanup;	
  	}
  	if (sync) {
@@ -13025,7 +13063,7 @@
  		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);
-@@ -5262,7 +5263,8 @@
+@@ -5263,7 +5264,8 @@
  			goto outgoing_app_cleanup;
  		}
  		memset(as, 0, sizeof(struct async_stat));
@@ -13035,7 +13073,7 @@
  		if (!chan) {
  			free(as);
  			res = -1;
-@@ -5551,6 +5553,9 @@
+@@ -5552,6 +5554,9 @@
   */
  static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
  {
@@ -13045,7 +13083,7 @@
  	/* Just return non-zero and it will hang up */
  	if (!chan->hangupcause)
  		chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
-@@ -6207,6 +6212,9 @@
+@@ -6206,6 +6211,9 @@
  			return -1;
  		}
  	}
@@ -13055,7 +13093,7 @@
  	return res = ast_say_number(chan, atoi((char *) tmp), "", chan->language, options);
  }
  
-@@ -6214,8 +6222,12 @@
+@@ -6213,8 +6221,12 @@
  {
  	int res = 0;
  
@@ -13069,7 +13107,7 @@
  	return res;
  }
  	
-@@ -6223,8 +6235,12 @@
+@@ -6222,8 +6234,12 @@
  {
  	int res = 0;
  
@@ -13083,7 +13121,7 @@
  	return res;
  }
  	
-@@ -6232,8 +6248,12 @@
+@@ -6231,8 +6247,12 @@
  {
  	int res = 0;
  
@@ -13097,9 +13135,9 @@
  	return res;
  }
  	
-diff -urN asterisk-1.2.10.orig/res/Makefile asterisk-1.2.10/res/Makefile
---- asterisk-1.2.10.orig/res/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.10/res/Makefile	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/res/Makefile asterisk-1.2.13.dfsg/res/Makefile
+--- asterisk-1.2.13.dfsg~/res/Makefile	2005-11-29 18:24:39.000000000 +0000
++++ asterisk-1.2.13.dfsg/res/Makefile	2006-10-23 22:22:34.000000000 +0100
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -13109,9 +13147,9 @@
  
  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.10.orig/res/res_agi.c asterisk-1.2.10/res/res_agi.c
---- asterisk-1.2.10.orig/res/res_agi.c	2006-07-12 15:54:10.000000000 +0200
-+++ asterisk-1.2.10/res/res_agi.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/res/res_agi.c asterisk-1.2.13.dfsg/res/res_agi.c
+--- asterisk-1.2.13.dfsg~/res/res_agi.c	2006-09-06 21:02:59.000000000 +0100
++++ asterisk-1.2.13.dfsg/res/res_agi.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -13428,8 +13466,8 @@
 +		agi.audio_out = efd;
 +		agi.audio_in = efd2;
  		res = run_agi(chan, argv[0], &agi, pid, dead);
-		if (fds[1] != fds[0])
-			close(fds[1]);
+ 		if (fds[1] != fds[0])
+ 			close(fds[1]);
  		if (efd > -1)
  			close(efd);
 +		if (efd2 > -1)
@@ -13437,7 +13475,7 @@
  	}
  	LOCAL_USER_REMOVE(u);
  	return res;
-@@ -2083,6 +2162,35 @@
+@@ -2084,6 +2163,35 @@
  	return res;
  }
  
@@ -13473,7 +13511,7 @@
  static int deadagi_exec(struct ast_channel *chan, void *data)
  {
  	return agi_exec_full(chan, data, 0, 1);
-@@ -2112,6 +2220,7 @@
+@@ -2113,6 +2221,7 @@
  	ast_cli_unregister(&dumpagihtml);
  	ast_cli_unregister(&cli_debug);
  	ast_cli_unregister(&cli_no_debug);
@@ -13481,7 +13519,7 @@
  	ast_unregister_application(eapp);
  	ast_unregister_application(deadapp);
  	return ast_unregister_application(app);
-@@ -2125,6 +2234,7 @@
+@@ -2126,6 +2235,7 @@
  	ast_cli_register(&cli_no_debug);
  	ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
  	ast_register_application(eapp, eagi_exec, esynopsis, descrip);
@@ -13489,9 +13527,9 @@
  	return ast_register_application(app, agi_exec, synopsis, descrip);
  }
  
-diff -urN asterisk-1.2.10.orig/res/res_features.c asterisk-1.2.10/res/res_features.c
---- asterisk-1.2.10.orig/res/res_features.c	2006-05-23 19:15:23.000000000 +0200
-+++ asterisk-1.2.10/res/res_features.c	2006-08-02 09:55:40.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/res/res_features.c asterisk-1.2.13.dfsg/res/res_features.c
+--- asterisk-1.2.13.dfsg~/res/res_features.c	2006-09-28 19:00:30.000000000 +0100
++++ asterisk-1.2.13.dfsg/res/res_features.c	2006-10-23 22:22:34.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -13628,7 +13666,7 @@
  		/* Make the masq execute */
  		f = ast_read(chan);
  		if (f)
-@@ -906,7 +973,7 @@
+@@ -909,7 +976,7 @@
  }
  
  /* find a feature by name */
@@ -13637,7 +13675,7 @@
  {
  	struct ast_call_feature *tmp;
  
-@@ -916,10 +983,21 @@
+@@ -919,10 +986,21 @@
  			break;
  	}
  	AST_LIST_UNLOCK(&feature_list);
@@ -13660,7 +13698,7 @@
  /* 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)
  {
-@@ -1018,7 +1096,7 @@
+@@ -1021,7 +1099,7 @@
  			return res;
  		
  		while ((tok = strsep(&tmp, "#")) != NULL) {
@@ -13669,7 +13707,7 @@
  			
  			if (feature) {
  				/* Feature is up for consideration */
-@@ -1071,7 +1149,7 @@
+@@ -1074,7 +1152,7 @@
  
  			/* while we have a feature */
  			while (NULL != (tok = strsep(&tmp, "#"))) {
@@ -13678,7 +13716,7 @@
  					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);
-@@ -1096,7 +1174,7 @@
+@@ -1099,7 +1177,7 @@
  	struct ast_frame *f = NULL;
  	int res = 0, ready = 0;
  	
@@ -13687,7 +13725,7 @@
  		ast_set_callerid(chan, cid_num, cid_name, cid_num);
  		ast_channel_inherit_variables(caller, chan);	
  		if (!ast_call(chan, data, timeout)) {
-@@ -1549,9 +1627,10 @@
+@@ -1554,9 +1632,10 @@
  					"Channel: %s\r\n"
  					"CallerID: %s\r\n"
  					"CallerIDName: %s\r\n"
@@ -13699,7 +13737,7 @@
  					);
  
  				if (option_verbose > 1) 
-@@ -1594,9 +1673,10 @@
+@@ -1599,9 +1678,10 @@
  								"Channel: %s\r\n"
  								"CallerID: %s\r\n"
  								"CallerIDName: %s\r\n"
@@ -13711,7 +13749,7 @@
  								);
  
  							/* There's a problem, hang them up*/
-@@ -1683,6 +1763,282 @@
+@@ -1688,6 +1768,282 @@
  	return res;
  }
  
@@ -13994,7 +14032,7 @@
  static int park_exec(struct ast_channel *chan, void *data)
  {
  	int res=0;
-@@ -1731,9 +2087,10 @@
+@@ -1736,9 +2092,10 @@
  			"From: %s\r\n"
  			"CallerID: %s\r\n"
  			"CallerIDName: %s\r\n"
@@ -14006,7 +14044,7 @@
  			);
  
  		free(pu);
-@@ -1901,12 +2258,13 @@
+@@ -1906,12 +2263,13 @@
  			"Timeout: %ld\r\n"
  			"CallerID: %s\r\n"
  			"CallerIDName: %s\r\n"
@@ -14021,7 +14059,7 @@
  			,idText);
  
              cur = cur->next;
-@@ -1922,6 +2280,416 @@
+@@ -1927,6 +2285,416 @@
          return RESULT_SUCCESS;
  }
  
@@ -14438,7 +14476,7 @@
  
  int ast_pickup_call(struct ast_channel *chan)
  {
-@@ -2076,7 +2844,7 @@
+@@ -2081,7 +2849,7 @@
  			}
  
  			{
@@ -14447,7 +14485,7 @@
  				int mallocd=0;
  				
  				if (!feature) {
-@@ -2138,6 +2906,7 @@
+@@ -2143,6 +2911,7 @@
  }
  
  int reload(void) {
@@ -14455,7 +14493,7 @@
  	return load_config();
  }
  
-@@ -2151,14 +2920,22 @@
+@@ -2156,14 +2925,22 @@
  	if ((res = load_config()))
  		return res;
  	ast_cli_register(&showparked);
@@ -14478,7 +14516,7 @@
  	return res;
  }
  
-@@ -2169,7 +2946,11 @@
+@@ -2174,7 +2951,11 @@
  
  	ast_manager_unregister("ParkedCalls");
  	ast_cli_unregister(&showfeatures);
@@ -14490,9 +14528,9 @@
  	ast_unregister_application(parkcall);
  	return ast_unregister_application(parkedcall);
  }
-diff -urN asterisk-1.2.10.orig/res/res_monitor.c asterisk-1.2.10/res/res_monitor.c
---- asterisk-1.2.10.orig/res/res_monitor.c	2006-03-02 20:05:40.000000000 +0100
-+++ asterisk-1.2.10/res/res_monitor.c	2006-07-31 14:13:08.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/res/res_monitor.c asterisk-1.2.13.dfsg/res/res_monitor.c
+--- asterisk-1.2.13.dfsg~/res/res_monitor.c	2006-09-28 19:00:30.000000000 +0100
++++ asterisk-1.2.13.dfsg/res/res_monitor.c	2006-10-23 22:22:34.000000000 +0100
 @@ -90,7 +90,7 @@
  
  /* Start monitoring a channel */
@@ -14629,9 +14667,9 @@
  	res = ast_monitor_stop(c, 1);
  	ast_mutex_unlock(&c->lock);
  	if (res) {
-diff -urN asterisk-1.2.10.orig/res/res_watchdog.c asterisk-1.2.10/res/res_watchdog.c
---- asterisk-1.2.10.orig/res/res_watchdog.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.10/res/res_watchdog.c	2006-08-10 14:07:14.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/res/res_watchdog.c asterisk-1.2.13.dfsg/res/res_watchdog.c
+--- asterisk-1.2.13.dfsg~/res/res_watchdog.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.13.dfsg/res/res_watchdog.c	2006-10-23 22:22:34.000000000 +0100
 @@ -0,0 +1,149 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -14782,9 +14820,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.10.orig/rtp.c asterisk-1.2.10/rtp.c
---- asterisk-1.2.10.orig/rtp.c	2006-07-13 20:44:17.000000000 +0200
-+++ asterisk-1.2.10/rtp.c	2006-07-31 14:16:56.000000000 +0200
+diff -urNad asterisk-1.2.13.dfsg~/rtp.c asterisk-1.2.13.dfsg/rtp.c
+--- asterisk-1.2.13.dfsg~/rtp.c	2006-09-01 18:35:06.000000000 +0100
++++ asterisk-1.2.13.dfsg/rtp.c	2006-10-23 22:22:34.000000000 +0100
 @@ -445,6 +445,11 @@
  	struct rtpPayloadType rtpPT;
  	

Copied: asterisk/branches/sarge/debian/patches/cdr_sqlite3_custom.dpatch (from rev 2620, asterisk/trunk/debian/patches/cdr_sqlite3_custom.dpatch)
===================================================================
--- asterisk/branches/sarge/debian/patches/cdr_sqlite3_custom.dpatch	                        (rev 0)
+++ asterisk/branches/sarge/debian/patches/cdr_sqlite3_custom.dpatch	2006-10-24 06:51:26 UTC (rev 2623)
@@ -0,0 +1,285 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## cdr_sqlite3_custom.dpatch by  <neuromancer at localhost.localdomain>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad asterisk-1.2.7.1.avatar/cdr/Makefile /tmp/dpep.Uw8Nee/asterisk-1.2.7.1.avatar/cdr/Makefile
+--- asterisk-1.2.7.1.avatar/cdr/Makefile	2006-05-30 07:40:47.000000000 +0000
++++ /tmp/dpep.Uw8Nee/asterisk-1.2.7.1.avatar/cdr/Makefile	2006-05-30 07:40:52.000000000 +0000
+@@ -106,6 +106,9 @@
+ ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sqlite.h),)
+   MODS+=cdr_sqlite.so
+ endif
++ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sqlite3.h),)
++  MODS+=cdr_sqlite3_custom.so
++endif
+ 
+ all: depend $(MODS)
+ 
+@@ -134,6 +137,9 @@
+ cdr_sqlite.so: cdr_sqlite.o
+ 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lsqlite $(MLFLAGS)
+ 
++cdr_sqlite3_custom.so: cdr_sqlite3_custom.o
++	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lsqlite3 $(MLFLAGS)
++
+ depend: .depend
+ 
+ .depend:
+diff -urNad asterisk-1.2.7.1.avatar/cdr/cdr_sqlite3_custom.c /tmp/dpep.Uw8Nee/asterisk-1.2.7.1.avatar/cdr/cdr_sqlite3_custom.c
+--- asterisk-1.2.7.1.avatar/cdr/cdr_sqlite3_custom.c	1970-01-01 00:00:00.000000000 +0000
++++ /tmp/dpep.Uw8Nee/asterisk-1.2.7.1.avatar/cdr/cdr_sqlite3_custom.c	2006-05-30 07:41:43.000000000 +0000
+@@ -0,0 +1,251 @@
++/*
++ * Asterisk -- An open source telephony toolkit.
++ *
++ * Copyright (C) 1999 - 2005, Digium, Inc.
++ *
++ * Mark Spencer <markster at digium.com> and others.
++ *
++ * See http://www.asterisk.org for more information about
++ * the Asterisk project. Please do not directly contact
++ * any of the maintainers of this project for assistance;
++ * 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.
++ */
++
++/*! \file
++ *
++ * \brief Custom SQLite3 CDR records.
++ *
++ * \author Adapted by Alejandro Rios <alejandro.rios at avatar.com.co> from 
++ *  cdr_mysql_custom by Edward Eastman <ed at dm3.co.uk>,
++ *	and cdr_sqlite by Holger Schurig <hs4233 at mail.mn-solutions.de>
++ *	
++ *
++ * \arg See also \ref AstCDR
++ *
++ *
++ * \ingroup cdr_drivers
++ */
++
++/*** moduleinfo
++	<depend>sqlite3</depend>
++ ***/
++
++#include <sys/types.h>
++#include <stdio.h>
++#include <string.h>
++#include <errno.h>
++
++#include <stdlib.h>
++#include <unistd.h>
++#include <time.h>
++#include <sqlite3.h>
++
++#include "asterisk.h"
++
++ASTERISK_FILE_VERSION(__FILE__, "$Revision: 7221 $")
++#include "asterisk/channel.h"
++#include "asterisk/cdr.h"
++#include "asterisk/module.h"
++#include "asterisk/config.h"
++#include "asterisk/pbx.h"
++#include "asterisk/logger.h"
++#include "asterisk/utils.h"
++#include "asterisk/cli.h"
++#include "asterisk/options.h"
++AST_MUTEX_DEFINE_STATIC(lock);
++
++static char *desc = "Customizable SQLite3 CDR Backend";
++
++static char *name = "cdr_sqlite3_custom";
++
++static sqlite3 *db = NULL;
++
++static char table[80];
++static char columns[1024];
++static char values[1024];
++
++static int load_config(int reload)
++{
++	struct ast_config *cfg;
++	struct ast_variable *mappingvar;
++	char *tmp;
++	int res = -1;
++
++	if ((cfg = ast_config_load("cdr_sqlite3_custom.conf"))) {
++		if (reload != 1) {
++			ast_mutex_lock(&lock);
++		}
++		mappingvar = ast_variable_browse(cfg, "master");
++		if (!mappingvar) {
++			/* nothing configured */
++			return 0;
++		}
++		/* Mapping must have a table name */
++		tmp = ast_variable_retrieve(cfg, "master", "table");
++		if (!ast_strlen_zero(tmp)) {
++			ast_copy_string(table, tmp, sizeof(table));
++		} else {
++			ast_log(LOG_WARNING, "%s: Table name not specified.  Assuming cdr.\n", name);
++			strcpy(table, "cdr");
++		}
++		tmp = ast_variable_retrieve(cfg, "master", "columns");
++		if (!ast_strlen_zero(tmp)) {
++			ast_copy_string(columns, tmp, sizeof(columns));
++		} else {
++			ast_log(LOG_WARNING, "%s: Column names not specified. Module not loaded.\n",
++					name);
++			return -1;
++		}
++		tmp = ast_variable_retrieve(cfg, "master", "values");
++		if (!ast_strlen_zero(tmp)) {
++			ast_copy_string(values, tmp, sizeof(values));
++		} else {
++			ast_log(LOG_WARNING, "%s: Values not specified. Module not loaded.\n", name);
++			return -1;
++		}
++
++		if (reload != 1) {
++			ast_mutex_unlock(&lock);
++		}
++
++		ast_config_destroy(cfg);
++
++		res = 0;
++
++	} else {
++		if (reload)
++			ast_log(LOG_WARNING, "%s: Failed to reload configuration file.\n", name);
++		else
++			ast_log(LOG_WARNING,
++					"%s: Failed to load configuration file. Module not activated.\n",
++					name);
++	}
++
++	return res;
++}
++
++static int sqlite3_log(struct ast_cdr *cdr)
++{
++	int res = 0;
++	char *zErr = 0;
++
++	/* Make sure we have a big enough buf */
++	char sql_insert_cmd[2048];
++	char sql_tmp_cmd[1024];
++	snprintf(sql_tmp_cmd, sizeof(sql_tmp_cmd), "INSERT INTO %s (%s) VALUES (%s)", table,
++			 columns, values);
++	struct ast_channel dummy;
++
++	int count = 0;
++
++	memset(sql_insert_cmd, 0, sizeof(sql_insert_cmd));
++	/* Not quite the first use of a static struct ast_channel, we need it so the var funcs will work */
++	memset(&dummy, 0, sizeof(dummy));
++	dummy.cdr = cdr;
++	pbx_substitute_variables_helper(&dummy, sql_tmp_cmd, sql_insert_cmd,
++									sizeof(sql_insert_cmd) - 1);
++
++	ast_mutex_lock(&lock);
++
++	for (count = 0; count < 5; count++) {
++		res = sqlite3_exec(db, sql_insert_cmd, NULL, NULL, &zErr);
++		if (res != SQLITE_BUSY && res != SQLITE_LOCKED)
++			break;
++		usleep(200);
++	}
++
++	if (zErr) {
++		ast_log(LOG_ERROR, "%s: %s. sentence: %s.\n", name, zErr, sql_insert_cmd);
++		free(zErr);
++	}
++
++	ast_mutex_unlock(&lock);
++	return res;
++}
++
++char *description(void)
++{
++	return desc;
++}
++
++int unload_module(void)
++{
++	if (db)
++		sqlite3_close(db);
++	ast_cdr_unregister(name);
++	return 0;
++}
++
++int load_module(void)
++{
++	char *zErr;
++	char fn[PATH_MAX];
++	int res;
++
++	if (!load_config(0)) {
++		res = ast_cdr_register(name, desc, sqlite3_log);
++		if (res) {
++			ast_log(LOG_ERROR, "%s: Unable to register custom SQLite3 CDR handling\n",
++					name);
++			return -1;
++		}
++	}
++
++	/* is the database there? */
++	snprintf(fn, sizeof(fn), "%s/master.db", ast_config_AST_LOG_DIR);
++	res = sqlite3_open(fn, &db);
++	if (!db) {
++		ast_log(LOG_ERROR, "%s: Could not open database %s.\n", name, fn);
++		free(zErr);
++		return -1;
++	}
++
++	/* is the table there? */
++	res = sqlite3_exec(db, "SELECT COUNT(AcctId) FROM %s;", NULL, NULL, NULL), table;
++	if (res) {
++		char sql_create_cmd[1024];
++		snprintf(sql_create_cmd, sizeof(sql_create_cmd),
++				 "CREATE TABLE %s (AcctId INTEGER PRIMARY KEY,%s)", table, columns);
++		res = sqlite3_exec(db, sql_create_cmd, NULL, NULL, &zErr);
++		if (zErr) {
++			ast_log(LOG_WARNING, "%s: %s.\n", name, zErr);
++			free(zErr);
++			return 0;
++		}
++
++		if (res) {
++			ast_log(LOG_ERROR, "%s: Unable to create table '%s': %s.\n", name, table,
++					zErr);
++			free(zErr);
++			if (db)
++				sqlite3_close(db);
++			return -1;
++		}
++	}
++
++	return 0;
++}
++
++int reload(void)
++{
++	int res = 0;
++	ast_mutex_lock(&lock);
++	res = load_config(1);
++	ast_mutex_unlock(&lock);
++	return res;
++}
++
++int usecount(void)
++{
++	return 0;
++}
++
++char *key(void)
++{
++	return ASTERISK_GPL_KEY;
++}

Copied: asterisk/branches/sarge/debian/patches/zapbri.dpatch (from rev 2620, asterisk/trunk/debian/patches/zapbri.dpatch)
===================================================================
--- asterisk/branches/sarge/debian/patches/zapbri.dpatch	                        (rev 0)
+++ asterisk/branches/sarge/debian/patches/zapbri.dpatch	2006-10-24 06:51:26 UTC (rev 2623)
@@ -0,0 +1,23 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## zapbri.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Theoretically this should suffice to configure a ZapBRI device 
+## DP: with standard libpri/chan_zap.
+
+ at DPATCH@
+diff -urNad asterisk-1.2.12.1.dfsg/channels/chan_zap.c /tmp/dpep.8e90kC/asterisk-1.2.12.1.dfsg/channels/chan_zap.c
+--- asterisk-1.2.12.1.dfsg/channels/chan_zap.c	2006-08-25 18:21:18.000000000 +0300
++++ /tmp/dpep.8e90kC/asterisk-1.2.12.1.dfsg/channels/chan_zap.c	2006-09-29 06:30:49.988574971 +0300
+@@ -6720,8 +6720,9 @@
+ 		} else {
+ 			if (si->totalchans == 31) { /* if it's an E1 */
+ 				pris[*span].dchannels[0] = 16 + offset;
+-			} else {
+-				pris[*span].dchannels[0] = 24 + offset;
++			} else { /* T1 or BRI: D Channel is the last Channel */
++				pris[*span].dchannels[0] = 
++					si->totalchans + offset;
+ 			}
+ 			pris[*span].dchanavail[0] |= DCHAN_PROVISIONED;
+ 			pris[*span].offset = offset;

Modified: asterisk/branches/sarge/debian/rules
===================================================================
--- asterisk/branches/sarge/debian/rules	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/branches/sarge/debian/rules	2006-10-24 06:51:26 UTC (rev 2623)
@@ -231,7 +231,7 @@
 	tar xfz ../$(UPFILENAME) 
 	@@find ../tarballs/asterisk-$(UPVERSION).tmp -type f -name 'fpm-*.mp3'|xargs -r rm 
 	@@rm -rf ../tarballs/asterisk-$(UPVERSION).tmp/asterisk-$(UPVERSION)/codecs/ilbc 
-	@@rm -rf ../tarballs/asterisk-$(UPVERSION).tmp/asterisk-$(UPVERSION)/contrib/firmware/iax/iaxy.bin
+	@@rm -rf ../tarballs/asterisk-$(UPVERSION).tmp/asterisk-$(UPVERSION)/contrib/firmware/
 	@@cd ../tarballs/asterisk-$(UPVERSION).tmp ; \
 	tar cfz ../$(FILENAME) *
 	@@echo Cleaning up...

Modified: asterisk/branches/sarge/debian/watch
===================================================================
--- asterisk/branches/sarge/debian/watch	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/branches/sarge/debian/watch	2006-10-24 06:51:26 UTC (rev 2623)
@@ -3,5 +3,5 @@
 
 # Full-site-with-pattern  [Version  [Action]]
 opts=dversionmangle=s/\.dfsg// \
-	http://ftp.digium.com/pub/asterisk/asterisk-([\d.].*[\d])\.tar\.gz \
+	http://ftp.digium.com/pub/asterisk/asterisk-(1.2.*[\d])\.tar\.gz \
 	debian  svn-upgrade

Modified: asterisk/trunk/debian/changelog
===================================================================
--- asterisk/trunk/debian/changelog	2006-10-24 06:36:32 UTC (rev 2622)
+++ asterisk/trunk/debian/changelog	2006-10-24 06:51:26 UTC (rev 2623)
@@ -13,16 +13,16 @@
   * Update debian/patches/bristuff.dpatch
 
   * TODO: fixup
-chan_sip.c: In function 'handle_request_refer':
-chan_sip.c:10907: error: 'rp' undeclared (first use in this function)
-chan_sip.c:10907: error: (Each undeclared identifier is reported only once
-chan_sip.c:10907: error: for each function it appears in.)
-chan_sip.c:10940: warning: type defaults to 'int' in declaration of '__p'
-chan_sip.c:10940: warning: comparison of distinct pointer types lacks a cast
-chan_sip.c: In function 'sipsock_read':
-chan_sip.c:11618: error: too many arguments to function 'find_call' 
+    chan_sip.c: In function 'handle_request_refer':
+    chan_sip.c:10907: error: 'rp' undeclared (first use in this function)
+    chan_sip.c:10907: error: (Each undeclared identifier is reported only once
+    chan_sip.c:10907: error: for each function it appears in.)
+    chan_sip.c:10940: warning: type defaults to 'int' in declaration of '__p'
+    chan_sip.c:10940: warning: comparison of distinct pointer types lacks a cast
+    chan_sip.c: In function 'sipsock_read':
+    chan_sip.c:11618: error: too many arguments to function 'find_call'
 
- -- Mark Purcell <msp at debian.org>  Mon, 23 Oct 2006 22:31:03 +0100
+ -- Kilian Krause <kilian at debian.org>  Tue, 24 Oct 2006 08:51:12 +0200
 
 asterisk (1:1.2.12.1.dfsg-1) unstable; urgency=low
 




More information about the Pkg-voip-commits mailing list