[Pkg-voip-commits] r1251 - in asterisk/trunk/debian: . patches

Tzafrir Cohen tzafrir-guest at costa.debian.org
Wed Feb 8 22:00:31 UTC 2006


Author: tzafrir-guest
Date: 2006-02-08 22:00:27 +0000 (Wed, 08 Feb 2006)
New Revision: 1251

Modified:
   asterisk/trunk/debian/changelog
   asterisk/trunk/debian/patches/bristuff.dpatch
Log:
new bristuff (0.3.0-PRE1k)


Modified: asterisk/trunk/debian/changelog
===================================================================
--- asterisk/trunk/debian/changelog	2006-02-07 22:40:51 UTC (rev 1250)
+++ asterisk/trunk/debian/changelog	2006-02-08 22:00:27 UTC (rev 1251)
@@ -1,15 +1,15 @@
 asterisk (1:1.2.4.dfsg-1) unstable; urgency=low
 
   [ Tzafrir Cohen ]
+  * bristuff 0.3.0-PRE-1i
   * Fix PID display (Closes: #338646)
-  * changes to the init.d script (Tzafrir)
+  * changes to the init.d script
   * debian/ast_config/ place here configurutaion files that will override
     the defaults from the source, though not get into the sample documentation
     dir
   * debian/ast_config/manager.conf: asterisk does listen onthe manager by
     default, but only on localhost. Other packages need not edit manager.conf
     to get a manager acount
-  * bristuff 0.3.0-PRE-1f
   * option_detach.dpatch: Adds option -D: always daemonize (even with -v,-d)
     (conflicts with bristuff, though)
   * ukcid.dpatch: UK Caller ID patch for the X100P. (Closes: #302380)
@@ -23,8 +23,9 @@
   * Add a noload for chan_capi by default, so that we d not stop loading when
     no CAPI is installed. (Closes: #328835)
   * Include smsq by adding Build-Depends on libpopt-dev (Closes: #348090)
+  * 
 
- -- Kilian Krause <kilian at debian.org>  Sun,  5 Feb 2006 11:44:28 +0100
+ -- Tzafrir Cohen <tzafrir at boomtime.cohens.org.il>  Wed,  8 Feb 2006 23:58:37 +0200
 
 asterisk (1:1.2.1.dfsg-3) unstable; urgency=low
 

Modified: asterisk/trunk/debian/patches/bristuff.dpatch
===================================================================
--- asterisk/trunk/debian/patches/bristuff.dpatch	2006-02-07 22:40:51 UTC (rev 1250)
+++ asterisk/trunk/debian/patches/bristuff.dpatch	2006-02-08 22:00:27 UTC (rev 1251)
@@ -2,231 +2,12 @@
 ## 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-1f
+## DP: bristuff support in asterisk: asterisk.patch from bristuff-0.3.0-PRE-1k
 
 @DPATCH@
-diff -urN asterisk-1.2.1.orig/.version asterisk-1.2.1/.version
---- asterisk-1.2.1.orig/.version	2005-12-07 00:13:04.000000000 +0100
-+++ asterisk-1.2.1/.version	2006-01-04 15:27:23.000000000 +0100
-@@ -1 +1 @@
--1.2.1
-+1.2.1-BRIstuffed-0.3.0-PRE-1f
-diff -urN asterisk-1.2.1.orig/HARDWARE asterisk-1.2.1/HARDWARE
---- asterisk-1.2.1.orig/HARDWARE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/HARDWARE	2005-12-21 14:25:44.000000000 +0100
-@@ -37,6 +37,19 @@
-    * Wildcard TE410P - Quad T1/E1 switchable interface.  Supports PRI and 
-      RBS signalling, as well as PPP, FR, and HDLC data modes.
- 
-+-- Junghanns.NET (Primary author of BRIstuff)
-+	http://www.junghanns.net
-+	
-+    * quadBRI PCI ISDN - 4port BRI ISDN interface, supports NT and TE mode
-+    
-+    * octoBRI PCI ISDN - 8port BRI ISDN interface, supports NT and TE mode
-+
-+    * singleE1 PCI ISDN - Single E1 interface
-+
-+    * doubleE1 PCI ISDN - Double E1 interface
-+    
-+    * quadGSM PCI ISDN - 4 channel GSM interface
-+
- Non-zaptel compatible hardware
- ==============================
- 
-diff -urN asterisk-1.2.1.orig/LICENSE asterisk-1.2.1/LICENSE
---- asterisk-1.2.1.orig/LICENSE	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/LICENSE	2005-12-21 14:25:44.000000000 +0100
-@@ -1,7 +1,7 @@
--Asterisk is distributed under the GNU General Public License version 2
--and is also available under alternative licenses negotiated directly
--with Digium, Inc. If you obtained Asterisk under the GPL, then the GPL
--applies to all loadable Asterisk modules used on your system as well,
-+BRIstuffed Asterisk is distributed under the GNU General Public License version 2
-+and is not available under any alternative licenses.
-+If you obtained BRIstuffed Asterisk under the GPL, then the GPL
-+applies to all loadable BRIstuffed Asterisk modules used on your system as well,
- except as defined below. The GPL (version 2) is included in this
- source tree in the file COPYING.
- 
-diff -urN asterisk-1.2.1.orig/Makefile asterisk-1.2.1/Makefile
---- asterisk-1.2.1.orig/Makefile	2005-12-05 07:47:51.000000000 +0100
-+++ asterisk-1.2.1/Makefile	2006-01-05 10:28:07.000000000 +0100
-@@ -759,6 +759,9 @@
- 		echo ";astctlowner = root" ; \
- 		echo ";astctlgroup = apache" ; \
- 		echo ";astctl = asterisk.ctl" ; \
-+		echo "[options]" ; \
-+		echo "uniquename = asterisk" ;\
-+		echo "silence_suppression = yes" ;\
- 		) > $(DESTDIR)$(ASTCONFPATH) ; \
- 	else \
- 		echo "Skipping asterisk.conf creation"; \
-diff -urN asterisk-1.2.1.orig/README asterisk-1.2.1/README
---- asterisk-1.2.1.orig/README	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/README	2005-12-21 14:25:44.000000000 +0100
-@@ -4,6 +4,8 @@
- 
- Copyright (C) 2001-2005 Digium, Inc.
- and other copyright holders.
-+Copyright (C) 2002-2005 Junghanns.NET GmbH 
-+and other copyright holders.
- ================================================================
- 
- * SECURITY
-diff -urN asterisk-1.2.1.orig/README.chan_capi asterisk-1.2.1/README.chan_capi
---- asterisk-1.2.1.orig/README.chan_capi	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/README.chan_capi	2005-12-21 14:25:44.000000000 +0100
-@@ -0,0 +1,146 @@
-+(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
-+(C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH 
-+Klaus-Peter Junghanns <kpj at junghanns.net>
-+
-+This program is free software and may be modified and distributed under
-+the terms of the GNU Public License. There is _NO_ warranty for this!
-+
-+Thanks go to the debuggers and bugfixers (listed in chronological order) :)
-+===========================================================================
-+Lele Forzani <lele at windmill.it>
-+Florian Overkamp <florian at obsimref.com>
-+Gareth Watts <gareth at omnipotent.net>
-+Jeff Noxon <jeff at planetfall.com>
-+Petr Michalek <petr.michalek at aca.cz>
-+Jan Stocker
-+(...and all the others that i forgot..) :-)
-+
-+chan_capi version 0.4.0-PRE1 includes:
-+======================================
-+
-+- multiple controller support
-+- CID,DNID (callling party, called party)
-+- CLIR/CLIP
-+- supplementary services, CD,HOLD,RETRIEVE,ECT
-+- DTMF (dependend on card) + software DTMF support
-+- early B3 connects (always,success,never)
-+- digital audio (what did you think?)
-+- incoming/outgoing calls
-+- overlap sending (dialtone)
-+- E(xplicit) C(all) T(ransfer) (...although it's done implicit .. but dont tell!)
-+- tuneable latency ;) you can configure the size of B3 blocks at compile time
-+  (in chan_capi_pvt.h, AST_CAPI_MAX_B3_BLOCK_SIZE)
-+  the default is 160 samples, for non-VoIP use you can tune it down to 130
-+- use asterisk's internal dsp functions for dtmf
-+- alaw support 
-+- ulaw support! 
-+- Eicon CAPI echo cancelation (echocancel=1)
-+- reject call waiting (ACO)
-+- DID for Point to Point mode (a.k.a overlap receiving)
-+- experimental echo squelching (echosquelch=1)
-+- call progress, no need to add ||r to your dialstring anymore
-+- rx/tx gains (rxgain=1.0)
-+- call deflection on circuitbusy (makefile option) (deflect=12345678)
-+- (inter)national dialing prefix (for callerid) configurable in capi.conf
-+- CLI command "capi info" shows B channel status
-+- capiECT will announce the callerID since it gets lost on most isdn pbxes
-+  the called party can press # to drop the call
-+- audio syncing (timing outgoing dataB3 on incoming dataB3), supposed to fix
-+  the DATA_B3_REQ (error = 0x1103) problem
-+- catch all MSN (incomingmsn=*)
-+- some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
-+- accountcode= added.
-+- finally the echo squelching works!
-+- callgroup support
-+- fixed pipe leak
-+- updated to support the new frame->delivery field
-+- compiles with latest cvs with a makefile option (LOOK AT THE MAKEFILE)
-+- fixed channel name bug in p2p mode
-+- added app_capiNoES for disabling the primitive echo suppressor, use this before
-+  you start recording voicemail or your files may get choppy
-+- fixed for latest cvs (AST_MUTEX_DEFINE_STATIC)
-+- fixed for latest cvs (asterisk/parking.h -> asterisk/features.h)
-+- fixed for latest cvs ast_pthread_create
-+
-+- ATTENTION! the dialstring syntax now uses the zaptel dialstring syntax 
-+  it used to be:  Dial(CAPI/[@]<outgoingMSN>:[b|B]<destination>)
-+ 
-+  now it is:      Dial(CAPI/g<group>/[b|B]<destination>)
-+  or:             Dial(CAPI/contr<controller>/[b|B]<destination>)
-+ 
-+  CLIP/CLIR is now uses the calling presentation of the calling channel, this can
-+  be modified using the CallingPres() application. Use CallinPres(32) for CLIR.
-+  That is why the msn= param in capi.conf is now obsolete. The callerID is also
-+  taken from the calling channel.
-+
-+- fixes for BSD (Jan Stocker)
-+
-+Helper applications
-+===================
-+kapejod says: "No No No, dont use those yet....!" (except maybe HOLD,ECT...)
-+
-+app_capiCD.c		forwards an unanswered call to another phone (does not rely on sservice CD)
-+			example:
-+			exten => s,1,Wait,1
-+			exten => s,2,capiCD,12345678
-+			
-+app_capiHOLD.c		puts an answered call on hold, this has nothing to do with asterisk's onhold thingie (music et al)
-+			after putting a call onhold, never use the Wait application!
-+
-+app_capiRETRIEVE.c	gets the holded call back
-+
-+app_capiECT.c		explicit call transfer of the holded call (must put call on hold first!)
-+			example:
-+			exten => s,1,Answer
-+			exten => s,2,capiHOLD
-+			exten => s,3,capiECT,55:50
-+			will ECT the call to 50 using 55 as the callerid/outgoing msn
-+
-+
-+Using CLIR
-+==========
-+Use the CallingPres() application before you dial:
-+exten => _X.,1,CallingPres(32)
-+exten => _X.,2,Dial(CAPI/contr1/${EXTEN})    
-+
-+Enjoying early B3 connects (inband call progress, tones and announcements)
-+==========================================================================
-+early B3 is now configurable in the dialstring :)
-+if you prefix the destination number with a 'b' early B3 will always be used, also if the call fails
-+because the number is unprovisioned, etc ...
-+if you prefix it with a 'B' early B3 will only be used on successful calls, giving you ring indication,etc...
-+
-+dont use indications in the Dial command, your local exchange will do that for you:
-+exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30)		(early B3 on success)
-+exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30)		(always early B3)
-+exten => _X.,1,Dial(CAPI/contr1/${EXTEN},30,r)		(no early B3, fake ring indication)
-+
-+exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30,r)		(always early B3, fake indicatons if the exchange
-+							does not give us indications)
-+exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30,r)		(early B3 on success, fake indicatons if the exchange
-+							does not give us indications)
-+    
-+you can totally turn B3 off in the Makefile at buildtime (-DNEVER_EVER_EARLY_B3_CONNECTS).
-+
-+For normal PBX usage you would use the "b" option, always early B3.
-+
-+Overlap sending (a.k.a. real dialtone)
-+======================================
-+when you dial an empty number, and have early B3 enabled, with:
-+    Dial(CAPI/g1/b)
-+the channel will come up at once and give you the dialtone it gets from the local exchange.
-+at this point the channel is like a legacy phone, now you can send dtmf digits to dial.    
-+
-+Example context for incoming calls on MSN 12345678:
-+===================================================
-+
-+[capi-in]
-+exten => 12345678,1,Dial(SIP/phone1)
-+exten => 12345678,2,Hangup
-+
-+
-+More information/documentation and commercial support can be found at:
-+	http://www.junghanns.net/asterisk/
-+	
-+
-+
-diff -urN asterisk-1.2.1.orig/agi/Makefile asterisk-1.2.1/agi/Makefile
---- asterisk-1.2.1.orig/agi/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/agi/Makefile	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/agi/Makefile asterisk-1.2.4/agi/Makefile
+--- asterisk-1.2.4.orig/agi/Makefile	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/agi/Makefile	2006-01-31 09:41:43.000000000 +0100
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -245,9 +26,9 @@
  
  %.so : %.o
  	$(CC) -shared -Xlinker -x -o $@ $<
-diff -urN asterisk-1.2.1.orig/agi/xagi-test.c asterisk-1.2.1/agi/xagi-test.c
---- asterisk-1.2.1.orig/agi/xagi-test.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/agi/xagi-test.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/agi/xagi-test.c asterisk-1.2.4/agi/xagi-test.c
+--- asterisk-1.2.4.orig/agi/xagi-test.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/agi/xagi-test.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,176 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -425,29 +206,9 @@
 +		return -1;
 +	exit(0);
 +}
-diff -urN asterisk-1.2.1.orig/apps/Makefile asterisk-1.2.1/apps/Makefile
---- asterisk-1.2.1.orig/apps/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/Makefile	2005-12-21 14:25:44.000000000 +0100
-@@ -28,8 +28,15 @@
-      app_test.so app_forkcdr.so app_math.so app_realtime.so \
-      app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
-      app_md5.so app_readfile.so app_chanspy.so app_settransfercapability.so \
-+     app_pickup.so app_segfault.so app_callingpres.so app_devstate.so \
-      app_dictate.so app_externalivr.so app_directed_pickup.so \
--     app_mixmonitor.so app_stack.so
-+     app_mixmonitor.so app_stack.so 
-+
-+
-+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/capi20.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/capi20.h),)
-+  APPS+= app_capiNoES.so app_capiCD.so app_capiECT.so
-+endif
-+    
- 
- #
- # Obsolete things...
-diff -urN asterisk-1.2.1.orig/apps/app_callingpres.c asterisk-1.2.1/apps/app_callingpres.c
---- asterisk-1.2.1.orig/apps/app_callingpres.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_callingpres.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_callingpres.c asterisk-1.2.4/apps/app_callingpres.c
+--- asterisk-1.2.4.orig/apps/app_callingpres.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_callingpres.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,70 @@
 +/*
 + * An application to change the CallingPresentation for an Asterisk channel.
@@ -519,9 +280,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_capiCD.c asterisk-1.2.1/apps/app_capiCD.c
---- asterisk-1.2.1.orig/apps/app_capiCD.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_capiCD.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_capiCD.c asterisk-1.2.4/apps/app_capiCD.c
+--- asterisk-1.2.4.orig/apps/app_capiCD.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_capiCD.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,172 @@
 +/*
 + * (CAPI*)
@@ -695,9 +456,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_capiECT.c asterisk-1.2.1/apps/app_capiECT.c
---- asterisk-1.2.1.orig/apps/app_capiECT.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_capiECT.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_capiECT.c asterisk-1.2.4/apps/app_capiECT.c
+--- asterisk-1.2.4.orig/apps/app_capiECT.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_capiECT.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,210 @@
 +/*
 + * (CAPI*)
@@ -909,9 +670,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_capiNoES.c asterisk-1.2.1/apps/app_capiNoES.c
---- asterisk-1.2.1.orig/apps/app_capiNoES.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_capiNoES.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_capiNoES.c asterisk-1.2.4/apps/app_capiNoES.c
+--- asterisk-1.2.4.orig/apps/app_capiNoES.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_capiNoES.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,96 @@
 +/*
 + * (CAPI*)
@@ -1009,9 +770,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_chanisavail.c asterisk-1.2.1/apps/app_chanisavail.c
---- asterisk-1.2.1.orig/apps/app_chanisavail.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_chanisavail.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_chanisavail.c asterisk-1.2.4/apps/app_chanisavail.c
+--- asterisk-1.2.4.orig/apps/app_chanisavail.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/apps/app_chanisavail.c	2006-01-31 09:41:43.000000000 +0100
 @@ -118,7 +118,7 @@
  				snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
  				status = inuse = ast_device_state(trychan);
@@ -1021,9 +782,9 @@
  					pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
  					/* Store the originally used channel too */
  					snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
-diff -urN asterisk-1.2.1.orig/apps/app_devstate.c asterisk-1.2.1/apps/app_devstate.c
---- asterisk-1.2.1.orig/apps/app_devstate.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_devstate.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_devstate.c asterisk-1.2.4/apps/app_devstate.c
+--- asterisk-1.2.4.orig/apps/app_devstate.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_devstate.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,219 @@
 +/*
 + * Devstate application
@@ -1244,9 +1005,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_dial.c asterisk-1.2.1/apps/app_dial.c
---- asterisk-1.2.1.orig/apps/app_dial.c	2005-11-30 18:39:36.000000000 +0100
-+++ asterisk-1.2.1/apps/app_dial.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_dial.c asterisk-1.2.4/apps/app_dial.c
+--- asterisk-1.2.4.orig/apps/app_dial.c	2006-01-25 02:50:52.000000000 +0100
++++ asterisk-1.2.4/apps/app_dial.c	2006-01-31 09:41:43.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -1279,7 +1040,7 @@
 +"           answered the call.\n"
 +"    c    - callback initiation, ring once and hangup.\n"
  "    t    - Allow the called party to transfer the calling party by sending the\n"
- "           DTMF sequence defiend in features.conf.\n"
+ "           DTMF sequence defined in features.conf.\n"
  "    T    - Allow the calling party to transfer the called party by sending the\n"
 @@ -210,6 +218,8 @@
  	OPT_CALLEE_MONITOR = (1 << 21),
@@ -1317,7 +1078,34 @@
  						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 {
-@@ -1004,7 +1016,7 @@
+@@ -916,17 +928,24 @@
+ 		}
+ 		
+ 		if( privdb_val == AST_PRIVACY_DENY ) {
++			ast_copy_string(status, "NOANSWER", sizeof(status));
+ 			ast_verbose( VERBOSE_PREFIX_3  "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
+ 			res=0;
+ 			goto out;
+ 		}
+ 		else if( privdb_val == AST_PRIVACY_KILL ) {
+-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
++			ast_copy_string(status, "DONTCALL", sizeof(status));
++			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
++				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
++			}
+ 			res = 0;
+ 			goto out; /* Is this right? */
+ 		}
+ 		else if( privdb_val == AST_PRIVACY_TORTURE ) {
+-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
++			ast_copy_string(status, "TORTURE", sizeof(status));
++			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
++				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
++			}
+ 			res = 0;
+ 			goto out; /* is this right??? */
+ 
+@@ -1005,7 +1024,7 @@
  				ast_log(LOG_DEBUG, "Dialing by extension %s\n", numsubst);
  		}
  		/* Request the peer */
