asterisk/asterisk.git
2 years agosip_to_pjsip.py: Fix comment typo and tabs.
Richard Mudgett [Wed, 31 Aug 2016 20:13:19 +0000 (15:13 -0500)]
sip_to_pjsip.py: Fix comment typo and tabs.

Change-Id: If35174614545727817d329c60ba4456c028941b5

2 years agoMerge "res_pjsip: qualify/unqualify added/deleted realtime endpoints"
zuul [Thu, 1 Sep 2016 18:21:54 +0000 (13:21 -0500)]
Merge "res_pjsip: qualify/unqualify added/deleted realtime endpoints"

2 years agoMerge "sip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations."
Joshua Colp [Thu, 1 Sep 2016 17:20:46 +0000 (12:20 -0500)]
Merge "sip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations."

2 years agores_pjsip: qualify/unqualify added/deleted realtime endpoints
Alexei Gradinari [Fri, 26 Aug 2016 15:39:11 +0000 (11:39 -0400)]
res_pjsip: qualify/unqualify added/deleted realtime endpoints

If the PJSIP endpoint's AOR with the permanent contact
was deleted from the realtime storage the res_pjsip module
continues trying to qualify this contact.
The error 'Unable to find an endpoint to qualify contact'
appeares every 'qualify_frequency' seconds.
This patch deletes this contact in this case.

The PJSIP endpoint's AOR with the permanent contact
is never qualified if it is added to realtime storage
after asterisk started.
This patch adds qualifying for the AOR's permanent contacts
on the first handling of this AOR.

ASTERISK-26319 #close

Change-Id: Ib93dded9121edb113076903d1aa95402f799f8fe

2 years agoMerge "res_pjsip: Default endpoints to the "offline" status."
zuul [Tue, 30 Aug 2016 00:01:40 +0000 (19:01 -0500)]
Merge "res_pjsip: Default endpoints to the "offline" status."

2 years agoMerge "pjproject_bundled: Disable srtp use by pjmedia"
zuul [Mon, 29 Aug 2016 23:06:38 +0000 (18:06 -0500)]
Merge "pjproject_bundled:  Disable srtp use by pjmedia"

2 years agoMerge "pbx.c: Prevent infinite recursion in manager_show_dialplan_helper."
zuul [Mon, 29 Aug 2016 21:50:23 +0000 (16:50 -0500)]
Merge "pbx.c: Prevent infinite recursion in manager_show_dialplan_helper."

2 years agoMerge "app_queue: Ensure member is removed from pending when hanging up."
zuul [Mon, 29 Aug 2016 19:56:27 +0000 (14:56 -0500)]
Merge "app_queue: Ensure member is removed from pending when hanging up."

2 years agoMerge "app_macro: Consider '~~s~~' as a macro start extension."
zuul [Mon, 29 Aug 2016 18:16:45 +0000 (13:16 -0500)]
Merge "app_macro: Consider '~~s~~' as a macro start extension."

2 years agores_pjsip: Default endpoints to the "offline" status.
Mark Michelson [Mon, 22 Aug 2016 22:08:19 +0000 (17:08 -0500)]
res_pjsip: Default endpoints to the "offline" status.

A recent change attempted to optimize startup by not updating contact
status. Instead, code responsible for qualifying contacts updates the
status as it becomes known. The code even accounts for contacts/AORs
that are not set to be qualified.

The problem, though, is when there are no contacts associated with an
endpoint. A common case is when an endpoint is set to register its
contacts but has not done so yet. In this case, prior to registration,
the endpoint's device state will appear to be "not in use" and hints
associated with that device will appear to be "idle". In actuality, the
device state and hint should both appear as "unavailable". The reason
for the failure is that the optimization change made all persistent
endpoint states set to "unknown".

The fix here is to change the hard-coded "unknown" to be "offline"
instead. The default state will be offline until the qualifying code
determines that the contact is actually online. This way, if there are
no contacts at all, then the state stays as offline, and device state
and hints appear correctly.

ASTERISK-26269 #close
Reported by nappsoft

Change-Id: Ie99b84169393983453076f5e9c0d35ff313a456a

2 years agopbx.c: Prevent infinite recursion in manager_show_dialplan_helper.
Etienne Lessard [Mon, 29 Aug 2016 12:07:38 +0000 (08:07 -0400)]
pbx.c: Prevent infinite recursion in manager_show_dialplan_helper.

Previously, if context A was including context B and context B was including
context A, i.e. if there was a circular dependency between contexts, then
calling manager_show_dialplan_helper could lead to an infinite recursion,
resulting in a crash.

This commit applies the same solution as the one implemented in the
show_dialplan_helper function. The manager_show_dialplan_helper and
show_dialplan_helper functions contain lots of code in common, but the former
was missing the "infinite recursion avoidance" code.

ASTERISK-26226 #close

Change-Id: I1aea85133c21787226f4f8442253a93000aa0897

2 years agoapp_queue: Ensure member is removed from pending when hanging up.
Joshua Colp [Thu, 25 Aug 2016 12:06:41 +0000 (12:06 +0000)]
app_queue: Ensure member is removed from pending when hanging up.

When dialing channels it is possible that they may not ever
leave the not in use state (Local channels in particular) by
the time we cancel them. If this occurs but we know they were
dialed we explicitly remove them from the pending members
container so that subsequent call attempts occur.

ASTERISK-26299 #close

Change-Id: I6ad0d17c36480c92cebf840626228ce3f7e4bd65

2 years agoMerge "res_pjsip: Cache global config options."
zuul [Sat, 27 Aug 2016 03:17:40 +0000 (22:17 -0500)]
Merge "res_pjsip: Cache global config options."

2 years agoMerge "channel: No hung-up on failing security requirements."
zuul [Sat, 27 Aug 2016 00:40:15 +0000 (19:40 -0500)]
Merge "channel: No hung-up on failing security requirements."

