[Pkg-voip-commits] r2313 - in asterisk/branches/sarge/debian: . patches

Tzafrir Cohen tzafrir-guest at costa.debian.org
Sat Aug 26 14:42:12 UTC 2006


Author: tzafrir-guest
Date: 2006-08-26 14:42:10 +0000 (Sat, 26 Aug 2006)
New Revision: 2313

Modified:
   asterisk/branches/sarge/debian/changelog
   asterisk/branches/sarge/debian/patches/bristuff.dpatch
Log:
bristuff 0.3.0-PRE-1s

Modified: asterisk/branches/sarge/debian/changelog
===================================================================
--- asterisk/branches/sarge/debian/changelog	2006-08-26 14:33:46 UTC (rev 2312)
+++ asterisk/branches/sarge/debian/changelog	2006-08-26 14:42:10 UTC (rev 2313)
@@ -14,6 +14,9 @@
   * asterisk-{classic-bristuff} Depends: asterisk
   * asterisk_fix needs to fix /var/run/asterisk
   * Move doc/asterisk -> asterisk-doc package
+  
+  [ Tzafrir Cohen]
+  * bristuff 0.3.0-PRE-1s
 
  -- Kilian Krause <kilian at debian.org>  Thu,  3 Aug 2006 12:04:00 +0200
 

Modified: asterisk/branches/sarge/debian/patches/bristuff.dpatch
===================================================================
--- asterisk/branches/sarge/debian/patches/bristuff.dpatch	2006-08-26 14:33:46 UTC (rev 2312)
+++ asterisk/branches/sarge/debian/patches/bristuff.dpatch	2006-08-26 14:42:10 UTC (rev 2313)
@@ -2,19 +2,19 @@
 ## bristuff.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
-## DP: bristuff support in asterisk: asterisk.patch from bristuff-0.3.0-PRE-1q
+## DP: bristuff support in asterisk: asterisk.patch from bristuff-0.3.0-PRE-1s
 ## DP: cygdef.h removed ;-)
 
 @DPATCH@
-diff -urN asterisk-1.2.9.1.orig/.version asterisk-1.2.9.1/.version
---- asterisk-1.2.9.1.orig/.version	2006-06-06 18:19:31.000000000 +0200
-+++ asterisk-1.2.9.1/.version	2006-06-09 10:25:16.000000000 +0200
+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.10
-+1.2.10-BRIstuffed-0.3.0-PRE-1q
-diff -urN asterisk-1.2.9.1.orig/HARDWARE asterisk-1.2.9.1/HARDWARE
---- asterisk-1.2.9.1.orig/HARDWARE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/HARDWARE	2006-06-09 10:25:04.000000000 +0200
++1.2.10-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
 @@ -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 +35,9 @@
  Non-zaptel compatible hardware
  ==============================
  
-diff -urN asterisk-1.2.9.1.orig/LICENSE asterisk-1.2.9.1/LICENSE
---- asterisk-1.2.9.1.orig/LICENSE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/LICENSE	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -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,22 +50,22 @@
  except as defined below. The GPL (version 2) is included in this
  source tree in the file COPYING.
  
-diff -urN asterisk-1.2.9.1.orig/Makefile asterisk-1.2.9.1/Makefile
---- asterisk-1.2.9.1.orig/Makefile	2006-04-30 16:27:56.000000000 +0200
-+++ asterisk-1.2.9.1/Makefile	2006-06-09 10:25:04.000000000 +0200
-@@ -761,6 +761,9 @@
+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
+@@ -772,6 +772,9 @@
  		echo ";astctlowner = root" ; \
  		echo ";astctlgroup = apache" ; \
  		echo ";astctl = asterisk.ctl" ; \
 +		echo "[options]" ; \
-+		echo "uniquename = asterisk" ;\
++		echo "uniquename = `hostname`" ;\
 +		echo "silence_suppression = yes" ;\
  		) > $(DESTDIR)$(ASTCONFPATH) ; \
  	else \
  		echo "Skipping asterisk.conf creation"; \
-diff -urN asterisk-1.2.9.1.orig/README asterisk-1.2.9.1/README
---- asterisk-1.2.9.1.orig/README	2006-03-03 09:12:33.000000000 +0100
-+++ asterisk-1.2.9.1/README	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -4,6 +4,8 @@
  
  Copyright (C) 2001-2005 Digium, Inc.
@@ -75,9 +75,9 @@
  ================================================================
  
  * SECURITY
-diff -urN asterisk-1.2.9.1.orig/README.chan_capi asterisk-1.2.9.1/README.chan_capi
---- asterisk-1.2.9.1.orig/README.chan_capi	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/README.chan_capi	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -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 +225,9 @@
 +	
 +
 +
-diff -urN asterisk-1.2.9.1.orig/agi/Makefile asterisk-1.2.9.1/agi/Makefile
---- asterisk-1.2.9.1.orig/agi/Makefile	2006-03-28 22:22:05.000000000 +0200
-+++ asterisk-1.2.9.1/agi/Makefile	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -246,9 +246,9 @@
  
  %.so : %.o
  	$(CC) -shared -Xlinker -x -o $@ $<
-diff -urN asterisk-1.2.9.1.orig/agi/xagi-test.c asterisk-1.2.9.1/agi/xagi-test.c
---- asterisk-1.2.9.1.orig/agi/xagi-test.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/agi/xagi-test.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,175 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -425,9 +425,9 @@
 +		return -1;
 +	exit(0);
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/Makefile asterisk-1.2.9.1/apps/Makefile
---- asterisk-1.2.9.1.orig/apps/Makefile	2006-04-30 15:38:22.000000000 +0200
-+++ asterisk-1.2.9.1/apps/Makefile	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -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 +445,9 @@
  
  #
  # Obsolete things...
-diff -urN asterisk-1.2.9.1.orig/apps/app_callingpres.c asterisk-1.2.9.1/apps/app_callingpres.c
---- asterisk-1.2.9.1.orig/apps/app_callingpres.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_callingpres.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,70 @@
 +/*
 + * An application to change the CallingPresentation for an Asterisk channel.
@@ -519,9 +519,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_capiCD.c asterisk-1.2.9.1/apps/app_capiCD.c
---- asterisk-1.2.9.1.orig/apps/app_capiCD.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_capiCD.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,172 @@
 +/*
 + * (CAPI*)
@@ -695,9 +695,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_capiECT.c asterisk-1.2.9.1/apps/app_capiECT.c
---- asterisk-1.2.9.1.orig/apps/app_capiECT.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_capiECT.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,210 @@
 +/*
 + * (CAPI*)
@@ -909,9 +909,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_capiNoES.c asterisk-1.2.9.1/apps/app_capiNoES.c
---- asterisk-1.2.9.1.orig/apps/app_capiNoES.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_capiNoES.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,96 @@
 +/*
 + * (CAPI*)
@@ -1009,9 +1009,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_chanisavail.c asterisk-1.2.9.1/apps/app_chanisavail.c
---- asterisk-1.2.9.1.orig/apps/app_chanisavail.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_chanisavail.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -118,7 +118,7 @@
  				snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
  				status = inuse = ast_device_state(trychan);
@@ -1021,10 +1021,10 @@
  					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.9.1.orig/apps/app_chanspy.c asterisk-1.2.9.1/apps/app_chanspy.c
---- asterisk-1.2.9.1.orig/apps/app_chanspy.c	2006-01-03 18:24:56.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_chanspy.c	2006-06-09 10:25:04.000000000 +0200
-@@ -54,6 +54,7 @@
+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
+@@ -55,6 +55,7 @@
  
  static const char *synopsis = "Listen to the audio of an active channel\n";
  static const char *app = "ChanSpy";
@@ -1032,7 +1032,7 @@
  static const char *desc = 
  "  ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
  "audio from an active Asterisk channel. This includes the audio coming in and\n"
-@@ -141,6 +142,19 @@
+@@ -142,6 +143,19 @@
  	return ret;
  }
  
@@ -1052,7 +1052,7 @@
  static void *spy_alloc(struct ast_channel *chan, void *data)
  {
  	/* just store the data pointer in the channel structure */
-@@ -553,11 +567,87 @@
+@@ -554,11 +568,87 @@
  	ALL_DONE(u, res);
  }
  
@@ -1141,7 +1141,7 @@
  
  	STANDARD_HANGUP_LOCALUSERS;
  
-@@ -566,7 +656,8 @@
+@@ -567,7 +657,8 @@
  
  int load_module(void)
  {
@@ -1151,9 +1151,9 @@
  }
  
  char *description(void)
-diff -urN asterisk-1.2.9.1.orig/apps/app_devstate.c asterisk-1.2.9.1/apps/app_devstate.c
---- asterisk-1.2.9.1.orig/apps/app_devstate.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_devstate.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,225 @@
 +/*
 + * Devstate application
@@ -1380,9 +1380,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_dial.c asterisk-1.2.9.1/apps/app_dial.c
---- asterisk-1.2.9.1.orig/apps/app_dial.c	2006-05-24 21:44:26.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_dial.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -1394,7 +1394,15 @@
   * 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.
-@@ -115,7 +119,8 @@
+@@ -55,6 +59,7 @@
+ #include "asterisk/causes.h"
+ #include "asterisk/manager.h"
+ #include "asterisk/privacy.h"
++#include "asterisk/transcap.h"
+ 
+ static char *tdesc = "Dialing Application";
+ 
+@@ -115,7 +120,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"
@@ -1404,7 +1412,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 +167,11 @@
+@@ -162,8 +168,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"
@@ -1417,7 +1425,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 +222,8 @@
+@@ -214,6 +223,8 @@
  	OPT_CALLEE_MONITOR = (1 << 21),
  	OPT_CALLER_MONITOR = (1 << 22),
  	OPT_GOTO = (1 << 23),
@@ -1426,7 +1434,7 @@
  } dial_exec_option_flags;
  
  #define DIAL_STILLGOING			(1 << 30)
-@@ -252,6 +262,8 @@
+@@ -252,6 +263,8 @@
  	AST_APP_OPTION('p', OPT_SCREENING),
  	AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
  	AST_APP_OPTION('r', OPT_RINGBACK),
@@ -1435,7 +1443,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 +401,7 @@
+@@ -389,7 +402,7 @@
  	char *context = NULL;
  	char cidname[AST_MAX_EXTENSION];
  
@@ -1444,7 +1452,7 @@
  	
  	if (single) {
  		/* Turn off hold music, etc */
-@@ -468,7 +480,7 @@
+@@ -468,7 +481,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 */
@@ -1453,7 +1461,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 +598,18 @@
+@@ -586,12 +599,18 @@
  							HANDLE_CAUSE(AST_CAUSE_CONGESTION, in);
  							break;
  						case AST_CONTROL_RINGING:
@@ -1478,7 +1486,7 @@
  							break;
  						case AST_CONTROL_PROGRESS:
  							if (option_verbose > 2)
-@@ -766,6 +784,7 @@
+@@ -766,6 +785,7 @@
  	int digit = 0, result = 0;
  	time_t start_time, answer_time, end_time;
  	struct ast_app *app = NULL;
@@ -1486,7 +1494,7 @@
  
  	char *parse;
  	AST_DECLARE_APP_ARGS(args,
-@@ -939,13 +958,13 @@
+@@ -939,13 +959,13 @@
  		}
  		
  		if( privdb_val == AST_PRIVACY_DENY ) {
@@ -1502,7 +1510,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 +972,7 @@
+@@ -953,7 +973,7 @@
  			goto out; /* Is this right? */
  		}
  		else if( privdb_val == AST_PRIVACY_TORTURE ) {
@@ -1511,7 +1519,7 @@
  			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
  				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
  			}
-@@ -992,7 +1011,7 @@
+@@ -1001,7 +1021,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");
  
@@ -1520,7 +1528,7 @@
  	cur = args.peers;
  	do {
  		/* Remember where to start next time */
-@@ -1034,7 +1053,7 @@
+@@ -1043,7 +1063,7 @@
  				ast_log(LOG_DEBUG, "Dialing by extension %s\n", numsubst);
  		}
  		/* Request the peer */
@@ -1529,7 +1537,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));
-@@ -1065,7 +1084,7 @@
+@@ -1074,7 +1094,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 */
@@ -1538,7 +1546,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
-@@ -1178,7 +1197,7 @@
+@@ -1187,7 +1207,7 @@
  
  	if (outgoing) {
  		/* Our status will at least be NOANSWER */
@@ -1547,7 +1555,7 @@
  		if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
  			moh=1;
  			ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
-@@ -1186,8 +1205,11 @@
+@@ -1195,8 +1215,11 @@
  			ast_indicate(chan, AST_CONTROL_RINGING);
  			sentringing++;
  		}
@@ -1561,7 +1569,36 @@
  
  	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);
-@@ -1599,7 +1621,15 @@
+@@ -1561,18 +1584,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);
+-			if (ast_test_flag(peerflags, OPT_CALLEE_TRANSFER))
++
++			if ((chan->transfercapability != AST_TRANS_CAP_DIGITAL) && (chan->transfercapability != AST_TRANS_CAP_RESTRICTED_DIGITAL)) {
++			    /* only non-digital calls are allowed to go through userspace */
++			    if (ast_test_flag(peerflags, OPT_CALLEE_TRANSFER))
+ 				ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
+-			if (ast_test_flag(peerflags, OPT_CALLER_TRANSFER))
++			    if (ast_test_flag(peerflags, OPT_CALLER_TRANSFER))
+ 				ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
+-			if (ast_test_flag(peerflags, OPT_CALLEE_HANGUP))
++			    if (ast_test_flag(peerflags, OPT_CALLEE_HANGUP))
+ 				ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
+-			if (ast_test_flag(peerflags, OPT_CALLER_HANGUP))
++			    if (ast_test_flag(peerflags, OPT_CALLER_HANGUP))
+ 				ast_set_flag(&(config.features_caller), AST_FEATURE_DISCONNECT);
+-			if (ast_test_flag(peerflags, OPT_CALLEE_MONITOR))
++			    if (ast_test_flag(peerflags, OPT_CALLEE_MONITOR))
+ 				ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
+-			if (ast_test_flag(peerflags, OPT_CALLER_MONITOR)) 
++			    if (ast_test_flag(peerflags, OPT_CALLER_MONITOR)) 
+ 				ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
++			}
+ 
+ 			config.timelimit = timelimit;
+ 			config.play_warning = play_warning;
+@@ -1608,7 +1635,15 @@
  		}
  		snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
  		pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