@@ -1326,7 +1114,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));
-@@ -1035,7 +1047,7 @@
+@@ -1036,7 +1055,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 */
@@ -1335,7 +1123,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 {
-@@ -1154,8 +1166,11 @@
+@@ -1155,8 +1174,11 @@
  			ast_indicate(chan, AST_CONTROL_RINGING);
  			sentringing++;
  		}
@@ -1348,9 +1136,18 @@
  
  	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);
-diff -urN asterisk-1.2.1.orig/apps/app_directed_pickup.c asterisk-1.2.1/apps/app_directed_pickup.c
---- asterisk-1.2.1.orig/apps/app_directed_pickup.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_directed_pickup.c	2005-12-21 14:25:44.000000000 +0100
+@@ -1285,6 +1307,8 @@
+ 								     opt_args[OPT_ARG_PRIVACY], privcid);
+ 						ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
+ 					}
++					ast_copy_string(status, "NOANSWER", sizeof(status));
++
+ 					if (ast_test_flag(&opts, OPT_MUSICBACK)) {
+ 						ast_moh_stop(chan);
+ 					} else if (ast_test_flag(&opts, OPT_RINGBACK)) {
+diff -urN asterisk-1.2.4.orig/apps/app_directed_pickup.c asterisk-1.2.4/apps/app_directed_pickup.c
+--- asterisk-1.2.4.orig/apps/app_directed_pickup.c	2005-12-20 18:34:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_directed_pickup.c	2006-01-31 09:41:43.000000000 +0100
 @@ -41,7 +41,7 @@
  #include "asterisk/app.h"
  
@@ -1360,10 +1157,10 @@
  static const char *synopsis = "Directed Call Pickup";
  static const char *descrip =
  "  Pickup(extension[@context]): This application can pickup any ringing channel\n"
-diff -urN asterisk-1.2.1.orig/apps/app_meetme.c asterisk-1.2.1/apps/app_meetme.c
---- asterisk-1.2.1.orig/apps/app_meetme.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_meetme.c	2006-01-05 10:15:32.000000000 +0100
-@@ -451,7 +451,7 @@
+diff -urN asterisk-1.2.4.orig/apps/app_meetme.c asterisk-1.2.4/apps/app_meetme.c
+--- asterisk-1.2.4.orig/apps/app_meetme.c	2006-01-18 22:02:06.000000000 +0100
++++ asterisk-1.2.4/apps/app_meetme.c	2006-01-31 09:41:43.000000000 +0100
+@@ -454,7 +454,7 @@
  			ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
  			ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
  			cnf->markedusers = 0;
@@ -1372,7 +1169,7 @@
  			if (cnf->chan) {
  				cnf->fd = cnf->chan->fds[0];	/* for use by conf_play() */
  			} else {
-@@ -819,8 +819,9 @@
+@@ -822,8 +822,9 @@
  	char exitcontext[AST_MAX_CONTEXT] = "";
  	char recordingtmp[AST_MAX_EXTENSION] = "";
  	int dtmf;
@@ -1383,7 +1180,7 @@
  	char *buf = __buf + AST_FRIENDLY_OFFSET;
  	
  	if (!user) {
-@@ -983,7 +984,7 @@
+@@ -986,7 +987,7 @@
  		}
  		/* Setup buffering information */
  		memset(&bi, 0, sizeof(bi));
@@ -1392,7 +1189,7 @@
  		bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
  		bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
  		bi.numbufs = audio_buffers;
-@@ -1268,6 +1269,14 @@
+@@ -1271,6 +1272,14 @@
  				f = ast_read(c);
  				if (!f)
  					break;
@@ -1407,7 +1204,7 @@
  				if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
  					if (user->talk.actual)
  						ast_frame_adjust_volume(f, user->talk.actual);
-@@ -1493,7 +1502,7 @@
+@@ -1500,7 +1509,7 @@
  				}
  				ast_frfree(f);
  			} else if (outfd > -1) {
@@ -1416,48 +1213,47 @@
  				if (res > 0) {
  					memset(&fr, 0, sizeof(fr));
  					fr.frametype = AST_FRAME_VOICE;
-diff -urN asterisk-1.2.1.orig/apps/app_milliwatt.c asterisk-1.2.1/apps/app_milliwatt.c
---- asterisk-1.2.1.orig/apps/app_milliwatt.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_milliwatt.c	2006-01-05 10:21:40.000000000 +0100
-@@ -75,13 +75,22 @@
+diff -urN asterisk-1.2.4.orig/apps/app_milliwatt.c asterisk-1.2.4/apps/app_milliwatt.c
+--- asterisk-1.2.4.orig/apps/app_milliwatt.c	2006-01-19 05:17:45.000000000 +0100
++++ asterisk-1.2.4/apps/app_milliwatt.c	2006-01-31 09:41:43.000000000 +0100
+@@ -74,20 +74,28 @@
+ {
  	struct ast_frame wf;
- 	unsigned char waste[AST_FRIENDLY_OFFSET];
- 	unsigned char buf[640];
--	int i,*indexp = (int *) data;
-+	const int maxsamples = sizeof (buf) / sizeof (buf[0]);
-+	int i, *indexp = (int *) data;
+ 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
++ 	const int maxsamples = (sizeof (buf) - AST_FRIENDLY_OFFSET) / sizeof (buf[0]);
+ 	int i,*indexp = (int *) data;
  
--	if (len > sizeof(buf))
-+	/* Instead of len, use samples, because channel.c generator_force 
-+	 * generate(chan, tmp, 0, 160) ignores len. In any case, len is  
+-	if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
+-	{
+-		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
+-		len = sizeof(buf) - AST_FRIENDLY_OFFSET;
+-	}
++ 	/* Instead of len, use samples, because channel.c generator_force 
++ 	 * generate(chan, tmp, 0, 160) ignores len. In any case, len is  
 +	 * a multiple of samples, given by number of samples times bytes per
-+	 * sample. In the case of ulaw, len = samples. for signed linear 
-+	 * len = 2 * samples                                                 */
-+
-+	if (samples > maxsamples)
- 	{
--		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
--		len = sizeof(buf);
-+		ast_log(LOG_WARNING, "Only doing %d samples (%d requested)\n", maxsamples, samples);
-+		samples = maxsamples;
- 	}
-+	len = samples * sizeof (buf[0]);
-+
- 	waste[0] = 0; /* make compiler happy */
++ 	 * sample. In the case of ulaw, len = samples. for signed linear 
++ 	 * len = 2 * samples                                                 */
++ 
++ 	if (samples > maxsamples)
++  	{
++ 		ast_log(LOG_WARNING, "Only doing %d samples (%d requested)\n", maxsamples, samples);
++ 		samples = maxsamples;
++  	}
++ 	len = samples * sizeof (buf[0]);
  	wf.frametype = AST_FRAME_VOICE;
  	wf.subclass = AST_FORMAT_ULAW;
-@@ -89,7 +98,7 @@
+ 	wf.offset = AST_FRIENDLY_OFFSET;
  	wf.mallocd = 0;
- 	wf.data = buf;
+ 	wf.data = buf + AST_FRIENDLY_OFFSET;
  	wf.datalen = len;
 -	wf.samples = wf.datalen;
 +	wf.samples = samples;
  	wf.src = "app_milliwatt";
  	wf.delivery.tv_sec = 0;
  	wf.delivery.tv_usec = 0;
-diff -urN asterisk-1.2.1.orig/apps/app_page.c asterisk-1.2.1/apps/app_page.c
---- asterisk-1.2.1.orig/apps/app_page.c	2005-12-02 01:51:15.000000000 +0100
-+++ asterisk-1.2.1/apps/app_page.c	2005-12-21 14:27:41.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_page.c asterisk-1.2.4/apps/app_page.c
+--- asterisk-1.2.4.orig/apps/app_page.c	2005-12-02 01:51:15.000000000 +0100
++++ asterisk-1.2.4/apps/app_page.c	2006-01-31 09:41:43.000000000 +0100
 @@ -85,7 +85,7 @@
  {
  	struct calloutdata *cd = data;
@@ -1467,9 +1263,9 @@
  	free(cd);
  	return NULL;
  }
-diff -urN asterisk-1.2.1.orig/apps/app_parkandannounce.c asterisk-1.2.1/apps/app_parkandannounce.c
---- asterisk-1.2.1.orig/apps/app_parkandannounce.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_parkandannounce.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_parkandannounce.c asterisk-1.2.4/apps/app_parkandannounce.c
+--- asterisk-1.2.4.orig/apps/app_parkandannounce.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/apps/app_parkandannounce.c	2006-01-31 09:41:43.000000000 +0100
 @@ -183,7 +183,7 @@
  
  	memset(&oh, 0, sizeof(oh));
@@ -1479,9 +1275,9 @@
  
  	if(dchan) {
  		if(dchan->_state == AST_STATE_UP) {
-diff -urN asterisk-1.2.1.orig/apps/app_pickup.c asterisk-1.2.1/apps/app_pickup.c
---- asterisk-1.2.1.orig/apps/app_pickup.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_pickup.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_pickup.c asterisk-1.2.4/apps/app_pickup.c
+--- asterisk-1.2.4.orig/apps/app_pickup.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_pickup.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,319 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -1802,9 +1598,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_queue.c asterisk-1.2.1/apps/app_queue.c
---- asterisk-1.2.1.orig/apps/app_queue.c	2005-12-05 01:09:12.000000000 +0100
-+++ asterisk-1.2.1/apps/app_queue.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_queue.c asterisk-1.2.4/apps/app_queue.c
+--- asterisk-1.2.4.orig/apps/app_queue.c	2006-01-22 20:03:53.000000000 +0100
++++ asterisk-1.2.4/apps/app_queue.c	2006-01-31 09:41:43.000000000 +0100
 @@ -501,7 +501,7 @@
  	return NULL;
  }
@@ -1814,7 +1610,7 @@
  {
  	/* Avoid potential for deadlocks by spawning a new thread to handle
  	   the event */
-@@ -1364,7 +1364,7 @@
+@@ -1386,7 +1386,7 @@
  		location = "";
  
  	/* Request the peer */
@@ -1823,7 +1619,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);
-@@ -1670,7 +1670,7 @@
+@@ -1692,7 +1692,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 */
@@ -1832,9 +1628,9 @@
  					if (status != o->oldstatus) 
  						update_dial_status(qe->parent, o->member, status);						
  					if (!o->chan) {
-diff -urN asterisk-1.2.1.orig/apps/app_readfile.c asterisk-1.2.1/apps/app_readfile.c
---- asterisk-1.2.1.orig/apps/app_readfile.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_readfile.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_readfile.c asterisk-1.2.4/apps/app_readfile.c
+--- asterisk-1.2.4.orig/apps/app_readfile.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/apps/app_readfile.c	2006-01-31 09:41:43.000000000 +0100
 @@ -40,7 +40,7 @@
  #include "asterisk/app.h"
  #include "asterisk/module.h"
@@ -1844,9 +1640,9 @@
  
  static char *app_readfile = "ReadFile";
  
-diff -urN asterisk-1.2.1.orig/apps/app_segfault.c asterisk-1.2.1/apps/app_segfault.c
---- asterisk-1.2.1.orig/apps/app_segfault.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/apps/app_segfault.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_segfault.c asterisk-1.2.4/apps/app_segfault.c
+--- asterisk-1.2.4.orig/apps/app_segfault.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/apps/app_segfault.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,75 @@
 +/*
 + * Segfault application
@@ -1923,9 +1719,9 @@
 +{
 +    return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/apps/app_sms.c asterisk-1.2.1/apps/app_sms.c
---- asterisk-1.2.1.orig/apps/app_sms.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_sms.c	2006-01-05 10:21:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_sms.c asterisk-1.2.4/apps/app_sms.c
+--- asterisk-1.2.4.orig/apps/app_sms.c	2005-12-26 19:19:12.000000000 +0100
++++ asterisk-1.2.4/apps/app_sms.c	2006-01-31 09:41:43.000000000 +0100
 @@ -1179,32 +1179,31 @@
  {
  	struct ast_frame f = { 0 };
@@ -1980,9 +1776,9 @@
  }
  
  static void sms_process (sms_t * h, int samples, signed short *data)
-diff -urN asterisk-1.2.1.orig/apps/app_zapras.c asterisk-1.2.1/apps/app_zapras.c
---- asterisk-1.2.1.orig/apps/app_zapras.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/apps/app_zapras.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/apps/app_zapras.c asterisk-1.2.4/apps/app_zapras.c
+--- asterisk-1.2.4.orig/apps/app_zapras.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/apps/app_zapras.c	2006-01-31 09:41:43.000000000 +0100
 @@ -182,7 +182,7 @@
  				}
  			}
@@ -1992,31 +1788,30 @@
  			ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
  
  			/* Restore saved values */
-diff -urN asterisk-1.2.1.orig/asterisk.8 asterisk-1.2.1/asterisk.8
---- asterisk-1.2.1.orig/asterisk.8	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/asterisk.8	2006-01-05 10:21:35.000000000 +0100
-@@ -114,6 +114,9 @@
- for controlling it. Additionally, if connection to the Asterisk 
- process is lost, attempt to reconnect for as long as 30 seconds.
- .TP
-+\fB-s\fR
-+Enable silence suppression if timing device is available.
-+.TP
- \fB-t\fR
- When recording files, write them first into a temporary holding directory, 
- then move them into the final location when done.
-diff -urN asterisk-1.2.1.orig/asterisk.c asterisk-1.2.1/asterisk.c
---- asterisk-1.2.1.orig/asterisk.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/asterisk.c	2006-01-05 10:21:35.000000000 +0100
-@@ -158,6 +158,7 @@
- int option_dontwarn = 0;			/*!< */
- int option_priority_jumping = 1;		/*!< Enable priority jumping as result value for apps */
- int option_transmit_silence_during_record = 0;	/*!< Transmit silence during record() app */
-+int option_silence_suppression = 0;
+diff -urN asterisk-1.2.4.orig/apps/Makefile asterisk-1.2.4/apps/Makefile
+--- asterisk-1.2.4.orig/apps/Makefile	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/apps/Makefile	2006-01-31 09:41:43.000000000 +0100
+@@ -28,8 +28,15 @@
+      app_test.so app_forkcdr.so app_math.so app_realtime.so \
+      app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
+      app_md5.so app_readfile.so app_chanspy.so app_settransfercapability.so \
++     app_pickup.so app_segfault.so app_callingpres.so app_devstate.so \
+      app_dictate.so app_externalivr.so app_directed_pickup.so \
+-     app_mixmonitor.so app_stack.so
++     app_mixmonitor.so app_stack.so 
++
++
++ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/capi20.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/capi20.h),)
++  APPS+= app_capiNoES.so app_capiCD.so app_capiECT.so
++endif
++    
  
- /*! @} */
- 
-@@ -215,6 +216,7 @@
+ #
+ # Obsolete things...
+diff -urN asterisk-1.2.4.orig/asterisk.c asterisk-1.2.4/asterisk.c
+--- asterisk-1.2.4.orig/asterisk.c	2006-01-24 23:55:32.000000000 +0100
++++ asterisk-1.2.4/asterisk.c	2006-01-31 09:41:43.000000000 +0100
+@@ -221,6 +221,7 @@
  char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH] = "\0";
  char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
  char ast_config_AST_CTL[AST_CONFIG_MAX_PATH] = "asterisk.ctl";
@@ -2024,7 +1819,7 @@
  
  static char *_argv[256];
  static int shuttingdown = 0;
-@@ -1795,6 +1797,7 @@
+@@ -1878,6 +1879,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));
@@ -2032,7 +1827,7 @@
  
  	/* no asterisk.conf? no problem, use buildtime config! */
  	if (!cfg) {
-@@ -1833,6 +1836,8 @@
+@@ -1916,6 +1918,8 @@
  			ast_copy_string(ast_config_AST_RUN_DIR, v->value, sizeof(ast_config_AST_RUN_DIR));
  		} else if (!strcasecmp(v->name, "astmoddir")) {
  			ast_copy_string(ast_config_AST_MODULE_DIR, v->value, sizeof(ast_config_AST_MODULE_DIR));
@@ -2041,38 +1836,9 @@
  		}
  		v = v->next;
  	}
