4 years agoMerge "PJPROJECT logging: Fix detection of max supported log level."
zuul [Fri, 27 Jan 2017 00:46:22 +0000 (18:46 -0600)]
Merge "PJPROJECT logging: Fix detection of max supported log level."

4 years agoMerge "ari: Implement 'debug all' and request/response logging"
George Joseph [Thu, 26 Jan 2017 23:06:40 +0000 (17:06 -0600)]
Merge "ari: Implement 'debug all' and request/response logging"

4 years agoMerge "res_musiconhold.c: Fix format ref leak when parsing MOH config class."
George Joseph [Thu, 26 Jan 2017 22:05:07 +0000 (16:05 -0600)]
Merge "res_musiconhold.c: Fix format ref leak when parsing MOH config class."

4 years agoMerge "frame.c: Fix off-nominal format ref leaks."
George Joseph [Thu, 26 Jan 2017 22:03:49 +0000 (16:03 -0600)]
Merge "frame.c: Fix off-nominal format ref leaks."

4 years agoMerge "test_voicemail_api: order of params to VERIFY macros"
George Joseph [Thu, 26 Jan 2017 22:02:50 +0000 (16:02 -0600)]
Merge "test_voicemail_api: order of params to VERIFY macros"

4 years agoMerge "Add notes about embedded ast_frame structs holding a format ref."
zuul [Thu, 26 Jan 2017 19:18:35 +0000 (13:18 -0600)]
Merge "Add notes about embedded ast_frame structs holding a format ref."

4 years agoMerge "T.140: Fix format ref and memory leaks."
George Joseph [Thu, 26 Jan 2017 16:23:14 +0000 (10:23 -0600)]
Merge "T.140: Fix format ref and memory leaks."

4 years agoMerge "main/app.c: Memory corruption from early format destruction."
Joshua Colp [Thu, 26 Jan 2017 14:42:50 +0000 (08:42 -0600)]
Merge "main/app.c: Memory corruption from early format destruction."

4 years agoMerge "app_queue: add RINGCANCELED log event on caller hang up"
zuul [Thu, 26 Jan 2017 01:14:12 +0000 (19:14 -0600)]
Merge "app_queue: add RINGCANCELED log event on caller hang up"

4 years agoMerge "astobj2.c: Add excessive ref count trap."
George Joseph [Wed, 25 Jan 2017 22:00:49 +0000 (16:00 -0600)]
Merge "astobj2.c: Add excessive ref count trap."

4 years agoT.140: Fix format ref and memory leaks.
Richard Mudgett [Tue, 10 Jan 2017 23:39:02 +0000 (17:39 -0600)]
T.140: Fix format ref and memory leaks.

* channel.c:ast_sendtext(): Fix T.140 SendText memory leak.

* format_compatibility.c: T.140 RED and T.140 were swapped.

* res_rtp_asterisk.c:rtp_red_init(): Fix ast_format_t140_red ref leak.

* res_rtp_asterisk.c:rtp_red_init(): Fix data race after starting periodic
scheduled red_write().

* res_rtp_asterisk.c: Some other minor misc tweaks.

Change-Id: Ifa27a2e0f8a966b1cf628607c86fc4374b0b88cb

4 years agoMerge "stasis_bridge.c: Fix off-nominal stasis control ref leak."
zuul [Wed, 25 Jan 2017 19:32:39 +0000 (13:32 -0600)]
Merge "stasis_bridge.c: Fix off-nominal stasis control ref leak."

4 years agoMerge "res_pjsip_endpoint_identifier_ip: Ensure error defaults to 0."
George Joseph [Wed, 25 Jan 2017 17:37:03 +0000 (11:37 -0600)]
Merge "res_pjsip_endpoint_identifier_ip: Ensure error defaults to 0."

4 years agoMerge "chan_oss.c: Fix format ref leak in oss_read()."
George Joseph [Wed, 25 Jan 2017 17:21:14 +0000 (11:21 -0600)]
Merge "chan_oss.c: Fix format ref leak in oss_read()."

4 years agoMerge "pjproject_bundled: Fix setting max log level"
George Joseph [Wed, 25 Jan 2017 04:29:54 +0000 (22:29 -0600)]
Merge "pjproject_bundled: Fix setting max log level"

4 years agoMerge "res_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands."
George Joseph [Tue, 24 Jan 2017 21:47:34 +0000 (15:47 -0600)]
Merge "res_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands."

4 years agores_pjsip_endpoint_identifier_ip: Ensure error defaults to 0.
Joshua Colp [Tue, 24 Jan 2017 21:39:39 +0000 (21:39 +0000)]
res_pjsip_endpoint_identifier_ip: Ensure error defaults to 0.

When configuring a match using a netmask the error variable was
not defaulting to 0. For some people this would cause the code
to think an error occurred when adding the match when in reality
it added perfectly fine.


Change-Id: I850c250813742bddde65c84e739093c9e01dfe56

4 years agoastobj2.c: Add excessive ref count trap.
Richard Mudgett [Tue, 10 Jan 2017 23:37:38 +0000 (17:37 -0600)]
astobj2.c: Add excessive ref count trap.

Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a