@@ -1578,9 +1615,9 @@
  		if (res != AST_PBX_NO_HANGUP_PEER) {
  			if (!chan->_softhangup)
  				chan->hangupcause = peer->hangupcause;
-diff -urN asterisk-1.2.9.1.orig/apps/app_directed_pickup.c asterisk-1.2.9.1/apps/app_directed_pickup.c
---- asterisk-1.2.9.1.orig/apps/app_directed_pickup.c	2006-04-06 19:00:10.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_directed_pickup.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -41,7 +41,7 @@
  #include "asterisk/app.h"
  
@@ -1590,9 +1627,9 @@
  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.9.1.orig/apps/app_meetme.c asterisk-1.2.9.1/apps/app_meetme.c
---- asterisk-1.2.9.1.orig/apps/app_meetme.c	2006-05-25 22:03:11.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_meetme.c	2006-06-09 10:25:04.000000000 +0200
+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 @@
  			ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
  			ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
@@ -1637,7 +1674,7 @@
  				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
  					if (user->talk.actual)
  						ast_frame_adjust_volume(f, user->talk.actual);
-@@ -1506,7 +1515,7 @@
+@@ -1509,7 +1518,7 @@
  				}
  				ast_frfree(f);
  			} else if (outfd > -1) {
@@ -1646,9 +1683,9 @@
  				if (res > 0) {
  					memset(&fr, 0, sizeof(fr));
  					fr.frametype = AST_FRAME_VOICE;
-diff -urN asterisk-1.2.9.1.orig/apps/app_milliwatt.c asterisk-1.2.9.1/apps/app_milliwatt.c
---- asterisk-1.2.9.1.orig/apps/app_milliwatt.c	2006-01-19 05:17:45.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_milliwatt.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -74,20 +74,28 @@
  {
  	struct ast_frame wf;
@@ -1684,9 +1721,9 @@
  	wf.src = "app_milliwatt";
  	wf.delivery.tv_sec = 0;
  	wf.delivery.tv_usec = 0;
-diff -urN asterisk-1.2.9.1.orig/apps/app_page.c asterisk-1.2.9.1/apps/app_page.c
---- asterisk-1.2.9.1.orig/apps/app_page.c	2006-04-13 19:40:21.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_page.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -85,7 +85,7 @@
  {
  	struct calloutdata *cd = data;
@@ -1696,9 +1733,9 @@
  	free(cd);
  	return NULL;
  }
-diff -urN asterisk-1.2.9.1.orig/apps/app_parkandannounce.c asterisk-1.2.9.1/apps/app_parkandannounce.c
---- asterisk-1.2.9.1.orig/apps/app_parkandannounce.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_parkandannounce.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -183,7 +183,7 @@
  
  	memset(&oh, 0, sizeof(oh));
@@ -1708,9 +1745,9 @@
  
  	if(dchan) {
  		if(dchan->_state == AST_STATE_UP) {
-diff -urN asterisk-1.2.9.1.orig/apps/app_pickup.c asterisk-1.2.9.1/apps/app_pickup.c
---- asterisk-1.2.9.1.orig/apps/app_pickup.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_pickup.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,319 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -2031,9 +2068,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_queue.c asterisk-1.2.9.1/apps/app_queue.c
---- asterisk-1.2.9.1.orig/apps/app_queue.c	2006-06-04 05:43:35.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_queue.c	2006-06-09 10:25:04.000000000 +0200
+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 @@
  	return NULL;
  }
@@ -2043,7 +2080,7 @@
  {
  	/* Avoid potential for deadlocks by spawning a new thread to handle
  	   the event */
-@@ -1512,7 +1512,7 @@
+@@ -1509,7 +1509,7 @@
  		location = "";
  
  	/* Request the peer */
@@ -2052,7 +2089,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);
-@@ -1819,7 +1819,7 @@
+@@ -1816,7 +1816,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 */
@@ -2061,7 +2098,7 @@
  					if (status != o->oldstatus) 
  						update_dial_status(qe->parent, o->member, status);						
  					if (!o->chan) {
-@@ -2363,14 +2363,14 @@
+@@ -2360,14 +2360,14 @@
  			else
  				which = peer;
  			if (monitorfilename)
@@ -2079,9 +2116,9 @@
  			}
  			if (qe->parent->monjoin)
  				ast_monitor_setjoinfiles(which, 1);
-diff -urN asterisk-1.2.9.1.orig/apps/app_readfile.c asterisk-1.2.9.1/apps/app_readfile.c
---- asterisk-1.2.9.1.orig/apps/app_readfile.c	2006-03-23 21:13:48.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_readfile.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -40,7 +40,7 @@
  #include "asterisk/app.h"
  #include "asterisk/module.h"
@@ -2091,9 +2128,9 @@
  
  static char *app_readfile = "ReadFile";
  
-diff -urN asterisk-1.2.9.1.orig/apps/app_segfault.c asterisk-1.2.9.1/apps/app_segfault.c
---- asterisk-1.2.9.1.orig/apps/app_segfault.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/apps/app_segfault.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,75 @@
 +/*
 + * Segfault application
@@ -2170,10 +2207,10 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/apps/app_zapras.c asterisk-1.2.9.1/apps/app_zapras.c
---- asterisk-1.2.9.1.orig/apps/app_zapras.c	2006-05-01 22:44:24.000000000 +0200
-+++ asterisk-1.2.9.1/apps/app_zapras.c	2006-06-09 10:25:04.000000000 +0200
-@@ -186,7 +186,7 @@
+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
+@@ -180,7 +180,7 @@
  				}
  			}
  			/* Throw back into audio mode */
@@ -2182,9 +2219,287 @@
  			ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
  
  			/* Restore saved values */
-diff -urN asterisk-1.2.9.1.orig/asterisk.c asterisk-1.2.9.1/asterisk.c
---- asterisk-1.2.9.1.orig/asterisk.c	2006-05-19 21:01:17.000000000 +0200
-+++ asterisk-1.2.9.1/asterisk.c	2006-06-13 10:10:50.000000000 +0200
+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
+@@ -0,0 +1,274 @@
++/*
++ * Asterisk -- An open source telephony toolkit.
++ *
++ * Copyright (C) 1999 - 2005, Digium, Inc.
++ *
++ * Mark Spencer <markster at digium.com>
++ *
++ * 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 Execute an ISDN RAS
++ * 
++ * \ingroup applications
++ */
++
++#include <sys/ioctl.h>
++#include <sys/wait.h>
++#ifdef __linux__
++#include <sys/signal.h>
++#else
++#include <signal.h>
++#endif /* __linux__ */
++
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <stdio.h>
++#include <fcntl.h>
++
++/* Need some zaptel help here */
++#ifdef __linux__
++#include <linux/zaptel.h>
++#else
++#include <zaptel.h>
++#endif /* __linux__ */
++
++#include "asterisk.h"
++
++ASTERISK_FILE_VERSION(__FILE__, "$Revision: 37419 $")
++
++#include "asterisk/lock.h"
++#include "asterisk/file.h"
++#include "asterisk/logger.h"
++#include "asterisk/channel.h"
++#include "asterisk/pbx.h"
++#include "asterisk/module.h"
++#include "asterisk/options.h"
++
++static char *tdesc = "Zap RAS Application";
++
++static char *app = "ZapRAS";
++
++static char *synopsis = "Executes Zaptel ISDN RAS application";
++
++static char *descrip =
++"  ZapRAS(args): Executes a RAS server using pppd on the given channel.\n"
++"The channel must be a clear channel (i.e. PRI source) and a Zaptel\n"
++"channel to be able to use this function (No modem emulation is included).\n"
++"Your pppd must be patched to be zaptel aware. Arguments should be\n"
++"separated by | characters.\n";
++
++STANDARD_LOCAL_USER;
++
++LOCAL_USER_DECL;
++
++#define PPP_MAX_ARGS	32
++#define PPP_EXEC	"/usr/sbin/pppd"
++
++static pid_t spawn_ras(struct ast_channel *chan, char *args)
++{
++	pid_t pid;
++	int x;	
++	char *c;
++
++	char *argv[PPP_MAX_ARGS];
++	int argc = 0;
++	char *stringp=NULL;
++
++	/* Start by forking */
++	pid = fork();
++	if (pid)
++		return pid;
++
++	/* Execute RAS on File handles */
++	dup2(chan->fds[0], STDIN_FILENO);
++
++	/* Drop high priority */
++	if (option_highpriority)
++		ast_set_priority(0);
++
++	/* Close other file descriptors */
++	for (x=STDERR_FILENO + 1;x<1024;x++) 
++		close(x);
++
++	/* Restore original signal handlers */
++	for (x=0;x<NSIG;x++)
++		signal(x, SIG_DFL);
++
++	/* Reset all arguments */
++	memset(argv, 0, sizeof(argv));
++
++	/* First argument is executable, followed by standard
++	   arguments for zaptel PPP */
++	argv[argc++] = PPP_EXEC;
++	argv[argc++] = "nodetach";
++
++	/* And all the other arguments */
++	stringp=args;
++	c = strsep(&stringp, "|");
++	while(c && strlen(c) && (argc < (PPP_MAX_ARGS - 4))) {
++		argv[argc++] = c;
++		c = strsep(&stringp, "|");
++	}
++
++	argv[argc++] = "plugin";
++	argv[argc++] = "zaptel.so";
++	argv[argc++] = "stdin";
++
++	/* Finally launch PPP */
++	execv(PPP_EXEC, argv);
++	fprintf(stderr, "Failed to exec PPPD!\n");
++	exit(1);
++}
++
++static void run_ras(struct ast_channel *chan, char *args)
++{
++	pid_t pid;
++	int status;
++	int res;
++	int signalled = 0;
++	struct zt_bufferinfo savebi;
++	int x;
++	
++	res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &savebi);
++	if(res) {
++		ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
++		return;
++	}
++
++	pid = spawn_ras(chan, args);
++	if (pid < 0) {
++		ast_log(LOG_WARNING, "Failed to spawn RAS\n");
++	} else {
++		for (;;) {
++			res = wait4(pid, &status, WNOHANG, NULL);
++			if (!res) {
++				/* Check for hangup */
++				if (chan->_softhangup && !signalled) {
++					ast_log(LOG_DEBUG, "Channel '%s' hungup.  Signalling RAS at %d to die...\n", chan->name, pid);
++					kill(pid, SIGTERM);
++					signalled=1;
++				}
++				/* Try again */
++				sleep(1);
++				continue;
++			}
++			if (res < 0) {
++				ast_log(LOG_WARNING, "wait4 returned %d: %s\n", res, strerror(errno));
++			}
++			if (option_verbose > 2) {
++				if (WIFEXITED(status)) {
++					ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated with status %d\n", chan->name, WEXITSTATUS(status));
++				} else if (WIFSIGNALED(status)) {
++					ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated with signal %d\n", 
++						 chan->name, WTERMSIG(status));
++				} else {
++					ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated weirdly.\n", chan->name);
++				}
++			}
++			/* Throw back into audio mode */
++			x = 1;
++			ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
++
++			/* Restore saved values */
++			res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &savebi);
++			if (res < 0) {
++				ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
++			}
++			break;
++		}
++	}
++}
++
++static int zapras_exec(struct ast_channel *chan, void *data)
++{
++	int res=-1;
++	char *args;
++	struct localuser *u;
++	ZT_PARAMS ztp;
++
++	if (!data) 
++		data = "";
++
++	LOCAL_USER_ADD(u);
++
++	args = ast_strdupa(data);
++	if (!args) {
++		ast_log(LOG_ERROR, "Out of memory\n");
++		LOCAL_USER_REMOVE(u);
++		return -1;
++	}
++	
++	/* Answer the channel if it's not up */
++	if (chan->_state != AST_STATE_UP)
++		ast_answer(chan);
++	if (strcasecmp(chan->type, "Zap")) {
++		/* If it's not a zap channel, we're done.  Wait a couple of
++		   seconds and then hangup... */
++		if (option_verbose > 1)
++			ast_verbose(VERBOSE_PREFIX_2 "Channel %s is not a Zap channel\n", chan->name);
++		sleep(2);
++	} else {
++		memset(&ztp, 0, sizeof(ztp));
++		if (ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp)) {
++			ast_log(LOG_WARNING, "Unable to get zaptel parameters\n");
++		} else if (ztp.sigtype != ZT_SIG_CLEAR) {
++			if (option_verbose > 1)
++				ast_verbose(VERBOSE_PREFIX_2 "Channel %s is not a clear channel\n", chan->name);
++		} else {
++			/* Everything should be okay.  Run PPP. */
++			if (option_verbose > 2)
++				ast_verbose(VERBOSE_PREFIX_3 "Starting RAS on %s\n", chan->name);
++			/* Execute RAS */
++			run_ras(chan, args);
++		}
++	}
++	LOCAL_USER_REMOVE(u);
++	return res;
++}
++
++int unload_module(void)
++{
++	int res;
++
++	res = ast_unregister_application(app);
++	
++	STANDARD_HANGUP_LOCALUSERS;
++
++	return res;
++}
++
++int load_module(void)
++{
++	return ast_register_application(app, zapras_exec, synopsis, descrip);
++}
++
++char *description(void)
++{
++	return tdesc;
++}
++
++int usecount(void)
++{
++	int res;
++	STANDARD_USECOUNT(res);
++	return res;
++}
++
++char *key()
++{
++	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
 @@ -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";
@@ -2193,7 +2508,7 @@
  
  static char *_argv[256];
  static int shuttingdown = 0;
-@@ -1893,6 +1894,7 @@
+@@ -1877,6 +1878,7 @@
  	ast_copy_string(ast_config_AST_PID, AST_PID, sizeof(ast_config_AST_PID));
  	ast_copy_string(ast_config_AST_SOCKET, AST_SOCKET, sizeof(ast_config_AST_SOCKET));
  	ast_copy_string(ast_config_AST_RUN_DIR, AST_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
@@ -2201,7 +2516,7 @@
  
  	/* no asterisk.conf? no problem, use buildtime config! */
  	if (!cfg) {
-@@ -2007,6 +2009,8 @@
+@@ -1991,6 +1993,8 @@
  		/* What group to run as */
  		} else if (!strcasecmp(v->name, "rungroup")) {
  			ast_copy_string(ast_config_AST_RUN_GROUP, v->value, sizeof(ast_config_AST_RUN_GROUP));
@@ -2210,9 +2525,9 @@
  		}
  		v = v->next;
  	}
-diff -urN asterisk-1.2.9.1.orig/build_tools/make_defaults_h asterisk-1.2.9.1/build_tools/make_defaults_h
---- asterisk-1.2.9.1.orig/build_tools/make_defaults_h	2005-06-20 19:26:08.000000000 +0200
-+++ asterisk-1.2.9.1/build_tools/make_defaults_h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -16,6 +16,7 @@
  #define AST_KEY_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
  #define AST_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
@@ -2221,9 +2536,9 @@
  
  #define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
  
-diff -urN asterisk-1.2.9.1.orig/channel.c asterisk-1.2.9.1/channel.c
---- asterisk-1.2.9.1.orig/channel.c	2006-06-01 22:27:50.000000000 +0200
-+++ asterisk-1.2.9.1/channel.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -94,8 +94,8 @@
   */
  static int shutting_down = 0;
@@ -2373,7 +2688,7 @@
  }
  
  int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
-@@ -2364,7 +2393,7 @@
+@@ -2377,7 +2406,7 @@
  			  &chan->writetrans, 1);
  }
  