-@@ -1889,6 +1894,9 @@
- 		/* Transmit SLINEAR silence while a channel is being recorded */
- 		} else if (!strcasecmp(v->name, "transmit_silence_during_record")) {
- 			option_transmit_silence_during_record = ast_true(v->value);
-+		/* Enable silence suppression */
-+		} else if (!strcasecmp(v->name, "silence_suppression")) {
-+			option_silence_suppression = ast_true(v->value);
- 		} else if (!strcasecmp(v->name, "maxcalls")) {
- 			if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
- 				option_maxcalls = 0;
-@@ -1966,7 +1974,7 @@
- 	}
- 	*/
- 	/* Check for options */
--	while((c=getopt(argc, argv, "tThfdvVqprRgcDinx:U:G:C:L:M:")) != -1) {
-+	while((c=getopt(argc, argv, "tThfdvVqprRgcDinsx:U:G:C:L:M:")) != -1) {
- 		switch(c) {
- 		case 'd':
- 			option_debug++;
-@@ -2009,6 +2017,9 @@
- 		case 'q':
- 			option_quiet++;
- 			break;
-+		case 's':
-+			option_silence_suppression++;
-+			break;
- 		case 't':
- 			option_cache_record_files++;
- 			break;
-diff -urN asterisk-1.2.1.orig/build_tools/make_defaults_h asterisk-1.2.1/build_tools/make_defaults_h
---- asterisk-1.2.1.orig/build_tools/make_defaults_h	2005-06-20 19:26:08.000000000 +0200
-+++ asterisk-1.2.1/build_tools/make_defaults_h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/build_tools/make_defaults_h asterisk-1.2.4/build_tools/make_defaults_h
+--- asterisk-1.2.4.orig/build_tools/make_defaults_h	2005-06-20 19:26:08.000000000 +0200
++++ asterisk-1.2.4/build_tools/make_defaults_h	2006-01-31 09:41:43.000000000 +0100
 @@ -16,6 +16,7 @@
  #define AST_KEY_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
  #define AST_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
@@ -2081,10 +1847,20 @@
  
  #define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
  
-diff -urN asterisk-1.2.1.orig/channel.c asterisk-1.2.1/channel.c
---- asterisk-1.2.1.orig/channel.c	2005-12-02 00:34:58.000000000 +0100
-+++ asterisk-1.2.1/channel.c	2006-01-05 10:21:35.000000000 +0100
-@@ -511,6 +512,17 @@
+diff -urN asterisk-1.2.4.orig/channel.c asterisk-1.2.4/channel.c
+--- asterisk-1.2.4.orig/channel.c	2006-01-25 10:46:43.000000000 +0100
++++ asterisk-1.2.4/channel.c	2006-01-31 09:41:43.000000000 +0100
+@@ -94,8 +94,8 @@
+  */
+ static int shutting_down = 0;
+ 
+-AST_MUTEX_DEFINE_STATIC(uniquelock);
+ static int uniqueint = 0;
++AST_MUTEX_DEFINE_EXPORTED(uniquelock);
+ 
+ unsigned long global_fin = 0, global_fout = 0;
+ 
+@@ -512,6 +512,17 @@
  	.description = "Null channel (should not see this)",
  };
  
@@ -2102,7 +1878,7 @@
  /*--- ast_channel_alloc: Create a new channel structure */
  struct ast_channel *ast_channel_alloc(int needqueue)
  {
-@@ -518,6 +530,7 @@
+@@ -519,6 +530,7 @@
  	int x;
  	int flags;
  	struct varshead *headp;        
@@ -2110,10 +1886,13 @@
  	        
  
  	/* If shutting down, don't allocate any new channels */
-@@ -584,6 +597,12 @@
+@@ -584,9 +596,12 @@
+ 	tmp->data = NULL;
  	tmp->fin = global_fin;
  	tmp->fout = global_fout;
- 	snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
+-	ast_mutex_lock(&uniquelock);
+-	snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
+-	ast_mutex_unlock(&uniquelock);
 +	tmpuniqueid = ast_alloc_uniqueid();
 +	snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), tmpuniqueid);
 +	if (tmpuniqueid) { 
@@ -2123,28 +1902,78 @@
  	headp = &tmp->varshead;
  	ast_mutex_init(&tmp->lock);
  	AST_LIST_HEAD_INIT_NOLOCK(headp);
-@@ -817,6 +836,20 @@
- 	return channel_find_locked(NULL, NULL, 0, context, exten);
+@@ -729,7 +744,7 @@
+  */
+ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
+ 					       const char *name, const int namelen,
+-					       const char *context, const char *exten)
++					       const char *context, const char *exten, const char *uniqueid)
+ {
+ 	const char *msg = prev ? "deadlock" : "initial deadlock";
+ 	int retries, done;
+@@ -740,9 +755,14 @@
+ 		for (c = channels; c; c = c->next) {
+ 			if (!prev) {
+ 				/* want head of list */
+-				if (!name && !exten)
++				if (!name && !exten && !uniqueid)
+ 					break;
+-				if (name) {
++				if (uniqueid) {
++				    if (!strcasecmp(c->uniqueid, uniqueid))
++				    	break;
++				    else
++					continue;
++				} else if (name) {
+ 					/* want match by full name */
+ 					if (!namelen) {
+ 						if (!strcasecmp(c->name, name))
+@@ -793,33 +813,39 @@
+ /*--- ast_channel_walk_locked: Browse channels in use */
+ struct ast_channel *ast_channel_walk_locked(const struct ast_channel *prev)
+ {
+-	return channel_find_locked(prev, NULL, 0, NULL, NULL);
++	return channel_find_locked(prev, NULL, 0, NULL, NULL, NULL);
  }
  
-+struct ast_channel *ast_get_channel_by_uniqueid_locked(char *uniqueid)
+ /*--- ast_get_channel_by_name_locked: Get channel by name and lock it */
+ struct ast_channel *ast_get_channel_by_name_locked(const char *name)
+ {
+-	return channel_find_locked(NULL, name, 0, NULL, NULL);
++	return channel_find_locked(NULL, name, 0, NULL, NULL, NULL);
+ }
+ 
+ /*--- ast_get_channel_by_name_prefix_locked: Get channel by name prefix and lock it */
+ struct ast_channel *ast_get_channel_by_name_prefix_locked(const char *name, const int namelen)
+ {
+-	return channel_find_locked(NULL, name, namelen, NULL, NULL);
++	return channel_find_locked(NULL, name, namelen, NULL, NULL, NULL);
+ }
+ 
+ /*--- ast_walk_channel_by_name_prefix_locked: Get next channel by name prefix and lock it */
+ struct ast_channel *ast_walk_channel_by_name_prefix_locked(struct ast_channel *chan, const char *name, const int namelen)
+ {
+-	return channel_find_locked(chan, name, namelen, NULL, NULL);
++	return channel_find_locked(chan, name, namelen, NULL, NULL, NULL);
+ }
+ 
+ /*--- ast_get_channel_by_exten_locked: Get channel by exten (and optionally context) and lock it */
+ struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const char *context)
+ {
+-	return channel_find_locked(NULL, NULL, 0, context, exten);
++	return channel_find_locked(NULL, NULL, 0, context, exten, NULL);
+ }
+ 
++struct ast_channel *ast_get_channel_by_uniqueid_locked(const char *uniqueid)
 +{
-+	struct ast_channel *chan;
-+	chan = ast_channel_walk_locked(NULL);
-+	while(chan) {
-+		if (!strcasecmp(chan->uniqueid, uniqueid))
-+			return chan;
-+		ast_mutex_unlock(&chan->lock);
-+		chan = ast_channel_walk_locked(chan);
-+	}
-+	return NULL;
++	return channel_find_locked(NULL, NULL, 0, NULL, NULL, uniqueid);
 +}
 +
 +
  /*--- ast_safe_sleep_conditional: Wait, look for hangups and condition arg */
  int ast_safe_sleep_conditional(	struct ast_channel *chan, int ms,
  	int (*cond)(void*), void *data )
-@@ -909,8 +942,10 @@
+@@ -912,8 +938,10 @@
  		free(chan->tech_pvt);
  	}
  
@@ -2157,7 +1986,7 @@
  
  	ast_copy_string(name, chan->name, sizeof(name));
  
-@@ -953,10 +988,11 @@
+@@ -956,10 +984,11 @@
  	while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
  		ast_var_delete(vardata);
  
@@ -2170,56 +1999,7 @@
  }
  
  int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
-@@ -1773,6 +1809,14 @@
- 	return 0; /* Time is up */
- }
- 
-+int ast_silence_suppression_enabled(struct ast_channel *chan)
-+{
-+	int ret = option_silence_suppression && chan->timingfd > -1;
-+	if (option_verbose > 9) 
-+		ast_verbose(VERBOSE_PREFIX_3 "Silence suppression is %s (option_silence_suppression=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", option_silence_suppression, chan->timingfd);
-+	return ret;
-+}
-+
- struct ast_frame *ast_read(struct ast_channel *chan)
- {
- 	struct ast_frame *f = NULL;
-@@ -1960,18 +2004,13 @@
- 		ast_cdr_answer(chan->cdr);
- 	} 
- 
--	/* Run any generator sitting on the line */
--	if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata) {
--		/* Mask generator data temporarily and apply.  If there is a timing function, it
--		   will be calling the generator instead */
-+	/* Run generator sitting on the line if timing device not available
-+	 * and synchronous generation of outgoing frames is necessary       */
-+	if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata && !ast_silence_suppression_enabled(chan)) {
- 		void *tmp;
- 		int res;
- 		int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
- 
--		if (chan->timingfunc) {
--			ast_log(LOG_DEBUG, "Generator got voice, switching to phase locked mode\n");
--			ast_settimeout(chan, 0, NULL, NULL);
--		}
- 		tmp = chan->generatordata;
- 		chan->generatordata = NULL;
- 		generate = chan->generator->generate;
-@@ -1981,11 +2020,6 @@
- 			ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
- 			ast_deactivate_generator(chan);
- 		}
--	} else if (f && (f->frametype == AST_FRAME_CNG)) {
--		if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) {
--			ast_log(LOG_DEBUG, "Generator got CNG, switching to zap timed mode\n");
--			ast_settimeout(chan, 160, generator_force, chan);
--		}
- 	}
- 	/* High bit prints debugging */
- 	if (chan->fin & 0x80000000)
-@@ -2359,7 +2393,7 @@
+@@ -2364,7 +2393,7 @@
  			  &chan->writetrans, 1);
  }
  
@@ -2228,7 +2008,7 @@
  {
  	int state = 0;
  	int cause = 0;
-@@ -2367,7 +2401,7 @@
+@@ -2372,7 +2401,7 @@
  	struct ast_frame *f;
  	int res = 0;
  	
@@ -2237,7 +2017,7 @@
  	if (chan) {
  		if (oh) {
  			if (oh->vars)	
-@@ -2379,6 +2413,7 @@
+@@ -2384,6 +2413,7 @@
  		}
  		ast_set_callerid(chan, cid_num, cid_name, cid_num);
  
@@ -2245,7 +2025,7 @@
  		if (!ast_call(chan, data, 0)) {
  			while(timeout && (chan->_state != AST_STATE_UP)) {
  				res = ast_waitfor(chan, timeout);
-@@ -2401,6 +2436,7 @@
+@@ -2406,6 +2436,7 @@
  					if (f->subclass == AST_CONTROL_RINGING)
  						state = AST_CONTROL_RINGING;
  					else if ((f->subclass == AST_CONTROL_BUSY) || (f->subclass == AST_CONTROL_CONGESTION)) {
@@ -2253,7 +2033,7 @@
  						state = f->subclass;
  						ast_frfree(f);
  						break;
-@@ -2470,12 +2506,12 @@
+@@ -2475,12 +2506,12 @@
  	return chan;
  }
  
@@ -2269,7 +2049,7 @@
  {
  	struct chanlist *chan;
  	struct ast_channel *c;
-@@ -2512,6 +2548,7 @@
+@@ -2517,6 +2548,7 @@
  		if (!(c = chan->tech->requester(type, capabilities, data, cause)))
  			return NULL;
  
@@ -2277,7 +2057,7 @@
  		if (c->_state == AST_STATE_DOWN) {
  			manager_event(EVENT_FLAG_CALL, "Newchannel",
  				      "Channel: %s\r\n"
-@@ -2759,6 +2796,29 @@
+@@ -2764,6 +2796,29 @@
  	return res;
  }
  
@@ -2307,7 +2087,7 @@
  void ast_change_name(struct ast_channel *chan, char *newname)
  {
  	char tmp[256];
-@@ -3125,15 +3185,14 @@
+@@ -3130,15 +3185,14 @@
  				);
  }
  
@@ -2325,7 +2105,7 @@
  	manager_event(EVENT_FLAG_CALL,
  		      (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
  		      "Channel: %s\r\n"
-@@ -3149,6 +3208,10 @@
+@@ -3154,6 +3208,10 @@
  	return 0;
  }
  
@@ -2336,7 +2116,7 @@
  /*--- Find bridged channel */
  struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
  {
-@@ -3320,6 +3383,7 @@
+@@ -3331,6 +3389,7 @@
  	char callee_warning = 0;
  	int to;
  
@@ -2344,7 +2124,7 @@
  	if (c0->_bridge) {
  		ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 
  			c0->name, c0->_bridge->name);
-@@ -3330,6 +3394,10 @@
+@@ -3341,6 +3400,10 @@
  			c1->name, c1->_bridge->name);
  		return -1;
  	}
@@ -2355,59 +2135,10 @@
  	
  	/* 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.1.orig/channels/Makefile asterisk-1.2.1/channels/Makefile
---- asterisk-1.2.1.orig/channels/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/channels/Makefile	2005-12-21 14:32:51.000000000 +0100
-@@ -121,6 +121,35 @@
- endif
- endif # WITHOUT_ZAPTEL
- 
-+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/capi20.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/capi20.h),)
-+  CHANNEL_LIBS+=chan_capi.so
-+# uncomment the following line if you really never ever want early b3 connects,
-+# you can also configure it in the dialstring, this is just for performance
-+# NOTE: this is probably obsolete by using the "R" dial option
-+#CFLAGS+=-DCAPI_NEVER_EVER_EARLY_B3_CONNECTS
-+
-+# uncommnet next line to force dtmf software detection/generation, can also be configured
-+# in capi.conf on a perdevice basis (softdtmf=1)
-+#CFLAGS+=-DCAPI_FORCE_SOFTWARE_DTMF
-+
-+# uncomment the next line if you are in the ulaw world
-+#CFLAGS+=-DCAPI_ULAW
-+
-+# very experimental echo squelching
-+CFLAGS+=-DCAPI_ES
-+
-+#gains
-+CFLAGS+=-DCAPI_GAIN
-+
-+# what do to with call waiting connect indications?
-+# uncomment the next line for call deflection in that case
-+CFLAGS+=-DCAPI_DEFLECT_ON_CIRCUITBUSY
-+
-+# audio sync
-+CFLAGS+=-DCAPI_SYNC
-+
-+endif
-+
- ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h),)
-   CHANNEL_LIBS+=chan_vpb.so
-   CFLAGS+=-DLINUX
-@@ -219,6 +248,9 @@
- chan_nbs.so: chan_nbs.o
- 	$(CC) $(SOLINK) -o $@ $< -lnbs
- 
-+chan_capi.so: chan_capi.o
-+	$(CC) $(SOLINK) -o $@ $< -lcapi20
-+
- chan_vpb.o: chan_vpb.c
- 	$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
- 
-diff -urN asterisk-1.2.1.orig/channels/chan_agent.c asterisk-1.2.1/channels/chan_agent.c
---- asterisk-1.2.1.orig/channels/chan_agent.c	2005-12-02 01:28:48.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_agent.c	2005-12-21 14:25:44.000000000 +0100
-@@ -1328,7 +1328,7 @@
+diff -urN asterisk-1.2.4.orig/channels/chan_agent.c asterisk-1.2.4/channels/chan_agent.c
+--- asterisk-1.2.4.orig/channels/chan_agent.c	2006-01-13 07:07:39.000000000 +0100
++++ asterisk-1.2.4/channels/chan_agent.c	2006-01-31 09:41:43.000000000 +0100
+@@ -1331,7 +1331,7 @@
  						chan = agent_new(p, AST_STATE_DOWN);
  					} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
  						/* Adjustable agent */
@@ -2416,9 +2147,9 @@
  						if (p->chan)
  							chan = agent_new(p, AST_STATE_DOWN);
  					}
-diff -urN asterisk-1.2.1.orig/channels/chan_capi.c asterisk-1.2.1/channels/chan_capi.c
---- asterisk-1.2.1.orig/channels/chan_capi.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_capi.c	2006-01-04 15:21:34.000000000 +0100
+diff -urN asterisk-1.2.4.orig/channels/chan_capi.c asterisk-1.2.4/channels/chan_capi.c
+--- asterisk-1.2.4.orig/channels/chan_capi.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/channels/chan_capi.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,2888 @@
 +/*
 + * (CAPI*)
@@ -5308,9 +5039,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/channels/chan_features.c asterisk-1.2.1/channels/chan_features.c
---- asterisk-1.2.1.orig/channels/chan_features.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_features.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/channels/chan_features.c asterisk-1.2.4/channels/chan_features.c
+--- asterisk-1.2.4.orig/channels/chan_features.c	2006-01-25 19:39:44.000000000 +0100
++++ asterisk-1.2.4/channels/chan_features.c	2006-01-31 09:41:43.000000000 +0100
 @@ -438,7 +438,7 @@
  	}
  	ast_mutex_unlock(&featurelock);
@@ -5320,9 +5051,9 @@
  		if (!chan) {
  			ast_log(LOG_NOTICE, "Unable to allocate subchannel '%s/%s'\n", tech, dest);
  			return NULL;
-diff -urN asterisk-1.2.1.orig/channels/chan_iax2.c asterisk-1.2.1/channels/chan_iax2.c
---- asterisk-1.2.1.orig/channels/chan_iax2.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_iax2.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/channels/chan_iax2.c asterisk-1.2.4/channels/chan_iax2.c
+--- asterisk-1.2.4.orig/channels/chan_iax2.c	2006-01-20 02:00:46.000000000 +0100
++++ asterisk-1.2.4/channels/chan_iax2.c	2006-01-31 09:41:43.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -5342,10 +5073,29 @@
  		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);
-diff -urN asterisk-1.2.1.orig/channels/chan_sip.c asterisk-1.2.1/channels/chan_sip.c
---- asterisk-1.2.1.orig/channels/chan_sip.c	2005-12-05 01:01:17.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_sip.c	2006-01-05 10:25:12.000000000 +0100
-@@ -593,6 +593,7 @@
+@@ -3102,7 +3105,8 @@
+ static struct ast_frame *iax2_read(struct ast_channel *c) 
+ {
+ 	static struct ast_frame f = { AST_FRAME_NULL, };
+-	ast_log(LOG_NOTICE, "I should never be called!\n");
++	if (option_verbose > 3)
++	    ast_log(LOG_NOTICE, "I should never be called!\n");
+ 	return &f;
+ }
+ 
+@@ -6688,7 +6692,7 @@
+ 		}
+ 		if (f.frametype == AST_FRAME_IAX) {
+ 			if (iaxs[fr.callno]->initid > -1) {
+-				/* Don't auto congest anymore since we've gotten something usefulb ack */
++				/* Don't auto congest anymore since we've gotten something useful back */
+ 				ast_sched_del(sched, iaxs[fr.callno]->initid);
+ 				iaxs[fr.callno]->initid = -1;
+ 			}
+diff -urN asterisk-1.2.4.orig/channels/chan_sip.c asterisk-1.2.4/channels/chan_sip.c
+--- asterisk-1.2.4.orig/channels/chan_sip.c	2006-01-28 14:52:15.000000000 +0100
++++ asterisk-1.2.4/channels/chan_sip.c	2006-01-31 09:41:43.000000000 +0100
+@@ -596,6 +596,7 @@
  	unsigned int flags;			/*!< SIP_ flags */	
  	int timer_t1;				/*!< SIP timer T1, ms rtt */
  	unsigned int sipoptions;		/*!< Supported SIP sipoptions on the other end */
@@ -5353,7 +5103,7 @@
  	int capability;				/*!< Special capability (codec) */
  	int jointcapability;			/*!< Supported capability at both ends (codecs ) */
  	int peercapability;			/*!< Supported peer capability */
-@@ -616,6 +617,7 @@
+@@ -619,6 +620,7 @@
  	char refer_to[AST_MAX_EXTENSION];	/*!< Place to store REFER-TO extension */
  	char referred_by[AST_MAX_EXTENSION];	/*!< Place to store REFERRED-BY extension */
  	char refer_contact[AST_MAX_EXTENSION];	/*!< Place to store Contact info from a REFER extension */
@@ -5361,7 +5111,7 @@
  	struct sip_pvt *refer_call;		/*!< Call we are referring */
  	struct sip_route *route;		/*!< Head of linked list of routing steps (fm Record-Route) */
  	int route_persistant;			/*!< Is this the "real" route? */
-@@ -635,6 +637,7 @@
+@@ -638,6 +640,7 @@
  	char peername[256];			/*!< [peer] name, not set if [user] */
  	char authname[256];			/*!< Who we use for authentication */
  	char uri[256];				/*!< Original requested URI */
@@ -5369,7 +5119,7 @@
  	char okcontacturi[256];			/*!< URI from the 200 OK on INVITE */
  	char peersecret[256];			/*!< Password */
  	char peermd5secret[256];
-@@ -919,7 +922,7 @@
+@@ -921,7 +924,7 @@
  static int determine_firstline_parts(struct sip_request *req);
  static void sip_dump_history(struct sip_pvt *dialog);	/* Dump history to LOG_DEBUG at end of dialog, before destroying data */
  static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
@@ -5378,7 +5128,7 @@
  static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
  
  /*! \brief Definition of this channel for PBX channel registration */
-@@ -1303,7 +1306,7 @@
+@@ -1304,7 +1307,7 @@
  	/* If this is a subscription, tell the phone that we got a timeout */
  	if (p->subscribed) {
  		p->subscribed = TIMEOUT;
@@ -5387,7 +5137,7 @@
  		p->subscribed = NONE;
  		append_history(p, "Subscribestatus", "timeout");
  		return 10000;	/* Reschedule this destruction so that we know that it's gone */
-@@ -3104,16 +3107,30 @@
+@@ -3109,16 +3112,30 @@
  
  /*! \brief  find_call: Connect incoming SIP message to current dialog or create new dialog structure */
  /*               Called by handle_request, sipsock_read */
@@ -5419,7 +5169,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
-@@ -4039,6 +4056,7 @@
+@@ -4043,6 +4060,7 @@
  	if (sipmethod == SIP_CANCEL) {
  		c = p->initreq.rlPart2;	/* Use original URI */
  	} else if (sipmethod == SIP_ACK) {
@@ -5427,17 +5177,7 @@
  		/* Use URI from Contact: in 200 OK (if INVITE) 
  		(we only have the contacturi on INVITEs) */
  		if (!ast_strlen_zero(p->okcontacturi))
-@@ -4447,7 +4465,8 @@
- 				    debug);
- 	}
- 
--	ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
-+	if(!ast_silence_suppression_enabled(p->owner))
-+		ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
- 
- 	if ((m_audio_left < 2) || (m_video_left < 2) || (a_audio_left == 0) || (a_video_left == 0))
- 		ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");
-@@ -4807,10 +4826,12 @@
+@@ -4808,10 +4826,12 @@
  		ast_build_string(&invite, &invite_max, ";%s", p->options->uri_options);
  
  	ast_copy_string(p->uri, invite_buf, sizeof(p->uri));
@@ -5451,7 +5191,7 @@
  	} else {
  		snprintf(to, sizeof(to), "<%s>", p->uri);
  	}
-@@ -4866,6 +4887,11 @@
+@@ -4867,6 +4887,11 @@
  		if (!ast_strlen_zero(p->referred_by))
  			add_header(&req, "Referred-By", p->referred_by);
  	}
@@ -5463,7 +5203,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);
-@@ -4940,8 +4966,7 @@
+@@ -4941,8 +4966,7 @@
  }
  
  /*! \brief  transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
@@ -5473,7 +5213,7 @@
  	char tmp[4000], from[256], to[256];
  	char *t = tmp, *c, *a, *mfrom, *mto;
  	size_t maxbytes = sizeof(tmp);
-@@ -5085,10 +5110,19 @@
+@@ -5086,10 +5110,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);
@@ -5496,7 +5236,7 @@
  		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
  		ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
  		break;
-@@ -6299,7 +6333,7 @@
+@@ -6299,7 +6332,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 */
@@ -5505,7 +5245,7 @@
  {
  	struct sip_pvt *p = data;
  
-@@ -6318,7 +6352,7 @@
+@@ -6318,7 +6351,7 @@
  		p->laststate = state;
  		break;
  	}