4 years agomain/app.c: Memory corruption from early format destruction.
Richard Mudgett [Tue, 10 Jan 2017 19:11:20 +0000 (13:11 -0600)]
main/app.c: Memory corruption from early format destruction.

* make_silence() created a malloced silence slin frame without adding a
slin format ref.  When the frame is destroyed it will unref the slin
format that never had a ref added.  Memory corruption is expected to

* Simplified and fixed counting the number of samples in a frame list for

* Eliminated an unnecessary RAII_VAR associated with the make_silence()

Change-Id: I47de3f9b92635b7f8b4d72309444d6c0aee6f747

4 years agoframe.c: Fix off-nominal format ref leaks.
Richard Mudgett [Wed, 11 Jan 2017 20:59:24 +0000 (14:59 -0600)]
frame.c: Fix off-nominal format ref leaks.

* ast_frisolate() could leak frame format refs on allocation

* Similified code in ast_frisolate() and code used by

Change-Id: I79566d4d36b3d7801bf0c8294fcd3e9a86a2ed6d

4 years agostasis_bridge.c: Fix off-nominal stasis control ref leak.
Richard Mudgett [Sat, 14 Jan 2017 01:08:53 +0000 (19:08 -0600)]
stasis_bridge.c: Fix off-nominal stasis control ref leak.

Change-Id: Ib17218343a6596832060180e19386da9df150ac8

4 years agores_musiconhold.c: Fix format ref leak when parsing MOH config class.
Richard Mudgett [Tue, 10 Jan 2017 18:30:57 +0000 (12:30 -0600)]
res_musiconhold.c: Fix format ref leak when parsing MOH config class.

Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5

4 years agochan_oss.c: Fix format ref leak in oss_read().
Richard Mudgett [Tue, 10 Jan 2017 20:03:24 +0000 (14:03 -0600)]
chan_oss.c: Fix format ref leak in oss_read().

Change-Id: I0a5d56c7dcf327d60f86a4c25a23571733709fd0

4 years agoAdd notes about embedded ast_frame structs holding a format ref.
Richard Mudgett [Tue, 10 Jan 2017 23:48:39 +0000 (17:48 -0600)]
Add notes about embedded ast_frame structs holding a format ref.

mod_format.h: Note holds a format ref.

translate.h: Note ast_trans_pvt.f holds a format ref.

Change-Id: I86bda354d725207b41e08920355d7c31b2d7f749

4 years agoMerge "Free endpoint ACLs when destroying PJSIP endpoints."
Joshua Colp [Tue, 24 Jan 2017 18:44:26 +0000 (12:44 -0600)]
Merge "Free endpoint ACLs when destroying PJSIP endpoints."

4 years agoPJPROJECT logging: Fix detection of max supported log level.
Richard Mudgett [Sat, 21 Jan 2017 03:13:34 +0000 (21:13 -0600)]
PJPROJECT logging: Fix detection of max supported log level.

The mechanism used for detecting the maximum log level compiled into the
linked pjproject did not work.  The API call simply stores the requested
level into an integer and does no range checking.  Asterisk was assuming
that there was range checking and limited the new value to the allowable
range.  To get the actual maximum log level compiled into the linked
pjproject we need to get and save off the initial set log level from
pjproject.  This is the maximum log level supported.

* Get and save off the initial log level setting before altering it to the
desired level on startup.  This has to be done by a macro rather than
calling a core function to avoid incorrectly linking pjproject.

* Split the initial log level warning messages to warn if the linked
pjproject cannot support the requested startup level and if it is too low
to get the pjproject buildopts for "pjproject show buildopts".

* Adjust the CLI "pjproject set log level" to check the saved max log
level and to generate normal output messages instead of a warning message.

ASTERISK-26743 #close

Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4

4 years agoMerge "res_pjsip_endpoint_identifier_ip: Read settings before resolving."
George Joseph [Tue, 24 Jan 2017 14:21:52 +0000 (08:21 -0600)]
Merge "res_pjsip_endpoint_identifier_ip: Read settings before resolving."

4 years agores_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands.
Richard Mudgett [Thu, 5 Jan 2017 19:21:08 +0000 (13:21 -0600)]
res_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands.

ASTERISK-23828 #close

Change-Id: Ifb8a3b61f447aedc58a8e6b36a810f7566018567

4 years agoFree endpoint ACLs when destroying PJSIP endpoints.
Mark Michelson [Mon, 23 Jan 2017 22:18:18 +0000 (16:18 -0600)]
Free endpoint ACLs when destroying PJSIP endpoints.

If endpoint ACLs were specified, they were not being freed
when endpoints were destroyed. On systems with realtime endpoints, this
could add up quickly since each DB lookup would allocate the ACL without
freeing it.

ASTERISK-26731 #close
Reported by Ustinov Artem

Change-Id: Ie1f8bf5b7a0de628c975beba01e69c56893331ad