@@ -2382,7 +2697,7 @@
  {
  	int state = 0;
  	int cause = 0;
-@@ -2372,7 +2401,7 @@
+@@ -2385,7 +2414,7 @@
  	struct ast_frame *f;
  	int res = 0;
  	
@@ -2391,7 +2706,7 @@
  	if (chan) {
  		if (oh) {
  			if (oh->vars)	
-@@ -2386,6 +2415,7 @@
+@@ -2399,6 +2428,7 @@
  		}
  		ast_set_callerid(chan, cid_num, cid_name, cid_num);
  
@@ -2399,7 +2714,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)) {
-@@ -2409,6 +2439,7 @@
+@@ -2422,6 +2452,7 @@
  					if (f->subclass == AST_CONTROL_RINGING)
  						state = AST_CONTROL_RINGING;
  					else if ((f->subclass == AST_CONTROL_BUSY) || (f->subclass == AST_CONTROL_CONGESTION)) {
@@ -2407,7 +2722,7 @@
  						state = f->subclass;
  						ast_frfree(f);
  						break;
-@@ -2478,12 +2509,12 @@
+@@ -2491,12 +2522,12 @@
  	return chan;
  }
  
@@ -2423,7 +2738,7 @@
  {
  	struct chanlist *chan;
  	struct ast_channel *c;
-@@ -2520,6 +2551,7 @@
+@@ -2533,6 +2564,7 @@
  		if (!(c = chan->tech->requester(type, capabilities, data, cause)))
  			return NULL;
  
@@ -2431,7 +2746,7 @@
  		if (c->_state == AST_STATE_DOWN) {
  			manager_event(EVENT_FLAG_CALL, "Newchannel",
  				      "Channel: %s\r\n"
-@@ -2775,6 +2807,29 @@
+@@ -2808,6 +2840,29 @@
  	return res;
  }
  
@@ -2461,7 +2776,7 @@
  void ast_change_name(struct ast_channel *chan, char *newname)
  {
  	char tmp[256];
-@@ -2914,7 +2969,7 @@
+@@ -2947,7 +3002,7 @@
  	ast_copy_string(clone->name, masqn, sizeof(clone->name));
  	
  	/* Notify any managers of the change, first the masq then the other */
@@ -2470,7 +2785,7 @@
  	manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", orig, newn, original->uniqueid);
  
  	/* Swap the technlogies */	
-@@ -3141,15 +3196,14 @@
+@@ -3174,15 +3229,14 @@
  				);
  }
  
@@ -2488,7 +2803,7 @@
  	manager_event(EVENT_FLAG_CALL,
  		      (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
  		      "Channel: %s\r\n"
-@@ -3165,6 +3219,10 @@
+@@ -3198,6 +3252,10 @@
  	return 0;
  }
  
@@ -2499,7 +2814,7 @@
  /*--- Find bridged channel */
  struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
  {
-@@ -3342,6 +3400,7 @@
+@@ -3375,6 +3433,7 @@
  	char callee_warning = 0;
  	int to;
  
@@ -2507,7 +2822,7 @@
  	if (c0->_bridge) {
  		ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 
  			c0->name, c0->_bridge->name);
-@@ -3352,6 +3411,10 @@
+@@ -3385,6 +3444,10 @@
  			c1->name, c1->_bridge->name);
  		return -1;
  	}
@@ -2518,9 +2833,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.9.1.orig/channels/Makefile asterisk-1.2.9.1/channels/Makefile
---- asterisk-1.2.9.1.orig/channels/Makefile	2006-04-30 16:27:56.000000000 +0200
-+++ asterisk-1.2.9.1/channels/Makefile	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -102,6 +102,11 @@
    ZAPR2=-lmfcr2
  endif
@@ -2588,9 +2903,9 @@
  chan_vpb.o: chan_vpb.c
  	$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
  
-diff -urN asterisk-1.2.9.1.orig/channels/chan_agent.c asterisk-1.2.9.1/channels/chan_agent.c
---- asterisk-1.2.9.1.orig/channels/chan_agent.c	2006-05-08 16:12:20.000000000 +0200
-+++ asterisk-1.2.9.1/channels/chan_agent.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -440,7 +440,7 @@
  		if ((pointer = strchr(filename, '.')))
  			*pointer = '-';
@@ -2600,7 +2915,7 @@
  		ast_monitor_setjoinfiles(ast, 1);
  		snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
  #if 0
-@@ -1331,7 +1331,7 @@
+@@ -1323,7 +1323,7 @@
  						chan = agent_new(p, AST_STATE_DOWN);
  					} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
  						/* Adjustable agent */
@@ -2609,9 +2924,9 @@
  						if (p->chan)
  							chan = agent_new(p, AST_STATE_DOWN);
  					}
-diff -urN asterisk-1.2.9.1.orig/channels/chan_capi.c asterisk-1.2.9.1/channels/chan_capi.c
---- asterisk-1.2.9.1.orig/channels/chan_capi.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/channels/chan_capi.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,2888 @@
 +/*
 + * (CAPI*)
@@ -5501,10 +5816,10 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/channels/chan_features.c asterisk-1.2.9.1/channels/chan_features.c
---- asterisk-1.2.9.1.orig/channels/chan_features.c	2006-01-25 19:39:44.000000000 +0100
-+++ asterisk-1.2.9.1/channels/chan_features.c	2006-06-09 10:25:04.000000000 +0200
-@@ -438,7 +438,7 @@
+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
+@@ -427,7 +427,7 @@
  	}
  	ast_mutex_unlock(&featurelock);
  	if (!tmp) {
@@ -5513,9 +5828,9 @@
  		if (!chan) {
  			ast_log(LOG_NOTICE, "Unable to allocate subchannel '%s/%s'\n", tech, dest);
  			return NULL;
-diff -urN asterisk-1.2.9.1.orig/channels/chan_iax2.c asterisk-1.2.9.1/channels/chan_iax2.c
---- asterisk-1.2.9.1.orig/channels/chan_iax2.c	2006-06-06 17:48:00.000000000 +0200
-+++ asterisk-1.2.9.1/channels/chan_iax2.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -5526,7 +5841,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.
-@@ -3068,7 +3071,7 @@
+@@ -3089,7 +3092,7 @@
   	memset(&ied, 0, sizeof(ied));
  	ast_mutex_lock(&iaxsl[callno]);
  	if (callno && iaxs[callno]) {
@@ -5535,7 +5850,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);
-@@ -3120,7 +3123,8 @@
+@@ -3141,7 +3144,8 @@
  static struct ast_frame *iax2_read(struct ast_channel *c) 
  {
  	static struct ast_frame f = { AST_FRAME_NULL, };
@@ -5545,9 +5860,9 @@
  	return &f;
  }
  
-diff -urN asterisk-1.2.9.1.orig/channels/chan_sip.c asterisk-1.2.9.1/channels/chan_sip.c
---- asterisk-1.2.9.1.orig/channels/chan_sip.c	2006-05-25 19:18:01.000000000 +0200
-+++ asterisk-1.2.9.1/channels/chan_sip.c	2006-06-09 10:25:04.000000000 +0200
+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 @@
  	unsigned int flags;			/*!< SIP_ flags */	
  	int timer_t1;				/*!< SIP timer T1, ms rtt */
@@ -5600,7 +5915,7 @@
  		p->subscribed = NONE;
  		append_history(p, "Subscribestatus", "timeout");
  		return 10000;	/* Reschedule this destruction so that we know that it's gone */
-@@ -3150,16 +3156,30 @@
+@@ -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 */
@@ -5632,7 +5947,7 @@
  	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
-@@ -4141,6 +4161,7 @@
+@@ -4135,6 +4155,7 @@
  	if (sipmethod == SIP_CANCEL) {
  		c = p->initreq.rlPart2;	/* Use original URI */
  	} else if (sipmethod == SIP_ACK) {
@@ -5640,7 +5955,7 @@
  		/* Use URI from Contact: in 200 OK (if INVITE) 
  		(we only have the contacturi on INVITEs) */
  		if (!ast_strlen_zero(p->okcontacturi))
-@@ -4907,13 +4928,15 @@
+@@ -4901,13 +4922,15 @@
  		ast_build_string(&invite, &invite_max, ";%s", p->options->uri_options);
  
  	ast_copy_string(p->uri, invite_buf, sizeof(p->uri));
@@ -5657,7 +5972,7 @@
  	} else {
  		snprintf(to, sizeof(to), "<%s>", p->uri);
  	}
-@@ -4970,6 +4993,11 @@
+@@ -4964,6 +4987,11 @@
  		if (!ast_strlen_zero(p->referred_by))
  			add_header(&req, "Referred-By", p->referred_by);
  	}
@@ -5669,7 +5984,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);
-@@ -5044,8 +5072,7 @@
+@@ -5038,8 +5066,7 @@
  }
  
  /*! \brief  transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
@@ -5679,7 +5994,7 @@
  	char tmp[4000], from[256], to[256];
  	char *t = tmp, *c, *a, *mfrom, *mto;
  	size_t maxbytes = sizeof(tmp);
-@@ -5189,10 +5216,19 @@
+@@ -5183,10 +5210,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);
@@ -5702,7 +6017,7 @@
  		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
  		ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
  		break;
-@@ -6019,8 +6055,10 @@
+@@ -6013,8 +6049,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);
@@ -5714,7 +6029,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);
-@@ -6411,7 +6449,7 @@
+@@ -6405,7 +6443,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 */
@@ -5723,7 +6038,7 @@
  {
  	struct sip_pvt *p = data;
  
-@@ -6430,7 +6468,7 @@
+@@ -6424,7 +6462,7 @@
  		p->laststate = state;
  		break;
  	}
@@ -5732,7 +6047,7 @@
  
  	if (option_debug > 1)
  		ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
-@@ -6456,7 +6494,13 @@
+@@ -6450,7 +6488,13 @@
  	char *name, *c;
  	char *t;
  	char *domain;
@@ -5747,7 +6062,7 @@
  	/* Terminate URI */
  	t = uri;
  	while(*t && (*t > 32) && (*t != ';'))
-@@ -6505,9 +6549,68 @@
+@@ -6499,9 +6543,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 {
@@ -5817,7 +6132,7 @@
  				sip_cancel_destroy(p);
  				switch (parse_register_contact(p, peer, req)) {
  				case PARSE_REGISTER_FAILED:
-@@ -6527,6 +6630,7 @@
+@@ -6521,6 +6624,7 @@
  					transmit_response_with_date(p, "200 OK", req);
  					peer->lastmsgssent = -1;
  					res = 0;
@@ -5825,7 +6140,7 @@
  					break;
  				}
  			} 
-@@ -6872,6 +6976,11 @@
+@@ -6866,6 +6970,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 */
@@ -5837,7 +6152,7 @@
  		}
  	} else if (ast_exists_extension(NULL, transfercontext, refer_to, 1, NULL) || !strcmp(refer_to, ast_parking_ext())) {
  		/* This is an unsupervised transfer (blind transfer) */
-@@ -7592,6 +7701,8 @@
+@@ -7586,6 +7695,8 @@
  	int peers_offline = 0;
  	char *id;
  	char idtext[256] = "";
@@ -5846,7 +6161,7 @@
  
  	if (s) {	/* Manager - get ActionID */
  		id = astman_get_header(m,"ActionID");
-@@ -7634,6 +7745,7 @@
+@@ -7628,6 +7739,7 @@
  		else
  			ast_copy_string(name, iterator->name, sizeof(name));
  
@@ -5854,7 +6169,7 @@
  		pstatus = peer_status(iterator, status, sizeof(status));
  		if (pstatus) 	
  			peers_online++;
-@@ -7650,14 +7762,24 @@
+@@ -7644,14 +7756,24 @@
  			}
  		}			
  		
@@ -5880,7 +6195,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? */
-@@ -7665,6 +7787,7 @@
+@@ -7659,6 +7781,7 @@
  			iterator->ha ? " A " : "   ",       /* permit/deny */
  			
  			ntohs(iterator->addr.sin_port), status);