@@ -5514,7 +5254,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);
-@@ -8579,6 +8613,7 @@
+@@ -8584,6 +8617,7 @@
  	char buf[1024];
  	unsigned int event;
  	char *c;
@@ -5522,7 +5262,7 @@
  	
  	/* Need to check the media/type */
  	if (!strcasecmp(get_header(req, "Content-Type"), "application/dtmf-relay") ||
-@@ -8642,6 +8677,19 @@
+@@ -8647,6 +8681,19 @@
  			ast_queue_control(p->owner, AST_CONTROL_VIDUPDATE);
  		transmit_response(p, "200 OK", req);
  		return;
@@ -5542,7 +5282,7 @@
  	} else if ((c = get_header(req, "X-ClientCode"))) {
  		/* Client code (from SNOM phone) */
  		if (ast_test_flag(p, SIP_USECLIENTCODE)) {
-@@ -8741,12 +8789,63 @@
+@@ -8746,12 +8793,63 @@
  	return RESULT_SUCCESS;
  }
  
@@ -5607,7 +5347,7 @@
  	if (argc < 4)
  		return RESULT_SHOWUSAGE;
  
-@@ -8763,41 +8862,13 @@
+@@ -8768,41 +8866,13 @@
  	}
  
  	for (i = 3; i < argc; i++) {
@@ -5654,7 +5394,7 @@
  /*! \brief  sip_do_history: Enable SIP History logging (CLI) ---*/
  static int sip_do_history(int fd, int argc, char *argv[])
  {
-@@ -9442,7 +9513,7 @@
+@@ -9447,7 +9517,7 @@
  		if (!ignore && p->owner) {
  			ast_queue_control(p->owner, AST_CONTROL_RINGING);
  			if (p->owner->_state != AST_STATE_UP)
@@ -5663,16 +5403,16 @@
  		}
  		if (!strcasecmp(get_header(req, "Content-Type"), "application/sdp")) {
  			process_sdp(p, req);
-@@ -10793,7 +10864,7 @@
- 			return 0;
- 		} else {
+@@ -10801,7 +10871,7 @@
+ 			struct sip_pvt *p_old;
+ 
  			transmit_response(p, "200 OK", req);
 -			transmit_state_notify(p, firststate, 1, 1);	/* Send first notification */
 +			transmit_state_notify(p, firststate, 1, 1, NULL, NULL);	/* Send first notification */
  			append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
- 		}
- 		if (!p->expiry)
-@@ -11077,7 +11148,7 @@
+ 
+ 			/* remove any old subscription from this peer for the same exten/context,
+@@ -11113,7 +11183,7 @@
  	/* Process request, with netlock held */
  retrylock:
  	ast_mutex_lock(&netlock);
@@ -5681,7 +5421,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)) {
-@@ -11399,6 +11470,52 @@
+@@ -11435,6 +11505,52 @@
  	return 0;
  }
  
@@ -5734,7 +5474,7 @@
  /*! \brief  sip_devicestate: Part of PBX channel interface ---*/
  
  /* Return values:---
-@@ -13084,6 +13201,8 @@
+@@ -13128,6 +13244,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);
@@ -5743,7 +5483,7 @@
  
  	sip_poke_all_peers();	
  	sip_send_all_registers();
-@@ -13114,6 +13233,7 @@
+@@ -13158,6 +13276,7 @@
  
  	ast_rtp_proto_unregister(&sip_rtp);
  
@@ -5751,9 +5491,9 @@
  	ast_manager_unregister("SIPpeers");
  	ast_manager_unregister("SIPshowpeer");
  
-diff -urN asterisk-1.2.1.orig/channels/chan_zap.c asterisk-1.2.1/channels/chan_zap.c
---- asterisk-1.2.1.orig/channels/chan_zap.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/channels/chan_zap.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/channels/chan_zap.c asterisk-1.2.4/channels/chan_zap.c
+--- asterisk-1.2.4.orig/channels/chan_zap.c	2006-01-30 18:08:28.000000000 +0100
++++ asterisk-1.2.4/channels/chan_zap.c	2006-01-31 09:46:14.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -5773,7 +5513,7 @@
  
  #ifndef ZT_SIG_EM_E1
  #error "Your zaptel is too old.  please cvs update"
-@@ -180,7 +185,7 @@
+@@ -183,7 +188,7 @@
  #define SIG_GR303FXOKS	(0x0100000 | ZT_SIG_FXOKS)
  #define SIG_GR303FXSKS	(0x0100000 | ZT_SIG_FXSKS)
  
@@ -5782,7 +5522,7 @@
  #define NUM_DCHANS		4	/*!< No more than 4 d-channels */
  #define MAX_CHANNELS	672		/*!< No more than a DS3 per trunk group */
  
-@@ -198,6 +203,9 @@
+@@ -201,6 +206,9 @@
  static char defaultcic[64] = "";
  static char defaultozz[64] = "";
  
@@ -5792,7 +5532,15 @@
  static char language[MAX_LANGUAGE] = "";
  static char musicclass[MAX_MUSICCLASS] = "";
  static char progzone[10]= "";
-@@ -291,6 +299,7 @@
+@@ -287,6 +295,7 @@
+ static int cur_priexclusive = 0;
+ 
+ static int priindication_oob = 0;
++static int pritransfer = 0;
+ 
+ #ifdef ZAPATA_PRI
+ static int minunused = 2;
+@@ -294,6 +303,7 @@
  static char idleext[AST_MAX_EXTENSION];
  static char idledial[AST_MAX_EXTENSION];
  static int overlapdial = 0;
@@ -5800,7 +5548,7 @@
  static int facilityenable = 0;
  static char internationalprefix[10] = "";
  static char nationalprefix[10] = "";
-@@ -302,8 +311,6 @@
+@@ -305,8 +315,6 @@
  #ifdef PRI_GETSET_TIMERS
  static int pritimers[PRI_MAX_TIMERS];
  #endif
@@ -5809,7 +5557,7 @@
  #endif
  
  /*! \brief Wait up to 16 seconds for first digit (FXO logic) */
-@@ -324,10 +331,6 @@
+@@ -327,10 +335,6 @@
  
  static int ifcount = 0;
  
@@ -5820,7 +5568,7 @@
  /*! \brief Whether we answer on a Polarity Switch event */
  static int answeronpolarityswitch = 0;
  
-@@ -400,6 +403,27 @@
+@@ -403,6 +407,27 @@
  #define PRI_SPAN(p) (((p) >> 8) & 0xff)
  #define PRI_EXPLICIT(p) (((p) >> 16) & 0x01)
  
@@ -5848,7 +5596,7 @@
  struct zt_pri {
  	pthread_t master;						/*!< Thread of master */
  	ast_mutex_t lock;						/*!< Mutex */
-@@ -413,6 +437,8 @@
+@@ -416,6 +441,8 @@
  	int nsf;							/*!< Network-Specific Facilities */
  	int dialplan;							/*!< Dialing plan */
  	int localdialplan;						/*!< Local dialing plan */
@@ -5857,7 +5605,7 @@
  	char internationalprefix[10];					/*!< country access code ('00' for european dialplans) */
  	char nationalprefix[10];					/*!< area access code ('0' for european dialplans) */
  	char localprefix[20];						/*!< area access code + area code ('0'+area code for european dialplans) */
-@@ -432,6 +458,7 @@
+@@ -435,6 +462,7 @@
  	int fds[NUM_DCHANS];						/*!< FD's for d-channels */
  	int offset;
  	int span;
@@ -5865,7 +5613,7 @@
  	int resetting;
  	int resetpos;
  	time_t lastreset;						/*!< time when unused channels were last reset */
-@@ -439,6 +466,9 @@
+@@ -442,6 +470,9 @@
  	struct zt_pvt *pvts[MAX_CHANNELS];				/*!< Member channel pvt structs */
  	struct zt_pvt *crvs;						/*!< Member CRV structs */
  	struct zt_pvt *crvend;						/*!< Pointer to end of CRV structs */
@@ -5875,7 +5623,7 @@
  };
  
  
-@@ -558,6 +588,8 @@
+@@ -561,6 +592,8 @@
  	unsigned int echocanbridged:1;
  	unsigned int echocanon:1;
  	unsigned int faxhandled:1;			/*!< Has a fax tone already been handled? */
@@ -5884,16 +5632,17 @@
  	unsigned int firstradio:1;
  	unsigned int hanguponpolarityswitch:1;
  	unsigned int hardwaredtmf:1;
-@@ -570,7 +602,7 @@
+@@ -573,7 +606,8 @@
  	unsigned int overlapdial:1;
  	unsigned int permcallwaiting:1;
  	unsigned int permhidecallerid:1;		/*!< Whether to hide our outgoing caller ID or not */
 -	unsigned int priindication_oob:1;
 +	unsigned int priindication_oob:2;
++	unsigned int pritransfer:2;
  	unsigned int priexclusive:1;
  	unsigned int pulse:1;
  	unsigned int pulsedial:1;			/*!< whether a pulse dial phone is detected */
-@@ -609,6 +641,7 @@
+@@ -612,6 +646,7 @@
  #endif
  	char cid_num[AST_MAX_EXTENSION];
  	int cid_ton;					/*!< Type Of Number (TON) */
@@ -5901,7 +5650,7 @@
  	char cid_name[AST_MAX_EXTENSION];
  	char lastcid_num[AST_MAX_EXTENSION];
  	char lastcid_name[AST_MAX_EXTENSION];
-@@ -673,6 +706,8 @@
+@@ -676,6 +711,8 @@
  	struct zt_pri *pri;
  	struct zt_pvt *bearer;
  	struct zt_pvt *realcall;
@@ -5910,11 +5659,13 @@
  	q931_call *call;
  	int prioffset;
  	int logicalspan;
-@@ -698,11 +733,12 @@
+@@ -701,11 +738,14 @@
  static int zt_indicate(struct ast_channel *chan, int condition);
  static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
  static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
 +static int zt_devicestate(void *data);
++static void disable_dtmf_detect(struct zt_pvt *p);
++static void enable_dtmf_detect(struct zt_pvt *p);
  
  static const struct ast_channel_tech zap_tech = {
  	.type = type,
@@ -5924,7 +5675,7 @@
  	.requester = zt_request,
  	.send_digit = zt_digit,
  	.send_text = zt_sendtext,
-@@ -716,6 +752,7 @@
+@@ -719,6 +759,7 @@
  	.indicate = zt_indicate,
  	.fixup = zt_fixup,
  	.setoption = zt_setoption,
@@ -5932,7 +5683,7 @@
  };
  
  #ifdef ZAPATA_PRI
-@@ -727,6 +764,13 @@
+@@ -730,6 +771,13 @@
  struct zt_pvt *round_robin[32];
  
  #ifdef ZAPATA_PRI
