rpms/asterisk/F-9 0003-Allow-alternate-extensions-to-be-specified-in-users.patch, NONE, 1.1 0004-Minor-changes-to-reduce-packaging-changes-made-by-th.patch, NONE, 1.1 0005-Add-chan_mobile-from-asterisk-addons.patch, NONE, 1.1 0006-Use-pkgconfig-to-check-for-Lua.patch, NONE, 1.1 0007-Build-using-external-libedit.patch, NONE, 1.1 0008-Update-cdr_tds-to-latest.patch, NONE, 1.1 0009-Merged-revisions-123952-via-svnmerge-from.patch, NONE, 1.1 0010-Merged-revisions-132778-via-svnmerge-from.patch, NONE, 1.1 0011-Replace-app_rxfax-app_txfax-with-app_fax-pulled-from.patch, NONE, 1.1 0012-Update-autoconf.patch, NONE, 1.1 0001-Modify-init-scripts-for-better-Fedora-compatibility.patch, 1.1, 1.2 0002-Modify-modules.conf-so-that-different-voicemail-modu.patch, 1.1, 1.2 asterisk.spec, 1.28, 1.29 0003-Add-FAX-apps.patch, 1.1, NONE 0004-Allow-alternate-extensions-to-be-specified-in-users.patch, 1.1, NONE 0005-Pick-proper-optimization-flags-for-Fedora.patch, 1.1, NONE 0006-Add-chan_mobile-from-asterisk-addons.patch, 1.1, NONE 0007-Use-pkgconfig-to-check-for-Lua.patch, 1.1, NONE 0008-Build-using-external-libedit.patch, 1.1, NONE 0009-Update-cdr_tds-to-latest.patch, 1.1, NONE 0010-Update-autoconf.patch, 1.1, NONE 0011-Merged-revisions-123952-via-svnmerge-from.patch, 1.1, NONE 0012-Merged-revisions-132778-via-svnmerge-from.patch, 1.1, NONE

Jeffrey C. Ollie (jcollie) fedora-extras-commits at redhat.com
Wed Jul 30 17:04:13 UTC 2008


Author: jcollie

Update of /cvs/pkgs/rpms/asterisk/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21433

Modified Files:
	0001-Modify-init-scripts-for-better-Fedora-compatibility.patch 
	0002-Modify-modules.conf-so-that-different-voicemail-modu.patch 
	asterisk.spec 
Added Files:
	0003-Allow-alternate-extensions-to-be-specified-in-users.patch 
	0004-Minor-changes-to-reduce-packaging-changes-made-by-th.patch 
	0005-Add-chan_mobile-from-asterisk-addons.patch 
	0006-Use-pkgconfig-to-check-for-Lua.patch 
	0007-Build-using-external-libedit.patch 
	0008-Update-cdr_tds-to-latest.patch 
	0009-Merged-revisions-123952-via-svnmerge-from.patch 
	0010-Merged-revisions-132778-via-svnmerge-from.patch 
	0011-Replace-app_rxfax-app_txfax-with-app_fax-pulled-from.patch 
	0012-Update-autoconf.patch 
Removed Files:
	0003-Add-FAX-apps.patch 
	0004-Allow-alternate-extensions-to-be-specified-in-users.patch 
	0005-Pick-proper-optimization-flags-for-Fedora.patch 
	0006-Add-chan_mobile-from-asterisk-addons.patch 
	0007-Use-pkgconfig-to-check-for-Lua.patch 
	0008-Build-using-external-libedit.patch 
	0009-Update-cdr_tds-to-latest.patch 0010-Update-autoconf.patch 
	0011-Merged-revisions-123952-via-svnmerge-from.patch 
	0012-Merged-revisions-132778-via-svnmerge-from.patch 
Log Message:
* Wed Jul 30 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.21.beta9
- Replace app_rxfax/app_txfax with app_fax taken from upstream SVN.


0003-Allow-alternate-extensions-to-be-specified-in-users.patch:

--- NEW FILE 0003-Allow-alternate-extensions-to-be-specified-in-users.patch ---
>From 673d0920ab94971a9ca2f91de16ecd1f0e9d9b43 Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jcollie at pc21224.campus.dmacc.edu>
Date: Thu, 8 Nov 2007 16:32:56 -0600
Subject: [PATCH] Allow alternate extensions to be specified in users.conf

---
 pbx/pbx_config.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 4a7a3d3..0e38d88 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1532,11 +1532,14 @@ static void pbx_load_users(void)
 {
 	struct ast_config *cfg;
 	char *cat, *chan;
+	char *ext;
 	const char *zapchan;
 	const char *hasexten;
+	const char *altexts;
 	char tmp[256];
 	char iface[256];
 	char zapcopy[256];
+	char altcopy[256];
 	char *c;
 	int len;
 	int hasvoicemail;
@@ -1617,6 +1620,17 @@ static void pbx_load_users(void)
 			} else {
 				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar);
 			}
+			altexts = ast_variable_retrieve(cfg, cat, "alternateexts");
+			if (!ast_strlen_zero(altexts)) {
+				snprintf(tmp, sizeof(tmp), "%s|1", cat);
+				ast_copy_string(altcopy, altexts, sizeof(altcopy));
+				c = altcopy;
+				ext = strsep(&c, ",");
+				while (ext) {
+					ast_add_extension2(con, 0, ext, 1, NULL, NULL, "Goto", strdup(tmp), ast_free, registrar);
+					ext = strsep(&c, ",");
+				}
+			}
 		}
 	}
 	ast_config_destroy(cfg);
-- 
1.5.5.2


0004-Minor-changes-to-reduce-packaging-changes-made-by-th.patch:

--- NEW FILE 0004-Minor-changes-to-reduce-packaging-changes-made-by-th.patch ---
>From 38df88e16ff71fd00dabc5e95e3692e4d37b5159 Mon Sep 17 00:00:00 2001
From: tilghman <tilghman at 614ede4d-c843-0410-af14-a771ab80d22e>
Date: Tue, 29 Jul 2008 23:00:45 +0000
Subject: [PATCH] Minor changes to reduce packaging changes made by the Fedora maintainer.
 (closes issue #12974)
  Reported by: jcollie
  Patches:
        0001-Don-t-override-duplicate-optimization-flags.patch uploaded by jcollie (license 412)

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@134312 614ede4d-c843-0410-af14-a771ab80d22e
---
 Makefile |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 7c44b41..a9fd366 100644
--- a/Makefile
+++ b/Makefile
@@ -221,10 +221,16 @@ ifeq ($(OSARCH),linux-gnu)
 endif
 
 ifeq ($(findstring -save-temps,$(ASTCFLAGS)),)
-ASTCFLAGS+=-pipe
+  ifeq ($(findstring -pipe,$(ASTCFLAGS)),)
+    ASTCFLAGS+=-pipe
+  endif
+endif
+
+ifeq ($(findstring -Wall,$(ASTCFLAGS)),)
+  ASTCFLAGS+=-Wall
 endif
 
-ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
+ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 
 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
 
@@ -237,8 +243,10 @@ ifneq ($(findstring BSD,$(OSARCH)),)
   ASTLDFLAGS+=-L/usr/local/lib
 endif
 
-ifneq ($(PROC),ultrasparc)
-  ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
+ifeq ($(findstring -march,$(ASTCFLAGS)),)
+  ifneq ($(PROC),ultrasparc)
+    ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
+  endif
 endif
 
 ifeq ($(PROC),ppc)
-- 
1.5.5.2


0005-Add-chan_mobile-from-asterisk-addons.patch:

--- NEW FILE 0005-Add-chan_mobile-from-asterisk-addons.patch ---
>From cff5fa429540c33f5b0dc06ab8e52b21b54b1ce1 Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Mon, 25 Feb 2008 09:23:28 -0600
Subject: [PATCH] Add chan_mobile from asterisk-addons.

---
 build_tools/menuselect-deps.in |    1 +
 channels/Makefile              |    2 +
 channels/chan_mobile.c         | 2118 ++++++++++++++++++++++++++++++++++++++++
 configs/mobile.conf.sample     |   60 ++
 configure.ac                   |    4 +
 doc/chan_mobile.txt            |  240 +++++
 makeopts.in                    |    3 +
 7 files changed, 2428 insertions(+), 0 deletions(-)
 create mode 100644 channels/chan_mobile.c
 create mode 100644 configs/mobile.conf.sample
 create mode 100644 doc/chan_mobile.txt

diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index aa76d56..97822e6 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -1,5 +1,6 @@
 ASOUND=@PBX_ALSA@
 CRYPTO=@PBX_CRYPTO@
+BLUETOOTH=@PBX_BLUETOOTH@
 CURL=@PBX_CURL@
 FREETDS=@PBX_FREETDS@
 GMIME=@PBX_GMIME@
diff --git a/channels/Makefile b/channels/Makefile
index 34bd8e0..d8e691a 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -101,3 +101,5 @@ misdn/isdn_lib.o: ASTCFLAGS+=-Wno-strict-aliasing
 $(if $(filter chan_misdn,$(EMBEDDED_MODS)),modules.link,chan_misdn.so): misdn_config.o misdn/isdn_lib.o misdn/isdn_msg_parser.o
 
 $(if $(filter chan_oss,$(EMBEDDED_MODS)),modules.link,chan_oss.so): console_video.o vgrabbers.o console_board.o
+
+chan_mobile.so: LIBS+=$(BLUETOOTH_LIB)
diff --git a/channels/chan_mobile.c b/channels/chan_mobile.c
new file mode 100644
index 0000000..1312ea9
--- /dev/null
+++ b/channels/chan_mobile.c
@@ -0,0 +1,2118 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Bluetooth Mobile Device channel driver
+ *
+ * \author Dave Bowerman <david.bowerman at gmail.com>
+ *
+ * \ingroup channel_drivers
+ */
+
+/*** MODULEINFO
+	<depend>bluetooth</depend>
+ ***/
+
+#include <asterisk.h>
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
+#include <bluetooth/rfcomm.h>
+#include <bluetooth/sco.h>
+#include <bluetooth/l2cap.h>
+
+#include <asterisk/lock.h>
+#include <asterisk/channel.h>
+#include <asterisk/config.h>
+#include <asterisk/logger.h>
+#include <asterisk/module.h>
+#include <asterisk/pbx.h>
+#include <asterisk/options.h>
+#include <asterisk/utils.h>
+#include <asterisk/linkedlists.h>
+#include <asterisk/cli.h>
+#include <asterisk/devicestate.h>
+#include <asterisk/causes.h>
+#include <asterisk/dsp.h>
+#include <asterisk/app.h>
+#include <asterisk/manager.h>
+
+#define MBL_CONFIG "mobile.conf"
+
+#define DEVICE_FRAME_SIZE 48
+#define DEVICE_FRAME_FORMAT AST_FORMAT_SLINEAR
+#define CHANNEL_FRAME_SIZE 320
+
+static int prefformat = DEVICE_FRAME_FORMAT;
+
+static int discovery_interval = 60;			/* The device discovery interval, default 60 seconds. */
+static pthread_t discovery_thread = AST_PTHREADT_NULL;	/* The discovery thread */
+static sdp_session_t *sdp_session;
+
+enum mbl_type {
+	MBL_TYPE_PHONE,
+	MBL_TYPE_HEADSET
+};
+
+enum mbl_state {
+	MBL_STATE_INIT = 0,
+	MBL_STATE_INIT1,
+	MBL_STATE_INIT2,
+	MBL_STATE_INIT3,
+	MBL_STATE_INIT4,
+	MBL_STATE_INIT5,
+	MBL_STATE_INIT6,
+	MBL_STATE_INIT7,
+	MBL_STATE_PREIDLE,
+	MBL_STATE_IDLE,
+	MBL_STATE_DIAL,
+	MBL_STATE_DIAL1,
+	MBL_STATE_OUTGOING,
+	MBL_STATE_RING,
+	MBL_STATE_RING2,
+	MBL_STATE_RING3,
+	MBL_STATE_INCOMING,
+	MBL_STATE_HANGUP,
+	MBL_STATE_INSMS,
+	MBL_STATE_OUTSMS,
+	MBL_STATE_OUTSMS1,
+	MBL_STATE_OUTSMS2
+};
+
+struct adapter_pvt {
+	int dev_id;					/* device id */
+	int hci_socket;					/* device descriptor */
+	char id[31];					/* the 'name' from mobile.conf */
+	bdaddr_t addr;					/* adddress of adapter */
+	unsigned int inuse:1;				/* are we in use ? */
+	unsigned int alignment_detection:1;		/* do alignment detection on this adpater? */
+	int sco_socket;
+	AST_LIST_ENTRY(adapter_pvt) entry;
+};
+
+static AST_LIST_HEAD_STATIC(adapters, adapter_pvt);
+
+struct mbl_pvt {
+	struct ast_channel *owner;			/* Channel we belong to, possibly NULL */
+	struct ast_frame fr;				/* "null" frame */
+	enum mbl_type type;				/* Phone or Headset */
+	char id[31];					/* The id from mobile.conf */
+	int group;					/* group number for group dialling */
+	bdaddr_t addr;					/* address of device */
+	struct adapter_pvt *adapter;			/* the adapter we use */
+	char context[AST_MAX_CONTEXT];			/* the context for incoming calls */
+	char connected;					/* is it connected? */
+	int rfcomm_port;				/* rfcomm port number */
+	int rfcomm_socket;				/* rfcomm socket descriptor */
+	char rfcomm_buf[256];
+	char io_buf[CHANNEL_FRAME_SIZE + AST_FRIENDLY_OFFSET];
+	char io_save_buf[DEVICE_FRAME_SIZE];
+	int io_save_len;
+	int io_pipe[2];
+	int sco_socket;					/* sco socket descriptor */
+	pthread_t sco_listener_thread;			/* inbound sco listener for this device */
+	enum mbl_state state;				/* monitor thread current state */
+	pthread_t monitor_thread;			/* monitor thread handle */
+	char dial_number[AST_MAX_EXTENSION];		/* number for the monitor thread to dial */
+	int dial_timeout;
+	char ciev_call_0[4];				/* dynamically built reponse strings */
+	char ciev_call_1[4];
+	char ciev_callsetup_0[4];
+	char ciev_callsetup_1[4];
[...2115 lines suppressed...]
+
+See configs/mobile.conf.sample for an example and an explanation of the configuration.
+
+
+Using chan_mobile :-
+
+chan_mobile.so must be loaded either by loading it using the Asterisk CLI, or by adding it to /etc/asterisk/modules.conf
+
+Search for your bluetooth devices using the CLI command 'mobile search'. Be patient with this command as
+it will take 8 - 10 seconds to do the discovery. This requires a free adapter.
+
+Headsets will generally have to be put into 'pairing' mode before they will show up here.
+
+This will return something like the following :-
+
+*CLI> mobile search
+Address           Name                           Usable Type    Port
+00:12:56:90:6E:00 LG TU500                       Yes    Phone   4
+00:80:C8:35:52:78 Toaster                        No     Headset 0
+00:0B:9E:11:74:A5 Hello II Plus                  Yes    Headset 1
+00:0F:86:0E:AE:42 Daves Blackberry               Yes    Phone   7
+
+This is a list of all bluetooth devices seen and whether or not they are usable with chan_mobile.
+The Address field contains the 'bd address' of the device. This is like an ethernet mac address.
+The Name field is whatever is configured into the device as its name.
+The Usable field tells you whether or not the device supports the Bluetooth Handsfree Profile or Headset profile.
+The Type field tells you whether the device is usable as a Phone line (FXO) or a headset (FXS)
+The Port field is the number to put in the configuration file.
+
+Choose which device(s) you want to use and edit /etc/asterisk/mobile.conf. There is a sample included
+with the Asterisk-addons source under configs/mobile.conf.sample.
+
+Be sure to configure the right bd address and port number from the search. If you want inbound
+calls on a device to go to a specific context, add a context= line, otherwise the default will
+be used. The 'id' of the device [bitinbrackets] can be anything you like, just make it unique.
+
+If you are configuring a Headset be sure to include the type=headset line, if left out it defaults
+to phone.
+
+The CLI command 'mobile show devices' can be used at any time to show the status of configured devices,
+and whether or not the device is capable of sending / receiving SMS via bluetooth.
+
+*CLI> mobile show devices
+ID              Address           Group Adapter         Connected State SMS
+headset         00:0B:9E:11:AE:C6 0     blue            No        Init  No
+LGTU550         00:E0:91:7F:46:44 1     dlink           No        Init  No
+*CLI>
+
+As each phone is connected you will see a message on the Asterisk console :-
+
+ Loaded chan_mobile.so => (Bluetooth Mobile Device Channel Driver)
+    -- Bluetooth Device blackberry has connected.
+    -- Bluetooth Device dave has connected.
+
+To make outbound calls, add something to you Dialplan like the following :- (modify to suit)
+
+; Calls via LGTU5500
+exten => _9X.,1,Dial(Mobile/LGTU550/${EXTEN:1},45)
+exten => _9X.,n,Hangup
+
+To use channel groups, add an entry to each phones definition in mobile.conf like group=n
+where n is a number.
+
+Then if you do something like Dial(Mobile/g1/123456) Asterisk will dial 123456 on the first
+connected free phone in group 1.
+
+Phones which do not have a specific 'group=n' will be in group 0.
+
+
+To dial out on a headset, you need to use some other mechanism, because the headset is not likely
+to have all the needed buttons on it. res_clioriginate is good for this :-
+
+*CLI> originate Mobile/headset extension NNNNN at context
+
+This will call your headset, once you answer, Asterisk will call NNNNN at context context
+
+Dialplan hints :-
+
+chan_mobile supports 'device status' so you can do somthing like
+
+exten => 1234,hint,SIP/30&Mobile/dave&Mobile/blackberry
+
+
+MobileStatus Application :-
+
+chan_mobile also registers an application named MobileStatus. You can use this in your Dialplan
+to determine the 'state' of a device.
+
+For example, suppose you wanted to call dave's extension, but only if he was in the office. You could
+test to see if his mobile phone was attached to Asterisk, if it is dial his extension, otherwise dial his
+mobile phone.
+
+exten => 40,1,MobileStatus(dave,DAVECELL)
+exten => 40,2,GotoIf($["${DAVECELL}" = "1"]?3:5)
+exten => 40,3,Dial(ZAP/g1/0427466412,45,tT)
+exten => 40,4,Hangup
+exten => 40,5,Dial(SIP/40,45,tT)
+exten => 40,6,Hangup
+
+MobileStatus sets the value of the given variable to :-
+
+1 = Disconnected. i.e. Device not in range of Asterisk, or turned off etc etc
+2 = Connected and Not on a call. i.e. Free
+3 = Connected and on a call. i.e. Busy
+
+
+SMS Sending / Receiving
+
+If Asterisk has detected your mobile phone is capable of SMS via bluetooth, you will be able to send and
+receive SMS.
+
+Incoming SMS's cause Asterisk to create an inbound call to the context you defined in mobile.conf or the default
+context if you did not define one. The call will start at extension 'sms'. Two channel variables will be available,
+SMSSRC = the number of the originator of the SMS and SMSTXT which is the text of the SMS.
+This is not a voice call, so grab the values of the variables and hang the call up.
+
+So, to handle incoming SMS's, do something like the following in your dialplan
+
+[incoming-mobile]
+exten => sms,1,Verbose(Incoming SMS from ${SMSSRC} ${SMSTXT})
+exten => sms,n,Hangup()
+
+The above will just print the message on the console.
+
+If you use res_jabber, you could do something like this :-
+
+[incoming-mobile]
+exten => sms,1,JabberSend(transport,user at jabber.somewhere.com,SMS from ${SMSRC} ${SMSTXT})
+exten => sms,2,Hangup()
+
+To send an SMS, use the application MobileSendSMS like the following :-
+
+exten => 99,1,MobileSendSMS(dave,0427123456,Hello World)
+
+This will send 'Hello World' via device 'dave' to '0427123456'
+
+
+DTMF Debouncing :-
+
+DTMF detection varies from phone to phone. There is a configuration variable that allows you to tune
+this to your needs. e.g. in mobile.conf
+
+[LGTU550]
+address=00:12:56:90:6E:00
+port=4
+context=incoming-mobile
+dtmfskip=50
+
+change dtmfskip to suit your phone. The default is 200. The larger the number, the more chance of missed DTMF.
+The smaller the number the more chance of multiple digits being detected.
+
+
+Debugging :-
+
+Different phone manufacturers have different interpretations of the Bluetooth Handsfree Profile Spec.
+This means that not all phones work the same way, particularly in the connection setup / initialisation
+sequence. I've tried to make chan_mobile as general as possible, but it may need modification to
+support some phone i've never tested.
+
+Some phones, most notably Sony Ericsson 'T' series, dont quite conform to the Bluetooth HFP spec.
+chan_mobile will detect these and adapt accordingly. The T-610 and T-630 have been tested and
+work fine.
+
+If your phone doesnt behave has expected, turn on Asterisk debugging with 'core set debug 1'.
+
+This will log a bunch of debug messages indicating what the phone is doing, importantly the rfcomm
+conversation between Asterisk and the phone. This can be used to sort out what your phone is doing
+and make chan_mobile support it.
+
+Be aware also, that just about all mobile phones behave differently. For example my LG TU500 wont dial unless
+the phone is a the 'idle' screen. i.e. if the phone is showing a 'menu' on the display, when you dial via
+Asterisk, the call will not work. chan_mobile handles this, but there may be other phones that do
+other things too...
+
+Important: Watch what your mobile phone is doing the first few times. Asterisk wont make random calls but
+if chan_mobile fails to hangup for some reason and you get a huge bill from your telco, dont blame me ;)
+
+
+Feedback, Support, Please can you make Mobile Phone X work... etc :-
+
+as always, bugs should be reported at http://bugs.digium.com
+
+email me at   david.bowerman at gmail.com   or dseeb_ on #asterisk & #asterisk-dev irc.
diff --git a/makeopts.in b/makeopts.in
index 3bf203e..9e99a6f 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -69,6 +69,9 @@ AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
 ASOUND_INCLUDE=@ALSA_INCLUDE@
 ASOUND_LIB=@ALSA_LIB@
 
+BLUETOOTH_LIB=@BLUETOOTH_LIB@
+BLUETOOTH_INCLUDE=@BLUETOOTH_INCLUDE@
+
 CURL_INCLUDE=@CURL_INCLUDE@
 CURL_LIB=@CURL_LIB@
 
-- 
1.5.5.2


0006-Use-pkgconfig-to-check-for-Lua.patch:

--- NEW FILE 0006-Use-pkgconfig-to-check-for-Lua.patch ---
>From e7c5d20c24e3d18954212c484cd015be14de2e1e Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Mon, 25 Feb 2008 13:14:23 -0600
Subject: [PATCH] Use pkgconfig to check for Lua.

---
 configure.ac |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 422981b..b8c093c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1331,9 +1331,14 @@ if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
 		[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
 fi
 
-LUA_INCLUDE="-I/usr/include/lua5.1"
-LUA_LIB="-llua5.1"
-AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h]) 
+PBX_LUA=0
+AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
+if test ! "x${PKGCONFIG}" = xNo; then
+   LUA_INCLUDE=$(${PKGCONFIG} lua --cflags 2>/dev/null)
+   LUA_LIB=$(${PKGCONFIG} lua --libs 2>/dev/null)
+   PBX_LUA=1
+   AC_DEFINE([HAVE_LUA], 1, [Define if your system has the LUA libraries.])
+fi
 
 AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
 
