Commit Graph

28627 Commits

Author SHA1 Message Date
Richard Mudgett
473330983b 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
trigger.

* 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
2017-01-13 21:30:53 -06:00
zuul
b9c73de158 Merge "res_rtp_asterisk: Fix bug in function CHANNEL(rtcp, all_rtt)" into 13 2017-01-12 19:54:09 -06:00
Aaron An
0047b1bc49 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
"AST_RTP_STAT_STRCPY".
It should compare "combined" with "stat" not "current_stat".

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

Change-Id: Id4140fafbf92e2db689dac5b17d9caa009028a15
2017-01-12 16:55:45 -06:00
George Joseph
47474cfd54 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
2017-01-11 12:07:33 -06:00
Joshua Colp
ac4d6828f5 Merge "res_pjsip_endpoint_identifier_ip: Add support for SRV lookups." into 13 2017-01-09 12:47:52 -06:00
Joshua Colp
d30bef1de9 Merge "chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND." into 13 2017-01-09 08:46:32 -06:00
Joshua Colp
bc5102adec Merge "res_pjsip: Fix known compact header issues" into 13 2017-01-09 07:23:10 -06:00
Joshua Colp
fdfa805552 Merge changes from topic 'ASTERISK-26672' into 13
* changes:
  res_rtp_asterisk.c: Fix uninitialized memory crash.
  chan_rtp.c: Fix uninitialized memory crash.
2017-01-09 07:22:18 -06:00
George Joseph
f8cd73ec3c 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
dependencies.

Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd
2017-01-08 09:37:04 -07:00
zuul
ecf49ae69a Merge "res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip()." into 13 2017-01-06 10:23:52 -06:00
Joshua Colp
37aaaa2da2 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".

ASTERISK-26693

Change-Id: I6b641e275bf96629320efa8b479737062aed82ac
2017-01-06 14:56:41 +00:00
zuul
bd37196774 Merge "bridge_native_rtp.c: Minor code cleanups." into 13 2017-01-05 13:22:43 -06:00
zuul
1fc8838883 Merge "res_pjsip_session: Access SIPDOMAIN via Dialplan." into 13 2017-01-05 07:43:51 -06:00
George Joseph
6fcf248fe3 Merge "acl.c: Improve ast_ouraddrfor() diagnostic messages." into 13 2017-01-04 22:06:40 -06:00
George Joseph
fd5fdb4e59 Merge "bridge_native_rtp.c: Fix native rtp bridge data race." into 13 2017-01-04 22:05:31 -06:00
George Joseph
3c48ab0532 Merge "chan_pjsip: Use session for retrieving CHANNEL() information." into 13 2017-01-04 16:25:47 -06:00
Alexander Traud
569dac8e50 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
2017-01-04 07:13:05 -06:00
Alexander Traud
367128e70b 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
2017-01-04 06:02:27 -06:00
George Joseph
d7e5a747c3 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 _pjsua.so 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
2017-01-03 16:03:21 -06:00
Joshua Colp
34e728cfb9 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.

ASTERISK-26673

Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6
2017-01-03 11:46:25 +00:00
Joshua Elson
a398f98b08 res_pjsip: Fix known compact header issues
ASTERISK-26684 #close

Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a
2016-12-31 18:56:09 -07:00
George Joseph
0ab9d103f6 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
patches:
	refer_compact_fix.diff	submitted by JoshE (license 6075)

Change-Id: I610410a99b02427ea5db887aeb454d5f12c2259f
2016-12-30 08:10:09 -07:00
Richard Mudgett
21151408f7 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
2016-12-23 13:10:18 -06:00
Richard Mudgett
9dcf9e9cea 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.

MALLOC_DEBUG, DO_CRASH, and the
tests/channels/pjsip/transfers/blind_transfer/caller_direct_media
testsuite test caught this.

* Add missing channel locking in native_rtp_bridge_compatible().

Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53
2016-12-23 13:10:04 -06:00
Richard Mudgett
a9e459f8ac 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
2016-12-22 12:22:44 -06:00
Richard Mudgett
bcdd282ada 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.

ASTERISK-26672

Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15
2016-12-22 12:16:20 -06:00
Richard Mudgett
ac31233dbe acl.c: Improve ast_ouraddrfor() diagnostic messages.
* Made not generate strings unless they will actually be used.