4 years agoMerge "LISTFILTER: Remove outdated ERROR message."
George Joseph [Mon, 23 Jan 2017 21:02:09 +0000 (15:02 -0600)]
Merge "LISTFILTER: Remove outdated ERROR message."

4 years agoMerge "res_pjsip_pubsub.c: Fix incorrect message string wrapping."
zuul [Mon, 23 Jan 2017 20:07:49 +0000 (14:07 -0600)]
Merge "res_pjsip_pubsub.c: Fix incorrect message string wrapping."

4 years agoari: Implement 'debug all' and request/response logging
George Joseph [Thu, 19 Jan 2017 15:05:36 +0000 (08:05 -0700)]
ari: Implement 'debug all' and request/response logging

The 'ari set debug' command has been enhanced to accept 'all' as an
application name.  This allows dumping of all apps even if an app
hasn't registered yet.  To accomplish this, a new global_debug global
variable was added to res/stasis/app.c and new APIs were added to
set and query the value.

'ari set debug' now displays requests and responses as well as events.
This required refactoring the existing debug code.

* The implementation for 'ari set debug' was moved from stasis/cli.{c,h}
  to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted.
* In order to print the body of incoming requests even if a request
  failed, the consumption of the body was moved from the ari stubs
  to ast_ari_callback in res_ari.c and the moustache templates were
  then regenerated.  The body is now passed to ast_ari_invoke and then
  on to the handlers.  This results in code savings since that template
  was inserted multiple times into all the stubs.

An additional change was made to the ao2_str_container implementation
to add partial key searching and a sort function.  The existing cli
code assumed it was already there when it wasn't so the tab completion
was never working.

Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf
(cherry picked from commit 1d890874f39a5a81b20da44358143ed9b54ab0fe)

4 years agotest_voicemail_api: order of params to VERIFY macros
Tzafrir Cohen [Sat, 21 Jan 2017 05:41:53 +0000 (07:41 +0200)]
test_voicemail_api: order of params to VERIFY macros

Fix order of parameters in calls to VM_API_INT_VERIFY and

ASTERISK-26739 #close

Change-Id: I30dc6b36893aadad6012be3f16f93aa5720870d6
Note: status: builds. Not tested any further.

4 years agoMerge "res_pjsip_pubsub.c: Fix AMI event list counts."
Joshua Colp [Mon, 23 Jan 2017 17:10:25 +0000 (11:10 -0600)]
Merge "res_pjsip_pubsub.c: Fix AMI event list counts."

4 years agopjproject_bundled: Fix setting max log level
George Joseph [Mon, 23 Jan 2017 15:10:50 +0000 (08:10 -0700)]
pjproject_bundled: Fix setting max log level

An earlier attempt to prevent pjsua from spitting out an extra 6795
lines of debug output every time the testsuite called it was also
turning off the ability for asterisk to output debug info when it
needed to.  This patch reverts the earlier fix and instead adds
a pjproject patch that sets the startup log level to 1 for pjsua
pjsystest and the pjsua python binding.  This is an asterisk-only
patch that does not affect pjproject functionality and will not be
submitted upstream.

Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8

4 years agores_pjsip_endpoint_identifier_ip: Read settings before resolving.
Joshua Colp [Mon, 23 Jan 2017 16:08:37 +0000 (16:08 +0000)]
res_pjsip_endpoint_identifier_ip: Read settings before resolving.

An option has been added, srv_lookups, which controls whether
SRV lookups are performed on the provided match hosts or not.
It was possible for this option to be applied after resolution
had already happened.

This change makes it so hosts are stored away, settings are read
and applied, and then resolution is done. This ensures that no
matter the ordering the srv_lookups option is in effect.


Change-Id: I750378cb277be0140f8c5539450270afbfc43388

4 years agoMerge "res_pjsip_pubsub.c: Eliminate trivial SCOPED_LOCK usage."
zuul [Mon, 23 Jan 2017 16:04:50 +0000 (10:04 -0600)]
Merge "res_pjsip_pubsub.c: Eliminate trivial SCOPED_LOCK usage."

4 years agoMerge "res_pjsip: alloca can never fail."
Joshua Colp [Mon, 23 Jan 2017 11:53:23 +0000 (05:53 -0600)]
Merge "res_pjsip: alloca can never fail."

4 years agoLISTFILTER: Remove outdated ERROR message.
Richard Mudgett [Sun, 22 Jan 2017 23:25:57 +0000 (17:25 -0600)]
LISTFILTER: Remove outdated ERROR message.

Feeding LISTFILTER an empty variable results in an invalid ERROR message.
Earlier changes made the message useless because we can no longer tell if
the variable is empty or does not exist.  It is valid to try to remove a
value from an empty list just as it is valid to try to remove a value that
is not in a non-empty list.

* Removed the outdated ERROR message.

* Added more test cases to the LISTFILTER unit test.

Change-Id: Ided9040e6359c44a335ef54e02ef5950a1863134