-- 
1.5.5.2


0007-Build-using-external-libedit.patch:

--- NEW FILE 0007-Build-using-external-libedit.patch ---
>From 23c345241390d5aa577421abfb7e36aa6f3a343e Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Tue, 25 Mar 2008 00:50:27 -0500
Subject: [PATCH] Build using external libedit.

---
 build_tools/menuselect-deps.in |    1 +
 configure.ac                   |   22 ++++++++++++++++++++++
 main/Makefile                  |    7 ++++---
 main/cli.c                     |    3 ++-
 makeopts.in                    |    4 ++++
 5 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index 97822e6..e51279b 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -16,6 +16,7 @@ ISDNNET=@PBX_ISDNNET@
 IXJUSER=@PBX_IXJUSER@
 JACK=@PBX_JACK@
 LDAP=@PBX_LDAP@
+LIBEDIT=@PBX_LIBEDIT@
 LTDL=@PBX_LTDL@
 LUA=@PBX_LUA@
 MISDN=@PBX_MISDN@
diff --git a/configure.ac b/configure.ac
index b8c093c..c72e9c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -220,6 +220,7 @@ AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
+AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit])
 AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
 AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
 AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn])
@@ -1568,6 +1569,27 @@ AC_SUBST(PBX_GTK2)
 AC_SUBST(GTK2_INCLUDE)
 AC_SUBST(GTK2_LIB)
 
+PBX_LIBEDIT=0
+LIBEDIT_INCLUDE=-Ieditline/readline
+LIBEDIT_LIB=
+LIBEDIT_OBJ=editline/libedit.a
+if test  "${USE_LIBEDIT}" != "no"; then
+   AC_CHECK_TOOL(PKGCONFIG, pkg-config, no)
+   if test "${PKGCONFIG}" != "no"; then
+      if ${PKGCONFIG} --exists libedit; then
+         LIBEDIT_INCLUDE=$(${PKGCONFIG} libedit --cflags)
+	 LIBEDIT_LIB=$(${PKGCONFIG} libedit --libs)
+         LIBEDIT_OBJ=
+         PBX_LIBEDIT=1
+         AC_DEFINE([HAVE_LIBEDIT], 1, [Define if your system has the NetBSD Editline libraries.])
+      fi
+   fi
+fi
+AC_SUBST(PBX_LIBEDIT)
+AC_SUBST(LIBEDIT_INCLUDE)
+AC_SUBST(LIBEDIT_LIB)
+AC_SUBST(LIBEDIT_OBJ)
+
 if test "${USE_CURL}" != "no"; then
    AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
    if test ! x"${CURL_CONFIG}" = xNo; then
diff --git a/main/Makefile b/main/Makefile
index 976c37b..09c5eb6 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -133,6 +133,7 @@ testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
 asterisk.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
 
+cli.o: ASTCFLAGS+=$(LIBEDIT_INCLUDE)
 
 ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
 http.o: ASTCFLAGS+=$(GMIME_INCLUDE)
@@ -166,13 +167,13 @@ ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
 GMIMELDFLAGS+=$(GMIME_LIB)
 endif
 
-$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
+$(MAIN_TGT): $(OBJS) $(LIBEDIT_OBJ) db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
 else
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
 endif
 	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/strip_nonapi $@ || rm $@
 
diff --git a/main/cli.c b/main/cli.c
index 11d6671..dce7950 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -34,6 +34,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <ctype.h>
 #include <regex.h>
 
+#include <readline.h>
+
 #include "asterisk/cli.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/module.h"
@@ -42,7 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 #include "asterisk/lock.h"
-#include "editline/readline/readline.h"
 #include "asterisk/threadstorage.h"
 
 /*!
diff --git a/makeopts.in b/makeopts.in
index 9e99a6f..b8a4ab6 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -235,3 +235,7 @@ TINFO_DIR=@TINFO_DIR@
 
 # if poll is not present, let the makefile know.
 POLL_AVAILABLE=@HAS_POLL@
+
+LIBEDIT_INCLUDE=@LIBEDIT_INCLUDE@
+LIBEDIT_LIB=@LIBEDIT_LIB@
+LIBEDIT_OBJ=@LIBEDIT_OBJ@
-- 
1.5.5.2


0008-Update-cdr_tds-to-latest.patch:

--- NEW FILE 0008-Update-cdr_tds-to-latest.patch ---
>From 56f5144dca1f95b75d78f4fa0ce8e1048a119fc6 Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Wed, 2 Jul 2008 10:15:41 -0500
Subject: [PATCH] Update cdr_tds to latest.

---
 UPGRADE.txt                      |    3 +
 cdr/cdr_tds.c                    |  462 +++++++++++++++++++-------------------
 configure.ac                     |   29 +---
 doc/tex/freetds.tex              |   20 +--
 include/asterisk/autoconfig.h.in |    3 -
 5 files changed, 238 insertions(+), 279 deletions(-)

diff --git a/UPGRADE.txt b/UPGRADE.txt
index 70a0f81..d5e97a1 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -123,6 +123,9 @@ CDR:
   username and password parameters in cdr_odbc.conf, therefore, are no
   longer used.  The dsn parameter now points to an entry in res_odbc.conf.
 
+* The cdr_tds module now supports all versions of FreeTDS that contain
+  the db-lib frontend.
+
 Formats:
 
 * format_wav: The GAIN preprocessor definition and source code that used it
diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c
index 9d322fd..8654c80 100644
--- a/cdr/cdr_tds.c
+++ b/cdr/cdr_tds.c
@@ -66,72 +66,76 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <time.h>
 #include <math.h>
 
-#include <tds.h>
-#include <tdsconvert.h>
-#include <ctype.h>
-
 #include "asterisk/config.h"
 #include "asterisk/channel.h"
 #include "asterisk/cdr.h"
 #include "asterisk/module.h"
 
-#ifdef FREETDS_PRE_0_62
-#warning "You have older TDS, you should upgrade!"
-#endif
+#include <sqlfront.h>
+#include <sybdb.h>
 
 #define DATE_FORMAT "%Y/%m/%d %T"
 
-static char *name = "mssql";
+static char *name = "FreeTDS (MSSQL)";
 static char *config = "cdr_tds.conf";
 
-static char *hostname = NULL, *dbname = NULL, *dbuser = NULL, *password = NULL, *charset = NULL, *language = NULL;
-static char *table = NULL;
-
-static int connected = 0;
+struct cdr_tds_config {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(hostname);
+		AST_STRING_FIELD(database);
+		AST_STRING_FIELD(username);
+		AST_STRING_FIELD(password);
+		AST_STRING_FIELD(table);
+		AST_STRING_FIELD(charset);
+		AST_STRING_FIELD(language);
+	);
+	DBPROCESS *dbproc;
+	unsigned int connected:1;
+};
 
 AST_MUTEX_DEFINE_STATIC(tds_lock);
 
-static TDSSOCKET *tds;
-static TDSLOGIN *login;
-static TDSCONTEXT *context;
+static struct cdr_tds_config *settings;
 
 static char *anti_injection(const char *, int);
-static void get_date(char *, struct timeval);
+static void get_date(char *, size_t len, struct timeval);
 
 static int mssql_connect(void);
 static int mssql_disconnect(void);
 
 static int tds_log(struct ast_cdr *cdr)
 {
-	char sqlcmd[2048], start[80], answer[80], end[80];
+	char start[80], answer[80], end[80];
 	char *accountcode, *src, *dst, *dcontext, *clid, *channel, *dstchannel, *lastapp, *lastdata, *uniqueid;
-	int res = 0;
-	int retried = 0;
-#ifdef FREETDS_PRE_0_62
-	TDS_INT result_type;
-#endif
+	RETCODE erc;
+	int res = -1;
+
+	accountcode = anti_injection(cdr->accountcode, 20);
+	src         = anti_injection(cdr->src, 80);
+	dst         = anti_injection(cdr->dst, 80);
+	dcontext    = anti_injection(cdr->dcontext, 80);
+	clid        = anti_injection(cdr->clid, 80);
+	channel     = anti_injection(cdr->channel, 80);
+	dstchannel  = anti_injection(cdr->dstchannel, 80);
+	lastapp     = anti_injection(cdr->lastapp, 80);
+	lastdata    = anti_injection(cdr->lastdata, 80);
+	uniqueid    = anti_injection(cdr->uniqueid, 32);
+
+	get_date(start, sizeof(start), cdr->start);
+	get_date(answer, sizeof(answer), cdr->answer);
+	get_date(end, sizeof(end), cdr->end);
 
 	ast_mutex_lock(&tds_lock);
 
-	memset(sqlcmd, 0, 2048);
+	/* Ensure that we are connected */
+	if (!settings->connected) {
+		if (mssql_connect()) {
+			/* Connect failed */
+			goto done;
+		}
+	}
 