2 years agopjproject_bundled: Disable srtp use by pjmedia
George Joseph [Fri, 26 Aug 2016 19:34:22 +0000 (13:34 -0600)]
pjproject_bundled:  Disable srtp use by pjmedia

The reason for the disable is that while Asterisk works fine with older
libsrtp versions, newer versions of pjproject won't compile with them.
Debian 6 for instance, has libsrtp 1.4.4 which is older than what
pjproject is expecting.

We don't use most of pjmedia but we DO use it for SDP negotiation.
Luckily disabling srtp in pjmedia doesn't interfere with it's ability
to negitiate a secure channel.  The proper crypto attributes are
negotiated in both directions.

ASTERISK-26279 #close

Change-Id: Id25a92cdf3df97a26c53cffae65b6b82de33c8e2

2 years agoMerge "res_fax: Fix deadlock in ast_channel_get_t38_state()."
Joshua Colp [Fri, 26 Aug 2016 19:03:10 +0000 (14:03 -0500)]
Merge "res_fax: Fix deadlock in ast_channel_get_t38_state()."

2 years agoMerge "res_fax: Fix deadlock setting FAXMODE channel variable."
Joshua Colp [Fri, 26 Aug 2016 19:03:05 +0000 (14:03 -0500)]
Merge "res_fax: Fix deadlock setting FAXMODE channel variable."

2 years agoMerge "res_fax.c: Fix deadlock in fax_gateway_indicate_t38()."
Joshua Colp [Fri, 26 Aug 2016 19:02:59 +0000 (14:02 -0500)]
Merge "res_fax.c: Fix deadlock in fax_gateway_indicate_t38()."

2 years agoMerge "res_fax.c: Add chan locked precondition comments."
Joshua Colp [Fri, 26 Aug 2016 19:02:54 +0000 (14:02 -0500)]
Merge "res_fax.c: Add chan locked precondition comments."

2 years agoMerge "ast_framehook_detach() must be called with the channel locked."
Joshua Colp [Fri, 26 Aug 2016 19:02:45 +0000 (14:02 -0500)]
Merge "ast_framehook_detach() must be called with the channel locked."

2 years agoMerge "ast_framehook_attach() must be called with the channel locked."
zuul [Fri, 26 Aug 2016 18:27:16 +0000 (13:27 -0500)]
Merge "ast_framehook_attach() must be called with the channel locked."

2 years agoMerge "Fix checks for allocation debugging."
zuul [Fri, 26 Aug 2016 17:55:22 +0000 (12:55 -0500)]
Merge "Fix checks for allocation debugging."

2 years agoMerge "Fix naming mismatch of allocator functions."
zuul [Fri, 26 Aug 2016 17:55:19 +0000 (12:55 -0500)]
Merge "Fix naming mismatch of allocator functions."

2 years agochannel: No hung-up on failing security requirements.
Alexander Traud [Fri, 26 Aug 2016 13:41:16 +0000 (15:41 +0200)]
channel: No hung-up on failing security requirements.

In your Diaplan, if you specify
 same => n,Set(CHANNEL(secure_bridge_media)=1)
 same => n,Set(CHANNEL(secure_bridge_signaling)=1)
only the SIP channel driver chan_sip supports this. All other channels drivers
like res_pjsip fail. In case of failure, the original sRTP source code released
the whole channel, even if not hung-up, yet. This change does not release the
channel but instead hangs-up the channel.

ASTERISK-26306

Change-Id: I0489f0cb660fab6673b0db8af027d116e70a66db

2 years agosip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations.
Alexander Traud [Sat, 20 Aug 2016 14:04:13 +0000 (16:04 +0200)]
sip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations.

When using the migration script sip_to_pjsip.py, and your sip.conf is
configured with bindaddr=::, two transports are written to pjsip.conf, one for
0.0.0.0 (IPv4) and one for [::] (IPv6). That way, PJProject listens on the IPv4
and IPv6 wildcards; a IPv4/IPv6 Dual Stack configuration on a single interface
like in chan_sip.

Furthermore, the script internal functions "build_host" and "split_hostport"
did not parse Literal IPv6 addresses as expected (like [::1]:5060). This change
makes sure, even such addresses are parsed correctly.

ASTERISK-26309

Change-Id: Ia4799a0f80fc30c0550fc373efc207c3330aeb48

2 years agores_pjsip: Cache global config options.
Richard Mudgett [Fri, 5 Aug 2016 01:11:29 +0000 (20:11 -0500)]
res_pjsip: Cache global config options.

We may check a global config option hundreds of times a second or more.
Asking sorcery for the global configuration from the config files backend
involves several allocations and container traversals.  Using realtime
without a memory cache is a lot worse because you have to lookup in the
realtime database each time to reconstitute the sorcery object.  With a
memory cache for realtime, there is about the same amount of overhead as
for config files.  Either way, it is still fairly expensive to access the
sorcery object that much.

* Cache the global config options so we can access them faster.  You must
now always perform a res_pjsip reload to change the global options.

Change-Id: Ice16c7a4cbca4614da344aaea21a072b86263ef7

2 years agores_fax: Fix deadlock in ast_channel_get_t38_state().
Richard Mudgett [Tue, 23 Aug 2016 16:02:35 +0000 (11:02 -0500)]
res_fax: Fix deadlock in ast_channel_get_t38_state().

ast_channel_get_t38_state() calls ast_channel_queryoption() with
AST_OPTION_T38_STATE.  If the passed in channel is a local channel then a
deadlock can happen if a channel lock is held when called.

* Made ast_channel_get_t38_state() callers not hold a channel lock before
calling.

* Update ast_channel_get_t38_state() doxygen to note that no channel locks
can be held when calling the function.

ASTERISK-26203 #close
Reported by: Etienne Lessard

ASTERISK-24822 #close
Reported by: David Brillert