4 years agoMerge "abstract/fixed/adpative jitter buffer: disallow frame re-inserts"
Joshua Colp [Fri, 20 Jan 2017 19:49:12 +0000 (13:49 -0600)]
Merge "abstract/fixed/adpative jitter buffer: disallow frame re-inserts"

4 years agoMerge "debug_utilities: Create ast_loggrabber"
zuul [Fri, 20 Jan 2017 19:45:33 +0000 (13:45 -0600)]
Merge "debug_utilities:  Create ast_loggrabber"

4 years agores_pjsip_pubsub.c: Fix AMI event list counts.
Richard Mudgett [Thu, 5 Jan 2017 21:11:12 +0000 (15:11 -0600)]
res_pjsip_pubsub.c: Fix AMI event list counts.

Fix the AMI PJSIPShowSubscriptionsInbound, PJSIPShowSubscriptionsOutbound,
and PJSIPShowResourceLists actions event counts.  The reported counts may
not necessarily be accurate depending on what happens.

The subscriptions count would be wrong if Asterisk ever has outbound

The resource list count could be wrong if a list were added or removed
during the AMI action being processed.

Change-Id: I4344301827523fa174960a42c413fd19abe4aed5

4 years agores_pjsip_pubsub.c: Fix incorrect message string wrapping.
Richard Mudgett [Thu, 5 Jan 2017 19:02:06 +0000 (13:02 -0600)]
res_pjsip_pubsub.c: Fix incorrect message string wrapping.

Change-Id: Id771e6fe56d89ce365ddcbb423f820af97211120

4 years agores_pjsip_pubsub.c: Eliminate trivial SCOPED_LOCK usage.
Richard Mudgett [Thu, 5 Jan 2017 19:01:17 +0000 (13:01 -0600)]
res_pjsip_pubsub.c: Eliminate trivial SCOPED_LOCK usage.

Change-Id: Ie0b69a830385452042fa19e7d267c6790ec6b6be

4 years agores_pjsip: alloca can never fail.
Richard Mudgett [Thu, 5 Jan 2017 18:58:52 +0000 (12:58 -0600)]
res_pjsip: alloca can never fail.

Change-Id: Ia2a6158e5fdf311bc2a1c0c43417978de504b1f1

4 years agodebug_utilities: Create ast_loggrabber
George Joseph [Fri, 13 Jan 2017 17:03:15 +0000 (10:03 -0700)]
debug_utilities:  Create ast_loggrabber

ast_loggrabber gathers log files from customizable search patterns,
optionally converts POSIX timestamps to a readable format and
tarballs the results.

Also a few tweaks were made to ast_coredumper.

Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495
(cherry picked from commit c70915287837704090d75f181525765de7a17221)

4 years agores_pjsip_outbound_authenticator_digest.c: Fix spacing in warning messages.
Richard Mudgett [Sun, 1 Jan 2017 09:47:50 +0000 (03:47 -0600)]
res_pjsip_outbound_authenticator_digest.c: Fix spacing in warning messages.

Change-Id: I573f0343c0c63a785cd4da60d57cc9f8b9ce7f49

4 years agoapp_queue: add RINGCANCELED log event on caller hang up
Martin Tomec [Thu, 22 Dec 2016 10:07:33 +0000 (11:07 +0100)]
app_queue: add RINGCANCELED log event on caller hang up

QueueLog did not log ringnoanswer when the caller abandoned call
before first timeout. It was impossible to get agent membername
and ringing duration for this short calls. After some discusions
it seems that the best way is to add new event RINGCANCELED,
which is generated after caller hangup during ringing.


Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3

4 years agoMerge "res_calendar: delete old calendars after reload"
zuul [Wed, 18 Jan 2017 00:44:02 +0000 (18:44 -0600)]
Merge "res_calendar: delete old calendars after reload"

4 years agoMerge "app_queue: Add QueueUpdate application."
Joshua Colp [Tue, 17 Jan 2017 23:26:10 +0000 (17:26 -0600)]
Merge "app_queue: Add QueueUpdate application."

4 years agoabstract/fixed/adpative jitter buffer: disallow frame re-inserts
Kevin Harwell [Thu, 12 Jan 2017 21:58:43 +0000 (15:58 -0600)]
abstract/fixed/adpative jitter buffer: disallow frame re-inserts

It was possible for a frame to be re-inserted into a jitter buffer after it
had been removed from it. A case when this happened was if a frame was read
out of the jitterbuffer, passed to the translation core, and then multiple
frames were returned from said translation core. Upon multiple frames being
returned the first is passed on, but sebsequently "chained" frames are put
back into the read queue. Thus it was possible for a frame to go back into
the jitter buffer where this would cause problems.

This patch adds a flag to frames that are inserted into the channel's read
queue after translation. The abstract jitter buffer code then checks for this
flag and ignores any frames marked as such.

Change-Id: I276c44edc9dcff61e606242f71274265c7779587

4 years agoapp_queue: Add QueueUpdate application.
Sebastian Gutierrez [Sun, 6 Nov 2016 12:30:07 +0000 (09:30 -0300)]
app_queue: Add QueueUpdate application.

Add an application that allows tracking outbound calls
using app_queue.