@@ -5888,7 +6203,7 @@
  		} else {	/* Manager format */
  			/* The names here need to be the same as other channels */
  			ast_cli(fd, 
-@@ -7690,7 +7813,9 @@
+@@ -7684,7 +7807,9 @@
  
  		ASTOBJ_UNLOCK(iterator);
  
@@ -5899,7 +6214,7 @@
  	} while(0) );
  
  	if (!s) {
-@@ -8725,6 +8850,7 @@
+@@ -8719,6 +8844,7 @@
  	char buf[1024];
  	unsigned int event;
  	char *c;
@@ -5907,7 +6222,7 @@
  	
  	/* Need to check the media/type */
  	if (!strcasecmp(get_header(req, "Content-Type"), "application/dtmf-relay") ||
-@@ -8788,6 +8914,19 @@
+@@ -8782,6 +8908,19 @@
  			ast_queue_control(p->owner, AST_CONTROL_VIDUPDATE);
  		transmit_response(p, "200 OK", req);
  		return;
@@ -5927,7 +6242,7 @@
  	} else if ((c = get_header(req, "X-ClientCode"))) {
  		/* Client code (from SNOM phone) */
  		if (ast_test_flag(p, SIP_USECLIENTCODE)) {
-@@ -8887,12 +9026,63 @@
+@@ -8881,12 +9020,63 @@
  	return RESULT_SUCCESS;
  }
  
@@ -5992,7 +6307,7 @@
  	if (argc < 4)
  		return RESULT_SHOWUSAGE;
  
-@@ -8909,41 +9099,13 @@
+@@ -8903,41 +9093,13 @@
  	}
  
  	for (i = 3; i < argc; i++) {
@@ -6014,15 +6329,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))
@@ -6033,20 +6348,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[])
  {
-@@ -9597,13 +9759,14 @@
- 		check_pendings(p);
- 		ast_set_flag(p, SIP_CAN_BYE);
- 		break;
-+	case 183:
- 	case 180:	/* 180 Ringing */
- 		if (!ignore)
- 			sip_cancel_destroy(p);
+@@ -9598,7 +9760,7 @@
  		if (!ignore && p->owner) {
  			ast_queue_control(p->owner, AST_CONTROL_RINGING);
  			if (p->owner->_state != AST_STATE_UP)
@@ -6055,30 +6363,7 @@
  		}
  		if (find_sdp(req)) {
  			process_sdp(p, req);
-@@ -9616,22 +9779,6 @@
- 		check_pendings(p);
- 		ast_set_flag(p, SIP_CAN_BYE);
- 		break;
--	case 183:	/* Session progress */
--		if (!ignore)
--			sip_cancel_destroy(p);
--		/* Ignore 183 Session progress without SDP */
--		if (find_sdp(req)) {
--			process_sdp(p, req);
--			if (!ignore && p->owner) {
--				/* Queue a progress frame */
--				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
--			}
--		}
--		/* must call check_pendings before setting CAN_BYE, so that
--		   if PENDINGBYE is set it will know to send CANCEL instead */
--		check_pendings(p);
--		ast_set_flag(p, SIP_CAN_BYE);
--		break;
- 	case 200:	/* 200 OK on invite - someone's answering our call */
- 		if (!ignore)
- 			sip_cancel_destroy(p);
-@@ -10424,9 +10572,18 @@
+@@ -10423,9 +10585,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 */
@@ -6100,7 +6385,7 @@
  	}
  	if (!ignore) {
  		/* Use this as the basis */
-@@ -10658,6 +10815,7 @@
+@@ -10657,6 +10828,7 @@
  	struct ast_channel *c=NULL;
  	int res;
  	struct ast_channel *transfer_to;
@@ -6108,7 +6393,7 @@
  
  	if (option_debug > 2)
  		ast_log(LOG_DEBUG, "SIP call transfer received for call %s (REFER)!\n", p->callid);
-@@ -10666,9 +10824,74 @@
+@@ -10665,9 +10837,73 @@
  	res = get_refer_info(p, req);
  	if (res < 0)
  		transmit_response(p, "603 Declined", req);
@@ -6117,39 +6402,39 @@
  		transmit_response(p, "484 Address Incomplete", req);
 -	else {
 +	else if (res == 2) {
-+			transmit_response(p, "202 Accepted", req);
-+			rp = sip_alloc(NULL, NULL, 0, SIP_INVITE);
-+			if (!rp) {
-+			    return -1;
-+			}
-+			rp->capability = global_capability;
++		transmit_response(p, "202 Accepted", req);
++		rp = sip_alloc(NULL, NULL, 0, SIP_INVITE);
++		if (!rp) {
++		    return -1;
++		}
++		rp->capability = global_capability;
 +
-+			build_route(rp, req, 0);
++		build_route(rp, req, 0);
 +		if (option_verbose > 3)
 +		    ast_log(LOG_NOTICE, "got REFER for callid %s TO %s CONTACT %s replacing callid %s (tohost %s, p->route %s, rp->route %s)\n", p->callid, p->refer_to, p->refer_contact, p->refer_replaces, p->tohost, p->route->hop, rp->route->hop);
-+			if (create_addr(rp, p->tohost)) {
-+			    sip_destroy(rp);
-+			    return -1;
-+			}
++		    if (create_addr(rp, p->tohost)) {
++	    	        sip_destroy(rp);
++			return -1;
++		    }
 +
-+			if (ast_sip_ouraddrfor(&rp->sa.sin_addr,&rp->ourip)) {
-+			    memcpy(&rp->ourip, &__ourip, sizeof(rp->ourip));
-+			}
-+			build_via(rp, rp->via, sizeof(rp->via));
-+			build_callid(rp->callid, sizeof(rp->callid) - 1, rp->ourip, rp->fromdomain);
-+	
++		if (ast_sip_ouraddrfor(&rp->sa.sin_addr,&rp->ourip)) {
++		    memcpy(&rp->ourip, &__ourip, sizeof(rp->ourip));
++		}
++		build_via(rp, rp->via, sizeof(rp->via));
++		build_callid(rp->callid, sizeof(rp->callid) - 1, rp->ourip, rp->fromdomain);
++ 	
 +	    ast_log(LOG_NOTICE, "1\n");
-+			rp->prefcodec = p->prefcodec;
-+			rp->jointcapability = rp->capability;
-+			rp->rtp = p->rtp;
-+			p->rtp = NULL;
-+			if (!ast_strlen_zero(p->refer_to)) {
-+			    ast_copy_string(rp->username, p->refer_to, sizeof(rp->username));
-+			    rp->fullcontact[0] = '\0';
-+			}
-+			if (!ast_strlen_zero(p->refer_replaces)) {
-+			    ast_copy_string(rp->refer_replaces, p->refer_replaces, sizeof(rp->refer_replaces));
-+			}
++		rp->prefcodec = p->prefcodec;
++		rp->jointcapability = rp->capability;
++		rp->rtp = p->rtp;
++		p->rtp = NULL;
++		if (!ast_strlen_zero(p->refer_to)) {
++		    ast_copy_string(rp->username, p->refer_to, sizeof(rp->username));
++		    rp->fullcontact[0] = '\0';
++		}
++		if (!ast_strlen_zero(p->refer_replaces)) {
++		    ast_copy_string(rp->refer_replaces, p->refer_replaces, sizeof(rp->refer_replaces));
++		}
 +	    ast_log(LOG_NOTICE, "2\n");
 +			ast_set_flag(rp, SIP_OUTGOING);
 +			
@@ -6174,18 +6459,17 @@
 +			    rp->initid = ast_sched_add(sched, rp->maxtime * 4, auto_congest, rp);
 +			}
 +
-+    			transmit_notify_with_sipfrag(p, seqno);
++ 			transmit_notify_with_sipfrag(p, seqno);
 +
 +			/* Always increment on a BYE */
 +			transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
 +			ast_set_flag(p, SIP_ALREADYGONE);
 +			return 0;
-+	
-+	} else {  /* res == 0 */
++	} else { /* res == 0 */
  		int nobye = 0;
  		if (!ignore) {
  			if (p->refer_call) {
-@@ -10993,7 +11216,7 @@
+@@ -10995,7 +11231,7 @@
  			struct sip_pvt *p_old;
  
  			transmit_response(p, "200 OK", req);
@@ -6194,7 +6478,7 @@
  			append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
  
  			/* remove any old subscription from this peer for the same exten/context,
-@@ -11187,6 +11410,8 @@
+@@ -11189,6 +11425,8 @@
  		res = handle_request_options(p, req, debug);
  		break;
  	case SIP_INVITE:
@@ -6203,7 +6487,7 @@
  		res = handle_request_invite(p, req, debug, ignore, seqno, sin, recount, e);
  		break;
  	case SIP_REFER:
-@@ -11307,7 +11532,7 @@
+@@ -11309,7 +11547,7 @@
  	/* Process request, with netlock held */
  retrylock:
  	ast_mutex_lock(&netlock);
@@ -6212,7 +6496,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)) {
-@@ -11634,6 +11859,52 @@
+@@ -11636,6 +11874,52 @@
  	return 0;
  }
  
@@ -6265,7 +6549,7 @@
  /*! \brief  sip_devicestate: Part of PBX channel interface ---*/
  
  /* Return values:---
-@@ -12171,6 +12442,7 @@
+@@ -12173,6 +12457,7 @@
  
  	peer->expire = -1;
  	peer->pokeexpire = -1;
@@ -6273,7 +6557,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);
-@@ -12216,7 +12488,9 @@
+@@ -12218,7 +12503,9 @@
  
  	if (peer) {
  		/* Already in the list, remove it and it will be added back (or FREE'd)  */
@@ -6284,7 +6568,7 @@
   	} else {
  		peer = malloc(sizeof(*peer));
  		if (peer) {
-@@ -12228,6 +12502,7 @@
+@@ -12230,6 +12517,7 @@
  			ASTOBJ_INIT(peer);
  			peer->expire = -1;
  			peer->pokeexpire = -1;
@@ -6292,7 +6576,7 @@
  		} else {
  			ast_log(LOG_WARNING, "Can't allocate SIP peer memory\n");
  		}
-@@ -12373,6 +12648,10 @@
+@@ -12375,6 +12663,10 @@
  			peer->call_limit = atoi(v->value);
  			if (peer->call_limit < 0)
  				peer->call_limit = 0;
@@ -6303,7 +6587,7 @@
  		} else if (!strcasecmp(v->name, "amaflags")) {
  			format = ast_cdr_amaflags2int(v->value);
  			if (format < 0) {
-@@ -12768,8 +13047,24 @@
+@@ -12770,8 +13062,24 @@
  				if (!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend")) {
  					peer = build_peer(cat, ast_variable_browse(cfg, cat), 0);
  					if (peer) {
@@ -6330,7 +6614,7 @@
  					}
  				} else if (strcasecmp(utype, "user")) {
  					ast_log(LOG_WARNING, "Unknown type '%s' for '%s' in %s\n", utype, cat, "sip.conf");
-@@ -13359,6 +13654,8 @@
+@@ -13361,6 +13669,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);
@@ -6339,7 +6623,7 @@
  
  	sip_poke_all_peers();	
  	sip_send_all_registers();
-@@ -13389,6 +13686,7 @@
+@@ -13391,6 +13701,7 @@
  
  	ast_rtp_proto_unregister(&sip_rtp);
  
@@ -6347,9 +6631,9 @@
  	ast_manager_unregister("SIPpeers");
  	ast_manager_unregister("SIPshowpeer");
  
-diff -urN asterisk-1.2.9.1.orig/channels/chan_zap.c asterisk-1.2.9.1/channels/chan_zap.c
---- asterisk-1.2.9.1.orig/channels/chan_zap.c	2006-05-31 22:26:17.000000000 +0200
-+++ asterisk-1.2.9.1/channels/chan_zap.c	2006-06-15 16:09:02.000000000 +0200
+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
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -7021,7 +7305,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) {
-@@ -3636,7 +3943,7 @@
+@@ -3633,7 +3940,7 @@
  			if (p->call) {
  				if (p->pri && p->pri->pri) {
  					if (!pri_grab(p, p->pri)) {
@@ -7030,7 +7314,7 @@
  						pri_destroycall(p->pri->pri, p->call);
  						p->call = NULL;
  						pri_rel(p->pri);
-@@ -4599,7 +4906,7 @@
+@@ -4596,7 +4903,7 @@
  		p->subs[index].f.data = NULL;
  		p->subs[index].f.datalen= 0;
  	}
@@ -7039,7 +7323,7 @@
  		/* Perform busy detection. etc on the zap line */
  		f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
  		if (f) {
-@@ -4611,8 +4918,9 @@
+@@ -4608,8 +4915,9 @@
  				}
  			} else if (f->frametype == AST_FRAME_DTMF) {
  #ifdef ZAPATA_PRI
@@ -7051,7 +7335,7 @@
  					f->frametype = AST_FRAME_NULL;
  					f->subclass = 0;
  				}
-@@ -4660,8 +4968,10 @@
+@@ -4657,8 +4965,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);
@@ -7064,7 +7348,7 @@
  				} else
  					ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
  			} else
-@@ -4747,7 +5057,9 @@
+@@ -4744,7 +5054,9 @@
  #endif
  	/* Write a frame of (presumably voice) data */
  	if (frame->frametype != AST_FRAME_VOICE) {
@@ -7075,7 +7359,7 @@
  			ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
  		return 0;
  	}
-@@ -4818,7 +5130,7 @@
+@@ -4815,7 +5127,7 @@
  		switch(condition) {
  		case AST_CONTROL_BUSY:
  #ifdef ZAPATA_PRI
@@ -7084,7 +7368,7 @@
  				chan->hangupcause = AST_CAUSE_USER_BUSY;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -4900,7 +5212,7 @@
+@@ -4897,7 +5209,7 @@
  		case AST_CONTROL_CONGESTION:
  			chan->hangupcause = AST_CAUSE_CONGESTION;
  #ifdef ZAPATA_PRI
@@ -7093,7 +7377,7 @@
  				chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -5085,8 +5397,12 @@
+@@ -5082,8 +5394,12 @@
  		if (state == AST_STATE_RING)
  			tmp->rings = 1;
  		tmp->tech_pvt = i;
@@ -7108,7 +7392,7 @@
  			tmp->callgroup = i->callgroup;
  			tmp->pickupgroup = i->pickupgroup;
  		}
-@@ -5216,6 +5532,7 @@
+@@ -5213,6 +5529,7 @@
  	int len = 0;
  	int res;
  	int index;
@@ -7116,7 +7400,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);
-@@ -5234,10 +5551,17 @@
+@@ -5231,10 +5548,17 @@
  		len = strlen(exten);
  		res = 0;
  		while((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
@@ -7137,7 +7421,65 @@
  			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
  				timeout = matchdigittimeout;
  			else
-@@ -6724,6 +7048,8 @@
+@@ -6327,18 +6651,44 @@
+ 		break;
+ 	case ZT_EVENT_NOALARM:
+ 		i->inalarm = 0;
++#ifdef ZAPATA_PRI
++		if (i->pri) {
++		    if ((i->pri->nodetype == BRI_CPE_PTMP) || (i->pri->nodetype == BRI_CPE_PTMP)) {
++			/* dont annoy BRI TE mode users with layer2layer alarms */
++		    } else {
++			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
++			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
++		              "Channel: %d\r\n", i->channel);
++		    }
++		}
++#else
+ 		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
+ 		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
+ 		              "Channel: %d\r\n", i->channel);
++#endif
+ 		break;
+ 	case ZT_EVENT_ALARM:
+ 		i->inalarm = 1;
+ 		res = get_alarms(i);
++#ifdef ZAPATA_PRI
++		if (i->pri) {
++		    if ((i->pri->nodetype == BRI_CPE_PTMP) || (i->pri->nodetype == BRI_CPE_PTMP)) {
++			/* dont annoy BRI TE mode users with layer2layer alarms */
++		    } else {
++			ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res));
++			manager_event(EVENT_FLAG_SYSTEM, "Alarm",
++		              "Alarm: %s\r\n"
++		              "Channel: %d\r\n",
++		              alarm2str(res), i->channel);
++		    }
++		}
++#else
+ 		ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res));
+ 		manager_event(EVENT_FLAG_SYSTEM, "Alarm",
+ 		              "Alarm: %s\r\n"
+ 		              "Channel: %d\r\n",
+ 		              alarm2str(res), i->channel);
++#endif
+ 		/* fall thru intentionally */
+ 	case ZT_EVENT_ONHOOK:
+ 		if (i->radio) break;
+@@ -6378,8 +6728,10 @@
+ 			zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ 			break;
+ 		case SIG_PRI:
+-			zt_disable_ec(i);
+-			res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
++			if (event != ZT_EVENT_ALARM) {
++			    zt_disable_ec(i);
++			    res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
++			}
+ 			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 @@
  		} else {
  			if (si->totalchans == 31) { /* if it's an E1 */
  				pris[*span].dchannels[0] = 16 + offset;
@@ -7146,7 +7488,7 @@
  			} else {
  				pris[*span].dchannels[0] = 24 + offset;
  			}
-@@ -6811,6 +7137,10 @@
+@@ -6789,6 +7143,10 @@
  
  #endif
  
@@ -7157,7 +7499,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) */
-@@ -6969,6 +7299,11 @@
+@@ -6947,6 +7305,11 @@
  							destroy_zt_pvt(&tmp);
  							return NULL;
  						}
@@ -7169,7 +7511,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);
-@@ -6996,6 +7331,17 @@
+@@ -6974,6 +7337,17 @@
  							return NULL;
  						}
  						pris[span].nodetype = pritype;
@@ -7180,14 +7522,14 @@
 +						}
 +// XXX tuev
 +
-+						if ((pritype == BRI_CPE) || (pritype == BRI_CPE_PTMP)) {
-+						    pris[span].dchanavail[0] =  DCHAN_AVAILABLE;
-+						    pri_find_dchan(&pris[span]);
-+						}
++//						if ((pritype == BRI_CPE) || (pritype == BRI_CPE_PTMP)) {
++//						    pris[span].dchanavail[0] =  DCHAN_AVAILABLE;
++//						    pri_find_dchan(&pris[span]);
++//						}
  						pris[span].switchtype = myswitchtype;
  						pris[span].nsf = nsf;
  						pris[span].dialplan = dialplan;
-@@ -7004,9 +7350,14 @@
+@@ -6982,9 +7356,14 @@
  						pris[span].minunused = minunused;
  						pris[span].minidle = minidle;
  						pris[span].overlapdial = overlapdial;