@@ -5946,7 +5697,7 @@
  static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
  {
  	int res;
-@@ -776,6 +820,112 @@
+@@ -779,6 +827,112 @@
  #define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
  #define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
  
@@ -6059,7 +5810,7 @@
  static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
  {
  	int res;
-@@ -1378,12 +1528,16 @@
+@@ -1381,12 +1535,16 @@
  	int res;
  	if (!p)
  		return;
@@ -6077,7 +5828,7 @@
  		return;
  	}
  	if (p->echocancel) {
-@@ -1409,7 +1563,7 @@
+@@ -1412,7 +1570,7 @@
  {
  	int x;
  	int res;
@@ -6086,20 +5837,22 @@
  		x = p->echotraining;
  		res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
  		if (res) 
-@@ -1771,7 +1925,11 @@
+@@ -1774,7 +1932,13 @@
  		ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", p->channel);
  	p->outgoing = 1;
  
 -	set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
-+	if (!IS_DIGITAL(ast->transfercapability)) {
++	if (IS_DIGITAL(ast->transfercapability)) {
++	    set_actual_gain(p->subs[SUB_REAL].zfd, 0, 0, 0, p->law);
++	} else {
 +	    set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
-+	} else {
-+	    set_actual_gain(p->subs[SUB_REAL].zfd, 0, 0, 0, p->law);
 +	}
++
++	disable_dtmf_detect(p);
  
  	switch(p->sig) {
  	case SIG_FXOLS:
-@@ -2011,6 +2169,12 @@
+@@ -2016,6 +2180,12 @@
  		int ldp_strip;
  		int exclusive;
  
@@ -6112,7 +5865,7 @@
  		c = strchr(dest, '/');
  		if (c)
  			c++;
-@@ -2028,6 +2192,7 @@
+@@ -2033,6 +2203,7 @@
  			ast_mutex_unlock(&p->lock);
  			return -1;
  		}
@@ -6120,7 +5873,7 @@
  		if (p->sig != SIG_FXSKS) {
  			p->dop.op = ZT_DIAL_OP_REPLACE;
  			s = strchr(c + p->stripmsd, 'w');
-@@ -2051,6 +2216,8 @@
+@@ -2056,6 +2227,8 @@
  			pri_rel(p->pri);
  			ast_mutex_unlock(&p->lock);
  			return -1;
@@ -6129,7 +5882,7 @@
  		}
  		if (!(sr = pri_sr_new())) {
  			ast_log(LOG_WARNING, "Failed to allocate setup request channel %d\n", p->channel);
-@@ -2279,8 +2446,10 @@
+@@ -2287,8 +2460,10 @@
  	}
  	if (newslot < 0) {
  		newslot = 0;
@@ -6141,34 +5894,57 @@
  	}
  	if (old && (oldslot != newslot))
  		ast_log(LOG_NOTICE, "Switching from from d-channel %d to channel %d!\n",
-@@ -2486,6 +2655,21 @@
+@@ -2344,8 +2519,7 @@
+ 
+ 	ast_log(LOG_DEBUG, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
+ 		p->channel, index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
+-	p->ignoredtmf = 0;
+-	
++
+ 	if (index > -1) {
+ 		/* Real channel, do some fixup */
+ 		p->subs[index].owner = NULL;
+@@ -2442,6 +2616,7 @@
+ 
+ 
+ 	if (!p->subs[SUB_REAL].owner && !p->subs[SUB_CALLWAIT].owner && !p->subs[SUB_THREEWAY].owner) {
++		int outgoing = p->outgoing;
+ 		p->owner = NULL;
+ 		p->ringt = 0;
+ 		p->distinctivering = 0;
+@@ -2505,6 +2680,26 @@
  								icause = atoi(cause);
  						}
  						pri_hangup(p->pri->pri, p->call, icause);
-+						if (p->pri->nodetype == BRI_NETWORK_PTMP) {
-+						    // fix for hangup in NT mode
-+						    // XXX check me
-+						    if ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING) || (ast->_state == AST_STATE_RING)) {
-+							p->call = NULL;
-+						    }
-+						}
++
 +						/* if we send a release complete we wont ge no hangup event, so clear the call here */
-+						if (icause == 34 || icause == 44 || icause == 82 || icause == 1 || icause == 81) {
++						if (icause == 34 || icause == 44 || icause == 82 || icause == 1 || icause == 81 || icause == 17) {
 +						    if ((ast->_state == AST_STATE_RING) || (ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING)) {
 +							p->call = NULL;
 +						    } else {
 +							ast_log(LOG_ERROR, "What is wrong with you? You cannot use cause %d number when in state %d!\n", icause, ast->_state);
++							icause = 16;
 +						    }
++						} 
++						
++						if (p->pri->nodetype == BRI_NETWORK_PTMP) {
++						    if ((icause == 16 || icause == -1) && (ast->_state != AST_STATE_UP)) {
++							if (outgoing) {
++							    p->call = NULL;
++							}
++						    }
 +						}
++						
++						
  					}
  					if (res < 0) 
  						ast_log(LOG_WARNING, "pri_disconnect failed\n");
-@@ -2682,10 +2866,14 @@
+@@ -2701,10 +2896,14 @@
  			p->proceeding = 1;
  			res = pri_answer(p->pri->pri, p->call, 0, !p->digital);
  			pri_rel(p->pri);
 +			/* stop ignoring inband dtmf */
-+			p->ignoredtmf = 0;
++			enable_dtmf_detect(p);
  		} else {
  			ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
  			res= -1;
@@ -6178,7 +5954,7 @@
  		break;
  #endif
  #ifdef ZAPATA_R2
-@@ -3252,6 +3440,15 @@
+@@ -3274,6 +3473,15 @@
  {
  	struct zt_pvt *p = newchan->tech_pvt;
  	int x;
@@ -6194,19 +5970,28 @@
  	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) {
-@@ -4586,8 +4783,9 @@
+@@ -4600,7 +4808,7 @@
+ 		p->subs[index].f.data = NULL;
+ 		p->subs[index].f.datalen= 0;
+ 	}
+-	if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect  || p->callprogress) && !index) {
++	if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect || p->callprogress) && !index) {
+ 		/* Perform busy detection. etc on the zap line */
+ 		f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
+ 		if (f) {
+@@ -4612,8 +4820,9 @@
  				}
  			} else if (f->frametype == AST_FRAME_DTMF) {
  #ifdef ZAPATA_PRI
 -				if (!p->proceeding && p->sig==SIG_PRI && p->pri && p->pri->overlapdial) {
 -					/* Don't accept in-band DTMF when in overlap dial mode */
-+				if (!p->proceeding && p->sig==SIG_PRI && p->pri && (p->pri->overlapdial || p->ignoredtmf)) {
++				if (p->ignoredtmf) {
 +					/* Don't accept in-band DTMF when in overlap dial mode 
 +					   or when in non-overlap overlapdialing mode ... */
  					f->frametype = AST_FRAME_NULL;
  					f->subclass = 0;
  				}
-@@ -4722,7 +4920,9 @@
+@@ -4748,7 +4957,9 @@
  #endif
  	/* Write a frame of (presumably voice) data */
  	if (frame->frametype != AST_FRAME_VOICE) {
@@ -6217,7 +6002,7 @@
  			ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
  		return 0;
  	}
-@@ -4793,7 +4993,7 @@
+@@ -4819,7 +5030,7 @@
  		switch(condition) {
  		case AST_CONTROL_BUSY:
  #ifdef ZAPATA_PRI
@@ -6226,7 +6011,7 @@
  				chan->hangupcause = AST_CAUSE_USER_BUSY;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -4875,7 +5075,7 @@
+@@ -4901,7 +5112,7 @@
  		case AST_CONTROL_CONGESTION:
  			chan->hangupcause = AST_CAUSE_CONGESTION;
  #ifdef ZAPATA_PRI
@@ -6235,7 +6020,7 @@
  				chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
  				chan->_softhangup |= AST_SOFTHANGUP_DEV;
  				res = 0;
-@@ -5057,8 +5257,12 @@
+@@ -5086,8 +5297,12 @@
  		if (state == AST_STATE_RING)
  			tmp->rings = 1;
  		tmp->tech_pvt = i;
@@ -6250,7 +6035,7 @@
  			tmp->callgroup = i->callgroup;
  			tmp->pickupgroup = i->pickupgroup;
  		}
-@@ -5188,6 +5392,7 @@
+@@ -5217,6 +5432,7 @@
  	int len = 0;
  	int res;
  	int index;
@@ -6258,7 +6043,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);
-@@ -5206,10 +5411,17 @@
+@@ -5235,10 +5451,17 @@
  		len = strlen(exten);
  		res = 0;
  		while((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
@@ -6279,7 +6064,7 @@
  			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
  				timeout = matchdigittimeout;
  			else
-@@ -6688,6 +6900,8 @@
+@@ -6720,6 +6943,8 @@
  		} else {
  			if (si->totalchans == 31) { /* if it's an E1 */
  				pris[*span].dchannels[0] = 16 + offset;
@@ -6288,7 +6073,7 @@
  			} else {
  				pris[*span].dchannels[0] = 24 + offset;
  			}
-@@ -6933,6 +7147,11 @@
+@@ -6965,6 +7190,11 @@
  							destroy_zt_pvt(&tmp);
  							return NULL;
  						}
@@ -6300,7 +6085,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);
-@@ -6960,6 +7179,17 @@
+@@ -6992,6 +7222,17 @@
  							return NULL;
  						}
  						pris[span].nodetype = pritype;
@@ -6318,7 +6103,7 @@
  						pris[span].switchtype = myswitchtype;
  						pris[span].nsf = nsf;
  						pris[span].dialplan = dialplan;
-@@ -6968,9 +7198,14 @@
+@@ -7000,9 +7241,14 @@
  						pris[span].minunused = minunused;
  						pris[span].minidle = minidle;
  						pris[span].overlapdial = overlapdial;
@@ -6333,7 +6118,15 @@
  						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));
-@@ -7397,7 +7632,7 @@
+@@ -7156,6 +7402,7 @@
+ 		tmp->restrictcid = restrictcid;
+ 		tmp->use_callingpres = use_callingpres;
+ 		tmp->priindication_oob = priindication_oob;
++		tmp->pritransfer = pritransfer;
+ 		tmp->priexclusive = cur_priexclusive;
+ 		if (tmp->usedistinctiveringdetection) {
+ 			if (!tmp->use_callerid) {
+@@ -7429,7 +7676,7 @@
  			break;
  		if (!backwards && (x >= pri->numchans))
  			break;
@@ -6342,7 +6135,7 @@
  			ast_log(LOG_DEBUG, "Found empty available channel %d/%d\n", 
  				pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
  			return x;
-@@ -7444,7 +7679,7 @@
+@@ -7476,7 +7723,7 @@
  	end = ifend;
  	/* We do signed linear */
  	oldformat = format;
@@ -6351,7 +6144,7 @@
  	if (!format) {
  		ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
  		return NULL;
-@@ -7604,6 +7839,11 @@
+@@ -7636,6 +7883,11 @@
  					p->digital = 1;
  					if (tmp)
  						tmp->transfercapability = AST_TRANS_CAP_DIGITAL;
@@ -6363,7 +6156,7 @@
  				} else {
  					ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
  				}
-@@ -7657,6 +7897,57 @@
+@@ -7689,6 +7941,57 @@
  	return NULL;
  }
  
@@ -6421,7 +6214,7 @@
  
  static int pri_find_principle(struct zt_pri *pri, int channel)
  {
-@@ -7689,7 +7980,9 @@
+@@ -7721,7 +8024,9 @@
  static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
  {
  	int x;
@@ -6431,7 +6224,7 @@
  	if (!c) {
  		if (principle < 0)
  			return -1;
-@@ -7703,6 +7996,7 @@
+@@ -7735,6 +8040,7 @@
  	/* First, check for other bearers */
  	for (x=0;x<pri->numchans;x++) {
  		if (!pri->pvts[x]) continue;
@@ -6439,7 +6232,7 @@
  		if (pri->pvts[x]->call == c) {
  			/* Found our call */
  			if (principle != x) {
-@@ -7716,19 +8010,56 @@
+@@ -7748,19 +8054,56 @@
  				}
  				/* Fix it all up now */
  				pri->pvts[principle]->owner = pri->pvts[x]->owner;
@@ -6497,7 +6290,7 @@
  			}
  			return principle;
  		}
-@@ -7757,7 +8088,9 @@
+@@ -7789,7 +8132,9 @@
  		}
  		crv = crv->next;
  	}
@@ -6508,7 +6301,7 @@
  	return -1;
  }
  
-@@ -7819,86 +8152,21 @@
+@@ -7851,86 +8196,21 @@
  #ifndef PRI_RESTART
  #error "Upgrade your libpri"
  #endif
@@ -6602,7 +6395,7 @@
  	do {
  		pri->resetpos++;
  	} while((pri->resetpos < pri->numchans) &&
-@@ -7981,6 +8249,32 @@
+@@ -8013,6 +8293,32 @@
  	}
  }
  
@@ -6635,7 +6428,7 @@
  static void *pri_dchannel(void *vpri)
  {
  	struct zt_pri *pri = vpri;
-@@ -8072,6 +8366,8 @@
+@@ -8104,6 +8410,8 @@
  				} else if (pri->pvts[x] && pri->pvts[x]->owner && pri->pvts[x]->isidlecall)
  					activeidles++;
  			}
@@ -6644,7 +6437,7 @@
  #if 0
  			printf("nextidle: %d, haveidles: %d, minunsed: %d\n",
  				nextidle, haveidles, minunused);
-@@ -8173,9 +8469,36 @@
+@@ -8205,9 +8513,36 @@
  					if (x == ZT_EVENT_ALARM) {
  						pri->dchanavail[which] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
  						pri_find_dchan(pri);
@@ -6683,7 +6476,7 @@
  					}
  				
  					if (option_debug)
-@@ -8187,8 +8510,7 @@
+@@ -8219,8 +8554,7 @@
  					break;
  			}
  		} else if (errno != EINTR)
@@ -6693,7 +6486,7 @@
  		if (e) {
  			if (pri->debug)
  				pri_dump_event(pri->dchans[which], e);
-@@ -8196,32 +8518,101 @@
+@@ -8228,32 +8562,101 @@
  				pri->dchanavail[which] |= DCHAN_UP;
  			switch(e->e) {
  			case PRI_EVENT_DCHAN_UP:
@@ -6819,7 +6612,7 @@
  					pri->resetting = 0;
  					/* Hangup active channels and put them in alarm mode */
  					for (i=0; i<pri->numchans; i++) {
-@@ -8229,7 +8620,7 @@
+@@ -8261,7 +8664,7 @@
  						if (p) {
  							if (p->call) {
  								if (p->pri && p->pri->pri) {
@@ -6828,7 +6621,7 @@
  									pri_destroycall(p->pri->pri, p->call);
  									p->call = NULL;
  								} else
-@@ -8242,6 +8633,7 @@
+@@ -8274,6 +8677,7 @@
  							p->inalarm = 1;
  						}
  					}
@@ -6836,7 +6629,7 @@
  				}
  				break;
  			case PRI_EVENT_RESTART:
-@@ -8276,8 +8668,8 @@
+@@ -8308,8 +8712,8 @@
  								pri_destroycall(pri->pri, pri->pvts[x]->call);
  								pri->pvts[x]->call = NULL;
  							}
@@ -6847,7 +6640,7 @@
   							else if (pri->pvts[x]->owner)
  								pri->pvts[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
  							ast_mutex_unlock(&pri->pvts[x]->lock);
-@@ -8311,7 +8703,6 @@
+@@ -8343,7 +8747,6 @@
  					}
  				}
  				break;
@@ -6855,7 +6648,7 @@
  			case PRI_EVENT_INFO_RECEIVED:
  				chanpos = pri_find_principle(pri, e->ring.channel);
  				if (chanpos < 0) {
-@@ -8320,9 +8711,11 @@
+@@ -8352,9 +8755,11 @@
  				} else {
  					chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
  					if (chanpos > -1) {
@@ -6868,7 +6661,7 @@
  							/* how to do that */
  							int digitlen = strlen(e->ring.callednum);
  							char digit;
-@@ -8334,6 +8727,14 @@
+@@ -8366,6 +8771,14 @@
  									zap_queue_frame(pri->pvts[chanpos], &f, pri);
  								}
  							}
@@ -6883,7 +6676,7 @@
  						}
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					}
-@@ -8341,39 +8742,55 @@
+@@ -8373,39 +8786,55 @@
  				break;
  			case PRI_EVENT_RING:
  				crv = NULL;
@@ -6955,13 +6748,13 @@
  				if (chanpos > -1) {
  					ast_mutex_lock(&pri->pvts[chanpos]->lock);
 +					/* dont detect dtmfs before the signalling is done */
-+					pri->pvts[chanpos]->ignoredtmf = 1;
++					disable_dtmf_detect(pri->pvts[chanpos]);
 +					/* this channel is owned by this TEI */
 +					pri->pvts[chanpos]->tei = e->ring.tei;
  					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));
-@@ -8394,6 +8811,7 @@
+@@ -8426,6 +8855,7 @@
  							break;
  						}
  					}
@@ -6969,7 +6762,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) {
-@@ -8418,29 +8836,78 @@
+@@ -8450,29 +8880,78 @@
  					}
  					apply_plan_to_number(pri->pvts[chanpos]->rdnis, sizeof(pri->pvts[chanpos]->rdnis), pri,
  							     e->ring.redirectingnum, e->ring.callingplanrdnis);
@@ -7061,7 +6854,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)) {
-@@ -8459,22 +8926,38 @@
+@@ -8491,22 +8970,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);
@@ -7107,7 +6900,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);
-@@ -8486,10 +8969,21 @@
+@@ -8518,10 +9013,21 @@
  								ast_log(LOG_DEBUG, "Started up crv %d:%d on bearer channel %d\n", pri->trunkgroup, crv->channel, crv->bearer->channel);
  							} else {
  								c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
@@ -7129,7 +6922,7 @@
  							if(e->ring.ani2 >= 0) {
  								snprintf(ani2str, 5, "%.2d", e->ring.ani2);
  								pbx_builtin_setvar_helper(c, "ANI2", ani2str);
-@@ -8505,8 +8999,8 @@
+@@ -8541,8 +9047,8 @@
  							ast_mutex_lock(&pri->lock);
  							if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
  								if (option_verbose > 2)
@@ -7140,7 +6933,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", 
-@@ -8519,6 +9013,7 @@
+@@ -8555,6 +9061,7 @@
  								}
  							}
  						} else  {
@@ -7148,7 +6941,7 @@
  							ast_mutex_unlock(&pri->lock);
  							/* Release PRI lock while we create the channel */
  							c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
-@@ -8538,10 +9033,26 @@
+@@ -8578,10 +9085,26 @@
  								snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
  								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
  								if (option_verbose > 2)
@@ -7177,7 +6970,7 @@
  							} else {
  								ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n", 
  									pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
-@@ -8550,6 +9061,7 @@
+@@ -8590,6 +9113,7 @@
  							}
  						}
  					} else {
@@ -7185,7 +6978,7 @@
  						if (option_verbose > 2)
  							ast_verbose(VERBOSE_PREFIX_3 "Extension '%s' in context '%s' from '%s' does not exist.  Rejecting call on channel %d/%d, span %d\n",
  								pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan, 
-@@ -8580,7 +9092,7 @@
+@@ -8620,7 +9144,7 @@
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
@@ -7194,7 +6987,7 @@
  							pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
  							pri->pvts[chanpos]->alerting = 1;
  						} else
-@@ -8605,9 +9117,15 @@
+@@ -8649,9 +9173,15 @@
  				}
  				break;
  			case PRI_EVENT_PROGRESS:
@@ -7211,7 +7004,7 @@
  #ifdef PRI_PROGRESS_MASK
  					if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
  #else
-@@ -8654,6 +9172,12 @@
+@@ -8698,6 +9228,12 @@
  			case PRI_EVENT_PROCEEDING:
  				chanpos = pri_find_principle(pri, e->proceeding.channel);
  				if (chanpos > -1) {
@@ -7224,7 +7017,7 @@
  					if (!pri->pvts[chanpos]->proceeding) {
  						struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
  						
-@@ -8704,6 +9228,295 @@
+@@ -8748,6 +9284,295 @@
  					}
  				}
  				break;				
@@ -7520,7 +7313,7 @@
  			case PRI_EVENT_ANSWER:
  				chanpos = pri_find_principle(pri, e->answer.channel);
  				if (chanpos < 0) {
-@@ -8719,6 +9532,7 @@
+@@ -8763,6 +9588,7 @@
  						chanpos = -1;
  					} else {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -7528,7 +7321,7 @@
  						/* Now we can do call progress detection */
  
  						/* We changed this so it turns on the DSP no matter what... progress or no progress.
-@@ -8748,11 +9562,15 @@
+@@ -8792,11 +9618,15 @@
  								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) {
@@ -7541,11 +7334,11 @@
  							zt_enable_ec(pri->pvts[chanpos]);
 +							zt_train_ec(pri->pvts[chanpos]);
 +							/* stop ignoring inband dtmf */
-+							pri->pvts[chanpos]->ignoredtmf = 0;
++							enable_dtmf_detect(pri->pvts[chanpos]);
  						}
- 						if (!ast_strlen_zero(e->answer.useruserinfo)) {
- 							pbx_builtin_setvar_helper(pri->pvts[chanpos]->owner, "USERUSERINFO", e->answer.useruserinfo);
-@@ -8797,18 +9615,21 @@
+ 
+ #ifdef SUPPORT_USERUSER
+@@ -8845,18 +9675,21 @@
  								}
  							}
  							if (option_verbose > 2) 
@@ -7572,8 +7365,8 @@
  						}
  						if (e->hangup.aoc_units > -1)
  							if (option_verbose > 2)
-@@ -8819,8 +9640,20 @@
- 						}
+@@ -8871,8 +9704,20 @@
+ 
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
 -						ast_log(LOG_WARNING, "Hangup on bad channel %d/%d on span %d\n", 
@@ -7595,7 +7388,7 @@
  					}
  				} 
  				break;