Change-Id: Ia0ab64aed934c25b2a25022adcc7c0624224346e

4 years agotaskprocessor.c: Change when high water warning logged.
Richard Mudgett [Sat, 14 Jan 2017 03:23:49 +0000 (21:23 -0600)]
taskprocessor.c: Change when high water warning logged.

The task processor queue reached X scheduled tasks message was originally
intended to get logged only once per task processor to prevent spamming
the log.  This is no longer necessary since high and low water thresholds
can better control when the message is logged.

It is beneficial to generate the warning each time a task processor
reaches the high water level because PJSIP stops processing new requests
while any high water alert is active.  Without this change you would have
to enable at least debug level 3 logging to know about a repeated alert

* Made generate the warning message whenever a task is pushed into the
task processor that triggers the high water alert.

* Appended 'again' to the warning for a repeated high water alert trigger.

Change-Id: Iabf75a004f7edaf1e5e8c323099418e667cac999

4 years agoMerge "res_rtp_asterisk: Fix bug in function CHANNEL(rtcp, all_rtt)"
Joshua Colp [Fri, 13 Jan 2017 01:55:28 +0000 (19:55 -0600)]
Merge "res_rtp_asterisk:  Fix bug in function CHANNEL(rtcp, all_rtt)"

4 years agores_rtp_asterisk: Fix bug in function CHANNEL(rtcp, all_rtt)
Aaron An [Tue, 10 Jan 2017 11:54:16 +0000 (19:54 +0800)]
res_rtp_asterisk:  Fix bug in function CHANNEL(rtcp, all_rtt)

Function CHANNEL(rtcp,all_rtt) CHANNEL(rtcp,all_loss) CHANNEL(rtcp,all_jitter)
always return 0.0 due to wrong define of macro "AST_RTP_SATA_SET" and
It should compare "combined" with "stat" not "current_stat".

ASTERISK-26710 #close
Reported-by: Aaron An
Tested-by: AaronAn

Change-Id: Id4140fafbf92e2db689dac5b17d9caa009028a15

4 years agodebug_utilities: Create the ast_coredumper utility
George Joseph [Wed, 11 Jan 2017 00:10:39 +0000 (17:10 -0700)]
debug_utilities:  Create the ast_coredumper utility

This utility allows easy manipulation of asterisk coredumps.

* Configurable search paths and patterns for existing coredumps
* Can generate a consistent coredump from the running instance
* Can dump the lock_infos table from a coredump
* Dumps backtraces to separate files...
  - thread apply 1 bt full -> <coredump>.thread1.txt
  - thread apply all bt -> <coredump>.brief.txt
  - thread apply all bt full -> <coredump>.full.txt
  - lock_infos table -> <coredump>.locks.txt
* Can tarball corefiles and optionally delete them after processing
* Can tarball results files and optionally delete them after processing
* Converts ':' in coredump and results file names '-' to facilitate
  uploading.  Jira for instance, won't accept file names with colons
  in them.

Tested on Fedora24+, Ubuntu14+, Debian6+, CentOS6+ and FreeBSD9+[1].

[1] For *BSDs, the "devel/gdb" package might have to be installed to
get a recent gdb.  The utility will check all instances of gdb
it finds in $PATH and if one isn't found that can run python, it
prints a friendly error.

Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd
(cherry picked from commit cb47b4556053cd50d9102eef913671ad0306062d)

4 years agoMerge "app_queue: add new Service Level calculation"
zuul [Tue, 10 Jan 2017 20:01:34 +0000 (14:01 -0600)]
Merge "app_queue: add new Service Level calculation"

4 years agoMerge "res_pjsip_endpoint_identifier_ip: Add support for SRV lookups."
zuul [Mon, 9 Jan 2017 18:44:58 +0000 (12:44 -0600)]
Merge "res_pjsip_endpoint_identifier_ip: Add support for SRV lookups."

4 years agoMerge "chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND."
zuul [Mon, 9 Jan 2017 14:38:46 +0000 (08:38 -0600)]
Merge "chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND."

4 years agoMerge "res_pjsip: Fix known compact header issues"
Joshua Colp [Mon, 9 Jan 2017 13:23:17 +0000 (07:23 -0600)]
Merge "res_pjsip: Fix known compact header issues"

4 years agoMerge changes from topic 'ASTERISK-26672'
Joshua Colp [Mon, 9 Jan 2017 13:22:42 +0000 (07:22 -0600)]
Merge changes from topic 'ASTERISK-26672'

* changes:
  res_rtp_asterisk.c: Fix uninitialized memory crash.
  chan_rtp.c: Fix uninitialized memory crash.
  res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().

4 years agopjproject_bundled: Fix compilation with MALLOC_DEBUG
George Joseph [Sun, 8 Jan 2017 16:29:01 +0000 (09:29 -0700)]
pjproject_bundled:  Fix compilation with MALLOC_DEBUG

When MALLOC_DEBUG was specified, make was failing.  Immediately
remaking would work.  The issues was in the ordering of the make

Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd

4 years agores_pjsip_endpoint_identifier_ip: Add support for SRV lookups.
Joshua Colp [Thu, 5 Jan 2017 12:11:43 +0000 (12:11 +0000)]
res_pjsip_endpoint_identifier_ip: Add support for SRV lookups.

This change implements SRV support for the IP based endpoint
identifier module. All possible addresses through SRV are looked
up and added as matches. If no SRV records are available a
fallback to normal host resolution is done. If an IP address
is provided then no SRV lookup occurs.

This is configured using the "srv_lookups" option on the
identify section and defaults to "yes".


Change-Id: I6b641e275bf96629320efa8b479737062aed82ac

4 years agoMerge "core/pbx: dialplan show - display filename/line#"
zuul [Thu, 5 Jan 2017 16:30:32 +0000 (10:30 -0600)]
Merge "core/pbx: dialplan show - display filename/line#"

4 years agoMerge "res_pjsip_session: Access SIPDOMAIN via Dialplan."
Joshua Colp [Thu, 5 Jan 2017 14:25:22 +0000 (08:25 -0600)]
Merge "res_pjsip_session: Access SIPDOMAIN via Dialplan."

4 years agoMerge "acl.c: Improve ast_ouraddrfor() diagnostic messages."
George Joseph [Thu, 5 Jan 2017 04:09:22 +0000 (22:09 -0600)]
Merge "acl.c: Improve ast_ouraddrfor() diagnostic messages."

4 years agoMerge "chan_pjsip: Use session for retrieving CHANNEL() information."
George Joseph [Wed, 4 Jan 2017 22:26:35 +0000 (16:26 -0600)]
Merge "chan_pjsip: Use session for retrieving CHANNEL() information."

4 years agoapp_queue: add new Service Level calculation
Sebastian Gutierrez [Sun, 6 Nov 2016 12:37:46 +0000 (09:37 -0300)]
app_queue: add new Service Level calculation

Adds a new formula for SL2 and documentation


Change-Id: I0970c620460507cd9d45b0d43600779c8915e770

4 years agocore/pbx: dialplan show - display filename/line#
Jonathan R. Rose [Mon, 19 Dec 2016 21:03:52 +0000 (15:03 -0600)]
core/pbx: dialplan show - display filename/line#

Adds the ability for extensions to be registered to include filename and
line number so that dialplan show output can show the filename and line
number of a config file responsible for generating a given extension.

This only affects config modules that are written to use the new extension
registering functions. In this patch, that only includes pbx_config, so
extensions registered in extensions.conf and any included extension will
be shown in this manner. Extensions registered in this manner will show
the filename and line number *instead* of the registrar.

ASTERISK-26658 #close
Reported by: Jonathan R. Rose

Change-Id: Ieccc6abccdff34ed5c7da3511fd24972b8f2dd30

4 years agores_pjsip_session: Access SIPDOMAIN via Dialplan.
Alexander Traud [Thu, 22 Dec 2016 15:13:46 +0000 (16:13 +0100)]
res_pjsip_session: Access SIPDOMAIN via Dialplan.

This feature was available in the SIP channel driver chan_sip. For example,
Asterisk is the outbound proxy and has to handle all SIP-URIs, even domains not
local to Asterisk. In that case, SIPDOMAIN is used in the Dialplan, to detect
and dial remote SIP-URIs. This change here sets the SIP destination domain of
an inbound call (SIPDOMAIN) in the SIP channel driver res_pjsip as well.

ASTERISK-26670 #close

Change-Id: I27c880dc404a3c1c6792e1ba3545475339577243

4 years agochan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND.
Alexander Traud [Wed, 4 Jan 2017 11:50:11 +0000 (12:50 +0100)]
chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND.

After a SIP_CODEC_INBOUND in the dialplan, do not continue with cached formats
but remember the joint format. Cached formats contain default parameters,
often create an empty fmtp line. However, a joint format might have passed
format_get_joint(.) in a res_format_attr_* module (like Opus Codec) and
contain the resulting format parameters from a SDP negotiation.

ASTERISK-26691 #close

Change-Id: I35712d98a793d4c3efdd156cec57deab9014b1dc

4 years agopjproject_bundled: Compile pjsua with max log level = 2
George Joseph [Tue, 3 Jan 2017 21:14:09 +0000 (14:14 -0700)]
pjproject_bundled:  Compile pjsua with max log level = 2

A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6.
This allowed us to control the log level better from inside Asterisk.
An unfortunate side effect of this was that the pjsua binary and
python bindings were also compiled with log level set to 6 so whenever
a testsuite test that uses pjsua runs, it spits out 6795 lines of
debug in an instant even before the test starts.  I believe this
overruns the Jenkins capture buffer and prevents the test from
properly terminating.  In turn, this results in the testsuite just
hanging until the job is killed.  It's more frequent on the higher
end agents because they can spit out the messages faster.