@@ -7202,7 +7544,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));
-@@ -7027,6 +7378,36 @@
+@@ -7005,6 +7384,36 @@
  				tmp->prioffset = 0;
  			}
  #endif
@@ -7225,7 +7567,7 @@
 +		    }
 +		    tmp->gsm.pvt = tmp;
 +		    tmp->gsm.span = tmp->span;
-+		    tmp->gsm.modul = gsm_new(tmp->gsm.fd, 0, tmp->gsm.pin, tmp->span);
++		    tmp->gsm.modul = gsm_new(tmp->gsm.fd, 0, tmp->gsm.pin, tmp->span, tmp->channel);
 +		    if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, tmp->channel)) {
 +			ast_log(LOG_ERROR, "Unable to set clear mode on clear channel %d: %s\n", tmp->channel, strerror(errno));
 +			destroy_zt_pvt(&tmp);
@@ -7239,7 +7581,7 @@
  #ifdef ZAPATA_R2
  			if (signalling == SIG_R2) {
  				if (r2prot < 0) {
-@@ -7160,6 +7541,7 @@
+@@ -7138,6 +7547,7 @@
  		tmp->restrictcid = restrictcid;
  		tmp->use_callingpres = use_callingpres;
  		tmp->priindication_oob = priindication_oob;
@@ -7247,7 +7589,7 @@
  		tmp->priexclusive = cur_priexclusive;
  		if (tmp->usedistinctiveringdetection) {
  			if (!tmp->use_callerid) {
-@@ -7433,7 +7815,7 @@
+@@ -7411,7 +7821,7 @@
  			break;
  		if (!backwards && (x >= pri->numchans))
  			break;
@@ -7256,7 +7598,7 @@
  			ast_log(LOG_DEBUG, "Found empty available channel %d/%d\n", 
  				pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
  			return x;
-@@ -7480,7 +7862,7 @@
+@@ -7458,7 +7868,7 @@
  	end = ifend;
  	/* We do signed linear */
  	oldformat = format;
@@ -7265,7 +7607,7 @@
  	if (!format) {
  		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
  		return NULL;
-@@ -7640,6 +8022,11 @@
+@@ -7618,6 +8028,11 @@
  					p->digital = 1;
  					if (tmp)
  						tmp->transfercapability = AST_TRANS_CAP_DIGITAL;
@@ -7277,7 +7619,15 @@
  				} else {
  					ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
  				}
-@@ -7679,6 +8066,164 @@
+@@ -7651,12 +8066,174 @@
+ 				*cause = AST_CAUSE_BUSY;
+ 		} else if (groupmatched) {
+ 			*cause = AST_CAUSE_CONGESTION;
++		} else {
++			*cause = AST_CAUSE_CONGESTION;
+ 		}
+ 	}
+ 		
  	return tmp;
  }
  
@@ -7301,6 +7651,8 @@
 +		ast_mutex_lock(&gsm->pvt->lock);
 +		if (!ast_strlen_zero(e->ring.callingnum)) {
 +		    strncpy(gsm->pvt->cid_num, e->ring.callingnum, sizeof(gsm->pvt->cid_num) - 1);
++		} else {
++		    strncpy(gsm->pvt->cid_name, withheldcid, sizeof(gsm->pvt->cid_name));
 +		}
 +		if (!ast_strlen_zero(gsm->exten)) {
 +		    strncpy(gsm->pvt->exten, gsm->exten, sizeof(gsm->pvt->exten) - 1);
@@ -7371,7 +7723,7 @@
 +		fprintf(stderr, "No gsm_mod\n");
 +		return NULL;
 +	}
-+	gsm_set_debug(gsm->modul, 1);
++	gsm_set_debug(gsm->modul, GSM_DEBUG_NONE);
 +	for (;;) {
 +		
 +		/* Run the D-Channel */
@@ -7442,7 +7794,7 @@
  
  #ifdef ZAPATA_PRI
  static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
-@@ -7693,6 +8238,57 @@
+@@ -7671,6 +8248,57 @@
  	return NULL;
  }
  
@@ -7500,7 +7852,7 @@
  
  static int pri_find_principle(struct zt_pri *pri, int channel)
  {
-@@ -7725,7 +8321,9 @@
+@@ -7703,7 +8331,9 @@
  static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
  {
  	int x;
@@ -7510,7 +7862,7 @@
  	if (!c) {
  		if (principle < 0)
  			return -1;
-@@ -7739,6 +8337,7 @@
+@@ -7717,6 +8347,7 @@
  	/* First, check for other bearers */
  	for (x=0;x<pri->numchans;x++) {
  		if (!pri->pvts[x]) continue;
@@ -7518,7 +7870,7 @@
  		if (pri->pvts[x]->call == c) {
  			/* Found our call */
  			if (principle != x) {
-@@ -7752,19 +8351,56 @@
+@@ -7730,19 +8361,56 @@
  				}
  				/* Fix it all up now */
  				pri->pvts[principle]->owner = pri->pvts[x]->owner;
@@ -7576,7 +7928,7 @@
  			}
  			return principle;
  		}
-@@ -7793,7 +8429,9 @@
+@@ -7771,7 +8439,9 @@
  		}
  		crv = crv->next;
  	}
@@ -7587,7 +7939,7 @@
  	return -1;
  }
  
-@@ -7855,86 +8493,33 @@
+@@ -7830,86 +8500,33 @@
  #ifndef PRI_RESTART
  #error "Upgrade your libpri"
  #endif
@@ -7638,7 +7990,9 @@
 -	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++) {
@@ -7665,21 +8019,19 @@
 -		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
-+static void zt_gsm_message(char *s, int span)
++static void zt_gsm_message(char *s, int channel)
 +{
-+//	ast_verbose("%d %s", span, s);
++	ast_verbose("GSM %d: %s", channel, s);
 +}
  
 -	ast_mutex_unlock(&pridebugfdlock);
-+static void zt_gsm_error(char *s, int span)
++static void zt_gsm_error(char *s, int channel)
 +{
-+	ast_log(LOG_WARNING, "GSM: %d %s", span, s);
++	ast_log(LOG_WARNING, "GSM %d: %s", channel, s);
  }
 +#endif
  
@@ -7691,7 +8043,7 @@
  	do {
  		pri->resetpos++;
  	} while((pri->resetpos < pri->numchans) &&
-@@ -8017,6 +8602,32 @@
+@@ -7992,6 +8609,32 @@
  	}
  }
  
@@ -7724,22 +8076,22 @@
  static void *pri_dchannel(void *vpri)
  {
  	struct zt_pri *pri = vpri;
-@@ -8108,6 +8719,8 @@
- 				} else if (pri->pvts[x] && pri->pvts[x]->owner && pri->pvts[x]->isidlecall)
- 					activeidles++;
- 			}
-+	//    ast_log(LOG_NOTICE, "name = %s condition = %d index = %d (%d) zfd = %d res = %d\n",chan->name, condition, index, SUB_REAL, p->subs[index].zfd, res);
-+
- 			if (nextidle > -1) {
- 				if (ast_tvdiff_ms(ast_tvnow(), lastidle) > 1000) {
- 					/* Don't create a new idle call more than once per second */
-@@ -8209,9 +8822,36 @@
+@@ -8172,15 +8815,44 @@
+ 					/* Check for an event */
+ 					x = 0;
+ 					res = ioctl(pri->fds[which], ZT_GETEVENT, &x);
+-					if (x) 
++					if ((pri->nodetype != BRI_CPE) && (pri->nodetype != BRI_CPE_PTMP)) {
++					    /* dont annoy BRI TE mode users with layer2layer alarms */
++					    if (x)
+ 						ast_log(LOG_NOTICE, "PRI got event: %s (%d) on %s D-channel of span %d\n", event2str(x), x, pri_order(which), pri->span);
++					}
+ 					/* Keep track of alarm state */	
  					if (x == ZT_EVENT_ALARM) {
  						pri->dchanavail[which] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
  						pri_find_dchan(pri);
 +						if ((pri->nodetype == BRI_CPE) || (pri->nodetype == BRI_CPE_PTMP)) {
 +						    if (pri->pri) {
-+							ast_log(LOG_NOTICE, "pri_shutdown\n");
 +							for (i=0; i<pri->numchans; i++) {
 +							    struct zt_pvt *p = pri->pvts[i];
 +							    if (p) {
@@ -7764,7 +8116,7 @@
 -						pri_restart(pri->dchans[which]);
 +						if ((pri->nodetype == BRI_CPE) || (pri->nodetype == BRI_CPE_PTMP)) {
 +						    pri->dchanavail[which] |= DCHAN_NOTINALARM;
-+						    pri->dchanavail[which] |= DCHAN_UP;
++						//    pri->dchanavail[which] |= DCHAN_UP;
 +						} else {
 +						    pri->dchanavail[which] |= DCHAN_NOTINALARM;
 +						    pri_restart(pri->dchans[which]);
@@ -7772,7 +8124,7 @@
  					}
  				
  					if (option_debug)
-@@ -8223,8 +8863,7 @@
+@@ -8192,8 +8864,7 @@
  					break;
  			}
  		} else if (errno != EINTR)
@@ -7782,7 +8134,7 @@
  		if (e) {
  			if (pri->debug)
  				pri_dump_event(pri->dchans[which], e);
-@@ -8232,32 +8871,102 @@
+@@ -8201,32 +8872,102 @@
  				pri->dchanavail[which] |= DCHAN_UP;
  			switch(e->e) {
  			case PRI_EVENT_DCHAN_UP:
@@ -7909,7 +8261,7 @@
  					pri->resetting = 0;
  					/* Hangup active channels and put them in alarm mode */
  					for (i=0; i<pri->numchans; i++) {
-@@ -8265,19 +8974,29 @@
+@@ -8234,19 +8975,29 @@
  						if (p) {
  							if (p->call) {
  								if (p->pri && p->pri->pri) {
@@ -7946,7 +8298,7 @@
  				}
  				break;
  			case PRI_EVENT_RESTART:
-@@ -8312,8 +9031,8 @@
+@@ -8281,8 +9032,8 @@
  								pri_destroycall(pri->pri, pri->pvts[x]->call);
  								pri->pvts[x]->call = NULL;
  							}
@@ -7957,7 +8309,7 @@
   							else if (pri->pvts[x]->owner)
  								pri->pvts[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
  							ast_mutex_unlock(&pri->pvts[x]->lock);
-@@ -8347,7 +9066,6 @@
+@@ -8316,7 +9067,6 @@
  					}
  				}
  				break;
@@ -7965,7 +8317,7 @@
  			case PRI_EVENT_INFO_RECEIVED:
  				chanpos = pri_find_principle(pri, e->ring.channel);
  				if (chanpos < 0) {
-@@ -8356,9 +9074,11 @@
+@@ -8325,9 +9075,11 @@
  				} else {
  					chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
  					if (chanpos > -1) {
@@ -7978,7 +8330,7 @@
  							/* how to do that */
  							int digitlen = strlen(e->ring.callednum);
  							char digit;
-@@ -8370,6 +9090,14 @@
+@@ -8339,6 +9091,14 @@
  									zap_queue_frame(pri->pvts[chanpos], &f, pri);
  								}
  							}
@@ -7993,7 +8345,7 @@
  						}
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					}
-@@ -8377,39 +9105,58 @@
+@@ -8346,39 +9106,58 @@
  				break;
  			case PRI_EVENT_RING:
  				crv = NULL;
@@ -8073,7 +8425,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));
-@@ -8423,13 +9170,14 @@
+@@ -8392,13 +9171,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);
@@ -8089,7 +8441,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) {
-@@ -8454,29 +9202,78 @@
+@@ -8423,29 +9203,78 @@
  					}
  					apply_plan_to_number(pri->pvts[chanpos]->rdnis, sizeof(pri->pvts[chanpos]->rdnis), pri,
  							     e->ring.redirectingnum, e->ring.callingplanrdnis);
@@ -8181,7 +8533,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)) {
-@@ -8495,22 +9292,38 @@
+@@ -8464,22 +9293,38 @@
  						res = zt_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law);
  						if (res < 0) 
  							ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel);
@@ -8227,7 +8579,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);
-@@ -8518,14 +9331,31 @@
+@@ -8487,14 +9332,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);
@@ -8259,7 +8611,7 @@
  							if(e->ring.ani2 >= 0) {
  								snprintf(ani2str, 5, "%.2d", e->ring.ani2);
  								pbx_builtin_setvar_helper(c, "ANI2", ani2str);
-@@ -8545,8 +9375,8 @@
+@@ -8514,8 +9376,8 @@
  							ast_mutex_lock(&pri->lock);
  							if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
  								if (option_verbose > 2)
@@ -8270,7 +8622,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", 
-@@ -8554,14 +9384,18 @@
+@@ -8523,14 +9385,18 @@
  								if (c)
  									ast_hangup(c);
  								else {
@@ -8290,7 +8642,7 @@
  							ast_mutex_lock(&pri->lock);
  							if (c) {
  								char calledtonstr[10];
-@@ -8582,23 +9416,40 @@
+@@ -8551,23 +9417,40 @@
  								snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
  								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
  								if (option_verbose > 2)
@@ -8335,7 +8687,7 @@
  						pri->pvts[chanpos]->call = NULL;
  						pri->pvts[chanpos]->exten[0] = '\0';
  					}
-@@ -8606,7 +9457,7 @@
+@@ -8575,7 +9458,7 @@
  						ast_mutex_unlock(&crv->lock);
  					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  				} else 
@@ -8344,7 +8696,7 @@
  				break;
  			case PRI_EVENT_RINGING:
  				chanpos = pri_find_principle(pri, e->ringing.channel);
-@@ -8624,7 +9475,7 @@
+@@ -8593,7 +9476,7 @@
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
@@ -8353,7 +8705,7 @@
  							pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
  							pri->pvts[chanpos]->alerting = 1;
  						} else
-@@ -8653,9 +9504,15 @@
+@@ -8622,9 +9505,16 @@
  				}
  				break;
  			case PRI_EVENT_PROGRESS:
@@ -8364,13 +8716,14 @@
 +				    if ((pri->pvts[chanpos]->priindication_oob == 2) && (e->proceeding.cause == PRI_CAUSE_USER_BUSY)) {
 +					/* received PROGRESS with cause BUSY, no inband callprogress wanted => hang up! */
 +					if (pri->pvts[chanpos]->owner) {
++					    pri->pvts[chanpos]->owner->hangupcause = AST_CAUSE_USER_BUSY;
 +					    pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 +					}
 +				    } else {
  #ifdef PRI_PROGRESS_MASK
  					if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
  #else
-@@ -8702,6 +9559,12 @@
+@@ -8671,6 +9561,12 @@
  			case PRI_EVENT_PROCEEDING:
  				chanpos = pri_find_principle(pri, e->proceeding.channel);
  				if (chanpos > -1) {
@@ -8383,7 +8736,7 @@
  					if (!pri->pvts[chanpos]->proceeding) {
  						struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
  						
-@@ -8752,6 +9615,295 @@
+@@ -8721,6 +9617,295 @@
  					}
  				}
  				break;				
@@ -8679,7 +9032,7 @@
  			case PRI_EVENT_ANSWER:
  				chanpos = pri_find_principle(pri, e->answer.channel);
  				if (chanpos < 0) {
-@@ -8767,6 +9919,7 @@
+@@ -8736,6 +9921,7 @@
  						chanpos = -1;
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -8687,7 +9040,7 @@
  						/* Now we can do call progress detection */
  
  						/* We changed this so it turns on the DSP no matter what... progress or no progress.
-@@ -8796,11 +9949,16 @@
+@@ -8765,11 +9951,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) {
@@ -8705,7 +9058,7 @@
  						}
  
  #ifdef SUPPORT_USERUSER
-@@ -8849,23 +10007,32 @@
+@@ -8818,23 +10009,32 @@
  								}
  							}
  							if (option_verbose > 2) 
@@ -8745,7 +9098,7 @@
  
  #ifdef SUPPORT_USERUSER
  						if (!ast_strlen_zero(e->hangup.useruserinfo)) {
-@@ -8875,8 +10042,20 @@
+@@ -8844,8 +10044,20 @@
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
@@ -8768,7 +9121,7 @@
  					}
  				} 
  				break;
-@@ -8886,17 +10065,25 @@
+@@ -8855,17 +10067,25 @@
  			case PRI_EVENT_HANGUP_REQ:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
  				if (chanpos < 0) {
@@ -8797,7 +9150,7 @@
  							pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
  							switch(e->hangup.cause) {
  							case PRI_CAUSE_USER_BUSY:
-@@ -8915,20 +10102,87 @@
+@@ -8884,20 +10104,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);
@@ -8895,7 +9248,7 @@
  						}
  
  #ifdef SUPPORT_USERUSER
-@@ -8939,9 +10193,36 @@
+@@ -8908,9 +10195,37 @@
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
@@ -8928,12 +9281,13 @@
 +						ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n",
 +						pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s");
 +					}
++				    pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
 +				    ast_channel_setwhentohangup(pri->pvts[chanpos]->owner, 5);
 +				}
  				break;
  			case PRI_EVENT_HANGUP_ACK:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
-@@ -8955,6 +10236,7 @@
+@@ -8924,6 +10239,7 @@
  					if (chanpos > -1) {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						pri->pvts[chanpos]->call = NULL;
@@ -8941,7 +9295,7 @@
  						pri->pvts[chanpos]->resetting = 0;
  						if (pri->pvts[chanpos]->owner) {
  							if (option_verbose > 2) 
-@@ -8968,7 +10250,9 @@
+@@ -8937,7 +10253,9 @@
  #endif
  
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -8951,7 +9305,7 @@
  				}
  				break;
  			case PRI_EVENT_CONFIG_ERR:
-@@ -9060,10 +10344,22 @@
+@@ -9029,10 +10347,22 @@
  					ast_mutex_lock(&pri->pvts[chanpos]->lock);
  					switch(e->notify.info) {
  					case PRI_NOTIFY_REMOTE_HOLD:
@@ -8974,7 +9328,7 @@
  						f.subclass = AST_CONTROL_UNHOLD;
  						zap_queue_frame(pri->pvts[chanpos], &f, pri);
  						break;
-@@ -9071,6 +10367,77 @@
+@@ -9040,6 +10370,77 @@
  					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  				}
  				break;
@@ -9052,7 +9406,7 @@
  			default:
  				ast_log(LOG_DEBUG, "Event: %d\n", e->e);
  			}
-@@ -9132,7 +10499,7 @@
+@@ -9101,7 +10502,7 @@
  			pri->fds[i] = -1;
  			return -1;
  		}
@@ -9061,7 +9415,7 @@
  		/* Force overlap dial if we're doing GR-303! */
  		if (pri->switchtype == PRI_SWITCH_GR303_TMC)
  			pri->overlapdial = 1;
-@@ -9201,39 +10568,77 @@
+@@ -9170,39 +10571,77 @@
  
  static int handle_pri_set_debug_file(int fd, int argc, char **argv)
  {
@@ -9161,7 +9515,7 @@
  	}
  
  	return RESULT_SUCCESS;
-@@ -9265,6 +10670,7 @@
+@@ -9234,6 +10673,7 @@
  
  
  
@@ -9169,7 +9523,7 @@
  static int handle_pri_no_debug(int fd, int argc, char *argv[])
  {
  	int span;
-@@ -9371,36 +10777,6 @@
+@@ -9340,36 +10780,6 @@
  	return RESULT_SUCCESS;
  }
  
@@ -9206,7 +9560,7 @@
  static char pri_debug_help[] = 
  	"Usage: pri debug span <span>\n"
  	"       Enables debugging on a given PRI span\n";
-@@ -9417,6 +10793,18 @@
+@@ -9386,6 +10796,18 @@
  	"Usage: pri show span <span>\n"
  	"       Displays PRI Information\n";
  
@@ -9225,7 +9579,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 },
-@@ -9424,19 +10812,218 @@
+@@ -9393,19 +10815,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 },
@@ -9275,7 +9629,71 @@
  
  
 +#ifdef ZAPATA_GSM
++static int handle_gsm_debug_helper(int fd, int channel, int debug)
++{
++/* gsm debug channel <channel> */
++	struct zt_pvt *pvt = NULL;
++	if (channel < 1) {
++		ast_cli(fd, "Invalid channel %d.  Should be a number.\n", channel);
++		return RESULT_SUCCESS;
++	}
++	pvt = iflist;
++	while (pvt) {
++	    if (pvt->channel == channel) {
++		ast_mutex_lock(&pvt->lock);
++		gsm_set_debug(pvt->gsm.modul, debug);
++		ast_mutex_unlock(&pvt->lock);
++		ast_cli(fd, "%s debugging on channel %d\n", debug ? "Enabled":"Disabled", channel);
++		return RESULT_SUCCESS;
++	    }
++	    pvt = pvt->next;
++	}
++	
++	ast_cli(fd, "No GSM running on channel %d\n", channel);
++	return RESULT_SUCCESS;
++}
 +
++
++
++static int handle_gsm_debug(int fd, int argc, char *argv[])
++{
++/* gsm debug channel <channel> */
++    int channel;
++    if (argc < 4) {
++    	return RESULT_SHOWUSAGE;
++    }
++    channel = atoi(argv[3]);
++    return handle_gsm_debug_helper(fd, channel, GSM_DEBUG_AT);
++}
++
++static int handle_gsm_no_debug(int fd, int argc, char *argv[])
++{
++/* gsm no debug channel <channel> */
++    int channel;
++    if (argc < 5) {
++    	return RESULT_SHOWUSAGE;
++    }
++    channel = atoi(argv[4]);
++    return handle_gsm_debug_helper(fd, channel, GSM_DEBUG_NONE);
++}
++
++static char gsm_debug_help[] = 
++	"Usage: gsm debug channel <channel>\n"
++	"       Enables debugging on a given GSM channel\n";
++	
++static char gsm_no_debug_help[] = 
++	"Usage: gsm no debug channel <channel>\n"
++	"       Disables debugging on a given GSM channel\n";
++
++static struct ast_cli_entry zap_gsm_cli[] = {
++	{ { "gsm", "debug", "channel", NULL }, handle_gsm_debug,
++	  "Enables GSM debugging on a channel", gsm_debug_help },
++	{ { "gsm", "no", "debug", "channel", NULL }, handle_gsm_no_debug,
++	  "Disables GSM debugging on a channel", gsm_no_debug_help},
++};
++
++
++
 +static char gsm_send_pdu_help[] = 
 +	"Usage: gsm send pdu <channel> <length> <pdu>\n"
 +	"       Sends a PDU on a GSM channel\n";
@@ -9447,7 +9865,7 @@
  #ifdef ZAPATA_R2
  static int handle_r2_no_debug(int fd, int argc, char *argv[])
  {
-@@ -10048,6 +11635,13 @@
+@@ -10017,6 +11702,14 @@
  			pthread_cancel(pris[i].master);
  	}
  	ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
@@ -9455,13 +9873,14 @@
 +	ast_unregister_application(zapInband_app);
 +#endif
 +#ifdef ZAPATA_GSM
++	ast_cli_unregister_multiple(zap_gsm_cli, sizeof(zap_gsm_cli) / sizeof(zap_gsm_cli[0]));
 +	ast_cli_unregister(&gsm_send_sms);
 +	ast_cli_unregister(&gsm_send_pdu);
 +	ast_cli_unregister(&gsm_show_status);
  #endif
  #ifdef ZAPATA_R2
  	ast_cli_unregister_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
-@@ -10059,6 +11653,7 @@
+@@ -10028,6 +11721,7 @@
  	ast_manager_unregister( "ZapDNDoff" );
  	ast_manager_unregister( "ZapDNDon" );
  	ast_manager_unregister("ZapShowChannels");
@@ -9469,7 +9888,7 @@
  	ast_channel_unregister(&zap_tech);
  	if (!ast_mutex_lock(&iflock)) {
  		/* Hangup all interfaces if they have an owner */
-@@ -10417,8 +12012,8 @@
+@@ -10386,8 +12080,8 @@
  			}
  		} else if (!strcasecmp(v->name, "echotraining")) {
  			if (sscanf(v->value, "%d", &y) == 1) {
@@ -9480,7 +9899,7 @@
  				} else {
  					echotraining = y;
  				}
-@@ -10604,12 +12199,33 @@
+@@ -10573,12 +12267,33 @@
  					cur_signalling = SIG_GR303FXSKS;
  					cur_radio = 0;
  					pritype = PRI_CPE;
@@ -9514,14 +9933,13 @@
  				} else {
  					ast_log(LOG_ERROR, "Unknown signalling method '%s'\n", v->value);
  				}
-@@ -10692,8 +12308,20 @@
+@@ -10661,8 +12376,20 @@
  					priindication_oob = 1;
  				else if (!strcasecmp(v->value, "inband"))
  					priindication_oob = 0;
 +				else if (!strcasecmp(v->value, "passthrough"))
 +					priindication_oob = 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 indication value, should be 'inband' , 'outofband' or 'passthrough' at line %d\n",
 +						v->value, v->lineno);
 +			} else if (!strcasecmp(v->name, "pritransfer")) {
@@ -9531,12 +9949,13 @@
 +					pritransfer = 1;
 +				else if (!strcasecmp(v->value, "hangup"))
 +					pritransfer = 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 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);
-@@ -10707,6 +12335,14 @@
+@@ -10676,6 +12403,14 @@
  				ast_copy_string(privateprefix, v->value, sizeof(privateprefix));
  			} else if (!strcasecmp(v->name, "unknownprefix")) {
  				ast_copy_string(unknownprefix, v->value, sizeof(unknownprefix));
@@ -9551,7 +9970,7 @@
  			} else if (!strcasecmp(v->name, "resetinterval")) {
  				if (!strcasecmp(v->value, "never"))
  					resetinterval = -1;
-@@ -10723,6 +12359,8 @@
+@@ -10692,6 +12427,8 @@
  				ast_copy_string(idleext, v->value, sizeof(idleext));
  			} else if (!strcasecmp(v->name, "idledial")) {
  				ast_copy_string(idledial, v->value, sizeof(idledial));
@@ -9560,7 +9979,7 @@
  			} else if (!strcasecmp(v->name, "overlapdial")) {
  				overlapdial = ast_true(v->value);
  			} else if (!strcasecmp(v->name, "pritimer")) {
-@@ -10908,6 +12546,7 @@
+@@ -10877,6 +12614,7 @@
  #ifdef ZAPATA_PRI
  	if (!reload) {
  		for (x=0;x<NUM_SPANS;x++) {
@@ -9568,7 +9987,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);
-@@ -10940,6 +12579,10 @@
+@@ -10909,6 +12647,10 @@
  	pri_set_error(zt_pri_error);
  	pri_set_message(zt_pri_message);
  #endif
@@ -9579,7 +9998,7 @@
  	res = setup_zap(0);
  	/* Make sure we can register our Zap channel type */
  	if(res) {
-@@ -10957,6 +12600,11 @@
+@@ -10926,6 +12668,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]));
@@ -9587,11 +10006,12 @@
 +	ast_cli_register(&gsm_send_sms);
 +	ast_cli_register(&gsm_send_pdu);
 +	ast_cli_register(&gsm_show_status);
++	ast_cli_register_multiple(zap_gsm_cli, sizeof(zap_gsm_cli) / sizeof(zap_gsm_cli[0]));
 +#endif
  	
  	memset(round_robin, 0, sizeof(round_robin));
  	ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
-@@ -10965,11 +12613,47 @@
+@@ -10934,11 +12682,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");
@@ -9640,7 +10060,7 @@
  {
  #define	END_SILENCE_LEN 400
  #define	HEADER_MS 50
-@@ -10988,6 +12672,7 @@
+@@ -10957,6 +12741,7 @@
  	float scont = 0.0;
  	int index;
  
@@ -9648,9 +10068,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.9.1.orig/codecs/codec_ilbc.c asterisk-1.2.9.1/codecs/codec_ilbc.c
---- asterisk-1.2.9.1.orig/codecs/codec_ilbc.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/codecs/codec_ilbc.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -49,7 +49,7 @@
  #include "slin_ilbc_ex.h"
  #include "ilbc_slin_ex.h"
@@ -9660,9 +10080,9 @@
  #define ILBC_MS 			30
  /* #define ILBC_MS			20 */
  
-diff -urN asterisk-1.2.9.1.orig/configs/capi.conf.sample asterisk-1.2.9.1/configs/capi.conf.sample
---- asterisk-1.2.9.1.orig/configs/capi.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/configs/capi.conf.sample	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,44 @@
 +;
 +; CAPI config
@@ -9708,17 +10128,17 @@
 +;msn=55512
 +;controller=2
 +;devices => 30
-diff -urN asterisk-1.2.9.1.orig/configs/modules.conf.sample asterisk-1.2.9.1/configs/modules.conf.sample
---- asterisk-1.2.9.1.orig/configs/modules.conf.sample	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/configs/modules.conf.sample	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -51,3 +51,4 @@
  ; exported to modules loaded after them.
  ;
  [global]
 +chan_capi.so=yes
-diff -urN asterisk-1.2.9.1.orig/configs/watchdog.conf.sample asterisk-1.2.9.1/configs/watchdog.conf.sample
---- asterisk-1.2.9.1.orig/configs/watchdog.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/configs/watchdog.conf.sample	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,22 @@
 +;
 +; Configuration file for res_watchdog
@@ -9742,9 +10162,9 @@
 +;device = /dev/watchdog
 +;interval = 100
 +
-diff -urN asterisk-1.2.9.1.orig/configs/zapata.conf.sample asterisk-1.2.9.1/configs/zapata.conf.sample
---- asterisk-1.2.9.1.orig/configs/zapata.conf.sample	2006-04-28 18:40:32.000000000 +0200
-+++ asterisk-1.2.9.1/configs/zapata.conf.sample	2006-06-09 10:25:04.000000000 +0200
+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 @@
  ; 
  ; outofband:      Signal Busy/Congestion out of band with RELEASE/DISCONNECT
@@ -9766,9 +10186,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.9.1.orig/db.c asterisk-1.2.9.1/db.c
---- asterisk-1.2.9.1.orig/db.c	2006-01-09 19:09:53.000000000 +0100
-+++ asterisk-1.2.9.1/db.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -516,11 +516,18 @@
  struct ast_cli_entry cli_database_deltree =
  { { "database", "deltree", NULL }, database_deltree, "Removes database keytree/values", database_deltree_usage };
@@ -9862,9 +10282,9 @@
 +	ast_manager_register("DBdel", EVENT_FLAG_SYSTEM, manager_dbdel, mandescr_dbdel);
  	return 0;
  }