ASTERISK-22732 #close
Reported by: Richard Mudgett

Change-Id: I49fd76fa9af628b4198009b5c0b82c8b03681214

2 years agores_fax: Fix deadlock setting FAXMODE channel variable.
Richard Mudgett [Tue, 23 Aug 2016 15:39:01 +0000 (10:39 -0500)]
res_fax: Fix deadlock setting FAXMODE channel variable.

ASTERISK-25980 added the FAXMODE channel variable to res_fax.c.
Unfortunately, it also introduced a deadlock potential because
set_channel_variables() which sets FAXMODE can be called during a
masquerade.  The ast_channel_get_t38_state() which gets the value used to
set FAXMODE cannot be called with the channel locked.  As a result, local
channels can deadlock because of how they must acquire the locks necessary
to operate.

The intent of FAXMODE is for dialplan to know how a fax was transferred
after the fax completes.  However, the previous patch sets FAXMODE to the
channel's current T.38 state AFTER the fax has completed and where T.38
may have already disconnected.

* Set FAXMODE based upon T.38 negotiations exchanged either with the fax
applications or the fax framehooks.

ASTERISK-26203
Reported by: Etienne Lessard

ASTERISK-24822
Reported by: David Brillert

ASTERISK-22732
Reported by: Richard Mudgett

Change-Id: Id525747254b64c1efe8b1b5973d52ff9719c2ae1

2 years agores_fax.c: Fix deadlock in fax_gateway_indicate_t38().
Richard Mudgett [Mon, 22 Aug 2016 17:31:24 +0000 (12:31 -0500)]
res_fax.c: Fix deadlock in fax_gateway_indicate_t38().

fax_gateway_indicate_t38() calls ast_indicate_data() which cannot be
called with any channel locks already held.  A deadlock can happen if the
function is operating on a local channel.

* Made fax_gateway_indicate_t38() unlock the channel before calling
ast_indicate_data() since fax_gateway_indicate_t38() is always called with
the channel locked.

* Made fax_gateway_indicate_t38() return void since nothing cared about
its return value.

ASTERISK-26203
Reported by: Etienne Lessard

ASTERISK-24822
Reported by: David Brillert

ASTERISK-22732
Reported by: Richard Mudgett

Change-Id: I701ff2d26c5fc23e0d5a48a3fd98759a9fd09407

2 years agores_fax.c: Add chan locked precondition comments.
Richard Mudgett [Tue, 23 Aug 2016 16:16:04 +0000 (11:16 -0500)]
res_fax.c: Add chan locked precondition comments.

Change-Id: Ic10ae434536bbf7fb7055d6ab36cc50b8748a4e7

2 years agoast_framehook_detach() must be called with the channel locked.
Richard Mudgett [Tue, 23 Aug 2016 15:42:08 +0000 (10:42 -0500)]
ast_framehook_detach() must be called with the channel locked.

The framehook container could become corrupted if the channel lock is not
held before calling.

Change-Id: If0a1c7ba0484ed3a191106a7516526b905952584

2 years agoast_framehook_attach() must be called with the channel locked.
Richard Mudgett [Mon, 22 Aug 2016 20:01:37 +0000 (15:01 -0500)]
ast_framehook_attach() must be called with the channel locked.

The framehook container could become corrupted if the channel lock is not
held before calling.

Change-Id: I1a6b957a1f7b899eb29a186915f8cccab886a438

2 years agoapp_macro: Consider '~~s~~' as a macro start extension.
chrisderock [Wed, 17 Aug 2016 07:51:17 +0000 (09:51 +0200)]
app_macro: Consider '~~s~~' as a macro start extension.

As described in issue ASTERISK-26282 the AEL parser creates macros with
extension '~~s~~'.  app_macro searches only for extension 's' so the
created extension cannot be found.  with this patch app_macro searches for
both extensions and performs the right extension.

ASTERISK-26282 #close

Change-Id: I939aa2a694148cc1054dd75ec0c47c47f47c90fb

2 years agochan_iax2: Set plaintext auth to deprecated as per ASTERISK-22820
varnav [Wed, 24 Aug 2016 09:44:15 +0000 (12:44 +0300)]
chan_iax2: Set plaintext auth to deprecated as per ASTERISK-22820

Starting from draft 2 of RFC 5456 (October 23, 2006) plaintext auth
is not supported in IAX2 protocol. Please refer to section 8.6.13 of
RFC 5456.

But plaintext auth is still supported by Asterisk implementation of IAX2.
This support should be dropped.

Patch, based on asterisk-dev discussion, adds deprecation warning on
startup if 'auth' is set to 'plaintext', changes default values of
'auth' from 'md5, plaintext' to 'md5'.

Patch is safe in terms of backwards compatibility, will work even if
remote peers have auth=plaintext and we have defaults.

auth=plaintext setting will remain deprecated in Asterisk 14 and 15,
and IAX2 plaintext support will be removed in Asterisk 16.

ASTERISK-22820 #close

Change-Id: I5d2f3830cb57645604818f87518916e8a5c317bf

2 years agores_rtp_multicast: Fix SEGV in ast_multicast_rtp_create_options
George Joseph [Wed, 24 Aug 2016 19:42:34 +0000 (13:42 -0600)]
res_rtp_multicast:  Fix SEGV in ast_multicast_rtp_create_options

ast_multicast_rtp_create_options now checks for NULL or empty options

Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362

2 years agoConfBridge: Rework announcer channel methodology
Mark Michelson [Wed, 10 Aug 2016 20:14:09 +0000 (15:14 -0500)]
ConfBridge: Rework announcer channel methodology

NOTE: This patch was submitted earlier and reverted because of a failing
test. The test has been patched so that it adjusts for the changes here,
so this is being resubmitted for review.

One feature that confbridge has is the ability to play sounds to all
participants in the conference. Prior to this commit, the algorithm for
this was as follows:

* Grab the playback lock
* Push the conference announcer channel into the bridge
* Play back the sound
* Pull the conference announcer channel from the bridge
* Release the playback lock

The issue here is that the act of adding the playback channel to the
bridge and removing it for each announcement is expensive. Amongst the
expenses:

* The announcer channel is imparted into the bridge, meaning a new
  thread is spun up for each playback.
* When the announcer is added or removed from the bridge, it results
  in the BRIDGEPEER channel variable being set on all channels in the
  bridge. This requires keeping the bridge locked and locking each
  individual channel in order to set it.
* There's also just the general overhead of adding the channel and
  removing it from the bridge. The bridge potentially has to reconfigure
  every single time

With this commit, the paradigm for playing back announcements has
shifted.

* The announcer channel is now added to the bridge when the conference
  is allocated, and it is hung up when the conference is destroyed.
* A taskprocessor is used to queue playbacks onto the announcer channel.
  This keeps the behavior from before where playbacks do not overlap.
* The announcer channel is no longer placed into the bridge as
  departable. Since we are not constantly removing the channel from
  the bridge, it is safe to add the channel using an independent thread
  and simply hang the channel up when it is time for the conference to
  be destroyed.

The use of the taskprocessor for playbacks opens up the interesting
possibility of having asynchronous announcements played. In this commit,
however, the behavior is still exactly the same as it previously was.

ASTERISK-26289
Reported by Mark Michelson

Change-Id: Ica9fa4907c2f3728cdd1cf0bc564ef4eb40754a0

2 years agoMerge "Revert "ConfBridge: Rework announcer channel methodology""
Joshua Colp [Tue, 23 Aug 2016 10:54:10 +0000 (05:54 -0500)]
Merge "Revert "ConfBridge: Rework announcer channel methodology""

2 years agoRevert "ConfBridge: Rework announcer channel methodology"
Joshua Colp [Tue, 23 Aug 2016 10:54:02 +0000 (05:54 -0500)]
Revert "ConfBridge: Rework announcer channel methodology"

This reverts commit 5aa877305223faab5a1119276a934893ab9dc138.

Change-Id: I9ab45776e54a54ecf1bac9ae62d976dec30ef491

2 years agoMerge "ConfBridge: Rework announcer channel methodology"
zuul [Tue, 23 Aug 2016 03:33:15 +0000 (22:33 -0500)]
Merge "ConfBridge: Rework announcer channel methodology"

2 years agoMerge "followme: initialize all config items on reload"
zuul [Mon, 22 Aug 2016 21:35:33 +0000 (16:35 -0500)]
Merge "followme: initialize all config items on reload"

2 years agoMerge "compilation failed with -Werror=maybe-uninitialized"
zuul [Mon, 22 Aug 2016 16:22:13 +0000 (11:22 -0500)]
Merge "compilation failed with -Werror=maybe-uninitialized"

2 years agoMerge "res_odbc_transaction: add dep on generic_odbc"
zuul [Mon, 22 Aug 2016 14:57:09 +0000 (09:57 -0500)]
Merge "res_odbc_transaction: add dep on generic_odbc"

2 years agoMerge "pjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations."
Joshua Colp [Mon, 22 Aug 2016 14:22:04 +0000 (09:22 -0500)]
Merge "pjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations."

2 years agocompilation failed with -Werror=maybe-uninitialized
Alexei Gradinari [Fri, 19 Aug 2016 15:21:01 +0000 (11:21 -0400)]
compilation failed with -Werror=maybe-uninitialized

The compilation failed for devmode
--enable DONT_OPTIMIZE
--enable BETTER_BACKTRACES
--enable DO_CRASH
--enable TEST_FRAMEWORK

res_pjsip/pjsip_configuration.c: In function dtls_handler:
res_pjsip/pjsip_configuration.c:974:20: error:
back may be used uninitialized in this function [-Werror=maybe-uninitialized]
int size = strlen(front);
           ^
cc1: all warnings being treated as errors

Change-Id: I7f082ead0312792a577ec7c73015ba64dabca580

2 years agoMerge "res_ari: Add http prefix to generated docs"
zuul [Mon, 22 Aug 2016 12:32:46 +0000 (07:32 -0500)]
Merge "res_ari: Add http prefix to generated docs"

2 years agores_odbc_transaction: add dep on generic_odbc
David M. Lee [Sat, 20 Aug 2016 19:51:59 +0000 (14:51 -0500)]
res_odbc_transaction: add dep on generic_odbc

When res_odbc_transaction depended on res_odbc, it got the generic_odbc
headers and libs implicitly. Now that it no longer depends on res_odbc,
its dependency on generic_odbc must be explicit.

Change-Id: I9db88f7af7388437f49903d3008ba8d4890d5911

2 years agopjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations.
Alexander Traud [Sat, 20 Aug 2016 16:18:51 +0000 (18:18 +0200)]
pjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations.

PJProject supports a lot of platforms even Windows, some with different defaults
when it comes to IPv6. In many Linux platforms like Ubuntu 16.04 LTS,
"/proc/sys/net/ipv6/bindv6only" is set to 0 (false). Different than in Windows.

Because of this, if configured with just an IPv6 address/transport, PJProject
listens to both IPv4 and IPv6. However, this is not supported by the PJProject
team. As consequence, you end-up with IPv4-mapped IPv6 addresses in SDP,
incompatible with IPv4-only clients. Technically, you end-up with an IPv6-only
server which accepts incoming connections on IPv4.

If you try to configure two transports, one with IPv4 and one with IPv6 on the
same interface, as expected by the PJProject team, the IPv4 transport is not
able to bind because the IPv6 transport listens to both already.

One solution would be to change "/proc/sys/net/ipv6/bindv6only" system-wide.
Then, you are able to configure two transports, one for each IP version on the
same interface. That way, you get a server which works with IPv4 clients and
IPv6 clients at the same time over the same interface.