Unfortunately, the messages are all spit out before we have control
of the python pj.Lib instance where we can set logging levels so the
only alternative was to actually compile pjsua and with an
overridden PJ_LOG_MAX_LEVEL.  Although defining a lower max level was
done in the Makefile, the define in config_site.h had to be wrapped
with "#ifndef" so the change would take effect.

Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff

4 years agoMerge "bridge_native_rtp.c: Minor code cleanups."
Joshua Colp [Tue, 3 Jan 2017 14:39:27 +0000 (08:39 -0600)]
Merge "bridge_native_rtp.c: Minor code cleanups."

4 years agoMerge "bridge_native_rtp.c: Fix native rtp bridge data race."
Joshua Colp [Tue, 3 Jan 2017 14:39:07 +0000 (08:39 -0600)]
Merge "bridge_native_rtp.c: Fix native rtp bridge data race."

4 years agochan_pjsip: Use session for retrieving CHANNEL() information.
Joshua Colp [Thu, 22 Dec 2016 22:00:58 +0000 (22:00 +0000)]
chan_pjsip: Use session for retrieving CHANNEL() information.

The CHANNEL() dialplan function implementation for PJSIP allows
querying of PJSIP specific information. This used the channel
passed in to get the PJSIP session and associated information.
It is possible for this channel to be masqueraded and end
up as a different channel type by the time the information
request is actually acted upon.

This change retrieves the PJSIP session safely and accesses
data from it (including channel). This provides a guarantee
that the session and channel will not be altered when the
request is being acted upon.


Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6

4 years agores_pjsip: Fix known compact header issues
Joshua Elson [Sun, 1 Jan 2017 01:56:09 +0000 (18:56 -0700)]
res_pjsip: Fix known compact header issues

ASTERISK-26684 #close

Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a

4 years agores_calendar: delete old calendars after reload
Martin Tomec [Fri, 30 Dec 2016 12:59:00 +0000 (13:59 +0100)]
res_calendar: delete old calendars after reload

When "fetch_again_at_reload" is set in config, we create now
new object and thread for each reloaded calendar (with new
configuration). Old calendar should be then unlinked, so the
old thread can exit and free memory.


Change-Id: Ic17fba9371c5a8b26a6bc54ea4957c13a32a343e

4 years agores_pjsip_refer: Handle compact Refer-To header.
George Joseph [Fri, 30 Dec 2016 15:10:09 +0000 (08:10 -0700)]
res_pjsip_refer:  Handle compact Refer-To header.

refer_incoming_refer_request needed to look for the "r" header as well
as the "Refer-To" header.

ASTERISK-26655 #close
refer_compact_fix.diff submitted by JoshE (license 6075)

Change-Id: I610410a99b02427ea5db887aeb454d5f12c2259f

4 years agobridge_native_rtp.c: Minor code cleanups.
Richard Mudgett [Fri, 23 Dec 2016 18:11:02 +0000 (12:11 -0600)]
bridge_native_rtp.c: Minor code cleanups.

In native_rtp_bridge_compatible_check()

* Made one variable declaration per line.

* Extracted if test assignment to make the test easier to see.

* Made long if tests easier to see the combinatorial logic.

* Added bridge id to a couple debug messages.

Change-Id: I65bc5732aa7c9a2537f062f106fbea711cf2daad

4 years agobridge_native_rtp.c: Fix native rtp bridge data race.
Richard Mudgett [Fri, 23 Dec 2016 18:10:40 +0000 (12:10 -0600)]
bridge_native_rtp.c: Fix native rtp bridge data race.

native_rtp_bridge_compatible() didn't lock the bridge channels before
checking the channels for native bridging ability.  As a result, one of
the channel's native format capabilities structure got replaced out from
under the native bridge check.  Use of a stale pointer to freed memory
causes bad things to happen.

testsuite test caught this.

* Add missing channel locking in native_rtp_bridge_compatible().

Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53

4 years agores_rtp_asterisk.c: Fix uninitialized memory crash.
Richard Mudgett [Wed, 21 Dec 2016 22:28:00 +0000 (16:28 -0600)]
res_rtp_asterisk.c: Fix uninitialized memory crash.

ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor().

* Optimized out the 'us' struct variable.

ASTERISK-26672 #close

Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc

4 years agoacl.c: Improve ast_ouraddrfor() diagnostic messages.
Richard Mudgett [Wed, 21 Dec 2016 22:25:00 +0000 (16:25 -0600)]
acl.c: Improve ast_ouraddrfor() diagnostic messages.

* Made not generate strings unless they will actually be used.


Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3

4 years agochan_rtp.c: Fix uninitialized memory crash.
Richard Mudgett [Wed, 21 Dec 2016 23:54:42 +0000 (17:54 -0600)]
chan_rtp.c: Fix uninitialized memory crash.

unicast_rtp_request() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort
the UnicastRTP channel request if it fails.


Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0

4 years agores_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().
Richard Mudgett [Wed, 21 Dec 2016 23:55:48 +0000 (17:55 -0600)]
res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().

We access uninitialized memory when the 'ourip' parameter does not
have an initial guess to our IP address.


Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15

