[Pkg-voip-commits] [asterisk] 04/04: Asterisk 12 in an experimental branch
tzafrir at debian.org
tzafrir at debian.org
Wed Oct 9 18:16:01 UTC 2013
This is an automated email from the git hooks/post-receive script.
tzafrir pushed a commit to branch experimental
in repository asterisk.
commit 996789775a384671447b5f08b6e8728834ca39d2
Author: Tzafrir Cohen <tzafrir at debian.org>
Date: Wed Oct 9 14:13:54 2013 -0400
Asterisk 12 in an experimental branch
* Patches dahdi_pri_event_removed, dahdi_create_channels, bzero,
pjproject removed: backports from Asterisk 12.
* Patch astdb_mans removed: accepted upstream.
* libjansson added to BuildRequired.
---
debian/changelog | 4 +
debian/control | 1 +
debian/patches/astdb_mans | 103 ------
debian/patches/bzero | 51 ---
debian/patches/dahdi_create_channels | 563 --------------------------------
debian/patches/dahdi_pri_event_removed | 155 ---------
debian/patches/pjproject | 430 ------------------------
debian/patches/series | 7 -
8 files changed, 5 insertions(+), 1309 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 0d5d364..211e4e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ asterisk (1:12.0.0~dfsg1~beta1-1) UNRELEASED; urgency=low
* Remove patch hyphen: don't fight with docbook2x-man.
* Switch to branch 12.
+ - Patches dahdi_pri_event_removed, dahdi_create_channels, bzero,
+ pjproject removed: backports from Asterisk 12.
+ * Patch astdb_mans removed: accepted upstream.
+ * libjansson added to BuildRequired.
-- Tzafrir Cohen <tzafrir at debian.org> Tue, 08 Oct 2013 11:56:39 -0400
diff --git a/debian/control b/debian/control
index 4157cce..9cd9913 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders: Mark Purcell <msp at debian.org>, Tzafrir Cohen <tzafrir at debian.org>, Je
Build-Depends: debhelper (>= 8),
dpkg-dev (>= 1.16.1.1),
lsb-base (>= 3.2-14),
+ libjansson-dev,
libreadline-dev | libreadline5-dev,
libgsm1-dev,
libssl-dev,
diff --git a/debian/patches/astdb_mans b/debian/patches/astdb_mans
deleted file mode 100644
index 0157113..0000000
--- a/debian/patches/astdb_mans
+++ /dev/null
@@ -1,103 +0,0 @@
-Description: Man pages for astdb2*
-Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---- a/Makefile
-+++ b/Makefile
-@@ -564,6 +564,7 @@ bininstall: _all installdirs $(SUBDIRS_I
- $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
- $(INSTALL) -m 644 doc/appdocsxml.dtd "$(DESTDIR)$(ASTDATADIR)/documentation"
- $(INSTALL) -m 644 doc/asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
-+ $(INSTALL) -m 644 doc/astdb*.8 "$(DESTDIR)$(ASTMANDIR)/man8"
- $(INSTALL) -m 644 contrib/scripts/astgenkey.8 "$(DESTDIR)$(ASTMANDIR)/man8"
- $(INSTALL) -m 644 contrib/scripts/autosupport.8 "$(DESTDIR)$(ASTMANDIR)/man8"
- $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 "$(DESTDIR)$(ASTMANDIR)/man8"
---- /dev/null
-+++ b/doc/astdb2bdb.8
-@@ -0,0 +1,46 @@
-+.TH "ASTDB2BDB" "8" "30 SEPTEMBER 2013" "Asterisk 11" ""
-+
-+.SH NAME
-+astdb2bdb \- convert astdb back to Berkeley DB 1.86
-+.SH SYNOPSIS
-+
-+.B cd $astlibdir && astdb2bdb path/to/astdb.sqlite3
-+
-+.SH "DESCRIPTION"
-+Up until version version 11, Asterisk used and old version of the
-+Berkeley DB 1.86 (bdb) to store its internal persistent database. In
-+version 11 it switched to using a SQLIte 3 database. This program is
-+used to convert the newly-formatted SQLite 3 astdb back to bdb.
-+
-+You may need it in case of reverting an upgrade or other similar
-+scenarios.
-+
-+.SH OPTIONS
-+There is a single (and required) parameter: the path the the sqlite file.
-+The output file will be a file called
-+.B astdb
-+in the current working directory.
-+
-+.SH EXAMPLES
-+In case you want to revert an upgrade to Asterisk 11, you can do the
-+following (while Asterisk is not running):
-+
-+ cd /var/lib/asterisk && astdb2bdb astdb.sqlite3 && rm astdb.sqlite3
-+
-+This will convert the newly-formatted astdb back to the old format, and
-+delete it (to avoid obsolete data copies).
-+
-+.SH NOTES
-+Berkeley DB 1.86 is obsolete. It is incompatible with newer versions
-+(4.x and newer) that you may see around. Chances are you don't have the
-+tools to use it independently of Asterisk.
-+
-+.SH SEE ALSO
-+.B astdb2sqlite3(8),
-+.B asterisk(8)
-+
-+.SH AUTHOR
-+astdb2bdb was written by Terry Wilson <twilson at digium.com>.
-+
-+This manual page was written by Tzafrir Cohen <tzafrir.cohen at xorcom.com>.
-+
---- /dev/null
-+++ b/doc/astdb2sqlite3.8
-@@ -0,0 +1,39 @@
-+.TH "ASTDB2SQLITE3" "8" "30 SEPTEMBER 2013" "Asterisk 11" ""
-+
-+.SH NAME
-+astdb2sqlite3 \- convert astdb to SQLite 3
-+.SH SYNOPSIS
-+
-+.B astdb2sqlite3 path/to/astdb
-+
-+.SH "DESCRIPTION"
-+Up until version version 11, Asterisk used and old version of the
-+Berkeley DB 1.86 (bdb) to store its internal persistent database. In
-+version 11 it switched to using a SQLIte 3 database. This program is
-+used to convert an existing bdb astdb file to astdb.sqlite3.
-+
-+Normally the conversion is done by Asterisk itself which will run this
-+program. But you may need to run it on your own.
-+
-+.SH OPTIONS
-+There is a single (and required) parameter: the path the the bdb file.
-+The output file will be the same as the input, with
-+.B .sqlite3
-+appended.
-+
-+.SH EXAMPLES
-+Asterisk will typically run the following to upgrade the database:
-+
-+ astdb2sqlite3 /var/lib/asterisk/astdb
-+
-+which will create \fB/var/lib/asterisk/astdb.sqlite3\fR.
-+
-+.SH SEE ALSO
-+.B astdb2bdb(8),
-+.B asterisk(8)
-+
-+.SH AUTHOR
-+astdb2sqlite3 was written by Terry Wilson <twilson at digium.com>.
-+
-+This manual page was written by Tzafrir Cohen <tzafrir.cohen at xorcom.com>.
-+
diff --git a/debian/patches/bzero b/debian/patches/bzero
deleted file mode 100644
index a259148..0000000
--- a/debian/patches/bzero
+++ /dev/null
@@ -1,51 +0,0 @@
-From 84eae85d72f4e5369e2d1e996062bfe1a7b6ad80 Mon Sep 17 00:00:00 2001
-From: Jason Parker <jparker at digium.com>
-Date: Thu, 28 Feb 2013 21:21:50 +0000
-Subject: [PATCH] Don't undefine bzero()/bcopy().
-
-This was causing build failures against external libraries that happened to use
-them, unless silly hacks were added to the modules that used those headers.
-
-Review: https://reviewboard.asterisk.org/r/2359/
-
-Backporting to 11, as pjproject has changed.
-
-Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=382292
----
- include/asterisk.h | 11 -----------
- res/res_rtp_asterisk.c | 4 ----
- 2 files changed, 15 deletions(-)
-
---- a/include/asterisk.h
-+++ b/include/asterisk.h
-@@ -213,17 +213,6 @@ struct ast_variable;
- struct ast_str;
- struct ast_sched_context;
-
--#ifdef bzero
--#undef bzero
--#endif
--
--#ifdef bcopy
--#undef bcopy
--#endif
--
--#define bzero 0x__dont_use_bzero__use_memset_instead""
--#define bcopy 0x__dont_use_bcopy__use_memmove_instead()
--
- /* Some handy macros for turning a preprocessor token into (effectively) a quoted string */
- #define __stringify_1(x) #x
- #define __stringify(x) __stringify_1(x)
---- a/res/res_rtp_asterisk.c
-+++ b/res/res_rtp_asterisk.c
-@@ -47,10 +47,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi
- #include <openssl/bio.h>
- #endif
-
--/* Asterisk discourages the use of bzero in favor of memset, in fact if you try to use bzero it will tell you to use memset. As a result bzero has to be undefined
-- * here since it is used internally by pjlib. The only other option would be to modify pjlib... which won't happen. */
--#undef bzero
--#define bzero bzero
- #include "pjlib.h"
- #include "pjlib-util.h"
- #include "pjnath.h"
diff --git a/debian/patches/dahdi_create_channels b/debian/patches/dahdi_create_channels
deleted file mode 100644
index 6cc30bf..0000000
--- a/debian/patches/dahdi_create_channels
+++ /dev/null
@@ -1,563 +0,0 @@
-From: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
-Date: Thu, 8 Aug 2013 22:09:07 +0000
-Subject: [PATCH] chan_dahdi: create channels at run-time
-Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=396474
-
-This code adds chan_dahdi the command 'dahdi create channels <range>'
-(where <range> is a single <n>-<m> or 'new') and updates 'dahdi destroy
-channel' with a similar 'dahdi destroy channels'. It allows DAHDI
-channels and spans to be added after the initial channel load
-(without destroying all other channels as in 'dahdi restart').
-
-It also includes some fixes to the D-Channel / span destruction code
-(r394552).
-
-This change is intended to provide a hook for a script running from
-udev once a span has been assigned ("registered") / unassigned
-("unregistered") for its channels. The udev hook configures the span's
-channels with dahdi_cfg -S, and can then ask Asterisk to create ethe
-channels. See the scripts added to DAHDI-tools in 2.7.0.
-
-Review: https://reviewboard.asterisk.org/r/1598/
-
-A trivial backport from trunk / 12.
-
----
- channels/chan_dahdi.c | 322 +++++++++++++++++++++++++++++++++++++++----------
- 1 file changed, 261 insertions(+), 61 deletions(-)
-
---- a/channels/chan_dahdi.c
-+++ b/channels/chan_dahdi.c
-@@ -404,6 +404,8 @@ static const char config[] = "chan_dahdi
- static int num_cadence = 4;
- static int user_has_defined_cadences = 0;
-
-+static int has_pseudo;
-+
- static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX] = {
- { { 125, 125, 2000, 4000 } }, /*!< Quick chirp followed by normal ring */
- { { 250, 250, 500, 1000, 250, 250, 500, 4000 } }, /*!< British style ring */
-@@ -1391,6 +1393,18 @@ struct dahdi_chan_conf {
- * \note Set from the "smdiport" string read in from chan_dahdi.conf
- */
- char smdi_port[SMDI_MAX_FILENAME_LEN];
-+
-+ /*!
-+ * \brief Don't create channels below this number
-+ * \note by default is 0 (no limit)
-+ */
-+ int wanted_channels_start;
-+
-+ /*!
-+ * \brief Don't create channels above this number (infinity by default)
-+ * \note by default is 0 (special value that means "no limit").
-+ */
-+ int wanted_channels_end;
- };
-
- /*! returns a new dahdi_chan_conf with default values (by-value) */
-@@ -3217,7 +3231,7 @@ static int sig_pri_tone_to_dahditone(enu
- #endif /* defined(HAVE_PRI) */
-
- #if defined(HAVE_PRI)
--static int pri_destroy_dchan(struct sig_pri_span *pri);
-+static void pri_destroy_span(struct sig_pri_span *pri);
-
- static void my_handle_dchan_exception(struct sig_pri_span *pri, int index)
- {
-@@ -3247,7 +3261,7 @@ static void my_handle_dchan_exception(st
- pri_event_noalarm(pri, index, 0);
- break;
- case DAHDI_EVENT_REMOVED:
-- pri_destroy_dchan(pri);
-+ pri_destroy_span(pri);
- break;
- default:
- break;
-@@ -11670,29 +11684,121 @@ static int mwi_send_process_event(struct
- return handled;
- }
-
--/* destroy a DAHDI channel, identified by its number */
--static int dahdi_destroy_channel_bynum(int channel)
-+/* destroy a range DAHDI channels, identified by their number */
-+static void dahdi_destroy_channel_range(int start, int end)
- {
- struct dahdi_pvt *cur;
-+ struct dahdi_pvt *next;
-+ int destroyed_first = 0;
-+ int destroyed_last = 0;
-
- ast_mutex_lock(&iflock);
-- for (cur = iflist; cur; cur = cur->next) {
-- if (cur->channel == channel) {
-+ ast_debug(1, "range: %d-%d\n", start, end);
-+ for (cur = iflist; cur; cur = next) {
-+ next = cur->next;
-+ if (cur->channel >= start && cur->channel <= end) {
- int x = DAHDI_FLASH;
-
-+ if (cur->channel > destroyed_last) {
-+ destroyed_last = cur->channel;
-+ }
-+ if (destroyed_first < 1 || cur->channel < destroyed_first) {
-+ destroyed_first = cur->channel;
-+ }
-+ ast_debug(3, "Destroying %d\n", cur->channel);
- /* important to create an event for dahdi_wait_event to register so that all analog_ss_threads terminate */
- ioctl(cur->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
-
- destroy_channel(cur, 1);
-- ast_mutex_unlock(&iflock);
- ast_module_unref(ast_module_info->self);
-- return RESULT_SUCCESS;
- }
- }
- ast_mutex_unlock(&iflock);
-- return RESULT_FAILURE;
-+ if (destroyed_first > start || destroyed_last < end) {
-+ ast_debug(1, "Asked to destroy %d-%d, destroyed %d-%d,\n",
-+ start, end, destroyed_first, destroyed_last);
-+ }
-+}
-+
-+static int setup_dahdi(int reload);
-+static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, struct dahdi_chan_conf *base_conf, struct dahdi_chan_conf *conf);
-+
-+/*!
-+ * \internal
-+ * \brief create a range of new DAHDI channels
-+ *
-+ * \param start first channel in the range
-+ * \param end last channel in the range
-+ *
-+ * \retval RESULT_SUCCESS on success.
-+ * \retval RESULT_FAILURE on error.
-+ */
-+static int dahdi_create_channel_range(int start, int end)
-+{
-+ struct dahdi_pvt *cur;
-+ struct dahdi_chan_conf default_conf = dahdi_chan_conf_default();
-+ struct dahdi_chan_conf base_conf = dahdi_chan_conf_default();
-+ struct dahdi_chan_conf conf = dahdi_chan_conf_default();
-+ int i, x;
-+ int ret = RESULT_FAILURE; /* be pessimistic */
-+
-+ ast_debug(1, "channel range caps: %d - %d\n", start, end);
-+ ast_mutex_lock(&iflock);
-+ for (cur = iflist; cur; cur = cur->next) {
-+ if (cur->channel >= start && cur->channel <= end) {
-+ ast_log(LOG_ERROR,
-+ "channel range %d-%d is occupied\n",
-+ start, end);
-+ goto out;
-+ }
-+ }
-+ for (x = 0; x < NUM_SPANS; x++) {
-+#ifdef HAVE_PRI
-+ struct dahdi_pri *pri = pris + x;
-+
-+ if (!pris[x].pri.pvts[0]) {
-+ break;
-+ }
-+ for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
-+ int channo = pri->dchannels[i];
-+
-+ if (!channo) {
-+ break;
-+ }
-+ if (!pri->pri.fds[i]) {
-+ break;
-+ }
-+ if (channo >= start && channo <= end) {
-+ ast_log(LOG_ERROR,
-+ "channel range %d-%d is occupied by span %d\n",
-+ start, end, x + 1);
-+ goto out;
-+ }
-+ }
-+#endif
-+ }
-+ if (!default_conf.chan.cc_params || !base_conf.chan.cc_params ||
-+ !conf.chan.cc_params) {
-+ goto out;
-+ }
-+ default_conf.wanted_channels_start = start;
-+ base_conf.wanted_channels_start = start;
-+ conf.wanted_channels_start = start;
-+ default_conf.wanted_channels_end = end;
-+ base_conf.wanted_channels_end = end;
-+ conf.wanted_channels_end = end;
-+ if (setup_dahdi_int(0, &default_conf, &base_conf, &conf) == 0) {
-+ ret = RESULT_SUCCESS;
-+ }
-+out:
-+ ast_cc_config_params_destroy(default_conf.chan.cc_params);
-+ ast_cc_config_params_destroy(base_conf.chan.cc_params);
-+ ast_cc_config_params_destroy(conf.chan.cc_params);
-+ ast_mutex_unlock(&iflock);
-+ return ret;
- }
-
-+
- static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
- {
- int res;
-@@ -12058,11 +12164,7 @@ static void *do_monitor(void *data)
- doomed = NULL;
- for (i = iflist;; i = i->next) {
- if (doomed) {
-- int res;
-- res = dahdi_destroy_channel_bynum(doomed->channel);
-- if (res != RESULT_SUCCESS) {
-- ast_log(LOG_WARNING, "Couldn't find channel to destroy, hopefully another destroy operation just happened.\n");
-- }
-+ dahdi_destroy_channel_range(doomed->channel, doomed->channel);
- doomed = NULL;
- }
- if (!i) {
-@@ -14497,10 +14599,21 @@ static int prepare_pri(struct dahdi_pri
- for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
- if (!pri->dchannels[i])
- break;
-+ if (pri->pri.fds[i] >= 0) {
-+ /* A partial range addition. Not a complete setup. */
-+ break;
-+ }
- pri->pri.fds[i] = open("/dev/dahdi/channel", O_RDWR);
-+ if ((pri->pri.fds[i] < 0)) {
-+ ast_log(LOG_ERROR, "Unable to open D-channel (fd=%d) (%s)\n",
-+ pri->pri.fds[i], strerror(errno));
-+ return -1;
-+ }
- x = pri->dchannels[i];
-- if ((pri->pri.fds[i] < 0) || (ioctl(pri->pri.fds[i],DAHDI_SPECIFY,&x) == -1)) {
-- ast_log(LOG_ERROR, "Unable to open D-channel %d (%s)\n", x, strerror(errno));
-+ res = ioctl(pri->pri.fds[i], DAHDI_SPECIFY, &x);
-+ if (res) {
-+ dahdi_close_pri_fd(pri, i);
-+ ast_log(LOG_ERROR, "Unable to SPECIFY channel %d (%s)\n", x, strerror(errno));
- return -1;
- }
- memset(&p, 0, sizeof(p));
-@@ -14901,22 +15014,44 @@ static char *handle_pri_show_spans(struc
- *
- * \param pri the pri span
- *
-- * \return TRUE if the span was valid and we attempted destroying.
-- *
- * Shuts down a span and destroys its D-Channel. Further destruction
- * of the B-channels using dahdi_destroy_channel() would probably be required
- * for the B-Channels.
- */
--static int pri_destroy_dchan(struct sig_pri_span *pri)
-+static void pri_destroy_span(struct sig_pri_span *pri)
- {
- int i;
-+ int res;
-+ int cancel_code;
- struct dahdi_pri* dahdi_pri;
-+ pthread_t master = pri->master;
-
-- if (!pri->master || (pri->master == AST_PTHREADT_NULL)) {
-- return 0;
-+ if (!master || (master == AST_PTHREADT_NULL)) {
-+ return;
-+ }
-+ ast_debug(2, "About to destroy DAHDI channels of span %d.\n", pri->span);
-+ for (i = 0; i < pri->numchans; i++) {
-+ int channel;
-+ struct sig_pri_chan *pvt = pri->pvts[i];
-+
-+ if (!pvt) {
-+ continue;
-+ }
-+ channel = pvt->channel;
-+ ast_debug(2, "About to destroy B-channel %d.\n", channel);
-+ dahdi_destroy_channel_range(channel, channel);
-+ }
-+
-+ cancel_code = pthread_cancel(master);
-+ ast_debug(4,
-+ "Waiting to join thread of span %d "
-+ "with pid=%p cancel_code=%d\n",
-+ pri->span, (void *)master, cancel_code);
-+ res = pthread_join(master, NULL);
-+ if (res != 0) {
-+ ast_log(LOG_NOTICE, "pthread_join failed: %d\n", res);
- }
-- pthread_cancel(pri->master);
-- pthread_join(pri->master, NULL);
-+ pri->master = AST_PTHREADT_NULL;
-
- /* The 'struct dahdi_pri' that contains our 'struct sig_pri_span' */
- dahdi_pri = container_of(pri, struct dahdi_pri, pri);
-@@ -14924,17 +15059,16 @@ static int pri_destroy_dchan(struct sig_
- ast_debug(4, "closing pri_fd %d\n", i);
- dahdi_close_pri_fd(dahdi_pri, i);
- }
-- pri->pri = NULL;
-+ sig_pri_init_pri(pri);
- ast_debug(1, "PRI span %d destroyed\n", pri->span);
-- return 1;
- }
-
- static char *handle_pri_destroy_span(struct ast_cli_entry *e, int cmd,
- struct ast_cli_args *a)
- {
- int span;
-- int i;
- int res;
-+ struct sig_pri_span *pri;
-
- switch (cmd) {
- case CLI_INIT:
-@@ -14958,25 +15092,13 @@ static char *handle_pri_destroy_span(str
- a->argv[3], 1, NUM_SPANS);
- return CLI_SUCCESS;
- }
-- if (!pris[span - 1].pri.pri) {
-+ pri = &pris[span - 1].pri;
-+ if (!pri->pri) {
- ast_cli(a->fd, "No PRI running on span %d\n", span);
- return CLI_SUCCESS;
- }
-
-- for (i = 0; i < pris[span - 1].pri.numchans; i++) {
-- int channel;
-- struct sig_pri_chan *pvt = pris[span - 1].pri.pvts[i];
--
-- if (!pvt) {
-- continue;
-- }
-- channel = pvt->channel;
-- ast_debug(2, "About to destroy B-channel %d.\n", channel);
-- dahdi_destroy_channel_bynum(channel);
-- }
-- ast_debug(2, "About to destroy D-channel of span %d.\n", span);
-- pri_destroy_dchan(&pris[span - 1].pri);
--
-+ pri_destroy_span(pri);
- return CLI_SUCCESS;
- }
-
-@@ -15428,26 +15550,97 @@ static struct ast_cli_entry dahdi_mfcr2_
-
- #endif /* HAVE_OPENR2 */
-
--static char *dahdi_destroy_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-+static char *dahdi_destroy_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
- {
-- int channel;
-- int ret;
-+ int start;
-+ int end;
- switch (cmd) {
- case CLI_INIT:
-- e->command = "dahdi destroy channel";
-+ e->command = "dahdi destroy channels";
- e->usage =
-- "Usage: dahdi destroy channel <chan num>\n"
-+ "Usage: dahdi destroy channels <from_channel> [<to_channel>]\n"
- " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
-- if (a->argc != 4)
-+ if ((a->argc < 4) || a->argc > 5) {
- return CLI_SHOWUSAGE;
-+ }
-+ start = atoi(a->argv[3]);
-+ if (start < 1) {
-+ ast_cli(a->fd, "Invalid starting channel number %s.\n",
-+ a->argv[4]);
-+ return CLI_FAILURE;
-+ }
-+ if (a->argc == 5) {
-+ end = atoi(a->argv[4]);
-+ if (end < 1) {
-+ ast_cli(a->fd, "Invalid ending channel number %s.\n",
-+ a->argv[4]);
-+ return CLI_FAILURE;
-+ }
-+ } else {
-+ end = start;
-+ }
-
-- channel = atoi(a->argv[3]);
-- ret = dahdi_destroy_channel_bynum(channel);
-- return ( RESULT_SUCCESS == ret ) ? CLI_SUCCESS : CLI_FAILURE;
-+ if (end < start) {
-+ ast_cli(a->fd,
-+ "range end (%d) is smaller than range start (%d)\n",
-+ end, start);
-+ return CLI_FAILURE;
-+ }
-+ dahdi_destroy_channel_range(start, end);
-+ return CLI_SUCCESS;
-+}
-+
-+static char *dahdi_create_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-+{
-+ int start;
-+ int end;
-+ int ret;
-+
-+ switch (cmd) {
-+ case CLI_INIT:
-+ e->command = "dahdi create channels";
-+ e->usage = "Usage: dahdi create channels <from> [<to>] - a range of channels\n"
-+ " dahdi create channels new - add channels not yet created\n"
-+ "For ISDN and SS7 the range should include complete spans.\n";
-+ return NULL;
-+ case CLI_GENERATE:
-+ return NULL;
-+ }
-+ if ((a->argc < 4) || a->argc > 5) {
-+ return CLI_SHOWUSAGE;
-+ }
-+ if (a->argc == 4 && !strcmp(a->argv[3], "new")) {
-+ ret = dahdi_create_channel_range(0, 0);
-+ return (RESULT_SUCCESS == ret) ? CLI_SUCCESS : CLI_FAILURE;
-+ }
-+ start = atoi(a->argv[3]);
-+ if (start <= 0) {
-+ ast_cli(a->fd, "Invalid starting channel number '%s'.\n",
-+ a->argv[3]);
-+ return CLI_FAILURE;
-+ }
-+ if (a->argc == 5) {
-+ end = atoi(a->argv[4]);
-+ if (end <= 0) {
-+ ast_cli(a->fd, "Invalid ending channel number '%s'.\n",
-+ a->argv[4]);
-+ return CLI_FAILURE;
-+ }
-+ } else {
-+ end = start;
-+ }
-+ if (end < start) {
-+ ast_cli(a->fd,
-+ "range end (%d) is smaller than range start (%d)\n",
-+ end, start);
-+ return CLI_FAILURE;
-+ }
-+ ret = dahdi_create_channel_range(start, end);
-+ return (RESULT_SUCCESS == ret) ? CLI_SUCCESS : CLI_FAILURE;
- }
-
- static void dahdi_softhangup_all(void)
-@@ -15478,7 +15671,6 @@ retry:
- ast_mutex_unlock(&iflock);
- }
-
--static int setup_dahdi(int reload);
- static int dahdi_restart(void)
- {
- #if defined(HAVE_PRI) || defined(HAVE_SS7)
-@@ -16254,7 +16446,8 @@ static struct ast_cli_entry dahdi_cli[]
- AST_CLI_DEFINE(handle_dahdi_show_cadences, "List cadences"),
- AST_CLI_DEFINE(dahdi_show_channels, "Show active DAHDI channels"),
- AST_CLI_DEFINE(dahdi_show_channel, "Show information on a channel"),
-- AST_CLI_DEFINE(dahdi_destroy_channel, "Destroy a channel"),
-+ AST_CLI_DEFINE(dahdi_destroy_channels, "Destroy channels"),
-+ AST_CLI_DEFINE(dahdi_create_channels, "Create channels"),
- AST_CLI_DEFINE(dahdi_restart_cmd, "Fully restart DAHDI channels"),
- AST_CLI_DEFINE(dahdi_show_status, "Show all DAHDI cards status"),
- AST_CLI_DEFINE(dahdi_show_version, "Show the DAHDI version in use"),
-@@ -17278,7 +17471,7 @@ static char *parse_spanchan(char *chanst
- return p;
- }
-
--static int build_channels(struct dahdi_chan_conf *conf, const char *value, int reload, int lineno, int *found_pseudo)
-+static int build_channels(struct dahdi_chan_conf *conf, const char *value, int reload, int lineno)
- {
- char *c, *chan;
- char *subdir;
-@@ -17301,8 +17494,6 @@ static int build_channels(struct dahdi_c
- finish = start;
- } else if (!strcasecmp(chan, "pseudo")) {
- finish = start = CHAN_PSEUDO;
-- if (found_pseudo)
-- *found_pseudo = 1;
- } else {
- ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", value, chan);
- return -1;
-@@ -17332,6 +17523,12 @@ static int build_channels(struct dahdi_c
- }
- }
- }
-+ if (conf->wanted_channels_start &&
-+ (real_channel < conf->wanted_channels_start ||
-+ real_channel > conf->wanted_channels_end)
-+ ) {
-+ continue;
-+ }
- tmp = mkintf(real_channel, conf, reload);
-
- if (tmp) {
-@@ -17341,6 +17538,9 @@ static int build_channels(struct dahdi_c
- (reload == 1) ? "reconfigure" : "register", value);
- return -1;
- }
-+ if (real_channel == CHAN_PSEUDO) {
-+ has_pseudo = 1;
-+ }
- }
- }
-
-@@ -17527,7 +17727,6 @@ static int process_dahdi(struct dahdi_ch
- {
- struct dahdi_pvt *tmp;
- int y;
-- int found_pseudo = 0;
- struct ast_variable *dahdichan = NULL;
-
- for (; v; v = v->next) {
-@@ -17540,7 +17739,7 @@ static int process_dahdi(struct dahdi_ch
- ast_log(LOG_WARNING, "Channel '%s' ignored.\n", v->value);
- continue;
- }
-- if (build_channels(confp, v->value, reload, v->lineno, &found_pseudo)) {
-+ if (build_channels(confp, v->value, reload, v->lineno)) {
- if (confp->ignore_failed_channels) {
- ast_log(LOG_WARNING, "Channel '%s' failure ignored: ignore_failed_channels.\n", v->value);
- continue;
-@@ -18673,8 +18872,7 @@ static int process_dahdi(struct dahdi_ch
-
- if (dahdichan) {
- /* Process the deferred dahdichan value. */
-- if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno,
-- &found_pseudo)) {
-+ if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno)) {
- if (confp->ignore_failed_channels) {
- ast_log(LOG_WARNING,
- "Dahdichan '%s' failure ignored: ignore_failed_channels.\n",
-@@ -18697,7 +18895,7 @@ static int process_dahdi(struct dahdi_ch
-
- /*< \todo why check for the pseudo in the per-channel section.
- * Any actual use for manual setup of the pseudo channel? */
-- if (!found_pseudo && reload != 1 && !(options & PROC_DAHDI_OPT_NOCHAN)) {
-+ if (!has_pseudo && reload != 1 && !(options & PROC_DAHDI_OPT_NOCHAN)) {
- /* use the default configuration for a channel, so
- that any settings from real configured channels
- don't "leak" into the pseudo channel config
-@@ -18711,6 +18909,7 @@ static int process_dahdi(struct dahdi_ch
- }
- if (tmp) {
- ast_verb(3, "Automatically generated pseudo channel\n");
-+ has_pseudo = 1;
- } else {
- ast_log(LOG_WARNING, "Unable to register pseudo channel!\n");
- }
-@@ -18990,7 +19189,8 @@ static int setup_dahdi_int(int reload, s
- if (reload != 1) {
- int x;
- for (x = 0; x < NUM_SPANS; x++) {
-- if (pris[x].pri.pvts[0]) {
-+ if (pris[x].pri.pvts[0] &&
-+ pris[x].pri.master == AST_PTHREADT_NULL) {
- prepare_pri(pris + x);
- if (sig_pri_start_pri(&pris[x].pri)) {
- ast_log(LOG_ERROR, "Unable to start D-channel on span %d\n", x + 1);
diff --git a/debian/patches/dahdi_pri_event_removed b/debian/patches/dahdi_pri_event_removed
deleted file mode 100644
index de83a41..0000000
--- a/debian/patches/dahdi_pri_event_removed
+++ /dev/null
@@ -1,155 +0,0 @@
-From: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
-Date: Wed, 17 Jul 2013 16:56:14 +0000
-Subject: handle DAHDI_EVENT_REMOVED on a pri D-Channel
-Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=394552
-
-When a DAHDI device is removed at run-time it sends the event
-DAHDI_EVENT_REMOVED on each channel. This is intended to signal the
-userspace program to close the respective file handle, as the driver of
-the device will need all of them closed to properly clean-up.
-
-This event has long since been handled in chan_dahdi (chan_zap at the
-time). However the event that is sent on a D-Channel of a "PRI" (ISDN)
-span simply gets ignored.
-
-This commit adds handling for closing the file descriptor (and shutting
-down the span, while we're at it).
-
-It also adds a CLI command 'pri destroy span <N>' to destroy the span
-and its DAHDI channels.
-
-Review: https://reviewboard.asterisk.org/r/726/
-
-Trivial backport from trunk / 12.
-
----
- channels/chan_dahdi.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 97 insertions(+)
-
---- a/channels/chan_dahdi.c
-+++ b/channels/chan_dahdi.c
-@@ -3217,6 +3217,8 @@ static int sig_pri_tone_to_dahditone(enu
- #endif /* defined(HAVE_PRI) */
-
- #if defined(HAVE_PRI)
-+static int pri_destroy_dchan(struct sig_pri_span *pri);
-+
- static void my_handle_dchan_exception(struct sig_pri_span *pri, int index)
- {
- int x;
-@@ -3244,6 +3246,9 @@ static void my_handle_dchan_exception(st
- case DAHDI_EVENT_NOALARM:
- pri_event_noalarm(pri, index, 0);
- break;
-+ case DAHDI_EVENT_REMOVED:
-+ pri_destroy_dchan(pri);
-+ break;
- default:
- break;
- }
-@@ -14887,6 +14892,97 @@ static char *handle_pri_show_spans(struc
- #endif /* defined(HAVE_PRI) */
-
- #if defined(HAVE_PRI)
-+#define container_of(ptr, type, member) \
-+ ((type *)((char *)(ptr) - offsetof(type, member)))
-+/*!
-+ * \internal
-+ * \brief Destroy a D-Channel of a PRI span
-+ * \since 12
-+ *
-+ * \param pri the pri span
-+ *
-+ * \return TRUE if the span was valid and we attempted destroying.
-+ *
-+ * Shuts down a span and destroys its D-Channel. Further destruction
-+ * of the B-channels using dahdi_destroy_channel() would probably be required
-+ * for the B-Channels.
-+ */
-+static int pri_destroy_dchan(struct sig_pri_span *pri)
-+{
-+ int i;
-+ struct dahdi_pri* dahdi_pri;
-+
-+ if (!pri->master || (pri->master == AST_PTHREADT_NULL)) {
-+ return 0;
-+ }
-+ pthread_cancel(pri->master);
-+ pthread_join(pri->master, NULL);
-+
-+ /* The 'struct dahdi_pri' that contains our 'struct sig_pri_span' */
-+ dahdi_pri = container_of(pri, struct dahdi_pri, pri);
-+ for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
-+ ast_debug(4, "closing pri_fd %d\n", i);
-+ dahdi_close_pri_fd(dahdi_pri, i);
-+ }
-+ pri->pri = NULL;
-+ ast_debug(1, "PRI span %d destroyed\n", pri->span);
-+ return 1;
-+}
-+
-+static char *handle_pri_destroy_span(struct ast_cli_entry *e, int cmd,
-+ struct ast_cli_args *a)
-+{
-+ int span;
-+ int i;
-+ int res;
-+
-+ switch (cmd) {
-+ case CLI_INIT:
-+ e->command = "pri destroy span";
-+ e->usage =
-+ "Usage: pri destroy span <span>\n"
-+ " Destorys D-channel of span and its B-channels.\n"
-+ " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n";
-+ return NULL;
-+ case CLI_GENERATE:
-+ return complete_span_4(a->line, a->word, a->pos, a->n);
-+ }
-+
-+ if (a->argc < 4) {
-+ return CLI_SHOWUSAGE;
-+ }
-+ res = sscanf(a->argv[3], "%30d", &span);
-+ if ((res != 1) || span < 1 || span > NUM_SPANS) {
-+ ast_cli(a->fd,
-+ "Invalid span '%s'. Should be a number from %d to %d\n",
-+ a->argv[3], 1, NUM_SPANS);
-+ return CLI_SUCCESS;
-+ }
-+ if (!pris[span - 1].pri.pri) {
-+ ast_cli(a->fd, "No PRI running on span %d\n", span);
-+ return CLI_SUCCESS;
-+ }
-+
-+ for (i = 0; i < pris[span - 1].pri.numchans; i++) {
-+ int channel;
-+ struct sig_pri_chan *pvt = pris[span - 1].pri.pvts[i];
-+
-+ if (!pvt) {
-+ continue;
-+ }
-+ channel = pvt->channel;
-+ ast_debug(2, "About to destroy B-channel %d.\n", channel);
-+ dahdi_destroy_channel_bynum(channel);
-+ }
-+ ast_debug(2, "About to destroy D-channel of span %d.\n", span);
-+ pri_destroy_dchan(&pris[span - 1].pri);
-+
-+ return CLI_SUCCESS;
-+}
-+
-+#endif /* defined(HAVE_PRI) */
-+
-+#if defined(HAVE_PRI)
- static char *handle_pri_show_span(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
- {
- int span;
-@@ -14992,6 +15088,7 @@ static struct ast_cli_entry dahdi_pri_cl
- AST_CLI_DEFINE(handle_pri_show_channels, "Displays PRI channel information"),
- AST_CLI_DEFINE(handle_pri_show_spans, "Displays PRI span information"),
- AST_CLI_DEFINE(handle_pri_show_span, "Displays PRI span information"),
-+ AST_CLI_DEFINE(handle_pri_destroy_span, "Destroy a PRI span"),
- AST_CLI_DEFINE(handle_pri_show_debug, "Displays current PRI debug settings"),
- AST_CLI_DEFINE(handle_pri_set_debug_file, "Sends PRI debug output to the specified file"),
- AST_CLI_DEFINE(handle_pri_version, "Displays libpri version"),
diff --git a/debian/patches/pjproject b/debian/patches/pjproject
deleted file mode 100644
index d88068d..0000000
--- a/debian/patches/pjproject
+++ /dev/null
@@ -1,430 +0,0 @@
-From 5d584d0d83c063006ba1b731046d309123b7409c Mon Sep 17 00:00:00 2001
-From: Jason Parker <jparker at digium.com>
-Date: Tue, 12 Mar 2013 19:08:59 +0000
-Origin: http://svnview.digium.com/svn/asterisk?view=rev&rev=382900
-Subject: Switch to using external pjproject libraries.
-
-ICE/STUN/TURN support in res_rtp_asterisk is also now optional.
-
-(With minor backport adjustments for branch 11)
-
---- a/build_tools/menuselect-deps.in
-+++ b/build_tools/menuselect-deps.in
-@@ -43,6 +43,7 @@ OPENH323=@PBX_OPENH323@
- OSPTK=@PBX_OSPTK@
- OSS=@PBX_OSS@
- PGSQL=@PBX_PGSQL@
-+PJPROJECT=@PBX_PJPROJECT@
- POPT=@PBX_POPT@
- PORTAUDIO=@PBX_PORTAUDIO@
- PRI=@PBX_PRI@
---- a/configure.ac
-+++ b/configure.ac
-@@ -425,6 +425,7 @@ AST_EXT_LIB_SETUP([OPENR2], [MFR2], [ope
- AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
- AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
- AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
-+AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject])
- AST_EXT_LIB_SETUP([POPT], [popt], [popt])
- AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
- AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
-@@ -1996,6 +1997,8 @@ if test "${PG_CONFIG}" != No; then
- fi
- fi
-
-+AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject])
-+
- AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
-
- AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
---- a/include/asterisk/autoconfig.h.in
-+++ b/include/asterisk/autoconfig.h.in
-@@ -551,6 +551,9 @@
- /* Define to indicate presence of the pg_encoding_to_char API. */
- #undef HAVE_PGSQL_pg_encoding_to_char
-
-+/* Define if your system has the PJPROJECT libraries. */
-+#undef HAVE_PJPROJECT
-+
- /* Define to 1 if your system defines IP_PKTINFO. */
- #undef HAVE_PKTINFO
-
---- a/makeopts.in
-+++ b/makeopts.in
-@@ -214,6 +214,9 @@ OSS_LIB=@OSS_LIB@ @FFMPEG_LIB@ @SDL_LIB@
- PGSQL_INCLUDE=@PGSQL_INCLUDE@
- PGSQL_LIB=@PGSQL_LIB@
-
-+PJPROJECT_INCLUDE=@PJPROJECT_INCLUDE@
-+PJPROJECT_LIB=@PJPROJECT_LIB@
-+
- POPT_INCLUDE=@POPT_INCLUDE@
- POPT_LIB=@POPT_LIB@
-
---- a/res/Makefile
-+++ b/res/Makefile
-@@ -67,26 +67,4 @@ endif
- ael/pval.o: ael/pval.c
-
- clean::
-- @if [ -f pjproject/build.mak ]; then $(MAKE) -C pjproject realclean; fi
- rm -f snmp/*.o snmp/*.i ael/*.o ael/*.i ais/*.o ais/*.i
--
--dist-clean::
-- rm -f pjproject/build.mak
--
--pjproject/build.mak: pjproject/aconfigure
-- (cd pjproject && CFLAGS="-fPIC" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --disable-floating-point --disable-sound --disable-oss --disable-speex-aec --disable-l16-codec --disable-gsm-codec --disable-g722-codec --disable-g7221-codec --disable-speex-codec --disable-ilbc-codec --disable-g711-codec)
--
--ifneq ($(findstring $(MAKECMDGOALS),all),)
---include pjproject/build.mak
--endif
--
--.PHONY: FORCE
--FORCE:
--
--$(PJ_LIB_FILES): FORCE
-- $(MAKE) -C $(patsubst %/lib/,%,$(dir $@))/build/ ../lib/$(notdir $@)
--
--res_rtp_asterisk.o: $(PJ_LIB_FILES)
--res_rtp_asterisk.o: _ASTCFLAGS+=$(PJ_CFLAGS)
--res_rtp_asterisk.so: _ASTLDFLAGS+=$(PJ_LDFLAGS)
--res_rtp_asterisk.so: LIBS+=$(PJ_LDLIBS)
---- a/res/res_rtp_asterisk.c
-+++ b/res/res_rtp_asterisk.c
-@@ -29,6 +29,7 @@
- */
-
- /*** MODULEINFO
-+ <use type="external">pjproject</use>
- <depend>uuid</depend>
- <support_level>core</support_level>
- ***/
-@@ -47,9 +48,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi
- #include <openssl/bio.h>
- #endif
-
--#include "pjlib.h"
--#include "pjlib-util.h"
--#include "pjnath.h"
-+#ifdef HAVE_PJPROJECT
-+#include <pjlib.h>
-+#include <pjlib-util.h>
-+#include <pjnath.h>
-+#endif
-
- #include "asterisk/stun.h"
- #include "asterisk/pbx.h"
-@@ -130,6 +133,7 @@ static int nochecksums;
- #endif
- static int strictrtp = DEFAULT_STRICT_RTP; /*< Only accept RTP frames from a defined source. If we receive an indication of a changing source, enter learning mode. */
- static int learning_min_sequential = DEFAULT_LEARNING_MIN_SEQUENTIAL; /*< Number of sequential RTP frames needed from a single source during learning mode to accept new source. */
-+#ifdef HAVE_PJPROJECT
- static int icesupport = DEFAULT_ICESUPPORT;
- static struct sockaddr_in stunaddr;
- static pj_str_t turnaddr;
-@@ -154,6 +158,7 @@ static pj_thread_t *thread;
-
- /*! \brief Notification that the ICE/TURN worker thread should stop */
- static int worker_terminate;
-+#endif
-
- #define FLAG_3389_WARNING (1 << 0)
- #define FLAG_NAT_ACTIVE (3 << 1)
-@@ -251,12 +256,14 @@ struct ast_rtp {
-
- struct rtp_red *red;
-
-+ ast_mutex_t lock; /*!< Lock for synchronization purposes */
-+ ast_cond_t cond; /*!< Condition for signaling */
-+
-+#ifdef HAVE_PJPROJECT
- pj_ice_sess *ice; /*!< ICE session */
- pj_turn_sock *turn_rtp; /*!< RTP TURN relay */
- pj_turn_sock *turn_rtcp; /*!< RTCP TURN relay */
-- ast_mutex_t lock; /*!< Lock for synchronization purposes */
- pj_turn_state_t turn_state; /*!< Current state of the TURN relay session */
-- ast_cond_t cond; /*!< Condition for signaling */
- unsigned int passthrough:1; /*!< Bit to indicate that the received packet should be passed through */
- unsigned int ice_started:1; /*!< Bit to indicate ICE connectivity checks have started */
-
-@@ -268,6 +275,7 @@ struct ast_rtp {
-
- struct ao2_container *local_candidates; /*!< The local ICE candidates */
- struct ao2_container *remote_candidates; /*!< The remote ICE candidates */
-+#endif
-
- #ifdef HAVE_OPENSSL_SRTP
- SSL_CTX *ssl_ctx; /*!< SSL context */
-@@ -395,6 +403,22 @@ static int ast_rtp_activate(struct ast_r
-
- static int __rtp_sendto(struct ast_rtp_instance *instance, void *buf, size_t size, int flags, struct ast_sockaddr *sa, int rtcp, int *ice, int use_srtp);
-
-+/*! \brief Helper function which updates an ast_sockaddr with the candidate used for the component */
-+static void update_address_with_ice_candidate(struct ast_rtp *rtp, int component, struct ast_sockaddr *cand_address)
-+{
-+#ifdef HAVE_PJPROJECT
-+ char address[PJ_INET6_ADDRSTRLEN];
-+
-+ if (!rtp->ice || (component < 1) || !rtp->ice->comp[component - 1].valid_check) {
-+ return;
-+ }
-+
-+ ast_sockaddr_parse(cand_address, pj_sockaddr_print(&rtp->ice->comp[component - 1].valid_check->rcand->addr, address, sizeof(address), 0), 0);
-+ ast_sockaddr_set_port(cand_address, pj_sockaddr_get_port(&rtp->ice->comp[component - 1].valid_check->rcand->addr));
-+#endif
-+}
-+
-+#ifdef HAVE_PJPROJECT
- /*! \brief Destructor for locally created ICE candidates */
- static void ast_rtp_ice_candidate_destroy(void *obj)
- {
-@@ -477,19 +501,6 @@ static void pj_thread_register_check(voi
- return;
- }
-
--/*! \brief Helper function which updates an ast_sockaddr with the candidate used for the component */
--static void update_address_with_ice_candidate(struct ast_rtp *rtp, int component, struct ast_sockaddr *cand_address)
--{
-- char address[PJ_INET6_ADDRSTRLEN];
--
-- if (!rtp->ice || (component < 1) || !rtp->ice->comp[component - 1].valid_check) {
-- return;
-- }
--
-- ast_sockaddr_parse(cand_address, pj_sockaddr_print(&rtp->ice->comp[component - 1].valid_check->rcand->addr, address, sizeof(address), 0), 0);
-- ast_sockaddr_set_port(cand_address, pj_sockaddr_get_port(&rtp->ice->comp[component - 1].valid_check->rcand->addr));
--}
--
- static void ast_rtp_ice_start(struct ast_rtp_instance *instance)
- {
- struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-@@ -693,6 +704,7 @@ static struct ast_rtp_engine_ice ast_rtp
- .get_local_candidates = ast_rtp_ice_get_local_candidates,
- .ice_lite = ast_rtp_ice_lite,
- };
-+#endif
-
- #ifdef HAVE_OPENSSL_SRTP
- static void dtls_info_callback(const SSL *ssl, int where, int ret)
-@@ -1020,13 +1032,16 @@ static struct ast_rtp_engine asterisk_rt
- .stop = ast_rtp_stop,
- .qos = ast_rtp_qos_set,
- .sendcng = ast_rtp_sendcng,
-+#ifdef HAVE_PJPROJECT
- .ice = &ast_rtp_ice,
-+#endif
- #ifdef HAVE_OPENSSL_SRTP
- .dtls = &ast_rtp_dtls,
- .activate = ast_rtp_activate,
- #endif
- };
-
-+#ifdef HAVE_PJPROJECT
- static void rtp_learning_seq_init(struct rtp_learning_info *info, uint16_t seq);
-
- static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status)
-@@ -1196,6 +1211,7 @@ static int ice_worker_thread(void *data)
-
- return 0;
- }
-+#endif
-
- static inline int rtp_debug_test_addr(struct ast_sockaddr *addr)
- {
-@@ -1450,6 +1466,7 @@ static int __rtp_recvfrom(struct ast_rtp
- }
- #endif
-
-+#ifdef HAVE_PJPROJECT
- if (rtp->ice) {
- pj_str_t combined = pj_str(ast_sockaddr_stringify(sa));
- pj_sockaddr address;
-@@ -1475,6 +1492,7 @@ static int __rtp_recvfrom(struct ast_rtp
- }
- rtp->passthrough = 0;
- }
-+#endif
-
- if ((*in & 0xC0) && res_srtp && srtp && res_srtp->unprotect(srtp, buf, &len, rtcp) < 0) {
- return -1;
-@@ -1506,6 +1524,7 @@ static int __rtp_sendto(struct ast_rtp_i
- return -1;
- }
-
-+#ifdef HAVE_PJPROJECT
- if (rtp->ice) {
- pj_thread_register_check();
-
-@@ -1514,6 +1533,7 @@ static int __rtp_sendto(struct ast_rtp_i
- return 0;
- }
- }
-+#endif
-
- return ast_sendto(rtcp ? rtp->rtcp->s : rtp->s, temp, len, flags, sa);
- }
-@@ -1631,6 +1651,7 @@ static int rtp_learning_rtp_seq_update(s
- return (info->packets == 0);
- }
-
-+#ifdef HAVE_PJPROJECT
- static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct ast_rtp *rtp, struct ast_sockaddr *addr, int port, int component,
- int transport, const pj_turn_sock_cb *turn_cb, pj_turn_sock **turn_sock)
- {
-@@ -1695,6 +1716,7 @@ static void rtp_add_candidates_to_ice(st
- }
- }
- }
-+#endif
-
- static int ast_rtp_new(struct ast_rtp_instance *instance,
- struct ast_sched_context *sched, struct ast_sockaddr *addr,
-@@ -1702,8 +1724,10 @@ static int ast_rtp_new(struct ast_rtp_in
- {
- struct ast_rtp *rtp = NULL;
- int x, startplace;
-+#ifdef HAVE_PJPROJECT
- pj_stun_config stun_config;
- pj_str_t ufrag, passwd;
-+#endif
-
- /* Create a new RTP structure to hold all of our data */
- if (!(rtp = ast_calloc(1, sizeof(*rtp)))) {
-@@ -1761,6 +1785,7 @@ static int ast_rtp_new(struct ast_rtp_in
- }
- }
-
-+#ifdef HAVE_PJPROJECT
- pj_thread_register_check();
-
- pj_stun_config_init(&stun_config, &cachingpool.factory, 0, ioqueue, timerheap);
-@@ -1773,13 +1798,14 @@ static int ast_rtp_new(struct ast_rtp_in
- ast_rtp_instance_set_data(instance, rtp);
-
- /* Create an ICE session for ICE negotiation */
-- if (icesupport && pj_ice_sess_create(&stun_config, NULL, PJ_ICE_SESS_ROLE_UNKNOWN, 2, &ast_rtp_ice_sess_cb, &ufrag, &passwd, &rtp->ice) == PJ_SUCCESS) {
-+ if (icesupport && pj_ice_sess_create(&stun_config, NULL, PJ_ICE_SESS_ROLE_UNKNOWN, 2, &ast_rtp_ice_sess_cb, &ufrag, &passwd, NULL, &rtp->ice) == PJ_SUCCESS) {
- /* Make this available for the callbacks */
- rtp->ice->user_data = rtp;
-
- /* Add all of the available candidates to the ICE session */
- rtp_add_candidates_to_ice(instance, rtp, addr, x, COMPONENT_RTP, TRANSPORT_SOCKET_RTP, &ast_rtp_turn_rtp_sock_cb, &rtp->turn_rtp);
- }
-+#endif
-
- /* Record any information we may need */
- rtp->sched = sched;
-@@ -1822,6 +1848,7 @@ static int ast_rtp_destroy(struct ast_rt
- ast_free(rtp->red);
- }
-
-+#ifdef HAVE_PJPROJECT
- pj_thread_register_check();
-
- /* Destroy the ICE session if being used */
-@@ -1849,6 +1876,7 @@ static int ast_rtp_destroy(struct ast_rt
- if (rtp->remote_candidates) {
- ao2_ref(rtp->remote_candidates, -1);
- }
-+#endif
-
- #ifdef HAVE_OPENSSL_SRTP
- /* Destroy the SSL context if present */
-@@ -3875,10 +3903,12 @@ static void ast_rtp_prop_set(struct ast_
- ast_debug(1, "Setup RTCP on RTP instance '%p'\n", instance);
- rtp->rtcp->schedid = -1;
-
-+#ifdef HAVE_PJPROJECT
- if (rtp->ice) {
- rtp_add_candidates_to_ice(instance, rtp, &rtp->rtcp->us, ast_sockaddr_port(&rtp->rtcp->us), COMPONENT_RTCP, TRANSPORT_SOCKET_RTCP,
- &ast_rtp_turn_rtcp_sock_cb, &rtp->turn_rtcp);
- }
-+#endif
-
- return;
- } else {
-@@ -4356,12 +4386,14 @@ static int rtp_reload(int reload)
- * the pool this will cause a small memory leak.
- */
-
-+#ifdef HAVE_PJPROJECT
- icesupport = DEFAULT_ICESUPPORT;
- turnport = DEFAULT_TURN_PORT;
- memset(&stunaddr, 0, sizeof(stunaddr));
- turnaddr = pj_str(NULL);
- turnusername = pj_str(NULL);
- turnpassword = pj_str(NULL);
-+#endif
-
- if (cfg) {
- if ((s = ast_variable_retrieve(cfg, "general", "rtpstart"))) {
-@@ -4412,6 +4444,7 @@ static int rtp_reload(int reload)
- DEFAULT_LEARNING_MIN_SEQUENTIAL);
- }
- }
-+#ifdef HAVE_PJPROJECT
- if ((s = ast_variable_retrieve(cfg, "general", "icesupport"))) {
- icesupport = ast_true(s);
- }
-@@ -4439,6 +4472,7 @@ static int rtp_reload(int reload)
- if ((s = ast_variable_retrieve(cfg, "general", "turnpassword"))) {
- pj_strdup2(pool, &turnpassword, s);
- }
-+#endif
- ast_config_destroy(cfg);
- }
- if (rtpstart >= rtpend) {
-@@ -4458,6 +4492,7 @@ static int reload_module(void)
-
- static int load_module(void)
- {
-+#ifdef HAVE_PJPROJECT
- pj_lock_t *lock;
-
- pj_log_set_level(0);
-@@ -4505,23 +4540,28 @@ static int load_module(void)
- pj_shutdown();
- return AST_MODULE_LOAD_DECLINE;
- }
-+#endif
-
- if (ast_rtp_engine_register(&asterisk_rtp_engine)) {
-+#ifdef HAVE_PJPROJECT
- worker_terminate = 1;
- pj_thread_join(thread);
- pj_thread_destroy(thread);
- pj_caching_pool_destroy(&cachingpool);
- pj_shutdown();
-+#endif
- return AST_MODULE_LOAD_DECLINE;
- }
-
- if (ast_cli_register_multiple(cli_rtp, ARRAY_LEN(cli_rtp))) {
-+#ifdef HAVE_PJPROJECT
- worker_terminate = 1;
- pj_thread_join(thread);
- pj_thread_destroy(thread);
- ast_rtp_engine_unregister(&asterisk_rtp_engine);
- pj_caching_pool_destroy(&cachingpool);
- pj_shutdown();
-+#endif
- return AST_MODULE_LOAD_DECLINE;
- }
-
-@@ -4535,6 +4575,7 @@ static int unload_module(void)
- ast_rtp_engine_unregister(&asterisk_rtp_engine);
- ast_cli_unregister_multiple(cli_rtp, ARRAY_LEN(cli_rtp));
-
-+#ifdef HAVE_PJPROJECT
- worker_terminate = 1;
-
- pj_thread_register_check();
-@@ -4544,6 +4585,7 @@ static int unload_module(void)
-
- pj_caching_pool_destroy(&cachingpool);
- pj_shutdown();
-+#endif
-
- return 0;
- }
diff --git a/debian/patches/series b/debian/patches/series
index 588243a..de14e71 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -21,12 +21,5 @@ no_uname
ilbc_disable
astdatadir
-bzero
-pjproject
-# Backport of dynamic generation of DAHDI channels:
-dahdi_pri_event_removed
-dahdi_create_channels
-
-astdb_mans
reenable
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/asterisk.git
More information about the Pkg-voip-commits
mailing list