ASTERISK-26672

Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3
2016-12-22 12:16:20 -06:00
Richard Mudgett
0aa5db4b38 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.

ASTERISK-26672

Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0
2016-12-22 12:16:20 -06:00
Richard Mudgett
e2fa3c7eda res_rtp_asterisk.c: Fix off nominal memory leak.
Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
2016-12-21 11:14:04 -06:00
Joshua Colp
bc6fc3ab4d Merge "pjproject_bundled: Make build single threaded" into 13 2016-12-20 05:31:15 -06:00
Joshua Colp
2a94c2c97e Merge "res_pjsip: Add/update ERROR msg if invalid URI." into 13 2016-12-20 05:30:37 -06:00
George Joseph
eaa05b039b Merge "autosupport: Add 'pjproject show buildopts'" into 13 2016-12-19 22:21:19 -06:00
George Joseph
4ea24af6c6 Merge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe." into 13 2016-12-19 22:18:28 -06:00
Joshua Colp
2b675ce122 Merge "chan_dahdi.c: Fix bounds check regression." into 13 2016-12-19 18:27:48 -06:00
Joshua Colp
4a8766f490 Merge "chan_sip: Reorder unload_module to deal with stuck TCP threads." into 13 2016-12-19 16:19:11 -06:00
zuul
c8aff2c51b Merge "app_queue: Ensure member is removed from pending when hanging up." into 13 2016-12-19 12:41:09 -06:00
Martin Tomec
d13be4eff6 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
2016-12-19 10:38:53 +01:00
George Joseph
815f755155 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
parallel.

Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1
2016-12-18 14:23:17 -07:00
Corey Farrell
493849dcd7 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.

ASTERISK-26586

Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882
2016-12-17 11:32:14 -05:00
David M. Lee
ab447f8a6a 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 bootstrap.sh, since -printf is not
a portable option for find.

Change-Id: I0f0e5b1a934b5af5737713834361e9c95b96b376
2016-12-16 07:53:11 -06:00
Richard Mudgett
35736d419a autosupport: Add 'pjproject show buildopts'
Change-Id: I8aa55a7c3fb175235ddc7f85e9457d5102d06fa7
2016-12-15 13:26:43 -06:00
Richard Mudgett
4b285d226d chan_dahdi.c: Fix bounds check regression.
Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb
2016-12-14 14:22:56 -06:00
Richard Mudgett
9114574188 res_pjsip: Add/update ERROR msg if invalid URI.
ASTERISK-24499

Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c
2016-12-14 11:30:58 -06:00
Richard Mudgett
75a6afbec5 MESSAGE: Flush Message/ast_msg_queue channel alert pipe.
ASTERISK-25083

Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2
2016-12-14 11:30:58 -06:00
George Joseph
91485734a4 res_sorcery_memory_cache: Change an error to a debug message
When a sorcery user calls ast_sorcery_delete on an object that
may have already expired from the cache, res_sorcery_memory_cache
spits out an ERROR.  Since this can happen frequently and validly when
an inbound registration expires after the cache entry expired, the
errors are unnecessary and misleading.  Changed to a debug/1.

Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7
2016-12-14 08:26:37 -06:00
George Joseph
cd46e86491 pjproject_bundled: Retry download if previously saved tarball is bad
If a tarball is corrupted during download, the makefile will attempt to
download it again. If the tarball somehow gets corrupted after it's
downloaded however, the makefile was just failing.  We now
retry the download.

ASTERISK-26653 #close

Change-Id: I1b24d454852d80186f60c5a65dc4624ea8a1c359
2016-12-09 07:14:09 -07:00
Joshua Colp
791c15942b Merge "Fix typo in chan_sip" into 13 2016-12-09 05:33:16 -06:00
Joshua Colp
c7eb439953 Merge "chan_sip: Delete unneeded check" into 13 2016-12-09 05:32:09 -06:00
zuul
5f9316e143 Merge "Small code cleanup in chan_sip" into 13 2016-12-09 03:25:12 -06:00
zuul
949a4a443a Merge "res_pjsip: Fix 'A = B != C' kind." into 13 2016-12-08 21:54:37 -06:00