Here, this change sets this parameter directly within PJProject to match the
expectations of the PJProject team in any case. This allows IPv4/IPv6 Dual Stack
servers out of the box like in chan_sip. This change was accepted by the
PJProject team as <http://trac.pjsip.org/repos/changeset/5403> and is expected
to arrive in the next version, PJProject 2.6.0. Until then, this change is
incorporated in the bundled PJProject of Asterisk.

ASTERISK-26309

Change-Id: I3335d8718f79f4b2feae91b5b005a3ce684a63ae

2 years agoFix checks for allocation debugging.
Corey Farrell [Fri, 19 Aug 2016 23:19:28 +0000 (19:19 -0400)]
Fix checks for allocation debugging.

MALLOC_DEBUG should not be used to check if debugging is actually
enabled, __AST_DEBUG_MALLOC should be used instead.  MALLOC_DEBUG only
indicates that debugging is requested, __AST_DEBUG_MALLOC indicates it
is active.

Change-Id: I3ce9cdb6ec91b74ee1302941328462231be1ea53

2 years agoFix naming mismatch of allocator functions.
Corey Farrell [Fri, 19 Aug 2016 19:09:45 +0000 (15:09 -0400)]
Fix naming mismatch of allocator functions.

Allocator functions that take file/line/func parameters are prefixed
with single-underscore when MALLOC_DEBUG is not defined,
double-underscore when it is defined.  This change updates all
allocators that accept file/line/func to have the same prototype in
either ABI mode.  The parameter order of __ast_vasprintf and
__ast_asprintf in utils.h have been changed to match that of astmm.h.

End-use allocator macro's have been removed from astmm.h and moved to an
unconditional part of utils.h.

Change-Id: I823bb6ce2b5675b3a4735948f10a3b420e9a023a

2 years agoMerge "sip_to_pjsip: Map externhost/ip to Transports."
zuul [Fri, 19 Aug 2016 22:54:48 +0000 (17:54 -0500)]
Merge "sip_to_pjsip: Map externhost/ip to Transports."

2 years agores_ari: Add http prefix to generated docs
Torrey Searle [Wed, 17 Aug 2016 13:10:54 +0000 (15:10 +0200)]
res_ari: Add http prefix to generated docs

updated the uri handler to include the url prefix of the http server
this enables res_ari to add it to the uris when generating docs

Change-Id: I279335a2625261a8492206c37219698f42591c2e
(cherry picked from commit 6f448f32fe9b7379e2630fab7b06205f901f2ded)

2 years agoMerge "res_odbc: Correct the dependency relationship with res_odbc_transaction"
zuul [Fri, 19 Aug 2016 20:52:36 +0000 (15:52 -0500)]
Merge "res_odbc:  Correct the dependency relationship with res_odbc_transaction"

2 years agoMerge "sip.conf: tlsclientmethod is using sslv23 as default."
zuul [Fri, 19 Aug 2016 19:38:24 +0000 (14:38 -0500)]
Merge "sip.conf: tlsclientmethod is using sslv23 as default."

2 years agoMerge "rest-api: Swagger scripts were not replacing format variable in file brief"
zuul [Fri, 19 Aug 2016 18:20:17 +0000 (13:20 -0500)]
Merge "rest-api: Swagger scripts were not replacing format variable in file brief"

2 years agoMerge "sip_to_pjsip: Add cert_file."
zuul [Fri, 19 Aug 2016 17:39:07 +0000 (12:39 -0500)]
Merge "sip_to_pjsip: Add cert_file."

2 years agoMerge "res_format_attr_g729: Add annexb=no format parameter to SDPs"
zuul [Fri, 19 Aug 2016 16:03:39 +0000 (11:03 -0500)]
Merge "res_format_attr_g729: Add annexb=no format parameter to SDPs"

2 years agoMerge "res_pjsip: Add contact_user to endpoint"
zuul [Fri, 19 Aug 2016 15:08:11 +0000 (10:08 -0500)]
Merge "res_pjsip:  Add contact_user to endpoint"

2 years agoMerge "ari: Add documentation that path parameters are case-sensitive"
zuul [Fri, 19 Aug 2016 12:20:41 +0000 (07:20 -0500)]
Merge "ari:  Add documentation that path parameters are case-sensitive"

2 years agosip_to_pjsip: Add cert_file.
Alexander Traud [Fri, 19 Aug 2016 08:59:40 +0000 (10:59 +0200)]
sip_to_pjsip: Add cert_file.

When using the migration script sip_to_pjsip.py, cert_file was not migrated to
pjsip.conf. A previous change regarding this contained a copy/paste error.

ASTERISK-22374

Change-Id: I0fa72e9412117d53b4284fc6b83fa5b2b95ba03b

2 years agosip.conf: tlsclientmethod is using sslv23 as default.
Alexander Traud [Thu, 18 Aug 2016 14:21:25 +0000 (16:21 +0200)]
sip.conf: tlsclientmethod is using sslv23 as default.

When 'tlsclientmethod' is not specified in sip.conf, chan_sip uses the OpenSSL
SSLv23_method. This was documented incorrectly in the file sip.conf.sample.

SSLv23_method got its name in the 90s. Today, with OpenSSL 1.0.2, this method
enables (just) the secure TLSv1.0 and TLSv1.2. Or stated differently, that
function should have been called 'secure_method' or 'automatic_method' back in
the 90s.

Consequently please, specify 'tlsclientmethod=tlsv1' in your sip.conf only if
you face a server which has problems like not falling back to TLSv1.0
automatically.

ASTERISK-24425

Change-Id: I502ce6146b4504cadfd3973af8d6ec3994f54fa3