-diff -urN asterisk-1.2.9.1.orig/devicestate.c asterisk-1.2.9.1/devicestate.c
---- asterisk-1.2.9.1.orig/devicestate.c	2006-02-10 21:38:59.000000000 +0100
-+++ asterisk-1.2.9.1/devicestate.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -62,6 +62,8 @@
  
  struct state_change {
@@ -9918,7 +10338,7 @@
  		AST_LIST_LOCK(&state_changes);
  		AST_LIST_INSERT_TAIL(&state_changes, change, list);
  		if (AST_LIST_FIRST(&state_changes) == change)
-@@ -224,23 +232,49 @@
+@@ -224,11 +232,17 @@
  	return 1;
  }
  
@@ -9938,41 +10358,16 @@
  }
  
  /*--- ast_device_state_changed: Accept change notification, add it to change queue */
- int ast_device_state_changed(const char *fmt, ...) 
- {
- 	char buf[AST_MAX_EXTENSION];
-+	char cid_num[AST_MAX_EXTENSION];
-+	char cid_name[AST_MAX_EXTENSION];
-+	char *s = NULL;
- 	va_list ap;
- 
+@@ -240,7 +254,7 @@
  	va_start(ap, fmt);
--	vsnprintf(buf, sizeof(buf), fmt, ap);
-+	if (*fmt == 's') {
-+	    s = va_arg(ap, char *);
-+	    snprintf(buf, sizeof(buf), s);
-+	    *fmt++;
-+	    if (*fmt == 's') {
-+		s = va_arg(ap, char *);
-+		if (s) {
-+		    snprintf(cid_num, sizeof(cid_num), s);
-+		}
-+		*fmt++;
-+	        if (*fmt == 's') {
-+		    s = va_arg(ap, char *);
-+		    if (s) {
-+			snprintf(cid_name, sizeof(cid_name), s);
-+		    }
-+		}
-+	    }
-+	}
+ 	vsnprintf(buf, sizeof(buf), fmt, ap);
  	va_end(ap);
 -	return __ast_device_state_changed_literal(buf);
-+	return __ast_device_state_changed_literal(buf, cid_num, cid_name);
++	return __ast_device_state_changed_literal(buf, NULL, NULL);
  }
  
  /*--- do_devstate_changes: Go through the dev state change queue and update changes in the dev state thread */
-@@ -255,7 +289,7 @@
+@@ -255,7 +269,7 @@
  		if (cur) {
  			/* we got an entry, so unlock the list while we process it */
  			AST_LIST_UNLOCK(&state_changes);
@@ -9981,9 +10376,9 @@
  			free(cur);
  			AST_LIST_LOCK(&state_changes);
  		} else {
-diff -urN asterisk-1.2.9.1.orig/doc/README.asterisk.conf asterisk-1.2.9.1/doc/README.asterisk.conf
---- asterisk-1.2.9.1.orig/doc/README.asterisk.conf	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/doc/README.asterisk.conf	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -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
@@ -9992,9 +10387,24 @@
  
  [files]
  ; Changing the following lines may compromise your security
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/agi.h asterisk-1.2.9.1/include/asterisk/agi.h
---- asterisk-1.2.9.1.orig/include/asterisk/agi.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/agi.h	2006-06-09 10:25:04.000000000 +0200
+diff -urN asterisk-1.2.10.orig/editline/cygdef.h asterisk-1.2.10/editline/cygdef.h
+--- asterisk-1.2.10.orig/editline/cygdef.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.10/editline/cygdef.h	2006-07-31 14:13:08.000000000 +0200
+@@ -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 -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
 @@ -29,7 +29,8 @@
  
  typedef struct agi_state {
@@ -10005,9 +10415,9 @@
  	int ctrl;	/* FD for input control */
  } AGI;
  
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/chan_capi.h asterisk-1.2.9.1/include/asterisk/chan_capi.h
---- asterisk-1.2.9.1.orig/include/asterisk/chan_capi.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/chan_capi.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,276 @@
 +/*
 + * (CAPI*)
@@ -10285,9 +10695,9 @@
 +#define CAPI_ETSI_NPLAN_INTERNAT	0x10
 +
 +#endif
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/chan_capi_app.h asterisk-1.2.9.1/include/asterisk/chan_capi_app.h
---- asterisk-1.2.9.1.orig/include/asterisk/chan_capi_app.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/chan_capi_app.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,30 @@
 +/*
 + * (CAPI*)
@@ -10319,9 +10729,9 @@
 +extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
 +
 +#endif
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/channel.h asterisk-1.2.9.1/include/asterisk/channel.h
---- asterisk-1.2.9.1.orig/include/asterisk/channel.h	2006-06-01 22:27:50.000000000 +0200
-+++ asterisk-1.2.9.1/include/asterisk/channel.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -86,6 +86,9 @@
  #ifndef _ASTERISK_CHANNEL_H
  #define _ASTERISK_CHANNEL_H
@@ -10408,9 +10818,9 @@
  
  /*! Gives the string form of a given cause code */
  /*! 
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/devicestate.h asterisk-1.2.9.1/include/asterisk/devicestate.h
---- asterisk-1.2.9.1.orig/include/asterisk/devicestate.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/devicestate.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -42,7 +42,7 @@
  /*! Device is ringing */
  #define AST_DEVICE_RINGING	6
@@ -10429,9 +10839,9 @@
  
  /*! \brief Registers a device state change callback 
   * \param callback Callback
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/features.h asterisk-1.2.9.1/include/asterisk/features.h
---- asterisk-1.2.9.1.orig/include/asterisk/features.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/features.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -45,6 +45,8 @@
  };
  
@@ -10474,9 +10884,20 @@
 +extern struct ast_call_feature *ast_find_builtin_feature(char *name);
 +
  #endif /* _AST_FEATURES_H */
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/monitor.h asterisk-1.2.9.1/include/asterisk/monitor.h
---- asterisk-1.2.9.1.orig/include/asterisk/monitor.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/monitor.h	2006-06-09 10:25:04.000000000 +0200
+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
+@@ -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 */
+ #define EVENT_FLAG_USER                 (1 << 6) /* Ability to read/set user info */
++#define EVENT_FLAG_EXTENSIONSTATUS	(1 << 7) /* ExtensionStatus events */
+ 
+ /* 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
 @@ -35,6 +35,8 @@
  	char write_filename[FILENAME_MAX];
  	char filename_base[FILENAME_MAX];
@@ -10495,9 +10916,9 @@
  
  /* Stop monitoring a channel */
  int ast_monitor_stop(struct ast_channel *chan, int need_lock);
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/pbx.h asterisk-1.2.9.1/include/asterisk/pbx.h
---- asterisk-1.2.9.1.orig/include/asterisk/pbx.h	2006-03-29 21:11:18.000000000 +0200
-+++ asterisk-1.2.9.1/include/asterisk/pbx.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -57,7 +57,7 @@
  	AST_EXTENSION_BUSY = 1 << 1,
  	/*! All devices UNAVAILABLE/UNREGISTERED */
@@ -10548,9 +10969,9 @@
  
  #if defined(__cplusplus) || defined(c_plusplus)
  }
-diff -urN asterisk-1.2.9.1.orig/include/asterisk/xlaw.h asterisk-1.2.9.1/include/asterisk/xlaw.h
---- asterisk-1.2.9.1.orig/include/asterisk/xlaw.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk/xlaw.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,1665 @@
 +#ifndef _ASTERISK_XLAW_H
 +#define _ASTERISK_XLAW_H
@@ -12217,9 +12638,9 @@
 +#endif // CAPI_ULAW
 +#endif
 +
-diff -urN asterisk-1.2.9.1.orig/include/asterisk.h asterisk-1.2.9.1/include/asterisk.h
---- asterisk-1.2.9.1.orig/include/asterisk.h	2005-11-30 04:37:37.000000000 +0100
-+++ asterisk-1.2.9.1/include/asterisk.h	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -36,6 +36,7 @@
  extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
  extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
@@ -12228,9 +12649,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.9.1.orig/manager.c asterisk-1.2.9.1/manager.c
---- asterisk-1.2.9.1.orig/manager.c	2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.9.1/manager.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -12258,7 +12679,15 @@
  	struct ast_variable *vars;
  };
  
-@@ -657,11 +663,17 @@
+@@ -99,6 +105,7 @@
+ 	{ EVENT_FLAG_COMMAND, "command" },
+ 	{ EVENT_FLAG_AGENT, "agent" },
+ 	{ EVENT_FLAG_USER, "user" },
++	{ EVENT_FLAG_EXTENSIONSTATUS, "extensionstatus" },
+ 	{ -1, "all" },
+ 	{ 0, "none" },
+ };
+@@ -657,11 +664,17 @@
  {
  	struct ast_channel *c = NULL;
  	char *name = astman_get_header(m, "Channel");
@@ -12279,7 +12708,7 @@
  	if (!c) {
  		astman_send_error(s, m, "No such channel");
  		return 0;
-@@ -760,6 +772,7 @@
+@@ -760,6 +773,7 @@
  }
  
  
@@ -12287,7 +12716,7 @@
  /*! \brief  action_status: Manager "status" command to show channels */
  /* Needs documentation... */
  static int action_status(struct mansession *s, struct message *m)
-@@ -866,32 +879,50 @@
+@@ -866,32 +880,50 @@
  	char *exten = astman_get_header(m, "Exten");
  	char *context = astman_get_header(m, "Context");
  	char *priority = astman_get_header(m, "Priority");
@@ -12344,7 +12773,7 @@
  			else
  				res = -1;
  			if (!res)
-@@ -937,15 +968,15 @@
+@@ -937,15 +969,15 @@
  	struct ast_channel *chan = NULL;
  
  	if (!ast_strlen_zero(in->app)) {
@@ -12364,7 +12793,7 @@
  	}   
  	if (!res)
  		manager_event(EVENT_FLAG_CALL,
-@@ -956,7 +987,7 @@
+@@ -956,7 +988,7 @@
  			"Exten: %s\r\n"
  			"Reason: %d\r\n"
  			"Uniqueid: %s\r\n",
@@ -12373,7 +12802,7 @@
  	else
  		manager_event(EVENT_FLAG_CALL,
  			"OriginateFailure",
-@@ -966,7 +997,7 @@
+@@ -966,7 +998,7 @@
  			"Exten: %s\r\n"
  			"Reason: %d\r\n"
  			"Uniqueid: %s\r\n",
@@ -12382,7 +12811,7 @@
  
  	/* Locked by ast_pbx_outgoing_exten or ast_pbx_outgoing_app */
  	if (chan)
-@@ -999,6 +1030,7 @@
+@@ -999,6 +1031,7 @@
  	char *priority = astman_get_header(m, "Priority");
  	char *timeout = astman_get_header(m, "Timeout");
  	char *callerid = astman_get_header(m, "CallerID");
@@ -12390,7 +12819,7 @@
  	char *account = astman_get_header(m, "Account");
  	char *app = astman_get_header(m, "Application");
  	char *appdata = astman_get_header(m, "Data");
-@@ -1007,12 +1039,15 @@
+@@ -1007,12 +1040,15 @@
  	struct ast_variable *vars = astman_get_variables(m);
  	char *tech, *data;
  	char *l=NULL, *n=NULL;
@@ -12406,7 +12835,7 @@
  	
  	pthread_t th;
  	pthread_attr_t attr;
-@@ -1028,6 +1063,10 @@
+@@ -1028,6 +1064,10 @@
  		astman_send_error(s, m, "Invalid timeout\n");
  		return 0;
  	}
@@ -12417,7 +12846,7 @@
  	ast_copy_string(tmp, name, sizeof(tmp));
  	tech = tmp;
  	data = strchr(tmp, '/');
-@@ -1048,6 +1087,7 @@
+@@ -1048,6 +1088,7 @@
  		if (ast_strlen_zero(l))
  			l = NULL;
  	}
@@ -12425,7 +12854,7 @@
  	if (ast_true(async)) {
  		struct fast_originate_helper *fast = malloc(sizeof(struct fast_originate_helper));
  		if (!fast) {
-@@ -1068,8 +1108,10 @@
+@@ -1068,8 +1109,10 @@
  			ast_copy_string(fast->context, context, sizeof(fast->context));
  			ast_copy_string(fast->exten, exten, sizeof(fast->exten));
  			ast_copy_string(fast->account, account, sizeof(fast->account));
@@ -12436,7 +12865,7 @@
  			pthread_attr_init(&attr);
  			pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  			if (ast_pthread_create(&th, &attr, fast_originate, fast)) {
-@@ -1079,19 +1121,28 @@
+@@ -1079,19 +1122,28 @@
  			}
  		}
  	} else if (!ast_strlen_zero(app)) {
@@ -12470,22 +12899,24 @@
  	return 0;
  }
  
-@@ -1565,10 +1616,10 @@
+@@ -1565,10 +1617,12 @@
  	return 0;
  }
  
 -static int manager_state_cb(char *context, char *exten, int state, void *data)
 +static int manager_state_cb(char *context, char *exten, int state, void *data, char *cid_num, char *cid_name)
  {
++	char hint[256] = "";
++	ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, exten);
  	/* Notify managers of change */
 -	manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nStatus: %d\r\n", exten, context, state);
-+	manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nStatus: %d\r\nCallerID: \"%s\" <%s>\r\n", exten, context, state, cid_num, cid_name);
++	manager_event(EVENT_FLAG_EXTENSIONSTATUS, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nStatus: %d\r\nCallerID: \"%s\" <%s>\r\nHint: %s\r\n", exten, context, state, cid_num, cid_name, hint);
  	return 0;
  }
  
-diff -urN asterisk-1.2.9.1.orig/pbx/pbx_spool.c asterisk-1.2.9.1/pbx/pbx_spool.c
---- asterisk-1.2.9.1.orig/pbx/pbx_spool.c	2006-02-11 19:15:00.000000000 +0100
-+++ asterisk-1.2.9.1/pbx/pbx_spool.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -259,11 +259,11 @@
  	if (!ast_strlen_zero(o->app)) {
  		if (option_verbose > 2)
@@ -12500,9 +12931,9 @@
  	}
  	if (res) {
  		ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
-diff -urN asterisk-1.2.9.1.orig/pbx.c asterisk-1.2.9.1/pbx.c
---- asterisk-1.2.9.1.orig/pbx.c	2006-05-23 19:15:23.000000000 +0200
-+++ asterisk-1.2.9.1/pbx.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -353,7 +353,8 @@
  	
  	{ "Hangup", pbx_builtin_hangup,
@@ -12545,7 +12976,7 @@
  				free(cbprev);
  	    		}
  	    		list->callbacks = NULL;
-@@ -3778,7 +3779,7 @@
+@@ -3777,7 +3778,7 @@
  			while (thiscb) {
  				prevcb = thiscb;	    
  				thiscb = thiscb->next;
@@ -12554,7 +12985,7 @@
  				free(prevcb);
  	    		}
  		} else {
-@@ -4980,7 +4981,7 @@
+@@ -4981,7 +4982,7 @@
  	return 0;  /* success */
  }
  