-@@ -8830,17 +9663,25 @@
+@@ -8882,17 +9727,25 @@
  			case PRI_EVENT_HANGUP_REQ:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
  				if (chanpos < 0) {
@@ -7624,7 +7417,7 @@
  							pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
  							switch(e->hangup.cause) {
  							case PRI_CAUSE_USER_BUSY:
-@@ -8863,25 +9704,90 @@
+@@ -8915,16 +9768,73 @@
  								if (option_verbose > 2)
  									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");
@@ -7634,38 +7427,48 @@
 + 								// find on hold call
 + 								struct zt_holded_call *onhold = NULL;
 + 								struct ast_channel *transferee = NULL;
++								int transfer_ok = 0;
 + 
 + 								onhold = pri_get_callonhold(pri, -1, e->hangup.tei);
 + 
 + 								if (onhold) {
-+ 									
-+ 								    if (((pri->pvts[chanpos]->owner->_state != AST_STATE_RING) && (pri->pvts[chanpos]->owner->_state != AST_STATE_RESERVED)) || ((!ast_strlen_zero(pri->pvts[chanpos]->exten)) && (strncasecmp(pri->pvts[chanpos]->exten, "s", sizeof(pri->pvts[chanpos]->exten))))) {
-+ 								        transferee = ast_get_holded_call(onhold->uniqueid);
++								    if (pri->pvts[chanpos]->pritransfer == 2) {
++ 									if (((pri->pvts[chanpos]->owner->_state != AST_STATE_RING) && (pri->pvts[chanpos]->owner->_state != AST_STATE_RESERVED)) || ((!ast_strlen_zero(pri->pvts[chanpos]->exten)) && (strncasecmp(pri->pvts[chanpos]->exten, "s", sizeof(pri->pvts[chanpos]->exten))))) {
++ 								    	    transferee = ast_get_holded_call(onhold->uniqueid);
 + 
-+ 									if (transferee) {
-+ 									    if (pri->pvts[chanpos]->owner->_state == AST_STATE_RINGING) {
-+ 									    	ast_indicate(transferee, AST_CONTROL_RINGING);
-+ 									    }
++ 									    if (transferee) {
++ 										if (pri->pvts[chanpos]->owner->_state == AST_STATE_RINGING) {
++ 									    	    ast_indicate(transferee, AST_CONTROL_RINGING);
++ 										}
 + 
-+ 									    pri->pvts[chanpos]->owner->_softhangup &= ~AST_SOFTHANGUP_DEV;
++ 										pri->pvts[chanpos]->owner->_softhangup &= ~AST_SOFTHANGUP_DEV;
 +  
-+  									    ast_mutex_unlock(&transferee->lock);
-+ 									    if (ast_channel_masquerade(pri->pvts[chanpos]->owner, transferee)) {
-+ 										ast_log(LOG_WARNING, "unable to masquerade\n");
-+ 									    } else { 
-+ 										/* beware of zombies!!! */
-+										ast_set_flag(transferee, AST_FLAG_ZOMBIE);
-+ 								//		transferee->zombie = 1;
-+ 										pri->pvts[chanpos]->owner = NULL;
-+ 										pri->pvts[chanpos]->tei = -1;
++  									        ast_mutex_unlock(&transferee->lock);
++ 										if (ast_channel_masquerade(pri->pvts[chanpos]->owner, transferee)) {
++ 										    ast_log(LOG_WARNING, "unable to masquerade\n");
++ 									        } else { 
++ 									    	    /* beware of zombies!!! */
++										    ast_set_flag(transferee, AST_FLAG_ZOMBIE);
++ 										    pri->pvts[chanpos]->owner = NULL;
++ 										    pri->pvts[chanpos]->tei = -1;
++										    transfer_ok = 1;
++ 										}
 + 									    }
-+ 									}
-+ 								    } else { 
++									}	
++ 								    } else if (pri->pvts[chanpos]->pritransfer == 0) {
++									ast_log(LOG_NOTICE, "killing channel %s \n", onhold->uniqueid);
 + 									ast_retrieve_call_to_death(onhold->uniqueid);
-+ 								    }
-+ 								    onhold->alreadyhungup = 1;	
-+ 								    pri_hangup(pri->pri, onhold->call, e->hangup.cause);
-+ 								    onhold = NULL;
++									transfer_ok = 1;
++ 								    } else if (pri->pvts[chanpos]->pritransfer == 1) {
++									/* we use ECT transfers, so just ignore this */
++									transfer_ok = 0;
++								    }
++							
++								    if (transfer_ok) {
++ 									onhold->alreadyhungup = 1;	
++ 									pri_hangup(pri->pri, onhold->call, e->hangup.cause);
++ 									onhold = NULL;
++								    }
 + 								    ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 + 								    break;
 + 								}
@@ -7689,10 +7492,12 @@
 +							    pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
 +							    pri->pvts[chanpos]->resetting = 1;
 +							}
++
  						}
- 						if (!ast_strlen_zero(e->hangup.useruserinfo)) {
- 							pbx_builtin_setvar_helper(pri->pvts[chanpos]->owner, "USERUSERINFO", e->hangup.useruserinfo);
- 						}
+ 
+ #ifdef SUPPORT_USERUSER
+@@ -8935,9 +9845,28 @@
+ 
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  					} else {
 -						ast_log(LOG_WARNING, "Hangup REQ on bad channel %d/%d on span %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
@@ -7721,7 +7526,7 @@
  				break;
  			case PRI_EVENT_HANGUP_ACK:
  				chanpos = pri_find_principle(pri, e->hangup.channel);
-@@ -8895,6 +9801,7 @@
+@@ -8951,6 +9880,7 @@
  					if (chanpos > -1) {
  						ast_mutex_lock(&pri->pvts[chanpos]->lock);
  						pri->pvts[chanpos]->call = NULL;
@@ -7729,9 +7534,9 @@
  						pri->pvts[chanpos]->resetting = 0;
  						if (pri->pvts[chanpos]->owner) {
  							if (option_verbose > 2) 
-@@ -8904,7 +9811,9 @@
- 							pbx_builtin_setvar_helper(pri->pvts[chanpos]->owner, "USERUSERINFO", e->hangup.useruserinfo);
- 						}
+@@ -8964,7 +9894,9 @@
+ #endif
+ 
  						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 +					    }
  					}
@@ -7739,7 +7544,7 @@
  				}
  				break;
  			case PRI_EVENT_CONFIG_ERR:
-@@ -8971,15 +9880,25 @@
+@@ -9031,15 +9963,25 @@
  					ast_log(LOG_WARNING, "Received SETUP_ACKNOWLEDGE on unconfigured channel %d/%d span %d\n", 
  						PRI_SPAN(e->setup_ack.channel), PRI_CHANNEL(e->setup_ack.channel), pri->span);
  				} else {
@@ -7770,7 +7575,7 @@
  				}
  				break;
  			case PRI_EVENT_NOTIFY:
-@@ -9003,6 +9922,78 @@
+@@ -9063,6 +10005,78 @@
  					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
  				}
  				break;
@@ -7849,7 +7654,7 @@
  			default:
  				ast_log(LOG_DEBUG, "Event: %d\n", e->e);
  			}
-@@ -9064,7 +10055,7 @@
+@@ -9124,7 +10138,7 @@
  			pri->fds[i] = -1;
  			return -1;
  		}
@@ -7858,7 +7663,7 @@
  		/* Force overlap dial if we're doing GR-303! */
  		if (pri->switchtype == PRI_SWITCH_GR303_TMC)
  			pri->overlapdial = 1;
-@@ -9133,39 +10124,77 @@
+@@ -9193,39 +10207,77 @@
  
  static int handle_pri_set_debug_file(int fd, int argc, char **argv)
  {
@@ -7958,7 +7763,7 @@
  	}
  
  	return RESULT_SUCCESS;
-@@ -9197,6 +10226,7 @@
+@@ -9257,6 +10309,7 @@
  
  
  
@@ -7966,7 +7771,7 @@
  static int handle_pri_no_debug(int fd, int argc, char *argv[])
  {
  	int span;
-@@ -9303,36 +10333,6 @@
+@@ -9363,36 +10416,6 @@
  	return RESULT_SUCCESS;
  }
  
@@ -8003,7 +7808,7 @@
  static char pri_debug_help[] = 
  	"Usage: pri debug span <span>\n"
  	"       Enables debugging on a given PRI span\n";
-@@ -9349,6 +10349,18 @@
+@@ -9409,6 +10432,18 @@
  	"Usage: pri show span <span>\n"
  	"       Displays PRI Information\n";
  
@@ -8022,7 +7827,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 },
-@@ -9356,19 +10368,77 @@
+@@ -9416,19 +10451,77 @@
  	  "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 },
@@ -8103,7 +7908,7 @@
  #ifdef ZAPATA_R2
  static int handle_r2_no_debug(int fd, int argc, char *argv[])
  {
-@@ -9991,6 +11061,7 @@
+@@ -10051,6 +11144,7 @@
  	ast_manager_unregister( "ZapDNDoff" );
  	ast_manager_unregister( "ZapDNDon" );
  	ast_manager_unregister("ZapShowChannels");
@@ -8111,7 +7916,7 @@
  	ast_channel_unregister(&zap_tech);
  	if (!ast_mutex_lock(&iflock)) {
  		/* Hangup all interfaces if they have an owner */
-@@ -10349,8 +11420,8 @@
+@@ -10409,8 +11503,8 @@
  			}
  		} else if (!strcasecmp(v->name, "echotraining")) {
  			if (sscanf(v->value, "%d", &y) == 1) {
@@ -8122,7 +7927,7 @@
  				} else {
  					echotraining = y;
  				}
-@@ -10536,6 +11607,22 @@
+@@ -10596,6 +11690,22 @@
  					cur_signalling = SIG_GR303FXSKS;
  					cur_radio = 0;
  					pritype = PRI_CPE;
@@ -8145,7 +7950,7 @@
  #endif
  #ifdef ZAPATA_R2
  				} else if (!strcasecmp(v->value, "r2")) {
-@@ -10624,8 +11711,10 @@
+@@ -10684,8 +11794,20 @@
  					priindication_oob = 1;
  				else if (!strcasecmp(v->value, "inband"))
  					priindication_oob = 0;
@@ -8154,10 +7959,20 @@
  				else
 -					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d\n",
 +					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' , 'outofband' or 'passthrough' at line %d\n",
++						v->value, v->lineno);
++			} else if (!strcasecmp(v->name, "pritransfer")) {
++				if (!strcasecmp(v->value, "no"))
++					pritransfer = 0;
++				else if (!strcasecmp(v->value, "ect"))
++					pritransfer = 1;
++				else if (!strcasecmp(v->value, "hangup"))
++					pritransfer = 2;
++				else
++					ast_log(LOG_WARNING, "'%s' is not a valid pri transfer value, should be 'no' , 'ect' or 'hangup' at line %d\n",
  						v->value, v->lineno);
  			} else if (!strcasecmp(v->name, "priexclusive")) {
  				cur_priexclusive = ast_true(v->value);
-@@ -10639,6 +11728,10 @@
+@@ -10699,6 +11821,10 @@
  				ast_copy_string(privateprefix, v->value, sizeof(privateprefix));
  			} else if (!strcasecmp(v->name, "unknownprefix")) {
  				ast_copy_string(unknownprefix, v->value, sizeof(unknownprefix));
@@ -8168,7 +7983,7 @@
  			} else if (!strcasecmp(v->name, "resetinterval")) {
  				if (!strcasecmp(v->value, "never"))
  					resetinterval = -1;
-@@ -10653,6 +11746,8 @@
+@@ -10713,6 +11839,8 @@
  				ast_copy_string(idleext, v->value, sizeof(idleext));
  			} else if (!strcasecmp(v->name, "idledial")) {
  				ast_copy_string(idledial, v->value, sizeof(idledial));
@@ -8177,7 +7992,7 @@
  			} else if (!strcasecmp(v->name, "overlapdial")) {
  				overlapdial = ast_true(v->value);
  			} else if (!strcasecmp(v->name, "pritimer")) {
-@@ -10838,6 +11933,7 @@
+@@ -10898,6 +12026,7 @@
  #ifdef ZAPATA_PRI
  	if (!reload) {
  		for (x=0;x<NUM_SPANS;x++) {
@@ -8185,7 +8000,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);
-@@ -10895,11 +11991,46 @@
+@@ -10955,11 +12084,46 @@
  	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");
@@ -8233,7 +8048,7 @@
  {
  #define	END_SILENCE_LEN 400
  #define	HEADER_MS 50
-@@ -10918,6 +12049,7 @@
+@@ -10978,6 +12142,7 @@
  	float scont = 0.0;
  	int index;
  
@@ -8241,9 +8056,58 @@
  	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.1.orig/codecs/codec_ilbc.c asterisk-1.2.1/codecs/codec_ilbc.c
---- asterisk-1.2.1.orig/codecs/codec_ilbc.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/codecs/codec_ilbc.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/channels/Makefile asterisk-1.2.4/channels/Makefile
+--- asterisk-1.2.4.orig/channels/Makefile	2005-12-15 11:52:30.000000000 +0100
++++ asterisk-1.2.4/channels/Makefile	2006-01-31 09:41:43.000000000 +0100
+@@ -122,6 +122,35 @@
+ endif
+ endif # WITHOUT_ZAPTEL
+ 
++ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/capi20.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/capi20.h),)
++  CHANNEL_LIBS+=chan_capi.so
++# uncomment the following line if you really never ever want early b3 connects,
++# you can also configure it in the dialstring, this is just for performance
++# NOTE: this is probably obsolete by using the "R" dial option
++#CFLAGS+=-DCAPI_NEVER_EVER_EARLY_B3_CONNECTS
++
++# uncommnet next line to force dtmf software detection/generation, can also be configured
++# in capi.conf on a perdevice basis (softdtmf=1)
++#CFLAGS+=-DCAPI_FORCE_SOFTWARE_DTMF
++
++# uncomment the next line if you are in the ulaw world
++#CFLAGS+=-DCAPI_ULAW
++
++# very experimental echo squelching
++CFLAGS+=-DCAPI_ES
++
++#gains
++CFLAGS+=-DCAPI_GAIN
++
++# what do to with call waiting connect indications?
++# uncomment the next line for call deflection in that case
++CFLAGS+=-DCAPI_DEFLECT_ON_CIRCUITBUSY
++
++# audio sync
++CFLAGS+=-DCAPI_SYNC
++
++endif
++
+ ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h),)
+   CHANNEL_LIBS+=chan_vpb.so
+   CFLAGS+=-DLINUX
+@@ -220,6 +249,9 @@
+ chan_nbs.so: chan_nbs.o
+ 	$(CC) $(SOLINK) -o $@ $< -lnbs
+ 
++chan_capi.so: chan_capi.o
++	$(CC) $(SOLINK) -o $@ $< -lcapi20
++
+ chan_vpb.o: chan_vpb.c
+ 	$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
+ 
+diff -urN asterisk-1.2.4.orig/codecs/codec_ilbc.c asterisk-1.2.4/codecs/codec_ilbc.c
+--- asterisk-1.2.4.orig/codecs/codec_ilbc.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/codecs/codec_ilbc.c	2006-01-31 09:41:43.000000000 +0100
 @@ -49,7 +49,7 @@
  #include "slin_ilbc_ex.h"
  #include "ilbc_slin_ex.h"
@@ -8253,9 +8117,9 @@
  #define ILBC_MS 			30
  /* #define ILBC_MS			20 */
  
-diff -urN asterisk-1.2.1.orig/configs/capi.conf.sample asterisk-1.2.1/configs/capi.conf.sample
---- asterisk-1.2.1.orig/configs/capi.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/configs/capi.conf.sample	2005-12-21 14:49:40.000000000 +0100
+diff -urN asterisk-1.2.4.orig/configs/capi.conf.sample asterisk-1.2.4/configs/capi.conf.sample
+--- asterisk-1.2.4.orig/configs/capi.conf.sample	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/configs/capi.conf.sample	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,44 @@
 +;
 +; CAPI config
@@ -8301,17 +8165,17 @@
 +;msn=55512
 +;controller=2
 +;devices => 30
-diff -urN asterisk-1.2.1.orig/configs/modules.conf.sample asterisk-1.2.1/configs/modules.conf.sample
---- asterisk-1.2.1.orig/configs/modules.conf.sample	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/configs/modules.conf.sample	2005-12-21 14:50:24.000000000 +0100
+diff -urN asterisk-1.2.4.orig/configs/modules.conf.sample asterisk-1.2.4/configs/modules.conf.sample
+--- asterisk-1.2.4.orig/configs/modules.conf.sample	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/configs/modules.conf.sample	2006-01-31 09:41:43.000000000 +0100
 @@ -51,3 +51,4 @@
  ; exported to modules loaded after them.
  ;
  [global]
 +chan_capi.so=yes
-diff -urN asterisk-1.2.1.orig/configs/watchdog.conf.sample asterisk-1.2.1/configs/watchdog.conf.sample
---- asterisk-1.2.1.orig/configs/watchdog.conf.sample	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/configs/watchdog.conf.sample	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/configs/watchdog.conf.sample asterisk-1.2.4/configs/watchdog.conf.sample
+--- asterisk-1.2.4.orig/configs/watchdog.conf.sample	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/configs/watchdog.conf.sample	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,22 @@
 +;
 +; Configuration file for res_watchdog
@@ -8335,10 +8199,34 @@
 +;device = /dev/watchdog
 +;interval = 100
 +
-diff -urN asterisk-1.2.1.orig/db.c asterisk-1.2.1/db.c
---- asterisk-1.2.1.orig/db.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/db.c	2005-12-21 14:25:44.000000000 +0100
-@@ -514,11 +514,18 @@
+diff -urN asterisk-1.2.4.orig/configs/zapata.conf.sample asterisk-1.2.4/configs/zapata.conf.sample
+--- asterisk-1.2.4.orig/configs/zapata.conf.sample	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/configs/zapata.conf.sample	2006-01-31 09:41:43.000000000 +0100
+@@ -121,9 +121,20 @@
+ ; 
+ ; outofband:      Signal Busy/Congestion out of band with RELEASE/DISCONNECT
+ ; inband:         Signal Busy/Congestion using in-band tones
++; passthrough:	  Listen to the telco
+ ;
+ ; priindication = outofband
+ ;
++; PRI/BRI transfers (HOLD -> SETUP -> ECT/Hangup)
++;
++; Configure how transfers are initiated. ECT should be preferred
++;
++; no:		no transfers allowed (results in hangup)
++; ect:  	use ECT (facility)
++: hangup:	transfer on hangup (if your phones dont support ECT)
++;
++; pritransfer = ect
++;
+ ; 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.4.orig/db.c asterisk-1.2.4/db.c
+--- asterisk-1.2.4.orig/db.c	2006-01-09 19:09:53.000000000 +0100
++++ asterisk-1.2.4/db.c	2006-01-31 09:41:43.000000000 +0100
+@@ -516,11 +516,18 @@
  struct ast_cli_entry cli_database_deltree =
  { { "database", "deltree", NULL }, database_deltree, "Removes database keytree/values", database_deltree_usage };
  
@@ -8358,7 +8246,7 @@
  	int res;
  
  	if (!strlen(family)) {
-@@ -543,6 +550,12 @@
+@@ -545,6 +552,12 @@
  	return 0;
  }
  
@@ -8371,7 +8259,7 @@
  static int manager_dbget(struct mansession *s, struct message *m)
  {
  	char *id = astman_get_header(m,"ActionID");
-@@ -572,7 +585,7 @@
+@@ -574,7 +587,7 @@
  		ast_cli(s->fd, "Event: DBGetResponse\r\n"
  				"Family: %s\r\n"
  				"Key: %s\r\n"
@@ -8380,7 +8268,7 @@
  				"%s"
  				"\r\n",
  				family, key, tmp, idText);
-@@ -580,6 +593,39 @@
+@@ -582,6 +595,39 @@
  	return 0;
  }
  
@@ -8420,7 +8308,7 @@
  int astdb_init(void)
  {
  	dbinit();
-@@ -589,7 +635,8 @@
+@@ -591,7 +637,8 @@
  	ast_cli_register(&cli_database_put);
  	ast_cli_register(&cli_database_del);
  	ast_cli_register(&cli_database_deltree);
@@ -8431,9 +8319,9 @@
 +	ast_manager_register("DBdel", EVENT_FLAG_SYSTEM, manager_dbdel, mandescr_dbdel);
  	return 0;
  }