2 years agoMerge "sip_to_pjsip: Write cos and tos."
Joshua Colp [Thu, 18 Aug 2016 23:55:35 +0000 (18:55 -0500)]
Merge "sip_to_pjsip: Write cos and tos."

2 years agores_format_attr_g729: Add annexb=no format parameter to SDPs
Kevin Harwell [Tue, 16 Aug 2016 20:57:24 +0000 (15:57 -0500)]
res_format_attr_g729: Add annexb=no format parameter to SDPs

Historically, Asterisk has always specified annexb=no for the g729 format.
However, when using res_pjsip no format attribute was specified. This patch
makes it so the SDP now contains a format attribute line with annexb=no.

Note, that this means only g729a is negotiated. Even for pass through support.
According to rfc7261 the type of annex used (a or b) is dependent upon the
answerer. However, Asterisk being a back to back user agent makes this tricky
to support at this time, thus we only allow annex 'a' for now.

ASTERISK-26228 #close
patches:
  res_format_attr_g729.c submitted by Jason Parker (license 4993)

Change-Id: I76bc20cc0a01af01536e9915afef319c269c22d0

2 years agorest-api: Swagger scripts were not replacing format variable in file brief
Kevin Harwell [Thu, 18 Aug 2016 22:02:24 +0000 (17:02 -0500)]
rest-api: Swagger scripts were not replacing format variable in file brief

Given resource paths did not have 'json' substituted in for the '{format}'. For
some auto generated documentation/comment strings it resulted in something like
the following:

"... REST handler for /api-docs/sounds.{format}"

This patch makes sure the resource api's path is properly substituted.

ASTERISK-25472 #close

Change-Id: Ie3e950a35db4043e284019d6c9061f3b03922e23

2 years agores_odbc: Correct the dependency relationship with res_odbc_transaction
George Joseph [Thu, 18 Aug 2016 20:15:46 +0000 (14:15 -0600)]
res_odbc:  Correct the dependency relationship with res_odbc_transaction

The MODULEINFO dependencies between these 2 modules was reversed.
res_odbc should depend on res_odbc_transaction, not the other way
around.

ASTERISK-25984 #close

Change-Id: Ifcfbb49c0b51cf6640a5446d47cd6c48caf1331f

2 years agosip_to_pjsip: Set correct tls transport method
Kevin Harwell [Thu, 18 Aug 2016 17:04:56 +0000 (12:04 -0500)]
sip_to_pjsip: Set correct tls transport method

A recent update had a copy/paste error where the unused variable 'val' was
being passed to the set_value function instead of the 'method' value itself.

This patch passes in the right variable.

ASTERISK-22374

Change-Id: I895b7b3779ce4442bc58b8ec40d59dd29bb43f06

2 years agoMerge "res_pjsip_session.c: Fix unbound srv failover tests."
zuul [Thu, 18 Aug 2016 16:55:20 +0000 (11:55 -0500)]
Merge "res_pjsip_session.c: Fix unbound srv failover tests."

2 years agoMerge "sip_to_pjsip: Parse register even with transport."
Joshua Colp [Thu, 18 Aug 2016 16:50:16 +0000 (11:50 -0500)]
Merge "sip_to_pjsip: Parse register even with transport."

2 years agoMerge "sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit."
Joshua Colp [Thu, 18 Aug 2016 16:49:53 +0000 (11:49 -0500)]
Merge "sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit."

2 years agoMerge "sip_to_pjsip: Map (session-)timers correctly."
Joshua Colp [Thu, 18 Aug 2016 16:49:15 +0000 (11:49 -0500)]
Merge "sip_to_pjsip: Map (session-)timers correctly."

2 years agoMerge "sip_to_pjsip: Add cert_file and ca_list_path."
Joshua Colp [Thu, 18 Aug 2016 16:48:32 +0000 (11:48 -0500)]
Merge "sip_to_pjsip: Add cert_file and ca_list_path."

2 years agoMerge "sip_to_pjsip: Write username even without authname."
Joshua Colp [Thu, 18 Aug 2016 16:48:23 +0000 (11:48 -0500)]
Merge "sip_to_pjsip: Write username even without authname."

2 years agoMerge "sip_to_pjsip: Map the TLS method correctly."
Joshua Colp [Thu, 18 Aug 2016 16:47:29 +0000 (11:47 -0500)]
Merge "sip_to_pjsip: Map the TLS method correctly."

2 years agoMerge "sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent."
Joshua Colp [Thu, 18 Aug 2016 16:46:39 +0000 (11:46 -0500)]
Merge "sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent."

2 years agoMerge "sip_to_pjsip: Write media_encryption."
Joshua Colp [Thu, 18 Aug 2016 16:45:56 +0000 (11:45 -0500)]
Merge "sip_to_pjsip: Write media_encryption."

2 years agoMerge "sip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry."
Joshua Colp [Thu, 18 Aug 2016 16:45:33 +0000 (11:45 -0500)]
Merge "sip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry."

2 years agoConfBridge: Rework announcer channel methodology
Mark Michelson [Wed, 10 Aug 2016 20:14:09 +0000 (15:14 -0500)]
ConfBridge: Rework announcer channel methodology

One feature that confbridge has is the ability to play sounds to all
participants in the conference. Prior to this commit, the algorithm for
this was as follows:

* Grab the playback lock
* Push the conference announcer channel into the bridge
* Play back the sound
* Pull the conference announcer channel from the bridge
* Release the playback lock

The issue here is that the act of adding the playback channel to the
bridge and removing it for each announcement is expensive. Amongst the
expenses:

* The announcer channel is imparted into the bridge, meaning a new
  thread is spun up for each playback.
* When the announcer is added or removed from the bridge, it results
  in the BRIDGEPEER channel variable being set on all channels in the
  bridge. This requires keeping the bridge locked and locking each
  individual channel in order to set it.
* There's also just the general overhead of adding the channel and
  removing it from the bridge. The bridge potentially has to reconfigure
  every single time