@@ -12563,7 +12994,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -4990,7 +4991,7 @@
+@@ -4991,7 +4992,7 @@
  
  	if (sync) {
  		LOAD_OH(oh);
@@ -12572,7 +13003,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5092,7 +5093,7 @@
+@@ -5093,7 +5094,7 @@
  			goto outgoing_exten_cleanup;
  		}	
  		memset(as, 0, sizeof(struct async_stat));
@@ -12581,7 +13012,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5138,7 +5139,7 @@
+@@ -5139,7 +5140,7 @@
  	pthread_t t;
  };
  
@@ -12590,7 +13021,7 @@
  {
  	struct app_tmp *tmp = data;
  	struct ast_app *app;
-@@ -5154,7 +5155,7 @@
+@@ -5155,7 +5156,7 @@
  	return NULL;
  }
  
@@ -12599,7 +13030,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -5174,7 +5175,7 @@
+@@ -5175,7 +5176,7 @@
  		goto outgoing_app_cleanup;	
  	}
  	if (sync) {
@@ -12608,7 +13039,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);
-@@ -5261,7 +5262,8 @@
+@@ -5262,7 +5263,8 @@
  			goto outgoing_app_cleanup;
  		}
  		memset(as, 0, sizeof(struct async_stat));
@@ -12618,7 +13049,7 @@
  		if (!chan) {
  			free(as);
  			res = -1;
-@@ -5548,6 +5550,9 @@
+@@ -5551,6 +5553,9 @@
   */
  static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
  {
@@ -12628,7 +13059,7 @@
  	/* Just return non-zero and it will hang up */
  	if (!chan->hangupcause)
  		chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
-@@ -6204,6 +6209,9 @@
+@@ -6207,6 +6212,9 @@
  			return -1;
  		}
  	}
@@ -12638,7 +13069,7 @@
  	return res = ast_say_number(chan, atoi((char *) tmp), "", chan->language, options);
  }
  
-@@ -6211,8 +6219,12 @@
+@@ -6214,8 +6222,12 @@
  {
  	int res = 0;
  
@@ -12652,7 +13083,7 @@
  	return res;
  }
  	
-@@ -6220,8 +6232,12 @@
+@@ -6223,8 +6235,12 @@
  {
  	int res = 0;
  
@@ -12666,7 +13097,7 @@
  	return res;
  }
  	
-@@ -6229,8 +6245,12 @@
+@@ -6232,8 +6248,12 @@
  {
  	int res = 0;
  
@@ -12680,9 +13111,9 @@
  	return res;
  }
  	
-diff -urN asterisk-1.2.9.1.orig/res/Makefile asterisk-1.2.9.1/res/Makefile
---- asterisk-1.2.9.1.orig/res/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.9.1/res/Makefile	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -12692,9 +13123,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.9.1.orig/res/res_agi.c asterisk-1.2.9.1/res/res_agi.c
---- asterisk-1.2.9.1.orig/res/res_agi.c	2006-06-01 01:50:00.000000000 +0200
-+++ asterisk-1.2.9.1/res/res_agi.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -12785,7 +13216,7 @@
  	pid = fork();
  	if (pid < 0) {
  		ast_log(LOG_WARNING, "Failed to fork(): %s\n", strerror(errno));
-@@ -290,15 +326,19 @@
+@@ -293,15 +329,19 @@
  		} else {
  			close(STDERR_FILENO + 1);
  		}
@@ -12806,7 +13237,7 @@
 +		for (x=STDERR_FILENO + 3;x<1024;x++) 
  			close(x);
  
- 		/* Don't run AGI scripts with realtime priority -- it causes audio stutter */
+ 		/* Execute script */
 @@ -317,6 +357,9 @@
  	if (efd) {
  		*efd = audio[1];
@@ -12917,7 +13348,7 @@
  	if (res == 2)			/* New command */
  		return RESULT_SUCCESS;
  	else if (res == 1)
-@@ -1860,7 +1906,12 @@
+@@ -1854,7 +1900,12 @@
  	int ms;
  	int returnstatus = 0;
  	struct ast_frame *f;
@@ -12930,7 +13361,7 @@
  	FILE *readf;
  	/* how many times we'll retry if ast_waitfor_nandfs will return without either 
  	  channel or file descriptor in case select is interrupted by a system call (EINTR) */
-@@ -1874,10 +1925,22 @@
+@@ -1868,10 +1919,22 @@
  		return -1;
  	}
  	setlinebuf(readf);
@@ -12955,7 +13386,7 @@
  		if (c) {
  			retry = RETRY;
  			/* Idle the channel until we get a command */
-@@ -1888,13 +1951,24 @@
+@@ -1882,13 +1945,24 @@
  				break;
  			} else {
  				/* If it's voice, write it to the audio pipe */
@@ -12982,7 +13413,7 @@
  			retry = RETRY;
  			if (!fgets(buf, sizeof(buf), readf)) {
  				/* Program terminated */
-@@ -1916,6 +1990,7 @@
+@@ -1910,6 +1984,7 @@
  			if ((returnstatus < 0) || (returnstatus == AST_PBX_KEEPALIVE)) {
  				break;
  			}
@@ -12990,7 +13421,7 @@
  		} else {
  			if (--retry <= 0) {
  				ast_log(LOG_WARNING, "No channel, no fd?\n");
-@@ -2022,6 +2097,7 @@
+@@ -2016,6 +2091,7 @@
  	int argc = 0;
  	int fds[2];
  	int efd = -1;
@@ -12998,7 +13429,7 @@
  	int pid;
          char *stringp;
  	AGI agi;
-@@ -2047,15 +2123,18 @@
+@@ -2041,15 +2117,18 @@
  		}
  	}
  #endif
@@ -13019,7 +13450,7 @@
  	}
  	LOCAL_USER_REMOVE(u);
  	return res;
-@@ -2089,6 +2168,35 @@
+@@ -2083,6 +2162,35 @@
  	return res;
  }
  
@@ -13055,7 +13486,7 @@
  static int deadagi_exec(struct ast_channel *chan, void *data)
  {
  	return agi_exec_full(chan, data, 0, 1);
-@@ -2118,6 +2226,7 @@
+@@ -2112,6 +2220,7 @@
  	ast_cli_unregister(&dumpagihtml);
  	ast_cli_unregister(&cli_debug);
  	ast_cli_unregister(&cli_no_debug);
@@ -13063,7 +13494,7 @@
  	ast_unregister_application(eapp);
  	ast_unregister_application(deadapp);
  	return ast_unregister_application(app);
-@@ -2131,6 +2240,7 @@
+@@ -2125,6 +2234,7 @@
  	ast_cli_register(&cli_no_debug);
  	ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
  	ast_register_application(eapp, eagi_exec, esynopsis, descrip);
@@ -13071,9 +13502,9 @@
  	return ast_register_application(app, agi_exec, synopsis, descrip);
  }
  
-diff -urN asterisk-1.2.9.1.orig/res/res_features.c asterisk-1.2.9.1/res/res_features.c
---- asterisk-1.2.9.1.orig/res/res_features.c	2006-05-23 19:15:23.000000000 +0200
-+++ asterisk-1.2.9.1/res/res_features.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -13293,7 +13724,7 @@
  								);
  
  							/* There's a problem, hang them up*/
-@@ -1683,6 +1763,280 @@
+@@ -1683,6 +1763,282 @@
  	return res;
  }
  
@@ -13504,8 +13935,10 @@
 +			tms = (tv.tv_sec - pu->start.tv_sec) * 1000 + (tv.tv_usec - pu->start.tv_usec) / 1000;
 +				for (x=0;x<AST_MAX_FDS;x++) {
 +					if ((pu->chan->fds[x] > -1) && (FD_ISSET(pu->chan->fds[x], &rfds) || FD_ISSET(pu->chan->fds[x], &efds))) {
-+				/*		if (FD_ISSET(pu->chan->fds[x], &efds))
-+							pu->chan->exception = 1; */
++						if (FD_ISSET(pu->chan->fds[x], &efds))
++							ast_set_flag(pu->chan, AST_FLAG_EXCEPTION);
++						else
++							ast_clear_flag(pu->chan, AST_FLAG_EXCEPTION);
 +						pu->chan->fdno = x;
 +						/* See if they need servicing */
 +						f = ast_read(pu->chan);
@@ -13574,7 +14007,7 @@
  static int park_exec(struct ast_channel *chan, void *data)
  {
  	int res=0;
-@@ -1731,9 +2085,10 @@
+@@ -1731,9 +2087,10 @@
  			"From: %s\r\n"
  			"CallerID: %s\r\n"
  			"CallerIDName: %s\r\n"
@@ -13586,7 +14019,7 @@
  			);
  
  		free(pu);
-@@ -1901,12 +2256,13 @@
+@@ -1901,12 +2258,13 @@
  			"Timeout: %ld\r\n"
  			"CallerID: %s\r\n"
  			"CallerIDName: %s\r\n"
@@ -13601,7 +14034,7 @@
  			,idText);
  
              cur = cur->next;
-@@ -1922,6 +2278,386 @@
+@@ -1922,6 +2280,416 @@
          return RESULT_SUCCESS;
  }
  
@@ -13777,6 +14210,34 @@
 +	return 0;
 +}
 +
++static void autoanswer_reregister_extensions(void)
++{
++	struct aauser *cur;
++	struct ast_context *con;
++	char exten[AST_MAX_EXTENSION];
++	char args[AST_MAX_EXTENSION];
++
++	ast_mutex_lock(&autoanswer_lock);
++
++	cur=aalot;
++	while(cur) {
++		con = ast_context_find(cur->context);
++		if (!con) {
++			con = ast_context_create(NULL,cur->context, registrar);
++			if (!con) {
++				ast_log(LOG_ERROR, "Context '%s' does not exist and unable to create\n", cur->context);
++			}
++		}
++		if (con) {
++			snprintf(exten, sizeof(exten), "%s", cur->exten);
++			snprintf(args, sizeof(args), "%s|%s", cur->context, cur->exten);
++			ast_add_extension2(con, 1, exten, 1, NULL, NULL, autoanswer, strdup((char *)args), free, registrar);
++		}
++		cur = cur->next;
++	}
++
++	ast_mutex_unlock(&autoanswer_lock);
++}
 +static void *do_autoanswer_thread(void *ignore)
 +{
 +	int ms, tms, max;
@@ -13803,8 +14264,10 @@
 +			tms = (tv.tv_sec - pu->start.tv_sec) * 1000 + (tv.tv_usec - pu->start.tv_usec) / 1000;
 +			for (x=0;x<AST_MAX_FDS;x++) {
 +				if ((pu->chan->fds[x] > -1) && (FD_ISSET(pu->chan->fds[x], &rfds) || FD_ISSET(pu->chan->fds[x], &efds))) {
-+/*					if (FD_ISSET(pu->chan->fds[x], &efds))
-+						pu->chan->exception = 1; */
++					if (FD_ISSET(pu->chan->fds[x], &efds))
++						ast_set_flag(pu->chan, AST_FLAG_EXCEPTION);
++					else
++						ast_clear_flag(pu->chan, AST_FLAG_EXCEPTION);
 +					pu->chan->fdno = x;
 +					/* See if they need servicing */
 +					f = ast_read(pu->chan);
@@ -13988,7 +14451,7 @@
  
  int ast_pickup_call(struct ast_channel *chan)
  {
-@@ -2076,7 +2812,7 @@
+@@ -2076,7 +2844,7 @@
  			}
  
  			{
@@ -13997,7 +14460,15 @@
  				int mallocd=0;
  				
  				if (!feature) {
-@@ -2151,14 +2887,22 @@
+@@ -2138,6 +2906,7 @@
+ }
+ 
+ int reload(void) {
++	autoanswer_reregister_extensions();
+ 	return load_config();
+ }
+ 
+@@ -2151,14 +2920,22 @@
  	if ((res = load_config()))
  		return res;
  	ast_cli_register(&showparked);
@@ -14020,7 +14491,7 @@
  	return res;
  }
  
-@@ -2169,7 +2913,11 @@
+@@ -2169,7 +2946,11 @@
  
  	ast_manager_unregister("ParkedCalls");
  	ast_cli_unregister(&showfeatures);
@@ -14032,9 +14503,9 @@
  	ast_unregister_application(parkcall);
  	return ast_unregister_application(parkedcall);
  }
-diff -urN asterisk-1.2.9.1.orig/res/res_monitor.c asterisk-1.2.9.1/res/res_monitor.c
---- asterisk-1.2.9.1.orig/res/res_monitor.c	2006-03-02 20:05:40.000000000 +0100
-+++ asterisk-1.2.9.1/res/res_monitor.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -90,7 +90,7 @@
  
  /* Start monitoring a channel */
@@ -14171,9 +14642,9 @@
  	res = ast_monitor_stop(c, 1);
  	ast_mutex_unlock(&c->lock);
  	if (res) {
-diff -urN asterisk-1.2.9.1.orig/res/res_watchdog.c asterisk-1.2.9.1/res/res_watchdog.c
---- asterisk-1.2.9.1.orig/res/res_watchdog.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.9.1/res/res_watchdog.c	2006-06-09 10:25:04.000000000 +0200
+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
 @@ -0,0 +1,149 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -14254,17 +14725,17 @@
 +	    while(cat) {
 +		cat = ast_category_browse(cfg, cat);
 +		utype = ast_variable_retrieve(cfg, cat, "type");
-+		if (utype) {
++/*		if (utype) {
 +		    ast_log(LOG_NOTICE, "type = %s\n", utype);
-+		}
++		} */
 +		udevice = ast_variable_retrieve(cfg, cat, "device");
-+		if (udevice) {
++/*		if (udevice) {
 +		    ast_log(LOG_NOTICE, "device = %s\n", udevice);
-+		}
++		} */
 +		uinterval = ast_variable_retrieve(cfg, cat, "interval");
-+		if (uinterval) {
++/*		if (uinterval) {
 +		    ast_log(LOG_NOTICE, "interval = %s\n", uinterval);
-+		}
++		} */
 +		if (uinterval && udevice && utype) {
 +		    woof = malloc(sizeof(struct watchdog_pvt));
 +		    if (!woof) {
@@ -14324,10 +14795,10 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.9.1.orig/rtp.c asterisk-1.2.9.1/rtp.c
---- asterisk-1.2.9.1.orig/rtp.c	2006-06-01 00:26:38.000000000 +0200
-+++ asterisk-1.2.9.1/rtp.c	2006-06-09 10:25:04.000000000 +0200
-@@ -444,6 +444,11 @@
+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
+@@ -445,6 +445,11 @@
  	struct rtpPayloadType rtpPT;
  	
  	len = sizeof(sin);




More information about the Pkg-voip-commits mailing list