-diff -urN asterisk-1.2.1.orig/devicestate.c asterisk-1.2.1/devicestate.c
---- asterisk-1.2.1.orig/devicestate.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/devicestate.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/devicestate.c asterisk-1.2.4/devicestate.c
+--- asterisk-1.2.4.orig/devicestate.c	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/devicestate.c	2006-01-31 09:41:43.000000000 +0100
 @@ -62,6 +62,8 @@
  
  struct state_change {
@@ -8550,18 +8438,10 @@
  			free(cur);
  			AST_LIST_LOCK(&state_changes);
  		} else {
-diff -urN asterisk-1.2.1.orig/doc/README.asterisk.conf asterisk-1.2.1/doc/README.asterisk.conf
---- asterisk-1.2.1.orig/doc/README.asterisk.conf	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/doc/README.asterisk.conf	2006-01-05 10:28:44.000000000 +0100
-@@ -52,6 +52,7 @@
- runuser = asterisk				; User to run asterisk as (-U) NOTE: will require changes to
- 						; directory and device permisions
- rungroup = asterisk				; Group to run asterisk as (-G)
-+silence_suppression = yes | no			; Enable silence suppression support (-s)
- 
- ;These options have no command line equivalent
- cache_record_files = yes | no			; Cache record() files in another directory until completion
-@@ -62,6 +63,7 @@
+diff -urN asterisk-1.2.4.orig/doc/README.asterisk.conf asterisk-1.2.4/doc/README.asterisk.conf
+--- asterisk-1.2.4.orig/doc/README.asterisk.conf	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/doc/README.asterisk.conf	2006-01-31 09:41:43.000000000 +0100
+@@ -62,6 +62,7 @@
  maxcalls = 255					; The maximum number of concurrent calls you want to allow 
  execincludes = yes | no 			; Allow #exec entries in configuration files
  dontwarn = yes | no				; Don't over-inform the Asterisk sysadm, he's a guru
@@ -8569,9 +8449,9 @@
  
  [files]
  ; Changing the following lines may compromise your security
-diff -urN asterisk-1.2.1.orig/editline/cygdef.h asterisk-1.2.1/editline/cygdef.h
---- asterisk-1.2.1.orig/editline/cygdef.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/editline/cygdef.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/editline/cygdef.h asterisk-1.2.4/editline/cygdef.h
+--- asterisk-1.2.4.orig/editline/cygdef.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/editline/cygdef.h	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,11 @@
 +/* cygdef.h. Generated automatically by configure. */ 
 +#ifndef _CYGDEF_H_
@@ -8584,9 +8464,32 @@
 + 
 +
 +#endif /* _CYGDEF_H_ */
-diff -urN asterisk-1.2.1.orig/include/asterisk/agi.h asterisk-1.2.1/include/asterisk/agi.h
---- asterisk-1.2.1.orig/include/asterisk/agi.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/agi.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/HARDWARE asterisk-1.2.4/HARDWARE
+--- asterisk-1.2.4.orig/HARDWARE	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/HARDWARE	2006-01-31 09:41:43.000000000 +0100
+@@ -37,6 +37,19 @@
+    * Wildcard TE410P - Quad T1/E1 switchable interface.  Supports PRI and 
+      RBS signalling, as well as PPP, FR, and HDLC data modes.
+ 
++-- Junghanns.NET (Primary author of BRIstuff)
++	http://www.junghanns.net
++	
++    * quadBRI PCI ISDN - 4port BRI ISDN interface, supports NT and TE mode
++    
++    * octoBRI PCI ISDN - 8port BRI ISDN interface, supports NT and TE mode
++
++    * singleE1 PCI ISDN - Single E1 interface
++
++    * doubleE1 PCI ISDN - Double E1 interface
++    
++    * quadGSM PCI ISDN - 4 channel GSM interface
++
+ Non-zaptel compatible hardware
+ ==============================
+ 
+diff -urN asterisk-1.2.4.orig/include/asterisk/agi.h asterisk-1.2.4/include/asterisk/agi.h
+--- asterisk-1.2.4.orig/include/asterisk/agi.h	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/agi.h	2006-01-31 09:41:43.000000000 +0100
 @@ -29,7 +29,8 @@
  
  typedef struct agi_state {
@@ -8597,9 +8500,43 @@
  	int ctrl;	/* FD for input control */
  } AGI;
  
-diff -urN asterisk-1.2.1.orig/include/asterisk/chan_capi.h asterisk-1.2.1/include/asterisk/chan_capi.h
---- asterisk-1.2.1.orig/include/asterisk/chan_capi.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/chan_capi.h	2005-12-21 14:40:15.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/chan_capi_app.h asterisk-1.2.4/include/asterisk/chan_capi_app.h
+--- asterisk-1.2.4.orig/include/asterisk/chan_capi_app.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/chan_capi_app.h	2006-01-31 09:41:43.000000000 +0100
+@@ -0,0 +1,30 @@
++/*
++ * (CAPI*)
++ *
++ * An implementation of Common ISDN API 2.0 for Asterisk
++ *
++ * include file for helper applications
++ *
++ * Copyright (C) 2002, 2003, 2004, Junghanns.NET GmbH
++ *
++ * Klaus-Peter Junghanns <kapejod at ns1.jnetdns.de>
++ *
++ * This program is free software and may be modified and 
++ * distributed under the terms of the GNU Public License.
++ */
++
++#ifndef _ASTERISK_CAPI_IF_H
++#define _ASTERISK_CAPI_IF_H
++ 
++// exported symbols from chan_capi
++
++// important things we need
++extern unsigned ast_capi_ApplID;
++extern unsigned ast_capi_MessageNumber;
++extern int capidebug;
++
++extern int capi_call(struct ast_channel *c, char *idest, int timeout);
++extern int capi_detect_dtmf(struct ast_channel *c, int flag);
++extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
++
++#endif
+diff -urN asterisk-1.2.4.orig/include/asterisk/chan_capi.h asterisk-1.2.4/include/asterisk/chan_capi.h
+--- asterisk-1.2.4.orig/include/asterisk/chan_capi.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/chan_capi.h	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,276 @@
 +/*
 + * (CAPI*)
@@ -8877,43 +8814,9 @@
 +#define CAPI_ETSI_NPLAN_INTERNAT	0x10
 +
 +#endif
-diff -urN asterisk-1.2.1.orig/include/asterisk/chan_capi_app.h asterisk-1.2.1/include/asterisk/chan_capi_app.h
---- asterisk-1.2.1.orig/include/asterisk/chan_capi_app.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/chan_capi_app.h	2005-12-21 14:25:44.000000000 +0100
-@@ -0,0 +1,30 @@
-+/*
-+ * (CAPI*)
-+ *
-+ * An implementation of Common ISDN API 2.0 for Asterisk
-+ *
-+ * include file for helper applications
-+ *
-+ * Copyright (C) 2002, 2003, 2004, Junghanns.NET GmbH
-+ *
-+ * Klaus-Peter Junghanns <kapejod at ns1.jnetdns.de>
-+ *
-+ * This program is free software and may be modified and 
-+ * distributed under the terms of the GNU Public License.
-+ */
-+
-+#ifndef _ASTERISK_CAPI_IF_H
-+#define _ASTERISK_CAPI_IF_H
-+ 
-+// exported symbols from chan_capi
-+
-+// important things we need
-+extern unsigned ast_capi_ApplID;
-+extern unsigned ast_capi_MessageNumber;
-+extern int capidebug;
-+
-+extern int capi_call(struct ast_channel *c, char *idest, int timeout);
-+extern int capi_detect_dtmf(struct ast_channel *c, int flag);
-+extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
-+
-+#endif
-diff -urN asterisk-1.2.1.orig/include/asterisk/channel.h asterisk-1.2.1/include/asterisk/channel.h
---- asterisk-1.2.1.orig/include/asterisk/channel.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/channel.h	2006-01-05 10:22:00.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/channel.h asterisk-1.2.4/include/asterisk/channel.h
+--- asterisk-1.2.4.orig/include/asterisk/channel.h	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/channel.h	2006-01-31 09:41:43.000000000 +0100
 @@ -86,6 +86,9 @@
  #ifndef _ASTERISK_CHANNEL_H
  #define _ASTERISK_CHANNEL_H
@@ -8933,10 +8836,12 @@
  
  	/* Why is the channel hanged up */
  	int hangupcause;
-@@ -531,6 +534,9 @@
+@@ -531,6 +534,11 @@
  #define AST_STATE_MUTE		(1 << 16)	
  /*! @} */
  
++extern ast_mutex_t uniquelock;			
++
 +/*! \brief Change the state of a channel and the callerid of the calling channel*/
 +int ast_setstate_and_cid(struct ast_channel *chan, int state, char *cid_num, char *cid_name);
 +
@@ -8969,7 +8874,7 @@
  struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const char *context);
  
 +/*! Get channel by uniqueid (locks channel) */
-+struct ast_channel *ast_get_channel_by_uniqueid_locked(char *uniqueid);
++struct ast_channel *ast_get_channel_by_uniqueid_locked(const char *uniqueid);
 + 
 +
  /*! Waits for a digit */
@@ -8985,26 +8890,9 @@
  
  /*! Gives the string form of a given cause code */
  /*! 
-@@ -1100,6 +1115,16 @@
-  */
- void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state);
- 
-+/*!
-+  \brief Check if the channel can run in silence suppression mode.
-+  \param chan The channel to check
-+  \return boolean
-+
-+  This function will return 1 if silence suppression is enabled and the timing
-+  device is available.
-+ */
-+int ast_silence_suppression_enabled(struct ast_channel *chan);
-+
- /* Misc. functions below */
- 
- /* Helper function for migrating select to poll */
-diff -urN asterisk-1.2.1.orig/include/asterisk/devicestate.h asterisk-1.2.1/include/asterisk/devicestate.h
---- asterisk-1.2.1.orig/include/asterisk/devicestate.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/devicestate.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/devicestate.h asterisk-1.2.4/include/asterisk/devicestate.h
+--- asterisk-1.2.4.orig/include/asterisk/devicestate.h	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/devicestate.h	2006-01-31 09:41:43.000000000 +0100
 @@ -42,7 +42,7 @@
  /*! Device is ringing */
  #define AST_DEVICE_RINGING	6
@@ -9023,9 +8911,9 @@
  
  /*! \brief Registers a device state change callback 
   * \param callback Callback
-diff -urN asterisk-1.2.1.orig/include/asterisk/features.h asterisk-1.2.1/include/asterisk/features.h
---- asterisk-1.2.1.orig/include/asterisk/features.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/features.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/features.h asterisk-1.2.4/include/asterisk/features.h
+--- asterisk-1.2.4.orig/include/asterisk/features.h	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/features.h	2006-01-31 09:41:43.000000000 +0100
 @@ -45,6 +45,8 @@
  };
  
@@ -9068,20 +8956,9 @@
 +extern struct ast_call_feature *ast_find_builtin_feature(char *name);
 +
  #endif /* _AST_FEATURES_H */
-diff -urN asterisk-1.2.1.orig/include/asterisk/options.h asterisk-1.2.1/include/asterisk/options.h
---- asterisk-1.2.1.orig/include/asterisk/options.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/options.h	2006-01-05 10:22:08.000000000 +0100
-@@ -47,6 +47,7 @@
- extern double option_maxload;
- extern int option_dontwarn;
- extern int option_priority_jumping;
-+extern int option_silence_suppression;
- extern char defaultlanguage[];
- extern time_t ast_startuptime;
- extern time_t ast_lastreloadtime;
-diff -urN asterisk-1.2.1.orig/include/asterisk/pbx.h asterisk-1.2.1/include/asterisk/pbx.h
---- asterisk-1.2.1.orig/include/asterisk/pbx.h	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/pbx.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/pbx.h asterisk-1.2.4/include/asterisk/pbx.h
+--- asterisk-1.2.4.orig/include/asterisk/pbx.h	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/pbx.h	2006-01-31 09:41:43.000000000 +0100
 @@ -57,7 +57,7 @@
  	AST_EXTENSION_BUSY = 1 << 1,
  	/*! All devices UNAVAILABLE/UNREGISTERED */
@@ -9132,9 +9009,9 @@
  
  #if defined(__cplusplus) || defined(c_plusplus)
  }
-diff -urN asterisk-1.2.1.orig/include/asterisk/xlaw.h asterisk-1.2.1/include/asterisk/xlaw.h
---- asterisk-1.2.1.orig/include/asterisk/xlaw.h	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk/xlaw.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk/xlaw.h asterisk-1.2.4/include/asterisk/xlaw.h
+--- asterisk-1.2.4.orig/include/asterisk/xlaw.h	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/include/asterisk/xlaw.h	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,1665 @@
 +#ifndef _ASTERISK_XLAW_H
 +#define _ASTERISK_XLAW_H
@@ -10801,9 +10678,9 @@
 +#endif // CAPI_ULAW
 +#endif
 +
-diff -urN asterisk-1.2.1.orig/include/asterisk.h asterisk-1.2.1/include/asterisk.h
---- asterisk-1.2.1.orig/include/asterisk.h	2005-11-30 04:37:37.000000000 +0100
-+++ asterisk-1.2.1/include/asterisk.h	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/include/asterisk.h asterisk-1.2.4/include/asterisk.h
+--- asterisk-1.2.4.orig/include/asterisk.h	2005-11-30 04:37:37.000000000 +0100
++++ asterisk-1.2.4/include/asterisk.h	2006-01-31 09:41:43.000000000 +0100
 @@ -36,6 +36,7 @@
  extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
  extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
@@ -10812,9 +10689,37 @@
  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.1.orig/manager.c asterisk-1.2.1/manager.c
---- asterisk-1.2.1.orig/manager.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/manager.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/LICENSE asterisk-1.2.4/LICENSE
+--- asterisk-1.2.4.orig/LICENSE	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/LICENSE	2006-01-31 09:41:43.000000000 +0100
+@@ -1,7 +1,7 @@
+-Asterisk is distributed under the GNU General Public License version 2
+-and is also available under alternative licenses negotiated directly
+-with Digium, Inc. If you obtained Asterisk under the GPL, then the GPL
+-applies to all loadable Asterisk modules used on your system as well,
++BRIstuffed Asterisk is distributed under the GNU General Public License version 2
++and is not available under any alternative licenses.
++If you obtained BRIstuffed Asterisk under the GPL, then the GPL
++applies to all loadable BRIstuffed Asterisk modules used on your system as well,
+ except as defined below. The GPL (version 2) is included in this
+ source tree in the file COPYING.
+ 
+diff -urN asterisk-1.2.4.orig/Makefile asterisk-1.2.4/Makefile
+--- asterisk-1.2.4.orig/Makefile	2005-12-05 07:47:51.000000000 +0100
++++ asterisk-1.2.4/Makefile	2006-01-31 09:41:43.000000000 +0100
+@@ -759,6 +759,9 @@
+ 		echo ";astctlowner = root" ; \
+ 		echo ";astctlgroup = apache" ; \
+ 		echo ";astctl = asterisk.ctl" ; \
++		echo "[options]" ; \
++		echo "uniquename = asterisk" ;\
++		echo "silence_suppression = yes" ;\
+ 		) > $(DESTDIR)$(ASTCONFPATH) ; \
+ 	else \
+ 		echo "Skipping asterisk.conf creation"; \
+diff -urN asterisk-1.2.4.orig/manager.c asterisk-1.2.4/manager.c
+--- asterisk-1.2.4.orig/manager.c	2006-01-09 05:52:16.000000000 +0100
++++ asterisk-1.2.4/manager.c	2006-01-31 09:41:43.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -11054,15 +10959,6 @@
  	return 0;
  }
  
-@@ -1391,7 +1442,7 @@
- 	int res;
- 	
- 	ast_mutex_lock(&s->__lock);
--	ast_cli(s->fd, "Asterisk Call Manager/1.0\r\n");
-+	ast_cli(s->fd, "Asterisk Call Manager/1.2\r\n");
- 	ast_mutex_unlock(&s->__lock);
- 	memset(&m, 0, sizeof(m));
- 	for (;;) {
 @@ -1569,10 +1620,10 @@
  	return 0;
  }
@@ -11076,9 +10972,9 @@
  	return 0;
  }
  
-diff -urN asterisk-1.2.1.orig/pbx/pbx_spool.c asterisk-1.2.1/pbx/pbx_spool.c
---- asterisk-1.2.1.orig/pbx/pbx_spool.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/pbx/pbx_spool.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/pbx/pbx_spool.c asterisk-1.2.4/pbx/pbx_spool.c
+--- asterisk-1.2.4.orig/pbx/pbx_spool.c	2006-01-09 21:08:24.000000000 +0100
++++ asterisk-1.2.4/pbx/pbx_spool.c	2006-01-31 09:41:43.000000000 +0100
 @@ -260,11 +260,11 @@
  	if (!ast_strlen_zero(o->app)) {
  		if (option_verbose > 2)
@@ -11093,9 +10989,9 @@
  	}
  	if (res) {
  		ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
-diff -urN asterisk-1.2.1.orig/pbx.c asterisk-1.2.1/pbx.c
---- asterisk-1.2.1.orig/pbx.c	2005-12-02 01:51:15.000000000 +0100
-+++ asterisk-1.2.1/pbx.c	2006-01-04 14:56:47.000000000 +0100
+diff -urN asterisk-1.2.4.orig/pbx.c asterisk-1.2.4/pbx.c
+--- asterisk-1.2.4.orig/pbx.c	2006-01-22 03:05:41.000000000 +0100
++++ asterisk-1.2.4/pbx.c	2006-01-31 09:41:43.000000000 +0100
 @@ -350,7 +350,8 @@
  	
  	{ "Hangup", pbx_builtin_hangup,
@@ -11106,7 +11002,7 @@
  	},
  
  	{ "NoOp", pbx_builtin_noop,
-@@ -1873,7 +1874,7 @@
+@@ -1871,7 +1872,7 @@
  	return ast_extension_state2(e);    		/* Check all devices in the hint */
  }
  
@@ -11115,7 +11011,7 @@
  {
  	struct ast_hint *hint;
  	struct ast_state_cb *cblist;
-@@ -1901,11 +1902,11 @@
+@@ -1899,11 +1900,11 @@
  			
  			/* For general callbacks */
  			for (cblist = statecbs; cblist; cblist = cblist->next)
@@ -11129,7 +11025,7 @@
  			
  			hint->laststate = state;
  			break;
-@@ -2146,7 +2147,7 @@
+@@ -2144,7 +2145,7 @@
  				/* Notify with -1 and remove all callbacks */
  				cbprev = cblist;	    
  				cblist = cblist->next;
@@ -11138,7 +11034,7 @@
  				free(cbprev);
  	    		}
  	    		list->callbacks = NULL;
-@@ -3760,7 +3761,7 @@
+@@ -3758,7 +3759,7 @@
  			while (thiscb) {
  				prevcb = thiscb;	    
  				thiscb = thiscb->next;
@@ -11147,7 +11043,7 @@
  				free(prevcb);
  	    		}
  		} else {
-@@ -4949,7 +4950,7 @@
+@@ -4957,7 +4958,7 @@
  	return 0;  /* success */
  }
  
@@ -11156,7 +11052,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -4959,7 +4960,7 @@
+@@ -4967,7 +4968,7 @@
  
  	if (sync) {
  		LOAD_OH(oh);
@@ -11165,7 +11061,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5055,7 +5056,7 @@
+@@ -5063,7 +5064,7 @@
  			goto outgoing_exten_cleanup;
  		}	
  		memset(as, 0, sizeof(struct async_stat));
@@ -11174,7 +11070,7 @@
  		if (channel) {
  			*channel = chan;
  			if (chan)
-@@ -5097,7 +5098,7 @@
+@@ -5105,7 +5106,7 @@
  	pthread_t t;
  };
  
@@ -11183,7 +11079,7 @@
  {
  	struct app_tmp *tmp = data;
  	struct ast_app *app;
-@@ -5113,7 +5114,7 @@
+@@ -5121,7 +5122,7 @@
  	return NULL;
  }
  
@@ -11192,7 +11088,7 @@
  {
  	struct ast_channel *chan;
  	struct async_stat *as;
-@@ -5132,7 +5133,7 @@
+@@ -5140,7 +5141,7 @@
  		goto outgoing_app_cleanup;	
  	}
  	if (sync) {
@@ -11201,7 +11097,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);
-@@ -5217,7 +5218,8 @@
+@@ -5225,7 +5226,8 @@
  			goto outgoing_app_cleanup;
  		}
  		memset(as, 0, sizeof(struct async_stat));