-	accountcode = anti_injection(cdr->accountcode, 20);
-	src = anti_injection(cdr->src, 80);
-	dst = anti_injection(cdr->dst, 80);
-	dcontext = anti_injection(cdr->dcontext, 80);
-	clid = anti_injection(cdr->clid, 80);
-	channel = anti_injection(cdr->channel, 80);
-	dstchannel = anti_injection(cdr->dstchannel, 80);
-	lastapp = anti_injection(cdr->lastapp, 80);
-	lastdata = anti_injection(cdr->lastdata, 80);
-	uniqueid = anti_injection(cdr->uniqueid, 32);
-
-	get_date(start, cdr->start);
-	get_date(answer, cdr->answer);
-	get_date(end, cdr->end);
-
-	sprintf(
-		sqlcmd,
+	erc = dbfcmd(settings->dbproc,
 		"INSERT INTO %s "
 		"("
 			"accountcode, "
@@ -172,7 +176,7 @@ static int tds_log(struct ast_cdr *cdr)
 			"'%s', "	/* amaflags */
 			"'%s'"		/* uniqueid */
 		")",
-		table,
+		settings->table,
 		accountcode,
 		src,
 		dst,
@@ -192,27 +196,26 @@ static int tds_log(struct ast_cdr *cdr)
 		uniqueid
 	);
 
-	do {
-		if (!connected) {
-			if (mssql_connect())
-				ast_log(LOG_ERROR, "Failed to reconnect to SQL database.\n");
-			else
-				ast_log(LOG_WARNING, "Reconnected to SQL database.\n");
+	if (erc == FAIL) {
+		ast_log(LOG_ERROR, "Failed to build INSERT statement, no CDR was logged.\n");
+		goto done;
+	}
 
-			retried = 1;	/* note that we have now tried */
-		}
+	if (dbsqlexec(settings->dbproc) == FAIL) {
+		ast_log(LOG_ERROR, "Failed to execute INSERT statement, no CDR was logged.\n");
+		goto done;
+	}
 
-#ifdef FREETDS_PRE_0_62
-		if (!connected || (tds_submit_query(tds, sqlcmd) != TDS_SUCCEED) || (tds_process_simple_query(tds, &result_type) != TDS_SUCCEED || result_type != TDS_CMD_SUCCEED))
-#else
-		if (!connected || (tds_submit_query(tds, sqlcmd) != TDS_SUCCEED) || (tds_process_simple_query(tds) != TDS_SUCCEED))
-#endif
-		{
-			ast_log(LOG_ERROR, "Failed to insert Call Data Record into SQL database.\n");
+	/* Consume any results we might get back (this is more of a sanity check than
+	 * anything else, since an INSERT shouldn't return results). */
+	while (dbresults(settings->dbproc) != NO_MORE_RESULTS) {
+		while (dbnextrow(settings->dbproc) != NO_MORE_ROWS);
+	}
 
-			mssql_disconnect();	/* this is ok even if we are already disconnected */
-		}
-	} while (!connected && !retried);
+	res = 0;
+
+done:
+	ast_mutex_unlock(&tds_lock);
 
 	ast_free(accountcode);
 	ast_free(src);
@@ -225,285 +228,252 @@ static int tds_log(struct ast_cdr *cdr)
 	ast_free(lastdata);
 	ast_free(uniqueid);
 
-	ast_mutex_unlock(&tds_lock);
-
 	return res;
 }
 
 static char *anti_injection(const char *str, int len)
 {
 	/* Reference to http://www.nextgenss.com/papers/advanced_sql_injection.pdf */
-
 	char *buf;
 	char *buf_ptr, *srh_ptr;
 	char *known_bad[] = {"select", "insert", "update", "delete", "drop", ";", "--", "\0"};
 	int idx;
 
-	if ((buf = ast_malloc(len + 1)) == NULL)
-	{
-		ast_log(LOG_ERROR, "cdr_tds:  Out of memory error\n");
+	if (!(buf = ast_calloc(1, len + 1))) {
+		ast_log(LOG_ERROR, "Out of memory\n");
 		return NULL;
 	}
-	memset(buf, 0, len);
 
 	buf_ptr = buf;
 
 	/* Escape single quotes */
-	for (; *str && strlen(buf) < len; str++)
-	{
-		if (*str == '\'')
+	for (; *str && strlen(buf) < len; str++) {
+		if (*str == '\'') {
 			*buf_ptr++ = '\'';
+		}
 		*buf_ptr++ = *str;
 	}
 	*buf_ptr = '\0';
 
 	/* Erase known bad input */
-	for (idx=0; *known_bad[idx]; idx++)
-	{
-		while((srh_ptr = strcasestr(buf, known_bad[idx])))
-		{
-			memmove(srh_ptr, srh_ptr+strlen(known_bad[idx]), strlen(srh_ptr+strlen(known_bad[idx]))+1);
+	for (idx = 0; *known_bad[idx]; idx++) {
+		while ((srh_ptr = strcasestr(buf, known_bad[idx]))) {
+			memmove(srh_ptr, srh_ptr + strlen(known_bad[idx]), strlen(srh_ptr + strlen(known_bad[idx])) + 1);
 		}
 	}
 
 	return buf;
 }
 
-static void get_date(char *dateField, struct timeval tv)
+static void get_date(char *dateField, size_t len, struct timeval tv)
 {
-	struct ast_tm tm;
-	char buf[80];
-
 	/* To make sure we have date variable if not insert null to SQL */
-	if (!ast_tvzero(tv))
-	{
+	if (!ast_tvzero(tv)) {
+		struct ast_tm tm;
 		ast_localtime(&tv, &tm, NULL);
-		ast_strftime(buf, 80, DATE_FORMAT, &tm);
-		sprintf(dateField, "'%s'", buf);
-	}
-	else
-	{
-		strcpy(dateField, "null");
+		ast_strftime(dateField, len, "'" DATE_FORMAT "'", &tm);
+	} else {
+		ast_copy_string(dateField, "null", len);
 	}
 }
 
 static int mssql_disconnect(void)
 {
-	if (tds) {
-		tds_free_socket(tds);
-		tds = NULL;
+	if (settings->dbproc) {
+		dbclose(settings->dbproc);
+		settings->dbproc = NULL;
 	}
 
-	if (context) {
-		tds_free_context(context);
-		context = NULL;
-	}
-
-	if (login) {
-		tds_free_login(login);
-		login = NULL;
-	}
-
-	connected = 0;
+	settings->connected = 0;
 
 	return 0;
 }
 
 static int mssql_connect(void)
 {
-#if (defined(FREETDS_0_63) || defined(FREETDS_0_64))
-	TDSCONNECTION *connection = NULL;
-#else
-	TDSCONNECTINFO *connection = NULL;
-#endif
-	char query[128];
-
-	/* Connect to M$SQL Server */
-	if (!(login = tds_alloc_login()))
-	{
-		ast_log(LOG_ERROR, "tds_alloc_login() failed.\n");
+	LOGINREC *login;
+
+	if ((login = dblogin()) == NULL) {
+		ast_log(LOG_ERROR, "Unable to allocate login structure for db-lib\n");
 		return -1;
 	}
-	
-	tds_set_server(login, hostname);
-	tds_set_user(login, dbuser);
-	tds_set_passwd(login, password);
-	tds_set_app(login, "TSQL");
-	tds_set_library(login, "TDS-Library");
-#ifndef FREETDS_PRE_0_62
-	tds_set_client_charset(login, charset);
-#endif
-	tds_set_language(login, language);
-	tds_set_packet(login, 512);
-	tds_set_version(login, 7, 0);
-
-#ifdef FREETDS_0_64
-	if (!(context = tds_alloc_context(NULL)))
-#else
-	if (!(context = tds_alloc_context()))
-#endif
-	{
-		ast_log(LOG_ERROR, "tds_alloc_context() failed.\n");
-		goto connect_fail;
+
+	DBSETLAPP(login,     "TSQL");
+	DBSETLUSER(login,    (char *) settings->username);
+	DBSETLPWD(login,     (char *) settings->password);
+	DBSETLCHARSET(login, (char *) settings->charset);
+	DBSETLNATLANG(login, (char *) settings->language);
+
+	if ((settings->dbproc = dbopen(login, (char *) settings->hostname)) == NULL) {
+		ast_log(LOG_ERROR, "Unable to connect to %s\n", settings->hostname);
+		dbloginfree(login);
+		return -1;
 	}
 
-	if (!(tds = tds_alloc_socket(context, 512))) {
-		ast_log(LOG_ERROR, "tds_alloc_socket() failed.\n");
-		goto connect_fail;
+	dbloginfree(login);
+
+	if (dbuse(settings->dbproc, (char *) settings->database) == FAIL) {
+		ast_log(LOG_ERROR, "Unable to select database %s\n", settings->database);
+		goto failed;
 	}
 
-	tds_set_parent(tds, NULL);
-	connection = tds_read_config_info(tds, login, context->locale);
-	if (!connection)
-	{
-		ast_log(LOG_ERROR, "tds_read_config() failed.\n");
-		goto connect_fail;
+	if (dbfcmd(settings->dbproc, "SELECT 1 FROM [%s]", settings->table) == FAIL) {
+		ast_log(LOG_ERROR, "Unable to build query while verifying the existence of table '%s'\n", settings->table);
+		goto failed;
 	}
 
-	if (tds_connect(tds, connection) == TDS_FAIL)
-	{
-		ast_log(LOG_ERROR, "Failed to connect to MSSQL server.\n");
-		tds = NULL;	/* freed by tds_connect() on error */
-#if (defined(FREETDS_0_63) || defined(FREETDS_0_64))
-		tds_free_connection(connection);
-#else
-		tds_free_connect(connection);
-#endif
-		connection = NULL;
-		goto connect_fail;
+	if (dbsqlexec(settings->dbproc) == FAIL) {
+		ast_log(LOG_ERROR, "Unable to verify existence of table '%s'\n", settings->table);
+		goto failed;
 	}
-#if (defined(FREETDS_0_63) || defined(FREETDS_0_64))
-	tds_free_connection(connection);
-#else
-	tds_free_connect(connection);
-#endif
-	connection = NULL;
-
-	sprintf(query, "USE %s", dbname);
-#ifdef FREETDS_PRE_0_62
-	if ((tds_submit_query(tds, query) != TDS_SUCCEED) || (tds_process_simple_query(tds, &result_type) != TDS_SUCCEED || result_type != TDS_CMD_SUCCEED))
-#else
-	if ((tds_submit_query(tds, query) != TDS_SUCCEED) || (tds_process_simple_query(tds) != TDS_SUCCEED))
-#endif
-	{
-		ast_log(LOG_ERROR, "Could not change database (%s)\n", dbname);
-		goto connect_fail;
+
+	/* Consume the result set (we don't really care about the result, though) */
+	while (dbresults(settings->dbproc) != NO_MORE_RESULTS) {
+		while (dbnextrow(settings->dbproc) != NO_MORE_ROWS);
 	}
 
-	connected = 1;
+	settings->connected = 1;
+
 	return 0;
 
-connect_fail:
-	mssql_disconnect();
+failed:
+	dbclose(settings->dbproc);
+	settings->dbproc = NULL;
 	return -1;
 }
 
 static int tds_unload_module(void)
 {
-	mssql_disconnect();
+	if (settings) {
+		ast_mutex_lock(&tds_lock);
+		mssql_disconnect();
+		ast_mutex_unlock(&tds_lock);
+
+		ast_string_field_free_memory(settings);
+		ast_free(settings);
+	}
 
 	ast_cdr_unregister(name);
 
-	if (hostname) ast_free(hostname);
-	if (dbname) ast_free(dbname);
-	if (dbuser) ast_free(dbuser);
-	if (password) ast_free(password);
-	if (charset) ast_free(charset);
-	if (language) ast_free(language);
-	if (table) ast_free(table);
+	dbexit();
+
+	return 0;
+}
+
+static int tds_error_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
+{
+	ast_log(LOG_ERROR, "%s (%d)\n", dberrstr, dberr);
+
+	if (oserr != DBNOERR) {
+		ast_log(LOG_ERROR, "%s (%d)\n", oserrstr, oserr);
+	}
+
+	return INT_CANCEL;
+}
+
+static int tds_message_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line)
+{
+	ast_debug(1, "Msg %d, Level %d, State %d, Line %d\n", msgno, severity, msgstate, line);
+	ast_log(LOG_NOTICE, "%s\n", msgtext);
 
 	return 0;
 }
 
 static int tds_load_module(int reload)
 {
-	int res = 0;
 	struct ast_config *cfg;
-	struct ast_variable *var;
 	const char *ptr = NULL;
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
-#ifdef FREETDS_PRE_0_62
-	TDS_INT result_type;
-#endif
 
 	cfg = ast_config_load(config, config_flags);
 	if (!cfg) {
-		ast_log(LOG_NOTICE, "Unable to load config for MSSQL CDR's: %s\n", config);
+		ast_log(LOG_NOTICE, "Unable to load TDS config for CDRs: %s\n", config);
 		return 0;
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
 		return 0;
 
-	var = ast_variable_browse(cfg, "global");
-	if (!var) /* nothing configured */ {
+	if (!ast_variable_browse(cfg, "global")) {
+		/* nothing configured */
 		ast_config_destroy(cfg);
 		return 0;
 	}
-	
+
+	ast_mutex_lock(&tds_lock);
+
+	/* Clear out any existing settings */
+	ast_string_field_init(settings, 0);
+
 	ptr = ast_variable_retrieve(cfg, "global", "hostname");
 	if (ptr) {
-		if (hostname)
-			ast_free(hostname);
-		hostname = ast_strdup(ptr);
-	} else
-		ast_log(LOG_ERROR, "Database server hostname not specified.\n");
+		ast_string_field_set(settings, hostname, ptr);
+	} else {
+		ast_log(LOG_ERROR, "Failed to connect: Database server hostname not specified.\n");
+		goto failed;
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "dbname");
 	if (ptr) {
-		if (dbname)
-			ast_free(dbname);
-		dbname = ast_strdup(ptr);
-	} else
-		ast_log(LOG_ERROR, "Database dbname not specified.\n");
+		ast_string_field_set(settings, database, ptr);
+	} else {
+		ast_log(LOG_ERROR, "Failed to connect: Database dbname not specified.\n");
+		goto failed;
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "user");
 	if (ptr) {
-		if (dbuser)
-			ast_free(dbuser);
-		dbuser = ast_strdup(ptr);
-	} else
-		ast_log(LOG_ERROR, "Database dbuser not specified.\n");
+		ast_string_field_set(settings, username, ptr);
+	} else {
+		ast_log(LOG_ERROR, "Failed to connect: Database dbuser not specified.\n");
+		goto failed;
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "password");
 	if (ptr) {
-		if (password)
-			ast_free(password);
-		password = ast_strdup(ptr);
-	} else
-		ast_log(LOG_ERROR,"Database password not specified.\n");
+		ast_string_field_set(settings, password, ptr);
+	} else {
+		ast_log(LOG_ERROR, "Failed to connect: Database password not specified.\n");
+		goto failed;
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "charset");
-	if (charset)
-		ast_free(charset);
-	if (ptr)
-		charset = ast_strdup(ptr);
-	else
-		charset = ast_strdup("iso_1");
-
-	if (language)
-		ast_free(language);
+	if (ptr) {
+		ast_string_field_set(settings, charset, ptr);
+	} else {
+		ast_string_field_set(settings, charset, "iso_1");
+	}
+
 	ptr = ast_variable_retrieve(cfg, "global", "language");
-	if (ptr)
-		language = ast_strdup(ptr);
-	else
-		language = ast_strdup("us_english");
+	if (ptr) {
+		ast_string_field_set(settings, language, ptr);
+	} else {
+		ast_string_field_set(settings, language, "us_english");
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "table");
-	if (ptr == NULL) {
-		ast_debug(1, "cdr_tds: table not specified.  Assuming cdr\n");
-		ptr = "cdr";
+	if (ptr) {
+		ast_string_field_set(settings, table, ptr);
+	} else {
+		ast_log(LOG_NOTICE, "Table name not specified, using 'cdr' by default.\n");
+		ast_string_field_set(settings, table, "cdr");
+	}
+
+	mssql_disconnect();
+
+	if (mssql_connect()) {
+		/* We failed to connect (mssql_connect takes care of logging it) */
+		goto failed;
 	}
-	if (table)
-		ast_free(table);
-	table = ast_strdup(ptr);
 
+	ast_mutex_unlock(&tds_lock);
 	ast_config_destroy(cfg);
 
-	ast_mutex_lock(&tds_lock);
-	mssql_disconnect();
-	mssql_connect();
+	return 1;
+
+failed:
 	ast_mutex_unlock(&tds_lock);
+	ast_config_destroy(cfg);
 
-	return res;
+	return 0;
 }
 
 static int reload(void)
@@ -513,9 +483,35 @@ static int reload(void)
 
 static int load_module(void)
 {
-	if (!tds_load_module(0))
+	if (dbinit() == FAIL) {
+		ast_log(LOG_ERROR, "Failed to initialize FreeTDS db-lib\n");
 		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	dberrhandle(tds_error_handler);
+	dbmsghandle(tds_message_handler);
+
+	settings = ast_calloc(1, sizeof(*settings));
+
+	if (!settings || ast_string_field_init(settings, 256)) {
+		if (settings) {
+			ast_free(settings);
+			settings = NULL;
+		}
+		dbexit();
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	if (!tds_load_module(0)) {
+		ast_string_field_free_memory(settings);
+		ast_free(settings);
+		settings = NULL;
+		dbexit();
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
 	ast_cdr_register(name, ast_module_info->description, tds_log);
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
@@ -524,7 +520,7 @@ static int unload_module(void)
 	return tds_unload_module();
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MSSQL CDR Backend",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "FreeTDS CDR Backend",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
diff --git a/configure.ac b/configure.ac
index c72e9c2..6c692f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1376,34 +1376,7 @@ fi
 
 AST_EXT_TOOL_CHECK([GMIME], [gmime])
 
-AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
-if test "${PBX_FREETDS}" != "0";
-then
-    if test "${FREETDS_DIR}x" = "x";
-    then
-        for tds_dir in /usr /usr/local;
-        do
-            if test -f "${tds_dir}/include/tdsver.h";
-            then
-                FREETDS_DIR="${tds_dir}"
-            fi
-        done
-    fi
-    case `${GREP} TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
-    *0.64*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
-	;;
-    *0.63*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
-	;;
-    *0.62*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
-	;;
-    *)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
-	;;
-    esac
-fi
+AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
 
 AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
 
diff --git a/doc/tex/freetds.tex b/doc/tex/freetds.tex
index 8dcbec2..8db589f 100644
--- a/doc/tex/freetds.tex
+++ b/doc/tex/freetds.tex
@@ -1,16 +1,6 @@
-The cdr\_tds module is NOT compatible with version 0.63 of FreeTDS.
-
-The cdr\_tds module is known to work with FreeTDS version 0.62.1;
-it should also work with 0.62.2, 0.62.3 and 0.62.4, which are bug
-fix releases.
-
-The cdr\_tds module uses the raw "libtds" API of FreeTDS. It appears
-that from 0.63 onwards, this is not considered a published API
-of FreeTDS and is subject to change without notice.
-
-Between 0.62.x and 0.63 of FreeTDS, many incompatible changes
-have been made to the libtds API.
-
-For newer versions of FreeTDS, it is recommended that you use the
-ODBC driver.
+The cdr\_tds module now works with most modern release versions of FreeTDS (from
+at least 0.60 through 0.82).  Although versions of FreeTDS prior to 0.82 will
+work, we recommend using the latest available version for performance and
+stability reasons.
 
+The latest release of FreeTDS is available from http://www.freetds.org/
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index b368c8d..3a76722 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -1193,9 +1193,6 @@
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
 
 /* Define like PROTOTYPES; this can be used by system headers. */
 #undef __PROTOTYPES
-- 
1.5.5.2


0009-Merged-revisions-123952-via-svnmerge-from.patch:

--- NEW FILE 0009-Merged-revisions-123952-via-svnmerge-from.patch ---
>From 7f4f8b28cddd114b43edf266a5b599aa415d1154 Mon Sep 17 00:00:00 2001
From: tilghman <tilghman at 614ede4d-c843-0410-af14-a771ab80d22e>
Date: Thu, 19 Jun 2008 17:23:22 +0000
Subject: [PATCH] Merged revisions 123952 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/trunk

........
r123952 | tilghman | 2008-06-19 12:22:27 -0500 (Thu, 19 Jun 2008) | 6 lines

Don't change pointers that need to be later passed back for deallocation.
(closes issue #12572)
 Reported by: flyn
 Patches:
       20080613__bug12572.diff.txt uploaded by Corydon76 (license 14)

........

git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@123958 614ede4d-c843-0410-af14-a771ab80d22e
---
 res/res_config_ldap.c |   85 +++++++++++++++++++++++++-----------------------
 1 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 33ed247..15a6827 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -282,33 +282,36 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
 
 		values = ldap_get_values_len(ldapConn, ldap_entry, ldap_attribute_name); /* these are freed at the end */
 		if (values) {
-			struct berval **v = values;
+			struct berval **v;
+			char *valptr;
 
-			while (*v) {
+			for (v = values; *v; v++) {
 				value = *v;
-				ast_debug(2, "LINE(%d) attribute_name: %s LDAP value: %s\n", __LINE__, attribute_name, value->bv_val);
+				valptr = value->bv_val;
+				ast_debug(2, "LINE(%d) attribute_name: %s LDAP value: %s\n", __LINE__, attribute_name, valptr);
 				if (is_realmed_password_attribute) {
-					if (!strncasecmp(value->bv_val, "{md5}", 5))
-						value->bv_val += 5;
-					else
-						value->bv_val = NULL;
-					ast_debug(2, "md5: %s\n", value->bv_val);
+					if (!strncasecmp(valptr, "{md5}", 5)) {
+						valptr += 5;
+					} else {
+						valptr = NULL;
+					}
+					ast_debug(2, "md5: %s\n", valptr);
 				}
-				if (value->bv_val) {
+				if (valptr) {
 					/* ok, so looping through all delimited values except the last one (not, last character is not delimited...) */
 					if (is_delimited) {
 						i = 0;
 						pos = 0;
-						while (!ast_strlen_zero(value->bv_val + i)) {
-							if (value->bv_val[i] == ';'){
-								value->bv_val[i] = '\0';
+						while (!ast_strlen_zero(valptr + i)) {
+							if (valptr[i] == ';'){
+								valptr[i] = '\0';
 								if (prev) {
-									prev->next = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+									prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 									if (prev->next) {
 										prev = prev->next;
 									}
 								} else {
-									prev = var = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+									prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 								}
 								pos = i + 1;
 							}
@@ -317,15 +320,14 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
 					}
 					/* for the last delimited value or if the value is not delimited: */
 					if (prev) {
-						prev->next = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+						prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 						if (prev->next) {
 							prev = prev->next;
 						}
 					} else {
-						prev = var = ast_variable_new(attribute_name, &value->bv_val[pos], table_config->table_name);
+						prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);
 					}
 				}
-				v++;
 			}
 			ldap_value_free_len(values);
 		}
@@ -400,23 +402,26 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 
 				values = ldap_get_values_len(ldapConn, ldap_entry, ldap_attribute_name);
 				if (values) {
-					struct berval **v = values;
+					struct berval **v;
+					char *valptr;
 
-					while (*v) {
+					for (v = values; *v; v++) {
 						value = *v;
+						valptr = value->bv_val;
 						if (is_realmed_password_attribute) {
-							if (strncasecmp(value->bv_val, "{md5}", 5) == 0)
-								value->bv_val += 5;
-							else
-								value->bv_val = NULL;
-							ast_debug(2, "md5: %s\n", value->bv_val);
+							if (strncasecmp(valptr, "{md5}", 5) == 0) {
+								valptr += 5;
+							} else {
+								valptr = NULL;
+							}
+							ast_debug(2, "md5: %s\n", valptr);
 						}
-						if (value->bv_val) {
+						if (valptr) {
 							if (delim_value == NULL 
 								&& !is_realmed_password_attribute 
 								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0)) {
 
-								delim_value = ast_strdup(value->bv_val);
+								delim_value = ast_strdup(valptr);
 
 								if ((delim_tot_count = semicolon_count_str(delim_value)) > 0) {
 									ast_debug(4, "LINE(%d) is delimited %d times: %s\n", __LINE__, delim_tot_count, delim_value);
@@ -426,11 +431,10 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 
 							if (is_delimited != 0 
 								&& !is_realmed_password_attribute 
-								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ){
+								&& (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ) {
 								/* for non-Static RealTime, first */
 
-								i = pos;
-								while (!ast_strlen_zero(value->bv_val + i)) {
+								for (i = pos; !ast_strlen_zero(valptr + i); i++) {
 									ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
 									if (delim_value[i] == ';') {
 										delim_value[i] = '\0';
@@ -451,9 +455,8 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 											break;
 										}
 									}
-									i++;
 								}
-								if (ast_strlen_zero(value->bv_val + i)) {
+								if (ast_strlen_zero(valptr + i)) {
 									ast_debug(4, "LINE(%d) DELIM pos: %d i: %d delim_count: %d\n", __LINE__, pos, i, delim_count);
 									/* Last delimited value */
 									ast_debug(4, "LINE(%d) DELIM - attribute_name: %s value: %s pos: %d\n", __LINE__, attribute_name, &delim_value[pos], pos);
@@ -468,9 +471,9 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 									/* Remembering to free memory */
 									is_delimited = 0;
 									pos = 0;
-									free(delim_value);
-									delim_value = NULL;
 								}
+								free(delim_value);
+								delim_value = NULL;
 								
 								ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
 							} else {
@@ -479,20 +482,19 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 									free(delim_value);
 									delim_value = NULL;
 								}
-								ast_debug(2, "LINE(%d) attribute_name: %s value: %s\n", __LINE__, attribute_name, value->bv_val);
+								ast_debug(2, "LINE(%d) attribute_name: %s value: %s\n", __LINE__, attribute_name, valptr);
 
 								if (prev) {
-									prev->next = ast_variable_new(attribute_name, value->bv_val, table_config->table_name);
+									prev->next = ast_variable_new(attribute_name, valptr, table_config->table_name);
 									if (prev->next) {
 										prev = prev->next;
 									}
 								} else {
-									prev = var = ast_variable_new(attribute_name, value->bv_val, table_config->table_name);
+									prev = var = ast_variable_new(attribute_name, valptr, table_config->table_name);
 								}
 							}
 						}
-						v++;
-					} /*!< while(*v) */
+					} /*!< for (v = values; *v; v++) */
 					ldap_value_free_len(values);
 				}/*!< if (values) */
 				ldap_attribute_name = ldap_next_attribute(ldapConn, ldap_entry, ber);
@@ -1459,10 +1461,11 @@ int parse_config(void)
 					static_table_config = table_config;
 			}
 			for (; var; var = var->next) {
-				if (!strcasecmp(var->name, "additionalFilter"))
-					table_config->additional_filter = strdup(var->value);
-				else
+				if (!strcasecmp(var->name, "additionalFilter")) {
+					table_config->additional_filter = ast_strdup(var->value);
+				} else {
 					ldap_table_config_add_attribute(table_config, var->name, var->value);
+				}
 			}
 		}
 	}
-- 
1.5.5.2


0010-Merged-revisions-132778-via-svnmerge-from.patch:

--- NEW FILE 0010-Merged-revisions-132778-via-svnmerge-from.patch ---
>From 56da7591f2d9b11f5f5d2ed2b7e4785d955d172b Mon Sep 17 00:00:00 2001
From: tilghman <tilghman at 614ede4d-c843-0410-af14-a771ab80d22e>
Date: Tue, 22 Jul 2008 21:55:06 +0000
Subject: [PATCH] Merged revisions 132778 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/trunk

................
r132778 | tilghman | 2008-07-22 16:53:40 -0500 (Tue, 22 Jul 2008) | 18 lines

Merged revisions 132713 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r132713 | tilghman | 2008-07-22 16:19:39 -0500 (Tue, 22 Jul 2008) | 10 lines

Merged revisions 132711 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r132711 | tilghman | 2008-07-22 16:14:10 -0500 (Tue, 22 Jul 2008) | 2 lines

Fixes for AST-2008-010 and AST-2008-011

........

................

................

git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@132780 614ede4d-c843-0410-af14-a771ab80d22e
---
 channels/chan_iax2.c    |   31 +++++++++++++++++++++++++++++--
 configs/iax.conf.sample |   10 ++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index abdad2d..125e087 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -275,6 +275,7 @@ enum iax2_flags {
 	IAX_DELAYPBXSTART =	(1 << 25),	/*!< Don't start a PBX on the channel until the peer sends us a
 						     response, so that we've achieved a three-way handshake with
 						     them before sending voice or anything else*/
+	IAX_ALLOWFWDOWNLOAD = (1 << 26),	/*!< Allow the FWDOWNL command? */
 };
 
 static int global_rtautoclear = 120;
@@ -1647,10 +1648,10 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s
 			snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
 
 		now = ast_tvnow();
-		start = 1 + (ast_random() % (TRUNK_CALL_START - 1));
+		start = 2 + (ast_random() % (TRUNK_CALL_START - 1));
 		for (x = start; 1; x++) {
 			if (x == TRUNK_CALL_START) {
-				x = 0;
+				x = 1;
 				continue;
 			}
 
@@ -3389,6 +3390,15 @@ struct parsed_dial_string {
 	char *options;
 };
 
+static int send_apathetic_reply(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int command, int ts, unsigned char seqno)
+{
+	struct ast_iax2_full_hdr f = { .scallno = htons(0x8000 | callno), .dcallno = htons(dcallno),
+		.ts = htonl(ts), .iseqno = seqno, .oseqno = seqno, .type = AST_FRAME_IAX,
+		.csub = compress_subclass(command) };
+
+	return sendto(defaultsockfd, &f, sizeof(f), 0, (struct sockaddr *)sin, sizeof(*sin));
+}
+
 /*!
  * \brief Parses an IAX dial string into its component parts.
  * \param data the string to be parsed
@@ -7935,6 +7945,17 @@ static int socket_process(struct iax2_thread *thread)
 		} else {
 			f.subclass = uncompress_subclass(fh->csub);
 		}
+
+		/* Deal with POKE/PONG without allocating a callno */
+		if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_POKE) {
+			/* Reply back with a PONG, but don't care about the result. */
+			send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohs(fh->ts), fh->oseqno);
+			return 1;
+		} else if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_ACK && dcallno == 1) {
+			/* Ignore */
+			return 1;
+		}
+
 		if ((f.frametype == AST_FRAME_IAX) && ((f.subclass == IAX_COMMAND_NEW) || (f.subclass == IAX_COMMAND_REGREQ) ||
 						       (f.subclass == IAX_COMMAND_POKE) || (f.subclass == IAX_COMMAND_FWDOWNL) ||
 						       (f.subclass == IAX_COMMAND_REGREL)))
@@ -9235,6 +9256,10 @@ retryowner2:
 				break;
 			case IAX_COMMAND_FWDOWNL:
 				/* Firmware download */
+				if (!ast_test_flag(&globalflags, IAX_ALLOWFWDOWNLOAD)) {
+					send_command_final(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, NULL, 0, -1);
+					break;
+				}
 				memset(&ied0, 0, sizeof(ied0));
 				res = iax_firmware_append(&ied0, (unsigned char *)ies.devicetype, ies.fwdesc);
 				if (res < 0)
@@ -10878,6 +10903,8 @@ static int set_config(char *config_file, int reload)
 			ast_set2_flag((&globalflags), ast_true(v->value), IAX_FORCEJITTERBUF);	
 		else if (!strcasecmp(v->name, "delayreject"))
 			delayreject = ast_true(v->value);
+		else if (!strcasecmp(v->name, "allowfwdownload"))
+			ast_set2_flag((&globalflags), ast_true(v->value), IAX_ALLOWFWDOWNLOAD);
 		else if (!strcasecmp(v->name, "rtcachefriends"))
 			ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTCACHEFRIENDS);	
 		else if (!strcasecmp(v->name, "rtignoreregexpire"))
diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample
index 2441f2c..854a243 100644
--- a/configs/iax.conf.sample
+++ b/configs/iax.conf.sample
@@ -264,6 +264,16 @@ autokill=yes
 ; The default value is 'host'
 ;
 ;codecpriority=host
+;
+; allowfwdownload controls whether this host will serve out firmware to
+; IAX clients which request it.  This has only been used for the IAXy,
+; and it has been recently proven that this firmware distribution method
+; can be used as a source of traffic amplification attacks.  Also, the
+; IAXy firmware has not been updated for at least 18 months, so unless
+; you are provisioning IAXys in a secure network, we recommend that you
+; leave this option to the default, off.
+;
+;allowfwdownload=yes
 
 ;rtcachefriends=yes	; Cache realtime friends by adding them to the internal list
 			; just like friends added from the config file only on a
-- 
1.5.5.2


0011-Replace-app_rxfax-app_txfax-with-app_fax-pulled-from.patch:

--- NEW FILE 0011-Replace-app_rxfax-app_txfax-with-app_fax-pulled-from.patch ---
>From d4666a37474b4edcfa131bc65724bb159a06d713 Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Wed, 30 Jul 2008 09:33:10 -0500
Subject: [PATCH] Replace app_rxfax/app_txfax with app_fax pulled from upstream SVN.  Merged
 the following commits into this one:

http://svn.digium.com/svn/asterisk/branches/1.6.0@119796
http://svn.digium.com/svn/asterisk/branches/1.6.0@119800
http://svn.digium.com/svn/asterisk/branches/1.6.0@119802
http://svn.digium.com/svn/asterisk/branches/1.6.0@120566
http://svn.digium.com/svn/asterisk/branches/1.6.0@129007

Once a new beta of 1.6.0 is released this patch can be dropped.
---
 apps/app_fax.c                   |  741 ++++++++++++++++++++++++++++++++++++++
 build_tools/menuselect-deps.in   |    1 +
 configure.ac                     |   14 +
 include/asterisk/autoconfig.h.in |    6 +
 makeopts.in                      |    3 +
 5 files changed, 765 insertions(+), 0 deletions(-)
 create mode 100644 apps/app_fax.c

diff --git a/apps/app_fax.c b/apps/app_fax.c
new file mode 100644
index 0000000..6d98755
--- /dev/null
+++ b/apps/app_fax.c
@@ -0,0 +1,741 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Simple fax applications
+ * 
+ * 2007-2008, Dmitry Andrianov <asterisk at dima.spb.ru>
+ *
+ * Code based on original implementation by Steve Underwood <steveu at coppice.org>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ *
+ */
+
+/*** MODULEINFO
+	 <depend>spandsp</depend>
+***/
+ 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <errno.h>
+#include <tiffio.h>
+
+#include <spandsp.h>
+
+#include "asterisk/lock.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/app.h"
+#include "asterisk/dsp.h"
+#include "asterisk/module.h"
+#include "asterisk/manager.h"
+
+static char *app_sndfax_name = "SendFAX";
+static char *app_sndfax_synopsis = "Send a FAX";
+static char *app_sndfax_desc = 
+"  SendFAX(filename[|options]):\n"
+"Send a given TIFF file to the channel as a FAX.\n"
+"The option string may contain zero or more of the following characters:\n"
+"     'a' -- makes the application behave as an answering machine\n"
+"	    The default behaviour is to behave as a calling machine.\n"
+"\n"
+"This application uses following variables:\n"
+"     LOCALSTATIONID to identify itself to the remote end.\n"
+"     LOCALHEADERINFO to generate a header line on each page.\n"
+"\n"
+"This application sets the following channel variables upon completion:\n"
+"     FAXSTATUS       - status of operation:\n"
+"			   SUCCESS | FAILED\n"
+"     FAXERROR	- Error when FAILED\n"
+"     REMOTESTATIONID - CSID of the remote side.\n"
+"     FAXPAGES	- number of pages sent.\n"
+"     FAXBITRATE      - transmition rate.\n"
+"     FAXRESOLUTION   - resolution.\n"
+"\n"
+"Returns -1 in case of user hang up or any channel error.\n"
+"Returns 0 on success.\n";
+
+static char *app_rcvfax_name = "ReceiveFAX";
+static char *app_rcvfax_synopsis = "Receive a FAX";
+static char *app_rcvfax_desc = 
+"  ReceiveFAX(filename[|options]):\n"
+"Receives a fax from the channel into the given filename overwriting\n"
+"the file if it already exists. File created will have TIFF format.\n"
+"The option string may contain zero or more of the following characters:\n"
+"     'c' -- makes the application behave as a calling machine\n"
+"	    The default behaviour is to behave as an answering machine.\n"
+"\n"
+"This application uses following variables:\n"
+"     LOCALSTATIONID to identify itself to the remote end.\n"
+"     LOCALHEADERINFO to generate a header line on each page.\n"
+"\n"
+"This application sets the following channel variables upon completion:\n"
+"     FAXSTATUS       - status of operation:\n"
+"			   SUCCESS | FAILED\n"
+"     FAXERROR	- Error when FAILED\n"
+"     REMOTESTATIONID - CSID of the remote side.\n"
+"     FAXPAGES	- number of pages sent.\n"
+"     FAXBITRATE      - transmition rate.\n"
+"     FAXRESOLUTION   - resolution.\n"
+"\n"
+"Returns -1 in case of user hang up or any channel error.\n"
+"Returns 0 on success.\n";
+
+#define MAX_SAMPLES 240
+
+/* Watchdog. I have seen situations when remote fax disconnects (because of poor line
+   quality) while SpanDSP continues staying in T30_STATE_IV_CTC state forever.
+   To avoid this, we terminate when we see that T30 state does not change for 5 minutes.
+   We also terminate application when more than 30 minutes passed regardless of
+   state changes. This is just a precaution measure - no fax should take that long */
+
+#define WATCHDOG_TOTAL_TIMEOUT	30 * 60
+#define WATCHDOG_STATE_TIMEOUT	5 * 60
+
+typedef struct {
+	struct ast_channel *chan;
+	enum ast_t38_state t38state;	/* T38 state of the channel */
+	int direction;			/* Fax direction: 0 - receiving, 1 - sending */
+	int caller_mode;
+	char *file_name;
+	
+	volatile int finished;
+} fax_session;
+
+static void span_message(int level, const char *msg)
+{
+	if (level == SPAN_LOG_ERROR) {
+		ast_log(LOG_ERROR, "%s", msg);
+	} else if (level == SPAN_LOG_WARNING) {
+		ast_log(LOG_WARNING, "%s", msg);
+	} else {
+		ast_log(LOG_DEBUG, "%s", msg);
+	}
+}
+
+static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
+{
+	struct ast_channel *chan = (struct ast_channel *) user_data;
+
+	struct ast_frame outf = {
+		.frametype = AST_FRAME_MODEM,
+		.subclass = AST_MODEM_T38,
+		.src = __FUNCTION__,
+	};
+
+	/* TODO: Asterisk does not provide means of resending the same packet multiple
+	  times so count is ignored at the moment */
+
+	AST_FRAME_SET_BUFFER(&outf, buf, 0, len);
+
+	if (ast_write(chan, &outf) < 0) {
+		ast_log(LOG_WARNING, "Unable to write frame to channel; %s\n", strerror(errno));
+		return -1;
+	}
+
+	return 0;
+}
+
+static void phase_e_handler(t30_state_t *f, void *user_data, int result)
+{
+	const char *local_ident;
+	const char *far_ident;
+	char buf[20];
+	fax_session *s = (fax_session *) user_data;
+	t30_stats_t stat;
+
+	ast_debug(1, "Fax phase E handler. result=%d\n", result);
+
+	t30_get_transfer_statistics(f, &stat);
+
+	s = (fax_session *) user_data;
+
+	if (result != T30_ERR_OK) {
+		s->finished = -1;
+
+		/* FAXSTATUS is already set to FAILED */
+		pbx_builtin_setvar_helper(s->chan, "FAXERROR", t30_completion_code_to_str(result));
+
+		ast_log(LOG_WARNING, "Error transmitting fax. result=%d: %s.\n", result, t30_completion_code_to_str(result));
+
+		return;
+	}
+	
+	s->finished = 1; 
+	
+	local_ident = t30_get_tx_ident(f);
+	far_ident = t30_get_rx_ident(f);
+	pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS"); 
+	pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL); 
+	pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", far_ident);
+	snprintf(buf, sizeof(buf), "%d", stat.pages_transferred);
+	pbx_builtin_setvar_helper(s->chan, "FAXPAGES", buf);
+	snprintf(buf, sizeof(buf), "%d", stat.y_resolution);
+	pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", buf);
+	snprintf(buf, sizeof(buf), "%d", stat.bit_rate);
+	pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf); 
+	
+	ast_debug(1, "Fax transmitted successfully.\n");
+	ast_debug(1, "  Remote station ID: %s\n", far_ident);
+	ast_debug(1, "  Pages transferred: %d\n", stat.pages_transferred);
+	ast_debug(1, "  Image resolution:  %d x %d\n", stat.x_resolution, stat.y_resolution);
+	ast_debug(1, "  Transfer Rate:     %d\n", stat.bit_rate);
+	
+	manager_event(EVENT_FLAG_CALL,
+		      s->direction ? "FaxSent" : "FaxReceived", 
+		      "Channel: %s\r\n"
+		      "Exten: %s\r\n"
+		      "CallerID: %s\r\n"
+		      "RemoteStationID: %s\r\n"
+		      "LocalStationID: %s\r\n"
+		      "PagesTransferred: %d\r\n"
+		      "Resolution: %d\r\n"
+		      "TransferRate: %d\r\n"
+		      "FileName: %s\r\n",
+		      s->chan->name,
+		      s->chan->exten,
+		      S_OR(s->chan->cid.cid_num, ""),
+		      far_ident,
+		      local_ident,
+		      stat.pages_transferred,
+		      stat.y_resolution,
+		      stat.bit_rate,
+		      s->file_name);
+}
+
+/* === Helper functions to configure fax === */
+
+/* Setup SPAN logging according to Asterisk debug level */
+static int set_logging(logging_state_t *state)
+{
+	int level = SPAN_LOG_WARNING + option_debug;
+
+	span_log_set_message_handler(state, span_message);
+	span_log_set_level(state, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | level); 
+
+	return 0;
+}
+
+static void set_local_info(t30_state_t *state, fax_session *s)
+{
+	const char *x;
+
+	x = pbx_builtin_getvar_helper(s->chan, "LOCALSTATIONID");
+	if (!ast_strlen_zero(x))
+		t30_set_tx_ident(state, x);
+
+	x = pbx_builtin_getvar_helper(s->chan, "LOCALHEADERINFO");
+	if (!ast_strlen_zero(x))
+		t30_set_tx_page_header_info(state, x);
+}
+
+static void set_file(t30_state_t *state, fax_session *s)
+{
+	if (s->direction)
+		t30_set_tx_file(state, s->file_name, -1, -1);
+	else
+		t30_set_rx_file(state, s->file_name, -1);
+}
+
+static void set_ecm(t30_state_t *state, int ecm)
+{
+	t30_set_ecm_capability(state, ecm);
+	t30_set_supported_compressions(state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
+}
+
+/* === Generator === */
+
+/* This function is only needed to return passed params so
+   generator_activate will save it to channel's generatordata */
+static void *fax_generator_alloc(struct ast_channel *chan, void *params)
+{
+	return params;
+}
+
+static int fax_generator_generate(struct ast_channel *chan, void *data, int len, int samples)
+{
+	fax_state_t *fax = (fax_state_t*) data;
+	uint8_t buffer[AST_FRIENDLY_OFFSET + MAX_SAMPLES * sizeof(uint16_t)];
+	int16_t *buf = (int16_t *) (buffer + AST_FRIENDLY_OFFSET);
+    
+	struct ast_frame outf = {
+		.frametype = AST_FRAME_VOICE,
+		.subclass = AST_FORMAT_SLINEAR,
+		.src = __FUNCTION__,
+	};
+
+	if (samples > MAX_SAMPLES) {
+		ast_log(LOG_WARNING, "Only generating %d samples, where %d requested\n", MAX_SAMPLES, samples);
+		samples = MAX_SAMPLES;
+	}
+	
+	if ((len = fax_tx(fax, buf, samples)) > 0) {
+		outf.samples = len;
+		AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET, len * sizeof(int16_t));
+
+		if (ast_write(chan, &outf) < 0) {
+			ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+struct ast_generator generator = {
+	alloc:		fax_generator_alloc,
+	generate: 	fax_generator_generate,
+};
+
+
+/* === Transmission === */
+
+static int transmit_audio(fax_session *s)
+{
+	int res = -1;
+	int original_read_fmt = AST_FORMAT_SLINEAR;
+	int original_write_fmt = AST_FORMAT_SLINEAR;
+	fax_state_t fax;
+	struct ast_dsp *dsp = NULL;
+	int detect_tone = 0;
+	struct ast_frame *inf = NULL;
+	struct ast_frame *fr;
+	int last_state = 0;
+	struct timeval now, start, state_change;
+	enum ast_control_t38 t38control;
+
+	original_read_fmt = s->chan->readformat;
+	if (original_read_fmt != AST_FORMAT_SLINEAR) {
+		res = ast_set_read_format(s->chan, AST_FORMAT_SLINEAR);
+		if (res < 0) {
+			ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n");
+			goto done;
+		}
+	}
+
+	original_write_fmt = s->chan->writeformat;
+	if (original_write_fmt != AST_FORMAT_SLINEAR) {
+		res = ast_set_write_format(s->chan, AST_FORMAT_SLINEAR);
+		if (res < 0) {
+			ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n");
+			goto done;
+		}
+	}
+
+	/* Initialize T30 terminal */
+	fax_init(&fax, s->caller_mode);
+
+	/* Setup logging */
+	set_logging(&fax.logging);
+	set_logging(&fax.t30_state.logging);
+
+	/* Configure terminal */
+	set_local_info(&fax.t30_state, s);
+	set_file(&fax.t30_state, s);
+	set_ecm(&fax.t30_state, TRUE);
+
+	fax_set_transmit_on_idle(&fax, TRUE);
+
+	t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, s);
+
+	if (s->t38state == T38_STATE_UNAVAILABLE) {
+		ast_debug(1, "T38 is unavailable on %s\n", s->chan->name);
+	} else if (!s->direction) {
+		/* We are receiving side and this means we are the side which should
+		   request T38 when the fax is detected. Use DSP to detect fax tone */
+		ast_debug(1, "Setting up CNG detection on %s\n", s->chan->name);
+		dsp = ast_dsp_new();
+		ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
+		ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG);
+		detect_tone = 1;
+	}
+
+	start = state_change = ast_tvnow();
+
+	ast_activate_generator(s->chan, &generator, &fax);
+
+	while (!s->finished) {
+		res = ast_waitfor(s->chan, 20);
+		if (res < 0)
+			break;
+		else if (res > 0)
+			res = 0;
+
+		inf = ast_read(s->chan);
+		if (inf == NULL) {
+			ast_debug(1, "Channel hangup\n");
+			res = -1;
+			break;
+		}
+
+		ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
+
+		/* Detect fax tone */
+		if (detect_tone && inf->frametype == AST_FRAME_VOICE) {
+			/* Duplicate frame because ast_dsp_process may free the frame passed */
+			fr = ast_frdup(inf);
+
+			/* Do not pass channel to ast_dsp_process otherwise it may queue modified audio frame back */
+			fr = ast_dsp_process(NULL, dsp, fr);
+			if (fr && fr->frametype == AST_FRAME_DTMF && fr->subclass == 'f') {
+				ast_debug(1, "Fax tone detected. Requesting T38\n");
+				t38control = AST_T38_REQUEST_NEGOTIATE;
+				ast_indicate_data(s->chan, AST_CONTROL_T38, &t38control, sizeof(t38control));
+				detect_tone = 0;
+			}
+
+			ast_frfree(fr);
+		}
+
+
+		/* Check the frame type. Format also must be checked because there is a chance
+		   that a frame in old format was already queued before we set chanel format
+		   to slinear so it will still be received by ast_read */
+		if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
+
+			if (fax_rx(&fax, inf->data, inf->samples) < 0) {
+				/* I know fax_rx never returns errors. The check here is for good style only */
+				ast_log(LOG_WARNING, "fax_rx returned error\n");
+				res = -1;
+				break;
+			}
+
+			/* Watchdog */
+			if (last_state != fax.t30_state.state) {
+				state_change = ast_tvnow();
+				last_state = fax.t30_state.state;
+			}
+		} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
+				inf->datalen == sizeof(enum ast_control_t38)) {
+			t38control =*((enum ast_control_t38 *) inf->data);
+			if (t38control == AST_T38_NEGOTIATED) {
+				/* T38 switchover completed */
+				ast_debug(1, "T38 negotiated, finishing audio loop\n");
+				res = 1;
+				break;
+			}
+		}
+
+		ast_frfree(inf);
+		inf = NULL;
+
+		/* Watchdog */
+		now = ast_tvnow();
+		if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
+			ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
+			res = -1;
+			break;
+		}
+	}
+
+	ast_debug(1, "Loop finished, res=%d\n", res);
+
+	if (inf)
+		ast_frfree(inf);
+
+	if (dsp)
+		ast_dsp_free(dsp);
+
+	ast_deactivate_generator(s->chan);
+
+	/* If we are switching to T38, remove phase E handler. Otherwise it will be executed
+	   by t30_terminate, display diagnostics and set status variables although no transmittion
+	   has taken place yet. */
+	if (res > 0) {
+		t30_set_phase_e_handler(&fax.t30_state, NULL, NULL);
+	}
+
+	t30_terminate(&fax.t30_state);
+	fax_release(&fax);
+
+done:
+	if (original_write_fmt != AST_FORMAT_SLINEAR) {
+		if (ast_set_write_format(s->chan, original_write_fmt) < 0)
+			ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", s->chan->name);
+	}
+
+	if (original_read_fmt != AST_FORMAT_SLINEAR) {
+		if (ast_set_read_format(s->chan, original_read_fmt) < 0)
+			ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", s->chan->name);
+	}
+
+	return res;
+
+}
+
+static int transmit_t38(fax_session *s)
+{
+	int res = 0;
+	t38_terminal_state_t t38;
+	struct ast_frame *inf = NULL;
+	int last_state = 0;
+	struct timeval now, start, state_change, last_frame;
+	enum ast_control_t38 t38control;
+
+	/* Initialize terminal */
+	memset(&t38, 0, sizeof(t38));
+	if (t38_terminal_init(&t38, s->caller_mode, t38_tx_packet_handler, s->chan) == NULL) {
+		ast_log(LOG_WARNING, "Unable to start T.38 termination.\n");
+		return -1;
+	}
+
+	/* Setup logging */
+	set_logging(&t38.logging);
+	set_logging(&t38.t30_state.logging);
+	set_logging(&t38.t38.logging);
+
+	/* Configure terminal */
+	set_local_info(&t38.t30_state, s);
+	set_file(&t38.t30_state, s);
+	set_ecm(&t38.t30_state, TRUE);
+
+	t30_set_phase_e_handler(&t38.t30_state, phase_e_handler, s);
+
+	now = start = state_change = ast_tvnow();
+
+	while (!s->finished) {
+
+		res = ast_waitfor(s->chan, 20);
+		if (res < 0)
+			break;
+		else if (res > 0)
+			res = 0;
+
+		last_frame = now;
+		now = ast_tvnow();
+		t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
+
+		inf = ast_read(s->chan);
+		if (inf == NULL) {
+			ast_debug(1, "Channel hangup\n");
+			res = -1;
+			break;
+		}
+
+		ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
+
+		if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
+			t38_core_rx_ifp_packet(&t38.t38, inf->data, inf->datalen, inf->seqno);
+
+			/* Watchdog */
+			if (last_state != t38.t30_state.state) {
+				state_change = ast_tvnow();
+				last_state = t38.t30_state.state;
+			}
+		} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
+				inf->datalen == sizeof(enum ast_control_t38)) {
+
+			t38control = *((enum ast_control_t38 *) inf->data);
+
+			if (t38control == AST_T38_TERMINATED || t38control == AST_T38_REFUSED) {
+				ast_debug(1, "T38 down, terminating\n");
+				res = -1;
+				break;
+			}
+		}
+
+		ast_frfree(inf);
+		inf = NULL;
+
+		/* Watchdog */
+		if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
+			ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
+			res = -1;
+			break;
+		}
+	}
+
+	ast_debug(1, "Loop finished, res=%d\n", res);
+
+	if (inf)
+		ast_frfree(inf);
+
+	t30_terminate(&t38.t30_state);
+	t38_terminal_release(&t38);
+
+	return res;
+}
+
+static int transmit(fax_session *s)
+{
+	int res = 0;
+
+	/* Clear all channel variables which to be set by the application.
+	   Pre-set status to error so in case of any problems we can just leave */
+	pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "FAILED"); 
+	pbx_builtin_setvar_helper(s->chan, "FAXERROR", "Channel problems"); 
+
+	pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", NULL);
+	pbx_builtin_setvar_helper(s->chan, "FAXPAGES", NULL);
+	pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", NULL);
+	pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", NULL); 
+
+	if (s->chan->_state != AST_STATE_UP) {
+		/* Shouldn't need this, but checking to see if channel is already answered
+		 * Theoretically asterisk should already have answered before running the app */
+		res = ast_answer(s->chan);
+		if (res) {
+			ast_log(LOG_WARNING, "Could not answer channel '%s'\n", s->chan->name);
+			return res;
+		}
+	}
+
+	s->t38state = ast_channel_get_t38_state(s->chan);
+	if (s->t38state != T38_STATE_NEGOTIATED) {
+		/* T38 is not negotiated on the channel yet. First start regular transmission. If it switches to T38, follow */	
+		res = transmit_audio(s);
+		if (res > 0) {
+			/* transmit_audio reports switchover to T38. Update t38state */
+			s->t38state = ast_channel_get_t38_state(s->chan);
+			if (s->t38state != T38_STATE_NEGOTIATED) {
+				ast_log(LOG_ERROR, "Audio loop reports T38 switchover but t38state != T38_STATE_NEGOTIATED\n");
+			}
+		}
+	}
+
+	if (s->t38state == T38_STATE_NEGOTIATED) {
+		res = transmit_t38(s);
+	}
+
+	if (res) {
+		ast_log(LOG_WARNING, "Transmission error\n");
+		res = -1;
+	} else if (s->finished < 0) {
+		ast_log(LOG_WARNING, "Transmission failed\n");
+	} else if (s->finished > 0) {
+		ast_debug(1, "Transmission finished Ok\n");
+	}
+
+	return res;
+}
+
+/* === Application functions === */
+
+static int sndfax_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	char *parse;
+	fax_session session;
+
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(file_name);
+		AST_APP_ARG(options);
+	);
+
+	if (chan == NULL) {
+		ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
+		return -1;
+	}
+
+	/* The next few lines of code parse out the filename and header from the input string */
+	if (ast_strlen_zero(data)) {
+		/* No data implies no filename or anything is present */
+		ast_log(LOG_ERROR, "SendFAX requires an argument (filename)\n");
+		return -1;
+	}
+
+	parse = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, parse);
+	
+	session.caller_mode = TRUE;
+
+	if (args.options) {
+		if (strchr(args.options, 'a'))
+			session.caller_mode = FALSE;
+	}
+
+	/* Done parsing */
+	session.direction = 1;
+	session.file_name = args.file_name;
+	session.chan = chan;
+	session.finished = 0;
+
+	res = transmit(&session);
+
+	return res;
+}
+
+static int rcvfax_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	char *parse;
+	fax_session session;
+
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(file_name);
+		AST_APP_ARG(options);
+	);
+
+	if (chan == NULL) {
+		ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
+		return -1;
+	}
+
+	/* The next few lines of code parse out the filename and header from the input string */
+	if (ast_strlen_zero(data)) {
+		/* No data implies no filename or anything is present */
+		ast_log(LOG_ERROR, "ReceiveFAX requires an argument (filename)\n");
+		return -1;
+	}
+
+	parse = ast_strdupa(data);
+	AST_STANDARD_APP_ARGS(args, parse);
+	
+	session.caller_mode = FALSE;
+
+	if (args.options) {
+		if (strchr(args.options, 'c'))
+			session.caller_mode = TRUE;
+	}
+
+	/* Done parsing */
+	session.direction = 0;
+	session.file_name = args.file_name;
+	session.chan = chan;
+	session.finished = 0;
+
+	res = transmit(&session);
+
+	return res;
+}
+
+static int unload_module(void)
+{
+	int res;
+
+	res = ast_unregister_application(app_sndfax_name);	
+	res |= ast_unregister_application(app_rcvfax_name);	
+
+	return res;
+}
+
+static int load_module(void)
+{
+	int res ;
+
+	res = ast_register_application(app_sndfax_name, sndfax_exec, app_sndfax_synopsis, app_sndfax_desc);
+	res |= ast_register_application(app_rcvfax_name, rcvfax_exec, app_rcvfax_synopsis, app_rcvfax_desc);
+
+	/* The default SPAN message handler prints to stderr. It is something we do not want */
+	span_set_message_handler(NULL);
+
+	return res;
+}
+
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Simple FAX Application",
+		.load = load_module,
+		.unload = unload_module,
+		);
+
+
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index e51279b..e50e64e 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -32,6 +32,7 @@ POPT=@PBX_POPT@
 PORTAUDIO=@PBX_PORTAUDIO@
 PRI=@PBX_PRI@
 RADIUS=@PBX_RADIUS@
+SPANDSP=@PBX_SPANDSP@
 SPEEX=@PBX_SPEEX@
 SPEEXDSP=@PBX_SPEEXDSP@
 SPEEX_PREPROCESS=@PBX_SPEEX_PREPROCESS@
diff --git a/configure.ac b/configure.ac
index 6c692f8..20b4976 100644
--- a/configure.ac
+++ b/configure.ac
@@ -236,6 +236,7 @@ AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
+AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
 AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
@@ -1294,6 +1295,19 @@ AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
 
+AST_C_COMPILE_CHECK([SPANDSP], [
+		#if SPANDSP_RELEASE_DATE < 20080516
+		#error "spandsp 0.0.5 or greater is required"
+		#endif
+	], [spandsp/version.h])
+
+if test "x${PBX_SPANDSP}" = "x1" ; then
+	# We found the correct version in the header, now let's make sure it links
+	# properly, and that libtiff is available
+	PBX_SPANDSP=0
+	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
+fi
+
 AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
 
 if test "${USE_PWLIB}" != "no"; then
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 3a76722..855f8ec 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -715,6 +715,12 @@
 /* Define to 1 if your system has soxmix application. */
 #undef HAVE_SOXMIX
 
+/* Define this to indicate the ${SPANDSP_DESCRIP} library */
+#undef HAVE_SPANDSP
+
+/* Define to indicate the ${SPANDSP_DESCRIP} library version */
+#undef HAVE_SPANDSP_VERSION
+
 /* Define this to indicate the ${SPEEX_DESCRIP} library */
 #undef HAVE_SPEEX
 
diff --git a/makeopts.in b/makeopts.in
index b8a4ab6..ad7a94d 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -172,6 +172,9 @@ SDL_LIB=@SDL_LIB@
 SDL_IMAGE_INCLUDE=@SDL_IMAGE_INCLUDE@
 SDL_IMAGE_LIB=@SDL_IMAGE_LIB@
 
+SPANDSP_INCLUDE=@SPANDSP_INCLUDE@
+SPANDSP_LIB=@SPANDSP_LIB@
+
 SPEEX_INCLUDE=@SPEEX_INCLUDE@
 SPEEX_LIB=@SPEEX_LIB@
 
-- 
1.5.5.2


0012-Update-autoconf.patch:

--- NEW FILE 0012-Update-autoconf.patch ---
>From 77b9ee99b4b0edd8261f60c96e4cc5ea2555099f Mon Sep 17 00:00:00 2001
From: Jeffrey C. Ollie <jeff at ocjtech.us>
Date: Wed, 30 Jul 2008 09:39:50 -0500
Subject: [PATCH] Update autoconf

---
 configure                        | 1378 ++++++++++++++++++++++++++++----------
 include/asterisk/autoconfig.h.in |   17 +-
 2 files changed, 1045 insertions(+), 350 deletions(-)

diff --git a/configure b/configure
index d72fa38..145369a 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 115581 .
+# From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.6.
 #
@@ -728,14 +728,18 @@ BKTR_LIB
 BKTR_INCLUDE
 BKTR_DIR
 PBX_BKTR
-CAP_LIB
-CAP_INCLUDE
-CAP_DIR
-PBX_CAP
+BLUETOOTH_LIB
+BLUETOOTH_INCLUDE
+BLUETOOTH_DIR
+PBX_BLUETOOTH
 CURL_LIB
 CURL_INCLUDE
 CURL_DIR
 PBX_CURL
+CAP_LIB
+CAP_INCLUDE
+CAP_DIR
+PBX_CAP
 CURSES_LIB
 CURSES_INCLUDE
 CURSES_DIR
@@ -788,6 +792,10 @@ LDAP_LIB
 LDAP_INCLUDE
 LDAP_DIR
 PBX_LDAP
+LIBEDIT_LIB
+LIBEDIT_INCLUDE
+LIBEDIT_DIR
+PBX_LIBEDIT
 LTDL_LIB
 LTDL_INCLUDE
 LTDL_DIR
@@ -848,6 +856,10 @@ PRI_LIB
 PRI_INCLUDE
 PRI_DIR
 PBX_PRI
+SPANDSP_LIB
+SPANDSP_INCLUDE
+SPANDSP_DIR
+PBX_SPANDSP
 SS7_LIB
 SS7_INCLUDE
 SS7_DIR
@@ -963,6 +975,7 @@ OPENH323_INCDIR
 OPENH323_LIBDIR
 OPENH323_SUFFIX
 OPENH323_BUILD
+PKGCONFIG
 PBX_SPEEX_PREPROCESS
 CONFIG_GMIME
 PBX_ZAPTEL_VLDTMF
@@ -976,7 +989,7 @@ PBX_H323
 PBX_IXJUSER
 CONFIG_SDL
 CONFIG_GTK
-PKGCONFIG
+LIBEDIT_OBJ
 CURL_CONFIG
 LTLIBOBJS'
 ac_subst_files=''
@@ -1576,8 +1589,9 @@ Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-asound=PATH      use Advanced Linux Sound Architecture files in PATH
   --with-execinfo=PATH    use Stack Backtrace support files in PATH
-  --with-cap=PATH         use POSIX 1.e capabilities files in PATH
+  --with-bluetooth=PATH   use Bluetooth Support files in PATH
   --with-curl=PATH        use cURL files in PATH
+  --with-cap=PATH         use POSIX 1.e capabilities files in PATH
   --with-curses=PATH      use curses files in PATH
   --with-crypto=PATH      use OpenSSL Cryptography support files in PATH
   --with-avcodec=PATH     use Ffmpeg and avcodec library files in PATH
@@ -1592,6 +1606,7 @@ Optional Packages:
   --with-isdnnet=PATH     use ISDN4Linux Library files in PATH
   --with-jack=PATH        use Jack Audio Connection Kit files in PATH
   --with-ldap=PATH        use OpenLDAP files in PATH
+  --with-libedit=PATH     use NetBSD Editline library files in PATH
   --with-ltdl=PATH        use libtool files in PATH
   --with-lua=PATH         use Lua files in PATH
   --with-misdn=PATH       use mISDN User Library files in PATH
@@ -1607,6 +1622,7 @@ Optional Packages:
   --with-popt=PATH        use popt files in PATH
   --with-portaudio=PATH   use PortAudio files in PATH
   --with-pri=PATH         use ISDN PRI files in PATH
+  --with-spandsp=PATH     use SPANDSP files in PATH
   --with-ss7=PATH         use ISDN SS7 files in PATH
   --with-pwlib=PATH       use PWlib files in PATH
   --with-h323=PATH        use OpenH323 files in PATH
@@ -7942,6 +7958,62 @@ fi
 
 
 
+    BLUETOOTH_DESCRIP="Bluetooth Support"
+    BLUETOOTH_OPTION="bluetooth"
+
+# Check whether --with-bluetooth was given.
+if test "${with_bluetooth+set}" = set; then
+  withval=$with_bluetooth;
+	case ${withval} in
+	n|no)
+	USE_BLUETOOTH=no
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} BLUETOOTH"
+	;;
+	*)
+	BLUETOOTH_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} BLUETOOTH"
+	;;
+	esac
+
+fi
+
+    PBX_BLUETOOTH=0
+
+
+
+
+
+
+    CURL_DESCRIP="cURL"
+    CURL_OPTION="curl"
+
+# Check whether --with-curl was given.
+if test "${with_curl+set}" = set; then
+  withval=$with_curl;
+	case ${withval} in
+	n|no)
+	USE_CURL=no
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} CURL"
+	;;
+	*)
+	CURL_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} CURL"
+	;;
+	esac
+
+fi
+
+    PBX_CURL=0
+
+
+
+
+
+
     CAP_DESCRIP="POSIX 1.e capabilities"
     CAP_OPTION="cap"
 
@@ -8362,6 +8434,34 @@ fi
 
 
 
+    LIBEDIT_DESCRIP="NetBSD Editline library"
+    LIBEDIT_OPTION="libedit"
+
+# Check whether --with-libedit was given.
+if test "${with_libedit+set}" = set; then
+  withval=$with_libedit;
+	case ${withval} in
+	n|no)
+	USE_LIBEDIT=no
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+	;;
+	*)
+	LIBEDIT_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+	;;
+	esac
+
+fi
+
+    PBX_LIBEDIT=0
+
+
+
+
+
+
     LTDL_DESCRIP="libtool"
     LTDL_OPTION="ltdl"
 
@@ -8782,6 +8882,34 @@ fi
 
 
 
+    SPANDSP_DESCRIP="SPANDSP"
+    SPANDSP_OPTION="spandsp"
+
+# Check whether --with-spandsp was given.
+if test "${with_spandsp+set}" = set; then
+  withval=$with_spandsp;
+	case ${withval} in
+	n|no)
+	USE_SPANDSP=no
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} SPANDSP"
+	;;
+	*)
+	SPANDSP_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} SPANDSP"
+	;;
+	esac
+
+fi
+
+    PBX_SPANDSP=0
+
+
+
+
+
+
     SS7_DESCRIP="ISDN SS7"
     SS7_OPTION="ss7"
 
@@ -12772,13 +12900,11 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+#include <stdio.h>
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
   ;
   return 0;
 }
@@ -12818,13 +12944,11 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+#include <stdio.h>
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
   ;
   return 0;
 }
@@ -18333,6 +18457,268 @@ fi
 
 
 
+if test "x${PBX_BLUETOOTH}" != "x1" -a "${USE_BLUETOOTH}" != "no"; then
+   pbxlibdir=""
+   # if --with-BLUETOOTH=DIR has been specified, use it.
+   if test "x${BLUETOOTH_DIR}" != "x"; then
+      if test -d ${BLUETOOTH_DIR}/lib; then
+      	 pbxlibdir="-L${BLUETOOTH_DIR}/lib"
+      else
+      	 pbxlibdir="-L${BLUETOOTH_DIR}"
+      fi
+   fi
+   pbxfuncname="ba2str"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_BLUETOOTH_FOUND=yes
+   else
+      as_ac_Lib=`echo "ac_cv_lib_bluetooth_${pbxfuncname}" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lbluetooth" >&5
+echo $ECHO_N "checking for ${pbxfuncname} in -lbluetooth... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbluetooth ${pbxlibdir}  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_Lib=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_BLUETOOTH_FOUND=yes
+else
+  AST_BLUETOOTH_FOUND=no
+fi
+
+   fi
+
+   # now check for the header.
+   if test "${AST_BLUETOOTH_FOUND}" = "yes"; then
+      BLUETOOTH_LIB="${pbxlibdir} -lbluetooth "
+      # if --with-BLUETOOTH=DIR has been specified, use it.
+      if test "x${BLUETOOTH_DIR}" != "x"; then
+	 BLUETOOTH_INCLUDE="-I${BLUETOOTH_DIR}/include"
+      fi
+      BLUETOOTH_INCLUDE="${BLUETOOTH_INCLUDE} "
+      if test "xbluetooth/bluetooth.h" = "x" ; then	# no header, assume found
+         BLUETOOTH_HEADER_FOUND="1"
+      else				# check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${BLUETOOTH_INCLUDE} "
+	 if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for bluetooth/bluetooth.h" >&5
+echo $ECHO_N "checking for bluetooth/bluetooth.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_bluetooth_bluetooth_h" >&5
+echo "${ECHO_T}$ac_cv_header_bluetooth_bluetooth_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking bluetooth/bluetooth.h usability" >&5
+echo $ECHO_N "checking bluetooth/bluetooth.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <bluetooth/bluetooth.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking bluetooth/bluetooth.h presence" >&5
+echo $ECHO_N "checking bluetooth/bluetooth.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <bluetooth/bluetooth.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: bluetooth/bluetooth.h: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to www.asterisk.org ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for bluetooth/bluetooth.h" >&5
+echo $ECHO_N "checking for bluetooth/bluetooth.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_bluetooth_bluetooth_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_bluetooth_bluetooth_h" >&5
+echo "${ECHO_T}$ac_cv_header_bluetooth_bluetooth_h" >&6; }
+
+fi
+if test $ac_cv_header_bluetooth_bluetooth_h = yes; then
+  BLUETOOTH_HEADER_FOUND=1
+else
+  BLUETOOTH_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${saved_cppflags}"
+      fi
+      if test "x${BLUETOOTH_HEADER_FOUND}" = "x0" ; then
+         BLUETOOTH_LIB=""
+         BLUETOOTH_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+	    BLUETOOTH_LIB=""
+	 fi
+         PBX_BLUETOOTH=1
+         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_BLUETOOTH 1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_BLUETOOTH_VERSION
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
 if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
    pbxlibdir=""
    # if --with-CURSES=DIR has been specified, use it.
@@ -38779,6 +39165,356 @@ fi
 
 
 
+    if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+	{ echo "$as_me:$LINENO: checking if \"
+		#if SPANDSP_RELEASE_DATE < 20080516
+		#error \"spandsp 0.0.5 or greater is required\"
+		#endif
+	\" compiles using spandsp/version.h" >&5
+echo $ECHO_N "checking if \"
+		#if SPANDSP_RELEASE_DATE < 20080516
+		#error \"spandsp 0.0.5 or greater is required\"
+		#endif
+	\" compiles using spandsp/version.h... $ECHO_C" >&6; }
+	saved_cppflags="${CPPFLAGS}"
+	if test "x${SPANDSP_DIR}" != "x"; then
+	    SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+	fi
+	CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
+
+	cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <spandsp/version.h>
+int
+main ()
+{
+
+		#if SPANDSP_RELEASE_DATE < 20080516
+		#error "spandsp 0.0.5 or greater is required"
+		#endif
+	;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+     { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+		PBX_SPANDSP=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SPANDSP 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SPANDSP_VERSION
+_ACEOF
+
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	       { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="${saved_cppflags}"
+    fi
+
+
+if test "x${PBX_SPANDSP}" = "x1" ; then
+	# We found the correct version in the header, now let's make sure it links
+	# properly, and that libtiff is available
+	PBX_SPANDSP=0
+
+if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+   pbxlibdir=""
+   # if --with-SPANDSP=DIR has been specified, use it.
+   if test "x${SPANDSP_DIR}" != "x"; then
+      if test -d ${SPANDSP_DIR}/lib; then
+      	 pbxlibdir="-L${SPANDSP_DIR}/lib"
+      else
+      	 pbxlibdir="-L${SPANDSP_DIR}"
+      fi
+   fi
+   pbxfuncname="span_set_message_handler"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SPANDSP_FOUND=yes
+   else
+      as_ac_Lib=`echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspandsp" >&5
+echo $ECHO_N "checking for ${pbxfuncname} in -lspandsp... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lspandsp ${pbxlibdir} -ltiff $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_Lib=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_SPANDSP_FOUND=yes
+else
+  AST_SPANDSP_FOUND=no
+fi
+
+   fi
+
+   # now check for the header.
+   if test "${AST_SPANDSP_FOUND}" = "yes"; then
+      SPANDSP_LIB="${pbxlibdir} -lspandsp -ltiff"
+      # if --with-SPANDSP=DIR has been specified, use it.
+      if test "x${SPANDSP_DIR}" != "x"; then
+	 SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+      fi
+      SPANDSP_INCLUDE="${SPANDSP_INCLUDE} "
+      if test "xspandsp.h" = "x" ; then	# no header, assume found
+         SPANDSP_HEADER_FOUND="1"
+      else				# check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE} "
+	 if test "${ac_cv_header_spandsp_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for spandsp.h" >&5
+echo $ECHO_N "checking for spandsp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_spandsp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
+echo "${ECHO_T}$ac_cv_header_spandsp_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking spandsp.h usability" >&5
+echo $ECHO_N "checking spandsp.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <spandsp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking spandsp.h presence" >&5
+echo $ECHO_N "checking spandsp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <spandsp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: spandsp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: spandsp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: spandsp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: spandsp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: spandsp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: spandsp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: spandsp.h: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to www.asterisk.org ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for spandsp.h" >&5
+echo $ECHO_N "checking for spandsp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_spandsp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_spandsp_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
+echo "${ECHO_T}$ac_cv_header_spandsp_h" >&6; }
+
+fi
+if test $ac_cv_header_spandsp_h = yes; then
+  SPANDSP_HEADER_FOUND=1
+else
+  SPANDSP_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${saved_cppflags}"
+      fi
+      if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
+         SPANDSP_LIB=""
+         SPANDSP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+	    SPANDSP_LIB=""
+	 fi
+         PBX_SPANDSP=1
+         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SPANDSP 1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SPANDSP_VERSION
+_ACEOF
+
+      fi
+   fi
+fi
+
+fi
+
+
 if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
    pbxlibdir=""
    # if --with-SS7=DIR has been specified, use it.
@@ -41087,271 +41823,115 @@ _ACEOF
 
 fi
 
-LUA_INCLUDE="-I/usr/include/lua5.1"
-LUA_LIB="-llua5.1"
-
-if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
-   pbxlibdir=""
-   # if --with-LUA=DIR has been specified, use it.
-   if test "x${LUA_DIR}" != "x"; then
-      if test -d ${LUA_DIR}/lib; then
-      	 pbxlibdir="-L${LUA_DIR}/lib"
-      else
-      	 pbxlibdir="-L${LUA_DIR}"
-      fi
-   fi
-   pbxfuncname="luaL_newstate"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LUA_FOUND=yes
-   else
-      as_ac_Lib=`echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua5.1" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -llua5.1... $ECHO_C" >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+PBX_LUA=0
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_PKGCONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llua5.1 ${pbxlibdir}  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_Lib=yes"
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test.
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="${ac_tool_prefix}pkg-config"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-	eval "$as_ac_Lib=no"
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_LUA_FOUND=yes
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
 else
-  AST_LUA_FOUND=no
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-   fi
 
-   # now check for the header.
-   if test "${AST_LUA_FOUND}" = "yes"; then
-      LUA_LIB="${pbxlibdir} -llua5.1 "
-      # if --with-LUA=DIR has been specified, use it.
-      if test "x${LUA_DIR}" != "x"; then
-	 LUA_INCLUDE="-I${LUA_DIR}/include"
-      fi
-      LUA_INCLUDE="${LUA_INCLUDE} "
-      if test "xlua5.1/lua.h" = "x" ; then	# no header, assume found
-         LUA_HEADER_FOUND="1"
-      else				# check for the header
-         saved_cppflags="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE} "
-	 if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
-echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
-echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
+if test -z "$ac_cv_prog_PKGCONFIG"; then
+  ac_ct_PKGCONFIG=$PKGCONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking lua5.1/lua.h usability" >&5
-echo $ECHO_N "checking lua5.1/lua.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <lua5.1/lua.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+  if test -n "$ac_ct_PKGCONFIG"; then
+  ac_cv_prog_ac_ct_PKGCONFIG="$ac_ct_PKGCONFIG" # Let the user override the test.
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_PKGCONFIG="pkg-config"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-	ac_header_compiler=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking lua5.1/lua.h presence" >&5
-echo $ECHO_N "checking lua5.1/lua.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <lua5.1/lua.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: lua5.1/lua.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
-echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_ct_PKGCONFIG=$ac_cv_prog_ac_ct_PKGCONFIG
+if test -n "$ac_ct_PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_PKGCONFIG" >&5
+echo "${ECHO_T}$ac_ct_PKGCONFIG" >&6; }
 else
-  ac_cv_header_lua5_1_lua_h=$ac_header_preproc
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
-echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
 
-fi
-if test $ac_cv_header_lua5_1_lua_h = yes; then
-  LUA_HEADER_FOUND=1
+  if test "x$ac_ct_PKGCONFIG" = x; then
+    PKGCONFIG="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKGCONFIG=$ac_ct_PKGCONFIG
+  fi
 else
-  LUA_HEADER_FOUND=0
+  PKGCONFIG="$ac_cv_prog_PKGCONFIG"
 fi
 
+if test ! "x${PKGCONFIG}" = xNo; then
+   LUA_INCLUDE=$(${PKGCONFIG} lua --cflags 2>/dev/null)
+   LUA_LIB=$(${PKGCONFIG} lua --libs 2>/dev/null)
+   PBX_LUA=1
 
-         CPPFLAGS="${saved_cppflags}"
-      fi
-      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
-         LUA_LIB=""
-         LUA_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-	    LUA_LIB=""
-	 fi
-         PBX_LUA=1
-         # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
-
-cat >>confdefs.h <<_ACEOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_LUA 1
 _ACEOF
 
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LUA_VERSION
-_ACEOF
-
-      fi
-   fi
 fi
 
 
-
 if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
    pbxlibdir=""
    # if --with-RADIUS=DIR has been specified, use it.
@@ -43914,18 +44494,18 @@ if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
       	 pbxlibdir="-L${FREETDS_DIR}"
       fi
    fi
-   pbxfuncname="tds_version"
+   pbxfuncname="dbinit"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_FREETDS_FOUND=yes
    else
-      as_ac_Lib=`echo "ac_cv_lib_tds_${pbxfuncname}" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -ltds" >&5
-echo $ECHO_N "checking for ${pbxfuncname} in -ltds... $ECHO_C" >&6; }
+      as_ac_Lib=`echo "ac_cv_lib_sybdb_${pbxfuncname}" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsybdb" >&5
+echo $ECHO_N "checking for ${pbxfuncname} in -lsybdb... $ECHO_C" >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltds ${pbxlibdir}  $LIBS"
+LIBS="-lsybdb ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -43991,29 +44571,29 @@ fi
 
    # now check for the header.
    if test "${AST_FREETDS_FOUND}" = "yes"; then
-      FREETDS_LIB="${pbxlibdir} -ltds "
+      FREETDS_LIB="${pbxlibdir} -lsybdb "
       # if --with-FREETDS=DIR has been specified, use it.
       if test "x${FREETDS_DIR}" != "x"; then
 	 FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
       fi
       FREETDS_INCLUDE="${FREETDS_INCLUDE} "
-      if test "xtds.h" = "x" ; then	# no header, assume found
+      if test "xsybdb.h" = "x" ; then	# no header, assume found
          FREETDS_HEADER_FOUND="1"
       else				# check for the header
          saved_cppflags="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE} "
-	 if test "${ac_cv_header_tds_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for tds.h" >&5
-echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tds_h+set}" = set; then
+	 if test "${ac_cv_header_sybdb_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sybdb.h" >&5
+echo $ECHO_N "checking for sybdb.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sybdb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
-echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sybdb_h" >&5
+echo "${ECHO_T}$ac_cv_header_sybdb_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking tds.h usability" >&5
-echo $ECHO_N "checking tds.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sybdb.h usability" >&5
+echo $ECHO_N "checking sybdb.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -44021,7 +44601,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <tds.h>
+#include <sybdb.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -44053,15 +44633,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking tds.h presence" >&5
-echo $ECHO_N "checking tds.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sybdb.h presence" >&5
+echo $ECHO_N "checking sybdb.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <tds.h>
+#include <sybdb.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -44094,25 +44674,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: tds.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sybdb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sybdb.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: tds.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: tds.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tds.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: tds.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tds.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: tds.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sybdb.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sybdb.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sybdb.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sybdb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sybdb.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sybdb.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sybdb.h: in the future, the compiler will take precedence" >&2;}
     ( cat <<\_ASBOX
 ## ------------------------------- ##
 ## Report this to www.asterisk.org ##
@@ -44121,18 +44701,18 @@ _ASBOX
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for tds.h" >&5
-echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tds_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for sybdb.h" >&5
+echo $ECHO_N "checking for sybdb.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sybdb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_tds_h=$ac_header_preproc
+  ac_cv_header_sybdb_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
-echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sybdb_h" >&5
+echo "${ECHO_T}$ac_cv_header_sybdb_h" >&6; }
 
 fi
-if test $ac_cv_header_tds_h = yes; then
+if test $ac_cv_header_sybdb_h = yes; then
   FREETDS_HEADER_FOUND=1
 else
   FREETDS_HEADER_FOUND=0
@@ -44164,33 +44744,6 @@ _ACEOF
    fi
 fi
 
-if test "${PBX_FREETDS}" != "0";
-then
-    if test "${FREETDS_DIR}x" = "x";
-    then
-        for tds_dir in /usr /usr/local;
-        do
-            if test -f "${tds_dir}/include/tdsver.h";
-            then
-                FREETDS_DIR="${tds_dir}"
-            fi
-        done
-    fi
-    case `${GREP} TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
-    *0.64*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
-	;;
-    *0.63*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"
-	;;
-    *0.62*)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_62"
-	;;
-    *)
-        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_PRE_0_62"
-	;;
-    esac
-fi
 
 
 if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
@@ -49918,6 +50471,126 @@ fi
 
 
 
+PBX_LIBEDIT=0
+LIBEDIT_INCLUDE=-Ieditline/readline
+LIBEDIT_LIB=
+LIBEDIT_OBJ=editline/libedit.a
+if test  "${USE_LIBEDIT}" != "no"; then
+   if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="${ac_tool_prefix}pkg-config"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_PKGCONFIG"; then
+  ac_ct_PKGCONFIG=$PKGCONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_PKGCONFIG"; then
+  ac_cv_prog_ac_ct_PKGCONFIG="$ac_ct_PKGCONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_PKGCONFIG="pkg-config"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_PKGCONFIG=$ac_cv_prog_ac_ct_PKGCONFIG
+if test -n "$ac_ct_PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_PKGCONFIG" >&5
+echo "${ECHO_T}$ac_ct_PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_PKGCONFIG" = x; then
+    PKGCONFIG="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKGCONFIG=$ac_ct_PKGCONFIG
+  fi
+else
+  PKGCONFIG="$ac_cv_prog_PKGCONFIG"
+fi
+
+   if test "${PKGCONFIG}" != "no"; then
+      if ${PKGCONFIG} --exists libedit; then
+         LIBEDIT_INCLUDE=$(${PKGCONFIG} libedit --cflags)
+	 LIBEDIT_LIB=$(${PKGCONFIG} libedit --libs)
+         LIBEDIT_OBJ=
+         PBX_LIBEDIT=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBEDIT 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+
+
 if test "${USE_CURL}" != "no"; then
    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}curl-config", so it can be a program name with args.
@@ -50892,14 +51565,18 @@ BKTR_LIB!$BKTR_LIB$ac_delim
 BKTR_INCLUDE!$BKTR_INCLUDE$ac_delim
 BKTR_DIR!$BKTR_DIR$ac_delim
 PBX_BKTR!$PBX_BKTR$ac_delim
-CAP_LIB!$CAP_LIB$ac_delim
-CAP_INCLUDE!$CAP_INCLUDE$ac_delim
-CAP_DIR!$CAP_DIR$ac_delim
-PBX_CAP!$PBX_CAP$ac_delim
+BLUETOOTH_LIB!$BLUETOOTH_LIB$ac_delim
+BLUETOOTH_INCLUDE!$BLUETOOTH_INCLUDE$ac_delim
+BLUETOOTH_DIR!$BLUETOOTH_DIR$ac_delim
+PBX_BLUETOOTH!$PBX_BLUETOOTH$ac_delim
 CURL_LIB!$CURL_LIB$ac_delim
 CURL_INCLUDE!$CURL_INCLUDE$ac_delim
 CURL_DIR!$CURL_DIR$ac_delim
 PBX_CURL!$PBX_CURL$ac_delim
+CAP_LIB!$CAP_LIB$ac_delim
+CAP_INCLUDE!$CAP_INCLUDE$ac_delim
+CAP_DIR!$CAP_DIR$ac_delim
+PBX_CAP!$PBX_CAP$ac_delim
 CURSES_LIB!$CURSES_LIB$ac_delim
 CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim
 CURSES_DIR!$CURSES_DIR$ac_delim
@@ -50952,6 +51629,10 @@ LDAP_LIB!$LDAP_LIB$ac_delim
 LDAP_INCLUDE!$LDAP_INCLUDE$ac_delim
 LDAP_DIR!$LDAP_DIR$ac_delim
 PBX_LDAP!$PBX_LDAP$ac_delim
+LIBEDIT_LIB!$LIBEDIT_LIB$ac_delim
+LIBEDIT_INCLUDE!$LIBEDIT_INCLUDE$ac_delim
+LIBEDIT_DIR!$LIBEDIT_DIR$ac_delim
+PBX_LIBEDIT!$PBX_LIBEDIT$ac_delim
 LTDL_LIB!$LTDL_LIB$ac_delim
 LTDL_INCLUDE!$LTDL_INCLUDE$ac_delim
 LTDL_DIR!$LTDL_DIR$ac_delim
@@ -50969,14 +51650,6 @@ NBS_INCLUDE!$NBS_INCLUDE$ac_delim
 NBS_DIR!$NBS_DIR$ac_delim
 PBX_NBS!$PBX_NBS$ac_delim
 NCURSES_LIB!$NCURSES_LIB$ac_delim
-NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim
-NCURSES_DIR!$NCURSES_DIR$ac_delim
-PBX_NCURSES!$PBX_NCURSES$ac_delim
-NETSNMP_LIB!$NETSNMP_LIB$ac_delim
-NETSNMP_INCLUDE!$NETSNMP_INCLUDE$ac_delim
-NETSNMP_DIR!$NETSNMP_DIR$ac_delim
-PBX_NETSNMP!$PBX_NETSNMP$ac_delim
-NEWT_LIB!$NEWT_LIB$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -51018,6 +51691,14 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim
+NCURSES_DIR!$NCURSES_DIR$ac_delim
+PBX_NCURSES!$PBX_NCURSES$ac_delim
+NETSNMP_LIB!$NETSNMP_LIB$ac_delim
+NETSNMP_INCLUDE!$NETSNMP_INCLUDE$ac_delim
+NETSNMP_DIR!$NETSNMP_DIR$ac_delim
+PBX_NETSNMP!$PBX_NETSNMP$ac_delim
+NEWT_LIB!$NEWT_LIB$ac_delim
 NEWT_INCLUDE!$NEWT_INCLUDE$ac_delim
 NEWT_DIR!$NEWT_DIR$ac_delim
 PBX_NEWT!$PBX_NEWT$ac_delim
@@ -51053,6 +51734,10 @@ PRI_LIB!$PRI_LIB$ac_delim
 PRI_INCLUDE!$PRI_INCLUDE$ac_delim
 PRI_DIR!$PRI_DIR$ac_delim
 PBX_PRI!$PBX_PRI$ac_delim
+SPANDSP_LIB!$SPANDSP_LIB$ac_delim
+SPANDSP_INCLUDE!$SPANDSP_INCLUDE$ac_delim
+SPANDSP_DIR!$SPANDSP_DIR$ac_delim
+PBX_SPANDSP!$PBX_SPANDSP$ac_delim
 SS7_LIB!$SS7_LIB$ac_delim
 SS7_INCLUDE!$SS7_INCLUDE$ac_delim
 SS7_DIR!$SS7_DIR$ac_delim
@@ -51103,18 +51788,6 @@ OPENSSL_DIR!$OPENSSL_DIR$ac_delim
 PBX_OPENSSL!$PBX_OPENSSL$ac_delim
 FREETDS_LIB!$FREETDS_LIB$ac_delim
 FREETDS_INCLUDE!$FREETDS_INCLUDE$ac_delim
-FREETDS_DIR!$FREETDS_DIR$ac_delim
-PBX_FREETDS!$PBX_FREETDS$ac_delim
-TERMCAP_LIB!$TERMCAP_LIB$ac_delim
-TERMCAP_INCLUDE!$TERMCAP_INCLUDE$ac_delim
-TERMCAP_DIR!$TERMCAP_DIR$ac_delim
-PBX_TERMCAP!$PBX_TERMCAP$ac_delim
-TINFO_LIB!$TINFO_LIB$ac_delim
-TINFO_INCLUDE!$TINFO_INCLUDE$ac_delim
-TINFO_DIR!$TINFO_DIR$ac_delim
-PBX_TINFO!$PBX_TINFO$ac_delim
-TONEZONE_LIB!$TONEZONE_LIB$ac_delim
-TONEZONE_INCLUDE!$TONEZONE_INCLUDE$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -51156,6 +51829,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+FREETDS_DIR!$FREETDS_DIR$ac_delim
+PBX_FREETDS!$PBX_FREETDS$ac_delim
+TERMCAP_LIB!$TERMCAP_LIB$ac_delim
+TERMCAP_INCLUDE!$TERMCAP_INCLUDE$ac_delim
+TERMCAP_DIR!$TERMCAP_DIR$ac_delim
+PBX_TERMCAP!$PBX_TERMCAP$ac_delim
+TINFO_LIB!$TINFO_LIB$ac_delim
+TINFO_INCLUDE!$TINFO_INCLUDE$ac_delim
+TINFO_DIR!$TINFO_DIR$ac_delim
+PBX_TINFO!$PBX_TINFO$ac_delim
+TONEZONE_LIB!$TONEZONE_LIB$ac_delim
+TONEZONE_INCLUDE!$TONEZONE_INCLUDE$ac_delim
 TONEZONE_DIR!$TONEZONE_DIR$ac_delim
 PBX_TONEZONE!$PBX_TONEZONE$ac_delim
 USB_LIB!$USB_LIB$ac_delim
@@ -51209,6 +51894,7 @@ OPENH323_INCDIR!$OPENH323_INCDIR$ac_delim
 OPENH323_LIBDIR!$OPENH323_LIBDIR$ac_delim
 OPENH323_SUFFIX!$OPENH323_SUFFIX$ac_delim
 OPENH323_BUILD!$OPENH323_BUILD$ac_delim
+PKGCONFIG!$PKGCONFIG$ac_delim
 PBX_SPEEX_PREPROCESS!$PBX_SPEEX_PREPROCESS$ac_delim
 CONFIG_GMIME!$CONFIG_GMIME$ac_delim
 PBX_ZAPTEL_VLDTMF!$PBX_ZAPTEL_VLDTMF$ac_delim
@@ -51222,12 +51908,12 @@ PBX_H323!$PBX_H323$ac_delim
 PBX_IXJUSER!$PBX_IXJUSER$ac_delim
 CONFIG_SDL!$CONFIG_SDL$ac_delim
 CONFIG_GTK!$CONFIG_GTK$ac_delim
-PKGCONFIG!$PKGCONFIG$ac_delim
+LIBEDIT_OBJ!$LIBEDIT_OBJ$ac_delim
 CURL_CONFIG!$CURL_CONFIG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 855f8ec..07deb31 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -116,6 +116,12 @@
 /* Define to indicate the ${BKTR_DESCRIP} library version */
 #undef HAVE_BKTR_VERSION
 
+/* Define this to indicate the ${BLUETOOTH_DESCRIP} library */
+#undef HAVE_BLUETOOTH
+
+/* Define to indicate the ${BLUETOOTH_DESCRIP} library version */
+#undef HAVE_BLUETOOTH_VERSION
+
 /* Define to 1 if byteswap.h macros are available. */
 #undef HAVE_BYTESWAP_H
 
@@ -385,6 +391,9 @@
 /* Define to indicate the ${LDAP_DESCRIP} library version */
 #undef HAVE_LDAP_VERSION
 
+/* Define if your system has the NetBSD Editline libraries. */
+#undef HAVE_LIBEDIT
+
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
@@ -442,12 +451,9 @@
 /* Define to indicate the ${LTDL_DESCRIP} library version */
 #undef HAVE_LTDL_VERSION
 
-/* Define this to indicate the ${LUA_DESCRIP} library */
+/* Define if your system has the LUA libraries. */
 #undef HAVE_LUA
 
-/* Define to indicate the ${LUA_DESCRIP} library version */
-#undef HAVE_LUA_VERSION
-
 /* Define to 1 if you have the <malloc.h> header file. */
 #undef HAVE_MALLOC_H
 
@@ -1199,6 +1205,9 @@
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
 
 /* Define like PROTOTYPES; this can be used by system headers. */
 #undef __PROTOTYPES
-- 
1.5.5.2


0001-Modify-init-scripts-for-better-Fedora-compatibility.patch:

Index: 0001-Modify-init-scripts-for-better-Fedora-compatibility.patch
===================================================================
RCS file: /cvs/pkgs/rpms/asterisk/F-9/0001-Modify-init-scripts-for-better-Fedora-compatibility.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0001-Modify-init-scripts-for-better-Fedora-compatibility.patch	2 Jul 2008 16:39:50 -0000	1.1
+++ 0001-Modify-init-scripts-for-better-Fedora-compatibility.patch	30 Jul 2008 17:03:43 -0000	1.2
@@ -1,4 +1,4 @@
-From 4b4ea77478104bd1bfa02cc41ffd8351780e14e7 Mon Sep 17 00:00:00 2001
+From c916a79652be51092082c2c5a537a3093636aa71 Mon Sep 17 00:00:00 2001
 From: Jeffrey C. Ollie <jeff at ocjtech.us>
 Date: Sun, 18 Nov 2007 21:47:59 -0600
 Subject: [PATCH] Modify init scripts for better Fedora compatibility.

0002-Modify-modules.conf-so-that-different-voicemail-modu.patch:

Index: 0002-Modify-modules.conf-so-that-different-voicemail-modu.patch
===================================================================
RCS file: /cvs/pkgs/rpms/asterisk/F-9/0002-Modify-modules.conf-so-that-different-voicemail-modu.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0002-Modify-modules.conf-so-that-different-voicemail-modu.patch	2 Jul 2008 16:39:50 -0000	1.1
+++ 0002-Modify-modules.conf-so-that-different-voicemail-modu.patch	30 Jul 2008 17:03:43 -0000	1.2
@@ -1,4 +1,4 @@
-From 053d0eda8a0cc575e682df337d630e3aaebf7329 Mon Sep 17 00:00:00 2001
+From fe8076de7d6ce46220751ecefe0e75823031325c Mon Sep 17 00:00:00 2001
 From: Jeffrey C. Ollie <jcollie at pc21224.campus.dmacc.edu>
 Date: Thu, 8 Nov 2007 15:52:36 -0600
 Subject: [PATCH] Modify modules.conf so that different voicemail modules can be loaded.


Index: asterisk.spec
===================================================================
RCS file: /cvs/pkgs/rpms/asterisk/F-9/asterisk.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- asterisk.spec	30 Jul 2008 14:38:04 -0000	1.28
+++ asterisk.spec	30 Jul 2008 17:03:43 -0000	1.29
@@ -4,7 +4,7 @@
 Summary: The Open Source PBX
 Name: asterisk
 Version: 1.6.0
-Release: 0.20.beta%{beta}%{?dist}
+Release: 0.21.beta%{beta}%{?dist}
 License: GPLv2
 Group: Applications/Internet
 URL: http://www.asterisk.org/
@@ -36,16 +36,16 @@
 
 Patch1:  0001-Modify-init-scripts-for-better-Fedora-compatibility.patch
 Patch2:  0002-Modify-modules.conf-so-that-different-voicemail-modu.patch
-Patch3:  0003-Add-FAX-apps.patch
-Patch4:  0004-Allow-alternate-extensions-to-be-specified-in-users.patch
-Patch5:  0005-Pick-proper-optimization-flags-for-Fedora.patch
-Patch6:  0006-Add-chan_mobile-from-asterisk-addons.patch
-Patch7:  0007-Use-pkgconfig-to-check-for-Lua.patch
-Patch8:  0008-Build-using-external-libedit.patch
-Patch9:  0009-Update-cdr_tds-to-latest.patch
-Patch10: 0010-Update-autoconf.patch
-Patch11: 0011-Merged-revisions-123952-via-svnmerge-from.patch
-Patch12: 0012-Merged-revisions-132778-via-svnmerge-from.patch
+Patch3:  0003-Allow-alternate-extensions-to-be-specified-in-users.patch
+Patch4:  0004-Minor-changes-to-reduce-packaging-changes-made-by-th.patch
+Patch5:  0005-Add-chan_mobile-from-asterisk-addons.patch
+Patch6:  0006-Use-pkgconfig-to-check-for-Lua.patch
+Patch7:  0007-Build-using-external-libedit.patch
+Patch8:  0008-Update-cdr_tds-to-latest.patch
+Patch9:  0009-Merged-revisions-123952-via-svnmerge-from.patch
+Patch10: 0010-Merged-revisions-132778-via-svnmerge-from.patch
+Patch11: 0011-Replace-app_rxfax-app_txfax-with-app_fax-pulled-from.patch
+Patch12: 0012-Update-autoconf.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
 
@@ -147,7 +147,7 @@
 Summary: FAX applications for Asterisk
 Group: Applications/Internet
 Requires: asterisk = %{version}-%{release}
-BuildRequires: spandsp-devel
+BuildRequires: spandsp-devel >= 0.0.5-0.1.pre4
 
 %description fax
 FAX applications for Asterisk
@@ -862,8 +862,7 @@
 
 %files fax
 %defattr(-,root,root,-)
-%{_libdir}/asterisk/modules/app_rxfax.so
-%{_libdir}/asterisk/modules/app_txfax.so
+%{_libdir}/asterisk/modules/app_fax.so
 
 %files festival
 %defattr(-,root,root,-)
@@ -1027,6 +1026,9 @@
 %{_libdir}/asterisk/modules/codec_zap.so
 
 %changelog
+* Wed Jul 30 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.21.beta9
+- Replace app_rxfax/app_txfax with app_fax taken from upstream SVN.
+
 * Tue Jul 29 2008 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.6.0-0.20.beta9
 - Bump release and rebuild with new libpri and zaptel.
 


--- 0003-Add-FAX-apps.patch DELETED ---


--- 0004-Allow-alternate-extensions-to-be-specified-in-users.patch DELETED ---


--- 0005-Pick-proper-optimization-flags-for-Fedora.patch DELETED ---


--- 0006-Add-chan_mobile-from-asterisk-addons.patch DELETED ---


--- 0007-Use-pkgconfig-to-check-for-Lua.patch DELETED ---


--- 0008-Build-using-external-libedit.patch DELETED ---


--- 0009-Update-cdr_tds-to-latest.patch DELETED ---


--- 0010-Update-autoconf.patch DELETED ---


--- 0011-Merged-revisions-123952-via-svnmerge-from.patch DELETED ---


--- 0012-Merged-revisions-132778-via-svnmerge-from.patch DELETED ---




More information about the fedora-extras-commits mailing list