With this commit, the paradigm for playing back announcements has
shifted.

* The announcer channel is now added to the bridge when the conference
  is allocated, and it is hung up when the conference is destroyed.
* A taskprocessor is used to queue playbacks onto the announcer channel.
  This keeps the behavior from before where playbacks do not overlap.
* The announcer channel is no longer placed into the bridge as
  departable. Since we are not constantly removing the channel from
  the bridge, it is safe to add the channel using an independent thread
  and simply hang the channel up when it is time for the conference to
  be destroyed.

The use of the taskprocessor for playbacks opens up the interesting
possibility of having asynchronous announcements played. In this commit,
however, the behavior is still exactly the same as it previously was.

ASTERISK-26289
Reported by Mark Michelson

Change-Id: Ic5cd2c4b98a1eaa1715eb7a5b35d62f1a76d78a5

2 years agosip_to_pjsip: Map the TLS method correctly.
Alexander Traud [Thu, 18 Aug 2016 13:19:15 +0000 (15:19 +0200)]
sip_to_pjsip: Map the TLS method correctly.

When using the migration script sip_to_pjsip.py and tlsclientmethod is not set
in sip.conf, the default value of chan_sip (sslv23) is copied to pjsip.conf, to
overwrite the default of the PJProject (tlsv1). This makes sure, res_pjsip is
offering/using not just TLSv1.0 but TLSv1.2 as well.

ASTERISK-22374

Change-Id: Ie530a3dae9926ae14f3920a21be1e2edb15bda4f

2 years agosip_to_pjsip: Add compactheaders, timerb, timert1, and useragent.
Alexander Traud [Thu, 18 Aug 2016 13:17:47 +0000 (15:17 +0200)]
sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent.

When using the migration script sip_to_pjsip.py, no section of type=system or
type=general were created. Therefore the keys compactheaders, timerb, timert1,
and useragent were not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I318a453843227ea36bf130d392d4abd7bd26b5a1

2 years agosip_to_pjsip: Map (session-)timers correctly.
Alexander Traud [Thu, 18 Aug 2016 13:16:45 +0000 (15:16 +0200)]
sip_to_pjsip: Map (session-)timers correctly.

When using the migration script sip_to_pjsip.py, session-timers=accept and
session-timers=refuse were mapped to wrong values.

ASTERISK-22374

Change-Id: Ie4e90d5f6a29aff07837b7fe5bc8aea5fb6fc092

2 years agosip_to_pjsip: Write username even without authname.
Alexander Traud [Thu, 18 Aug 2016 13:15:38 +0000 (15:15 +0200)]
sip_to_pjsip: Write username even without authname.

When using the migration script sip_to_pjsip.py, now the (mandatory) username is
written to pjsip.conf, even if there was no (optional) authname in the register
string in sip.conf.

ASTERISK-22374

Change-Id: Ie53e1997104cd2674821688b8a8247249f5e156f

2 years agosip_to_pjsip: Parse register even with transport.
Alexander Traud [Thu, 18 Aug 2016 13:14:36 +0000 (15:14 +0200)]
sip_to_pjsip: Parse register even with transport.

When using the migration script sip_to_pjsip.py and the register string
started with a transport in sip.conf - like tls://... - register was not parsed
correctly and therefore not migrated correctly to pjsip.conf.

ASTERISK-22374

Change-Id: I44c12104eea2bd8558ada6d25d77edfecd92edd2

2 years agosip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit.
Alexander Traud [Thu, 18 Aug 2016 13:13:03 +0000 (15:13 +0200)]
sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit.

When using the migration script sip_to_pjsip.py, those keys got missing. These
keys might appear several times and the function "merge_value" tried to collect
those. However, because these keys have different names in sip.conf and
pjsip.conf, "merge_value" was not able to find the new key name in sip.conf.
This change lets "merge_value" search with the old key name in sip.conf and
write with the new key name in pjsip.conf.

ASTERISK-22374

Change-Id: Ie53c5278ae6f1cb8fa7e96c5289877d46981d9d2

2 years agosip_to_pjsip: Map externhost/ip to Transports.
Alexander Traud [Thu, 18 Aug 2016 13:11:02 +0000 (15:11 +0200)]
sip_to_pjsip: Map externhost/ip to Transports.

When using the migration script sip_to_pjsip.py, the externhost or externip of
sip.conf were erroneously written to Endpoints instead to Transports.

ASTERISK-22374

Change-Id: I2c5873386cfc388899fa9cf2368639dd12f1b8e4

2 years agosip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry.
Alexander Traud [Thu, 18 Aug 2016 13:04:53 +0000 (15:04 +0200)]
sip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry.

When using the migration script sip_to_pjsip.py, defaultexpiry, maxexpiry, and
minexpiry were not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I007fbf543dcadc96fc3ed71c54da502bcb209b7b

2 years agosip_to_pjsip: Write media_encryption.
Alexander Traud [Thu, 18 Aug 2016 13:03:24 +0000 (15:03 +0200)]
sip_to_pjsip: Write media_encryption.

When using the migration script sip_to_pjsip.py, encryption=yes got missing and
media_encryption=sdes was not written to pjsip.conf, because of a typo.

ASTERISK-22374

Change-Id: I0fc3e55dc512a57603ae0fef41baacccf2a35c05

2 years agosip_to_pjsip: Write cos and tos.
Alexander Traud [Thu, 18 Aug 2016 13:02:07 +0000 (15:02 +0200)]
sip_to_pjsip: Write cos and tos.

When using the migration script sip_to_pjsip.py, both tos_sip and cos_sip got
missed, because of a typo. Therefore, cos and tos were not written to
pjsip.conf. Furthermore, that revealed a misuse of an internal function, caused
by a copy-and-paste error.

ASTERISK-22374