@@ -11211,7 +11107,7 @@
  		if (!chan) {
  			free(as);
  			res = -1;
-@@ -5502,6 +5504,9 @@
+@@ -5510,6 +5512,9 @@
   */
  static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
  {
@@ -11219,9 +11115,9 @@
 +        if (data)
 +	       chan->hangupcause = atoi(data);
  	/* Just return non-zero and it will hang up */
- 	return -1;
- }
-@@ -6141,6 +6146,9 @@
+ 	if (!chan->hangupcause)
+ 		chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
+@@ -6151,6 +6156,9 @@
  			return -1;
  		}
  	}
@@ -11231,7 +11127,7 @@
  	return res = ast_say_number(chan, atoi((char *) tmp), "", chan->language, options);
  }
  
-@@ -6148,8 +6156,12 @@
+@@ -6158,8 +6166,12 @@
  {
  	int res = 0;
  
@@ -11245,7 +11141,7 @@
  	return res;
  }
  	
-@@ -6157,8 +6169,12 @@
+@@ -6167,8 +6179,12 @@
  {
  	int res = 0;
  
@@ -11259,7 +11155,7 @@
  	return res;
  }
  	
-@@ -6166,8 +6182,12 @@
+@@ -6176,8 +6192,12 @@
  {
  	int res = 0;
  
@@ -11273,9 +11169,171 @@
  	return res;
  }
  	
-diff -urN asterisk-1.2.1.orig/res/Makefile asterisk-1.2.1/res/Makefile
---- asterisk-1.2.1.orig/res/Makefile	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/res/Makefile	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/README asterisk-1.2.4/README
+--- asterisk-1.2.4.orig/README	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/README	2006-01-31 09:41:43.000000000 +0100
+@@ -4,6 +4,8 @@
+ 
+ Copyright (C) 2001-2005 Digium, Inc.
+ and other copyright holders.
++Copyright (C) 2002-2005 Junghanns.NET GmbH 
++and other copyright holders.
+ ================================================================
+ 
+ * SECURITY
+diff -urN asterisk-1.2.4.orig/README.chan_capi asterisk-1.2.4/README.chan_capi
+--- asterisk-1.2.4.orig/README.chan_capi	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/README.chan_capi	2006-01-31 09:41:43.000000000 +0100
+@@ -0,0 +1,146 @@
++(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
++(C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH 
++Klaus-Peter Junghanns <kpj at junghanns.net>
++
++This program is free software and may be modified and distributed under
++the terms of the GNU Public License. There is _NO_ warranty for this!
++
++Thanks go to the debuggers and bugfixers (listed in chronological order) :)
++===========================================================================
++Lele Forzani <lele at windmill.it>
++Florian Overkamp <florian at obsimref.com>
++Gareth Watts <gareth at omnipotent.net>
++Jeff Noxon <jeff at planetfall.com>
++Petr Michalek <petr.michalek at aca.cz>
++Jan Stocker
++(...and all the others that i forgot..) :-)
++
++chan_capi version 0.4.0-PRE1 includes:
++======================================
++
++- multiple controller support
++- CID,DNID (callling party, called party)
++- CLIR/CLIP
++- supplementary services, CD,HOLD,RETRIEVE,ECT
++- DTMF (dependend on card) + software DTMF support
++- early B3 connects (always,success,never)
++- digital audio (what did you think?)
++- incoming/outgoing calls
++- overlap sending (dialtone)
++- E(xplicit) C(all) T(ransfer) (...although it's done implicit .. but dont tell!)
++- tuneable latency ;) you can configure the size of B3 blocks at compile time
++  (in chan_capi_pvt.h, AST_CAPI_MAX_B3_BLOCK_SIZE)
++  the default is 160 samples, for non-VoIP use you can tune it down to 130
++- use asterisk's internal dsp functions for dtmf
++- alaw support 
++- ulaw support! 
++- Eicon CAPI echo cancelation (echocancel=1)
++- reject call waiting (ACO)
++- DID for Point to Point mode (a.k.a overlap receiving)
++- experimental echo squelching (echosquelch=1)
++- call progress, no need to add ||r to your dialstring anymore
++- rx/tx gains (rxgain=1.0)
++- call deflection on circuitbusy (makefile option) (deflect=12345678)
++- (inter)national dialing prefix (for callerid) configurable in capi.conf
++- CLI command "capi info" shows B channel status
++- capiECT will announce the callerID since it gets lost on most isdn pbxes
++  the called party can press # to drop the call
++- audio syncing (timing outgoing dataB3 on incoming dataB3), supposed to fix
++  the DATA_B3_REQ (error = 0x1103) problem
++- catch all MSN (incomingmsn=*)
++- some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
++- accountcode= added.
++- finally the echo squelching works!
++- callgroup support
++- fixed pipe leak
++- updated to support the new frame->delivery field
++- compiles with latest cvs with a makefile option (LOOK AT THE MAKEFILE)
++- fixed channel name bug in p2p mode
++- added app_capiNoES for disabling the primitive echo suppressor, use this before
++  you start recording voicemail or your files may get choppy
++- fixed for latest cvs (AST_MUTEX_DEFINE_STATIC)
++- fixed for latest cvs (asterisk/parking.h -> asterisk/features.h)
++- fixed for latest cvs ast_pthread_create
++
++- ATTENTION! the dialstring syntax now uses the zaptel dialstring syntax 
++  it used to be:  Dial(CAPI/[@]<outgoingMSN>:[b|B]<destination>)
++ 
++  now it is:      Dial(CAPI/g<group>/[b|B]<destination>)
++  or:             Dial(CAPI/contr<controller>/[b|B]<destination>)
++ 
++  CLIP/CLIR is now uses the calling presentation of the calling channel, this can
++  be modified using the CallingPres() application. Use CallinPres(32) for CLIR.
++  That is why the msn= param in capi.conf is now obsolete. The callerID is also
++  taken from the calling channel.
++
++- fixes for BSD (Jan Stocker)
++
++Helper applications
++===================
++kapejod says: "No No No, dont use those yet....!" (except maybe HOLD,ECT...)
++
++app_capiCD.c		forwards an unanswered call to another phone (does not rely on sservice CD)
++			example:
++			exten => s,1,Wait,1
++			exten => s,2,capiCD,12345678
++			
++app_capiHOLD.c		puts an answered call on hold, this has nothing to do with asterisk's onhold thingie (music et al)
++			after putting a call onhold, never use the Wait application!
++
++app_capiRETRIEVE.c	gets the holded call back
++
++app_capiECT.c		explicit call transfer of the holded call (must put call on hold first!)
++			example:
++			exten => s,1,Answer
++			exten => s,2,capiHOLD
++			exten => s,3,capiECT,55:50
++			will ECT the call to 50 using 55 as the callerid/outgoing msn
++
++
++Using CLIR
++==========
++Use the CallingPres() application before you dial:
++exten => _X.,1,CallingPres(32)
++exten => _X.,2,Dial(CAPI/contr1/${EXTEN})    
++
++Enjoying early B3 connects (inband call progress, tones and announcements)
++==========================================================================
++early B3 is now configurable in the dialstring :)
++if you prefix the destination number with a 'b' early B3 will always be used, also if the call fails
++because the number is unprovisioned, etc ...
++if you prefix it with a 'B' early B3 will only be used on successful calls, giving you ring indication,etc...
++
++dont use indications in the Dial command, your local exchange will do that for you:
++exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30)		(early B3 on success)
++exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30)		(always early B3)
++exten => _X.,1,Dial(CAPI/contr1/${EXTEN},30,r)		(no early B3, fake ring indication)
++
++exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30,r)		(always early B3, fake indicatons if the exchange
++							does not give us indications)
++exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30,r)		(early B3 on success, fake indicatons if the exchange
++							does not give us indications)
++    
++you can totally turn B3 off in the Makefile at buildtime (-DNEVER_EVER_EARLY_B3_CONNECTS).
++
++For normal PBX usage you would use the "b" option, always early B3.
++
++Overlap sending (a.k.a. real dialtone)
++======================================
++when you dial an empty number, and have early B3 enabled, with:
++    Dial(CAPI/g1/b)
++the channel will come up at once and give you the dialtone it gets from the local exchange.
++at this point the channel is like a legacy phone, now you can send dtmf digits to dial.    
++
++Example context for incoming calls on MSN 12345678:
++===================================================
++
++[capi-in]
++exten => 12345678,1,Dial(SIP/phone1)
++exten => 12345678,2,Hangup
++
++
++More information/documentation and commercial support can be found at:
++	http://www.junghanns.net/asterisk/
++	
++
++
+diff -urN asterisk-1.2.4.orig/res/Makefile asterisk-1.2.4/res/Makefile
+--- asterisk-1.2.4.orig/res/Makefile	2005-11-29 19:24:39.000000000 +0100
++++ asterisk-1.2.4/res/Makefile	2006-01-31 09:41:43.000000000 +0100
 @@ -11,7 +11,7 @@
  # the GNU General Public License
  #
@@ -11285,9 +11343,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.1.orig/res/res_agi.c asterisk-1.2.1/res/res_agi.c
---- asterisk-1.2.1.orig/res/res_agi.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/res/res_agi.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/res/res_agi.c asterisk-1.2.4/res/res_agi.c
+--- asterisk-1.2.4.orig/res/res_agi.c	2005-12-20 21:21:26.000000000 +0100
++++ asterisk-1.2.4/res/res_agi.c	2006-01-31 09:41:43.000000000 +0100
 @@ -11,6 +11,9 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -11593,7 +11651,7 @@
  	int pid;
          char *stringp;
  	AGI agi;
-@@ -2031,15 +2107,18 @@
+@@ -2030,15 +2106,18 @@
  		}
  	}
  #endif
@@ -11614,7 +11672,7 @@
  	}
  	LOCAL_USER_REMOVE(u);
  	return res;
-@@ -2073,6 +2152,35 @@
+@@ -2072,6 +2151,35 @@
  	return res;
  }
  
@@ -11650,7 +11708,7 @@
  static int deadagi_exec(struct ast_channel *chan, void *data)
  {
  	return agi_exec_full(chan, data, 0, 1);
-@@ -2102,6 +2210,7 @@
+@@ -2101,6 +2209,7 @@
  	ast_cli_unregister(&dumpagihtml);
  	ast_cli_unregister(&cli_debug);
  	ast_cli_unregister(&cli_no_debug);
@@ -11658,7 +11716,7 @@
  	ast_unregister_application(eapp);
  	ast_unregister_application(deadapp);
  	return ast_unregister_application(app);
-@@ -2115,6 +2224,7 @@
+@@ -2114,6 +2223,7 @@
  	ast_cli_register(&cli_no_debug);
  	ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
  	ast_register_application(eapp, eagi_exec, esynopsis, descrip);
@@ -11666,9 +11724,9 @@
  	return ast_register_application(app, agi_exec, synopsis, descrip);
  }
  
-diff -urN asterisk-1.2.1.orig/res/res_features.c asterisk-1.2.1/res/res_features.c
---- asterisk-1.2.1.orig/res/res_features.c	2005-11-29 19:24:39.000000000 +0100
-+++ asterisk-1.2.1/res/res_features.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/res/res_features.c asterisk-1.2.4/res/res_features.c
+--- asterisk-1.2.4.orig/res/res_features.c	2006-01-17 19:29:57.000000000 +0100
++++ asterisk-1.2.4/res/res_features.c	2006-01-31 09:41:43.000000000 +0100
 @@ -11,6 +11,10 @@
   * the project provides a web site, mailing lists and IRC
   * channels for your use.
@@ -11782,12 +11840,10 @@
  char *ast_pickup_ext(void)
  {
  	return pickup_ext;
-@@ -361,11 +426,12 @@
- 		"From: %s\r\n"
+@@ -362,10 +427,11 @@
  		"Timeout: %ld\r\n"
  		"CallerID: %s\r\n"
--		"CallerIDName: %s\r\n\r\n"
-+		"CallerIDName: %s\r\n"
+ 		"CallerIDName: %s\r\n"
 +		"Unqiueid: %s\r\n\r\n"
  		,pu->parkingnum, pu->chan->name, peer->name
  		,(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL)
@@ -11839,7 +11895,7 @@
  /* exec an app by feature */
  static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
  {
-@@ -1012,7 +1090,7 @@
+@@ -1014,7 +1092,7 @@
  			return res;
  		
  		while ((tok = strsep(&tmp, "#")) != NULL) {
@@ -11848,7 +11904,7 @@
  			
  			if (feature) {
  				/* Feature is up for consideration */
-@@ -1062,7 +1140,7 @@
+@@ -1064,7 +1142,7 @@
  
  			/* while we have a feature */
  			while (NULL != (tok = strsep(&tmp, "#"))) {
@@ -11857,7 +11913,7 @@
  					if (ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
  						if (ast_test_flag(feature, AST_FEATURE_FLAG_CALLER))
  							ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
-@@ -1087,7 +1165,7 @@
+@@ -1089,7 +1167,7 @@
  	struct ast_frame *f = NULL;
  	int res = 0, ready = 0;
  	
@@ -11866,12 +11922,10 @@
  		ast_set_callerid(chan, cid_num, cid_name, cid_num);
  		ast_channel_inherit_variables(caller, chan);	
  		if (!ast_call(chan, data, timeout)) {
-@@ -1533,10 +1611,11 @@
- 					"Exten: %d\r\n"
+@@ -1538,9 +1616,10 @@
  					"Channel: %s\r\n"
  					"CallerID: %s\r\n"
--					"CallerIDName: %s\r\n\r\n"
-+					"CallerIDName: %s\r\n"
+ 					"CallerIDName: %s\r\n"
 +					"Uniqueid: %s\r\n\r\n"
  					,pu->parkingnum, pu->chan->name
  					,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
@@ -11880,12 +11934,10 @@
  					);
  
  				if (option_verbose > 1) 
-@@ -1577,10 +1656,11 @@
- 								"Exten: %d\r\n"
+@@ -1583,9 +1662,10 @@
  								"Channel: %s\r\n"
  								"CallerID: %s\r\n"
--								"CallerIDName: %s\r\n\r\n"
-+								"CallerIDName: %s\r\n"
+ 								"CallerIDName: %s\r\n"
 +								"Uniqueid: %s\r\n\r\n"
  								,pu->parkingnum, pu->chan->name
  								,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
@@ -11894,7 +11946,7 @@
  								);
  
  							/* There's a problem, hang them up*/
-@@ -1667,6 +1747,280 @@
+@@ -1672,6 +1752,280 @@
  	return res;
  }
  
@@ -12071,11 +12123,11 @@
 +		    return peer;
 +		} else {
 +		    if (option_verbose > 2) 
-+			ast_verbose(VERBOSE_PREFIX_3 "Could not find channel with uniqueid %s to retrieve.\n", uniqueid);
++			ast_verbose(VERBOSE_PREFIX_3 "Could not find channel with uniqueid %s.\n", uniqueid);
 +		    return NULL;
 +		}
 +	} else {
-+		ast_log(LOG_WARNING, "Could not find channel with uniqueid %s to retrieve.\n", uniqueid);
++		ast_log(LOG_WARNING, "Could not find held channel with uniqueid %s to retrieve.\n", uniqueid);
 +	}
 +	return NULL;
 +}
@@ -12175,12 +12227,10 @@
  static int park_exec(struct ast_channel *chan, void *data)
  {
  	int res=0;
-@@ -1714,10 +2068,11 @@
- 			"Channel: %s\r\n"
+@@ -1720,9 +2074,10 @@
  			"From: %s\r\n"
  			"CallerID: %s\r\n"
--			"CallerIDName: %s\r\n\r\n"
-+			"CallerIDName: %s\r\n"
+ 			"CallerIDName: %s\r\n"
 +			"Uniqueid: %s\r\n\r\n"
  			,pu->parkingnum, pu->chan->name, chan->name
  			,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
@@ -12189,7 +12239,7 @@
  			);
  
  		free(pu);
-@@ -1885,12 +2240,13 @@
+@@ -1890,12 +2245,13 @@
  			"Timeout: %ld\r\n"
  			"CallerID: %s\r\n"
  			"CallerIDName: %s\r\n"
@@ -12204,7 +12254,7 @@
  			,idText);
  
              cur = cur->next;
-@@ -1906,6 +2262,386 @@
+@@ -1911,6 +2267,386 @@
          return RESULT_SUCCESS;
  }
  
@@ -12591,7 +12641,7 @@
  
  int ast_pickup_call(struct ast_channel *chan)
  {
-@@ -2059,7 +2795,7 @@
+@@ -2064,7 +2800,7 @@
  			}
  
  			{
@@ -12600,7 +12650,7 @@
  				int mallocd=0;
  				
  				if (!feature) {
-@@ -2135,14 +2871,22 @@
+@@ -2140,14 +2876,22 @@
  	if ((res = load_config()))
  		return res;
  	ast_cli_register(&showparked);
@@ -12623,7 +12673,7 @@
  	return res;
  }
  
-@@ -2153,7 +2897,11 @@
+@@ -2158,7 +2902,11 @@
  
  	ast_manager_unregister("ParkedCalls");
  	ast_cli_unregister(&showfeatures);
@@ -12635,9 +12685,9 @@
  	ast_unregister_application(parkcall);
  	return ast_unregister_application(parkedcall);
  }
-diff -urN asterisk-1.2.1.orig/res/res_watchdog.c asterisk-1.2.1/res/res_watchdog.c
---- asterisk-1.2.1.orig/res/res_watchdog.c	1970-01-01 01:00:00.000000000 +0100
-+++ asterisk-1.2.1/res/res_watchdog.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/res/res_watchdog.c asterisk-1.2.4/res/res_watchdog.c
+--- asterisk-1.2.4.orig/res/res_watchdog.c	1970-01-01 01:00:00.000000000 +0100
++++ asterisk-1.2.4/res/res_watchdog.c	2006-01-31 09:41:43.000000000 +0100
 @@ -0,0 +1,148 @@
 +/*
 + * Asterisk -- A telephony toolkit for Linux.
@@ -12787,9 +12837,9 @@
 +{
 +	return ASTERISK_GPL_KEY;
 +}
-diff -urN asterisk-1.2.1.orig/rtp.c asterisk-1.2.1/rtp.c
---- asterisk-1.2.1.orig/rtp.c	2005-11-30 15:27:59.000000000 +0100
-+++ asterisk-1.2.1/rtp.c	2005-12-21 14:25:44.000000000 +0100
+diff -urN asterisk-1.2.4.orig/rtp.c asterisk-1.2.4/rtp.c
+--- asterisk-1.2.4.orig/rtp.c	2005-11-30 15:27:59.000000000 +0100
++++ asterisk-1.2.4/rtp.c	2006-01-31 09:41:43.000000000 +0100
 @@ -442,6 +442,11 @@
  	struct rtpPayloadType rtpPT;
  	
@@ -12802,3 +12852,9 @@
  	
  	/* Cache where the header will go */
  	res = recvfrom(rtp->s, rtp->rawdata + AST_FRIENDLY_OFFSET, sizeof(rtp->rawdata) - AST_FRIENDLY_OFFSET,
+diff -urN asterisk-1.2.4.orig/.version asterisk-1.2.4/.version
+--- asterisk-1.2.4.orig/.version	2006-01-31 04:55:50.000000000 +0100
++++ asterisk-1.2.4/.version	2006-01-31 09:41:43.000000000 +0100
+@@ -1 +1 @@
+-1.2.4
++1.2.4-BRIstuffed-0.3.0-PRE-1k




More information about the Pkg-voip-commits mailing list