4 years agoMerge "Fixes to various issues reported by pyflakes"
Joshua Colp [Thu, 22 Dec 2016 00:36:52 +0000 (18:36 -0600)]
Merge "Fixes to various issues reported by pyflakes"

4 years agores_rtp_asterisk.c: Fix off nominal memory leak.
Richard Mudgett [Wed, 7 Dec 2016 21:23:02 +0000 (15:23 -0600)]
res_rtp_asterisk.c: Fix off nominal memory leak.

Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75

4 years agoFixes to various issues reported by pyflakes
Tzafrir Cohen [Wed, 14 Dec 2016 08:21:25 +0000 (10:21 +0200)]
Fixes to various issues reported by pyflakes

Pyflake is a python (2) source checker. This patch fixes various
(mostly trivial) errors and warnings it reports.

Change-Id: Ia35c5ac61751b927814cf693994c632c412386ea

4 years agoMerge "pjproject_bundled: Make build single threaded"
Joshua Colp [Tue, 20 Dec 2016 11:31:04 +0000 (05:31 -0600)]
Merge "pjproject_bundled:  Make build single threaded"

4 years agoMerge "res_pjsip: Add/update ERROR msg if invalid URI."
Joshua Colp [Tue, 20 Dec 2016 11:29:56 +0000 (05:29 -0600)]
Merge "res_pjsip: Add/update ERROR msg if invalid URI."

4 years agoMerge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe."
Joshua Colp [Tue, 20 Dec 2016 11:29:35 +0000 (05:29 -0600)]
Merge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe."

4 years agoMerge "chan_dahdi.c: Fix bounds check regression."
Joshua Colp [Tue, 20 Dec 2016 01:48:31 +0000 (19:48 -0600)]
Merge "chan_dahdi.c: Fix bounds check regression."

4 years agoMerge "chan_sip: Reorder unload_module to deal with stuck TCP threads."
Joshua Colp [Mon, 19 Dec 2016 22:11:37 +0000 (16:11 -0600)]
Merge "chan_sip: Reorder unload_module to deal with stuck TCP threads."

4 years agoMerge "autosupport: Add 'pjproject show buildopts'"
Joshua Colp [Mon, 19 Dec 2016 21:22:47 +0000 (15:22 -0600)]
Merge "autosupport: Add 'pjproject show buildopts'"

4 years agoapp_queue: Ensure member is removed from pending when hanging up.
Martin Tomec [Fri, 9 Dec 2016 18:23:37 +0000 (19:23 +0100)]
app_queue: Ensure member is removed from pending when hanging up.

In some cases member is added to pending_members, and the channel
is hung up before any extension state change. So the member would
stay in pending_members forever. So when we call do_hang, we
should also remove member from pending.

ASTERISK-26621 #close

Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54

4 years agopjproject_bundled: Make build single threaded
George Joseph [Sun, 18 Dec 2016 21:23:17 +0000 (14:23 -0700)]
pjproject_bundled:  Make build single threaded

There were just too many issues in various environments with
multi threaded building of pjproject.  It doesn't really speed
things up anyway since asterisk is already being compiled in

Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1

4 years agochan_sip: Reorder unload_module to deal with stuck TCP threads.
Corey Farrell [Fri, 9 Dec 2016 02:00:02 +0000 (21:00 -0500)]
chan_sip: Reorder unload_module to deal with stuck TCP threads.

In some situations TCP threads may become frozen.  This creates the
possibility that Asterisk could segfault if they become unfrozen after
chan_sip has been dlclose'd.  This reorders the unload_module process to
allow abort if threads do not exit within 5 seconds.

High level order as follows:
1) Unregister from the core to stop new requests.
2) Signal threads to stop
3) Clear config based tables (but do not free the table itself).
4) Verify that threads have shutdown, cancel unload if not.
5) Clean all remaining resources.


Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882

4 years agoconfigure: fix with-pjproject-bundled
David M. Lee [Fri, 16 Dec 2016 07:32:57 +0000 (01:32 -0600)]
configure: fix with-pjproject-bundled

The AC_ARG_WITH macro's shell variable is withval; not enableval. Purely
coincidentally, the option would work when --enable-dev-mode is given.

Also fixed a portability problem with, since -printf is not
a portable option for find.

Change-Id: I0f0e5b1a934b5af5737713834361e9c95b96b376

4 years agoautosupport: Add 'pjproject show buildopts'
Richard Mudgett [Thu, 15 Dec 2016 19:25:50 +0000 (13:25 -0600)]
autosupport: Add 'pjproject show buildopts'

Change-Id: I8aa55a7c3fb175235ddc7f85e9457d5102d06fa7

4 years agochan_dahdi.c: Fix bounds check regression.
Richard Mudgett [Wed, 14 Dec 2016 20:21:47 +0000 (14:21 -0600)]
chan_dahdi.c: Fix bounds check regression.

Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb

4 years agores_pjsip: Add/update ERROR msg if invalid URI.
Richard Mudgett [Tue, 13 Dec 2016 20:34:54 +0000 (14:34 -0600)]
res_pjsip: Add/update ERROR msg if invalid URI.


Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c