Change-Id: Id245ebadf70ab9776eb280c026288540af3af5c2

2 years agosip_to_pjsip: Add cert_file and ca_list_path.
Alexander Traud [Thu, 18 Aug 2016 12:55:58 +0000 (14:55 +0200)]
sip_to_pjsip: Add cert_file and ca_list_path.

When using the migration script sip_to_pjsip.py, cert_file and ca_list_path were
not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I4612877d190b7f86a48698cefbf5c4db6c265825

2 years agores_pjsip: Add contact_user to endpoint
George Joseph [Tue, 16 Aug 2016 20:36:10 +0000 (14:36 -0600)]
res_pjsip:  Add contact_user to endpoint

contact_user, when specified on an endpoint, will override the user
portion of the Contact header on outgoing requests.

Change-Id: Icd4ebfda2f2e44d3ac749d0b4066630e988407d4

2 years agores_pjsip_session.c: Fix unbound srv failover tests.
Richard Mudgett [Wed, 17 Aug 2016 19:13:56 +0000 (14:13 -0500)]
res_pjsip_session.c: Fix unbound srv failover tests.

Commit 1b666549f33d69dc080b212bf92126f3bc3a18b2 broke the srv failover
functionality if a TCP connection gets disconnected.  Under these
conditions, session_inv_on_state_changed() gets a
PJSIP_EVENT_TRANSPORT_ERROR and restarts the INVITE transaction on a new
transport.  Unfortunately, session_inv_on_tsx_state_changed() also gets
the same PJSIP_EVENT_TRANSPORT_ERROR event and unconditionally terminates
the session.

* Made session_inv_on_tsx_state_changed() complete terminating the session
on PJSIP_EVENT_TRANSPORT_ERROR only if the session state is still
PJSIP_INV_STATE_DISCONNECTED.

ASTERISK-26305 #close
Reported by: Richard Mudgett

Change-Id: If736e766b5c55b970fa38ca6c8a885caf27b897d

2 years agofollowme: initialize all config items on reload
Tzafrir Cohen [Thu, 11 Aug 2016 17:10:44 +0000 (20:10 +0300)]
followme: initialize all config items on reload

Some configuration directives were not initialized on reload, and hence
were not reset to default if they were removed from followme.conf.

ASTERISK-26288 #close

Change-Id: Ief829e16374ad1e0ecfd63e6ee4923b5a1d1c150

2 years agoBuildSystem: Detect ca_list_path capabilities in external PJProject.
Alexander Traud [Wed, 17 Aug 2016 11:12:19 +0000 (13:12 +0200)]
BuildSystem: Detect ca_list_path capabilities in external PJProject.

Since Asterisk 13.8, pj_ssl_cert_load_from_files2 got detected only in the
bundled PJProject but not in an external PJProject. Therefore, ca_list_path
could not be used in pjsip.conf. With this change, pj_ssl_cert_load_from_files2
is detected again to enable ca_list_path again.

ASTERISK-26303 #close

Change-Id: I4a4a0cdc5cdff33730911fb4cfc0498c069043d0

2 years agoMerge "translate: Enables native Packet-Loss Concealment (PLC) for supporting codecs."
zuul [Tue, 16 Aug 2016 22:29:58 +0000 (17:29 -0500)]
Merge "translate: Enables native Packet-Loss Concealment (PLC) for supporting codecs."

2 years agoari: Add documentation that path parameters are case-sensitive
George Joseph [Tue, 16 Aug 2016 17:24:29 +0000 (11:24 -0600)]
ari:  Add documentation that path parameters are case-sensitive

Added to api.wiki.mustache so that the generated object pages
have the notation in the table header as well as under each method
that has path parameters.

ASTERISK-25492 #close

Change-Id: I36c46c6dc0c9ac350470394a999a1b19ef3fcdaf

2 years agoRefactor usage pattern of xmldoc info tag.
Corey Farrell [Mon, 15 Aug 2016 20:29:53 +0000 (16:29 -0400)]
Refactor usage pattern of xmldoc info tag.

This updates func_channel.c and main/message.c to use a generic xpointer
include instead of including info from each channel driver.  Now the
name attribute of info is CHANNEL or CHANNEL_EXAMPLES to be included in
documentation for func_channel.  Setting the name attribute of info to
MessageToInfo or MessageFromInfo causes it to be included in the
MessageSend application and AMI action.

Change-Id: I89fd8276a3250824241a618009714267d3a8d1ea

2 years agoMerge "chan_sip: Fix lastrtprx always updated"
Joshua Colp [Tue, 16 Aug 2016 15:26:27 +0000 (10:26 -0500)]
Merge "chan_sip: Fix lastrtprx always updated"

2 years agoMerge "core: Entity ID is not set or invalid"
zuul [Tue, 16 Aug 2016 15:03:20 +0000 (10:03 -0500)]
Merge "core: Entity ID is not set or invalid"

2 years agoMerge "res_sorcery_config.c: Cleanup ao2 container usage idioms."
Joshua Colp [Tue, 16 Aug 2016 13:24:38 +0000 (08:24 -0500)]
Merge "res_sorcery_config.c: Cleanup ao2 container usage idioms."

2 years agoMerge "sorcery.c: Minor optimizations."
Joshua Colp [Tue, 16 Aug 2016 13:24:31 +0000 (08:24 -0500)]
Merge "sorcery.c: Minor optimizations."

2 years agoMerge "sorcery.c: Tweak some container declaration formatting."
Joshua Colp [Tue, 16 Aug 2016 13:24:19 +0000 (08:24 -0500)]
Merge "sorcery.c: Tweak some container declaration formatting."

2 years agoMerge "manager: Add <see-also> tags to relate AoC events and actions"
Joshua Colp [Tue, 16 Aug 2016 10:34:33 +0000 (05:34 -0500)]
Merge "manager: Add <see-also> tags to relate AoC events and actions"