Commit Graph

27207 Commits

Author SHA1 Message Date
Corey Farrell
a6823bb0c4 chan_sip: Fix buffer overrun in sip_sipredirect.
sip_sipredirect uses sscanf to copy up to 256 characters to a stacked buffer
of 256 characters.  This patch reduces the copy to 255 characters to leave
room for the string null terminator.

ASTERISK-25722 #close

Change-Id: Id6c3a629a609e94153287512c59aa1923e8a03ab
2016-01-25 12:06:28 -05:00
Joshua Colp
fcb6c1737d Merge "Stasis: Use control queue to prevent crash." into 13 2016-01-23 10:07:44 -06:00
Mark Michelson
1003c2eb05 Stasis: Fix potential memory leak of control data.
When queuing tasks onto the Stasis control queue, you can pass an
arbitrary data pointer and a function to free that data. All ARI
commands that use the Stasis control queue made the assumption that the
destructor function would be called in all paths, whether the task was
queued successfully or not. However, this was not correct. If a task was
queued onto a control structure that was already completed, the
allocated data would not be freed properly.

This patch corrects this by making sure that all return paths call the
data destructor.

Change-Id: Ibf06522094f8e5c4cce652537dc5d7222b1c4fcb
2016-01-22 15:08:58 -06:00
Mark Michelson
eedd77fda0 Stasis: Use control queue to prevent crash.
A crash occurred when attempting to set a channel variable on a channel
that had already been hung up. This is because there is a small window
between when a control is grabbed and when the channel variable is set
that the channel can be hung up.

The fix here is to queue the setting of the channel variable onto the
control queue. This way, the manipulation of the channel happens in a
thread where it is safe to be done.

In this change, I also noticed that the setting of bridge roles on
channels was being done outside of the control queue, so I also changed
those operations to be done in the control queue.

ASTERISK-25709 #close
Reported by Mark Michelson

Change-Id: I2a0a4d51bce6fba6f1d9954e40935e42f366ea78
2016-01-22 14:55:28 -06:00
Richard Mudgett
1c95b211a0 logger.c: Fix buffer overrun found by address sanitizer.
The null terminator of the tail struct member was not being allocated
when no logger.conf config file is installed.

ASTERISK-25714 #close
Reported by: Badalian Vyacheslav

Change-Id: I45770fdd08af39506a3bc33ba279c4f16e047a30
2016-01-22 11:50:41 -06:00
Matt Jordan
a0d3932e2a Merge "Build System: Add support for checking alembic branches." into 13 2016-01-21 20:56:58 -06:00
Matt Jordan
c3f4afe40c Merge "res/res_pjsip/presence_xml.c: Add missing 2nd call presence state case." into 13 2016-01-21 17:25:22 -06:00
Corey Farrell
6ff945ab87 Build System: Add support for checking alembic branches.
* Add 'check-alembic' target to root Makefile.
* Create build_tools/make_check_alembic to do the actual checks.

ASTERISK-25685

Change-Id: Ibb3cae7d1202ac23dc70b0f3b5801571ad46b004
2016-01-21 18:11:07 -05:00
Richard Mudgett
02035212de res/res_pjsip/presence_xml.c: Add missing 2nd call presence state case.
ASTERISK-25712 #close
Reported by: Richard Mudgett

Change-Id: I70634df24f8c6c3a2c66c45af61d021e4999253f
2016-01-21 15:56:47 -06:00
Diederik de Groot
c68c66c61f main/asterisk.c: ast_el_read_char
Make sure buf[res] is not accessed at res=-1 (buffer underrun).
Address Sanitizer will complain about this quite loudly.

ASTERISK-24801 #close

Change-Id: Ifcd7f691310815a31756b76067c56fba299d3ae9
2016-01-21 15:25:07 -06:00
Richard Mudgett
f87c3275cc res_pjsip: Add CLI "pjsip dump endpt [details]"
Dump the res_pjsip endpt internals.

In non-developer mode we will not document or make easily accessible the
"details" option even though it is still available.  The user has to know
it exists to use it.  Presumably they would also be aware of the potential
crash warning below.

Warning: PJPROJECT documents that the function used by this CLI command
may cause a crash when asking for details because it tries to access all
active memory pools.

Change-Id: If2d98a3641c9873364d1daaad971376311aef3cb
2016-01-21 12:39:28 -06:00
Mark Michelson
09a6354f9e Merge topics 'increase_taskprocessor_timeout', 'fix_taskprocessor_unrefs' into 13
* changes:
  taskprocessor.c: Increase CLI "core ping taskprocessor" timeout.
  taskprocessor.c: Fix some taskprocessor unrefs.
2016-01-20 14:18:45 -06:00
Joshua Colp
a2928b6093 Merge "res_pjproject: Add module providing pjproject logging and utils" into 13 2016-01-20 11:46:14 -06:00
Joshua Colp
de3d988b9e Merge "funcs/func_cdr: Correctly report high precision values for duration and billsec" into 13 2016-01-20 10:33:19 -06:00
Joshua Colp
d1113e0f56 Merge "pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject" into 13 2016-01-20 10:32:41 -06:00
Matt Jordan
46b2de55f9 funcs/func_cdr: Correctly report high precision values for duration and billsec
When CDRs were refactored, func_cdr's ability to report high precision values
for duration and billsec (the 'f' option) was broken. This was due to func_cdr
incorrectly interpreting the duration/billsec values provided by the CDR engine
in milliseconds, as opposed to seconds. Since the CDR engine only provides
duration and billsec in seconds, and does not expose either attribute with
sufficient precision to merely pass back the underlying value, this patch fixes
the bug by re-calculating duration and billsec with microsecond precision based
on the start/answer/end times on the CDR.

ASTERISK-25179 #close

Change-Id: I8bc63822b496537a5bf80baf6102c06206bee841
2016-01-20 08:08:20 -06:00
George Joseph
137fe5ae01 res_pjproject: Add module providing pjproject logging and utils
res_pjsip_log_forwarder has been renamed to res_pjproject
and enhanced as follows:

As a follow-on to the recent 'Add CLI "pjsip show buildopts"' patch,
a new ast_pjproject_get_buildopt function has been added.  It
allows the caller to get the value of one of the buildopts.

The initial use case is retrieving the runtime value of
PJ_MAX_HOSTNAME to insure we don't send a hostname greater
than pjproject can handle.  Since it can differ between
the version of pjproject that Asterisk was compiled against
and the version of pjproject that Asterisk is running against,
we can't use the PJ_MAX_HOSTNAME macro directly in Asterisk
source code.

Change-Id: Iab6e82fec3d7cf00c1cf6185c42be3e7569dee1e
2016-01-20 06:13:41 -07:00
Matt Jordan
113adf336a Merge "test_threadpool: Wait for each task to complete and fix memory leak." into 13 2016-01-19 19:37:13 -06:00
Joshua Colp
b5c13c1545 test_threadpool: Wait for each task to complete and fix memory leak.
This change makes the thread_timeout_thrash unit test wait for
each task to complete. This fixes the problem where the test would
prematurely end when all threads were gone and a new one had to be
started to handle the last task. It also increases the thrasing as
it is now more likely for each task to encounter the above scenario.

This also fixes a memory leak where the data for each task was not
being freed.

ASTERISK-25611 #close

Change-Id: I5017d621a4dc911f509074c16229b86bff2fb3c6
2016-01-19 19:18:10 -04:00
Richard Mudgett
0ab89182d9 taskprocessor.c: Increase CLI "core ping taskprocessor" timeout.
Change-Id: I4892d6acbb580d6c207d006341eaf5e0f8f2a029
2016-01-19 16:37:12 -06:00
Richard Mudgett
a2a8ea3330 taskprocessor.c: Fix some taskprocessor unrefs.
You have to call ast_taskprocessor_unref() outside of the taskprocessor
implementation code.  Taskprocessor use since v12 has become more
transient than just the singleton uses in earlier versions.

Change-Id: If7675299924c0cc65f2a43a85254e6f06f2d61bb
2016-01-19 16:30:56 -06:00
Richard Mudgett
d604a9afc8 Fix alembic branches on v13.
Change-Id: I313449b609ede18ad1e1763a655dd23b9210a8e0
2016-01-19 13:44:31 -06:00
Joshua Colp
80e901396e Merge "Remove res/ari/* content during 'make clean'." into 13 2016-01-18 19:27:44 -06:00
Joshua Colp
e7b83fa76e Merge "pjsip/alembic: Fix qualify_timeout column definition" into 13 2016-01-18 19:24:40 -06:00
George Joseph
a0c79f3a4f pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject
Change-Id: I5387821f29e5caa0cba0b7d62b0fc0d341e7e20b
2016-01-18 17:45:48 -07:00
Mark Michelson
e50c6f32cc Merge "Update version number in features.conf.sample" into 13 2016-01-18 17:31:35 -06:00
Rusty Newton
018ccf680b func_channel: Add help text for undocumented CHANNEL function arguments
Adding help text documentation for:
* hangupsource
* appname
* appdata
* exten
* context
* channame
* uniqueid
* linkedid

ASTERISK-24097 #close
Reported by: Steven T. Wheeler
Tested by: Rusty Newton

Change-Id: Ib94b00568b0433987df87d5b67ea529b5905754d
2016-01-17 11:49:43 -06:00
Joshua Colp
33af878768 Merge "main/config: Clean config maps on shutdown." into 13 2016-01-17 11:44:28 -06:00
Daniel Journo
5644bca9f9 Update version number in features.conf.sample
Update the version number in the comments from Asterisk 12 to Asterisk 12+

Change-Id: Ie692ac8cda3c993c3bf10f27f51a1cca3317ec7b
2016-01-16 20:06:40 +00:00
Joshua Colp
d690b88a1e Merge "bridge_basic: don't play an attended transfer fail sound after target hangs up" into 13 2016-01-16 08:29:51 -06:00
Joshua Colp
aaa52a2a05 Merge "bridge_basic: don't cache xferfailsound during an attended transfer" into 13 2016-01-16 08:29:23 -06:00
Joshua Colp
0aa47e11e1 Merge "taskprocessor.c: Simplify ast_taskprocessor_get() return code." into 13 2016-01-16 08:28:10 -06:00
Corey Farrell
3f5f30cf82 main/config: Clean config maps on shutdown.
ASTERISK-25700 #close

Change-Id: I096da84f9c62c6095f68bcf98eac4b7c7868e808
2016-01-15 19:59:59 -06:00
Kevin Harwell
660fedecb7 bridge_basic: don't cache xferfailsound during an attended transfer
The xferfailsound was read from the channel at the beginning of the transfer,
and that value is "cached" for the duration of the transfer. Therefore, changing
the xferfailsound on the channel using the FEATURE() dialplan function does
nothing once the transfer is under way.

This makes it so the transfer code instead gets the xferfailsound configuration
options from the channel when it is actually going to be used.

This patch also fixes a potential memory leak of the props object as well as
making sure the condition variable gets initialized before being destroyed.

ASTERISK-25696 #close

Change-Id: Ic726b0f54ef588bd9c9c67f4b0e4d787934f85e4
2016-01-15 17:45:51 -06:00
Richard Mudgett
9cda1de34d taskprocessor.c: Simplify ast_taskprocessor_get() return code.
Change-Id: Id5bd18ef1f60ef8be453e677e98478298358a9d1
2016-01-15 12:36:34 -06:00
Richard Mudgett
a79af2b312 astmm.c: Add more stats to CLI "memory show" commands.
* Add freed regions totals to allocations and summary.

* Add totals for all allocations and not just the selected allocations.

Change-Id: I61d5a5112617b0733097f2545a3006a344b4032a
2016-01-14 19:37:36 -06:00
Kevin Harwell
83feb7db3b bridge_basic: don't play an attended transfer fail sound after target hangs up
If the attended transfer destination answers (picks call up or goes to
voicemail) and then hangs up on the transferer then transferer hears the
fail sound.

This patch makes it so the fail sound is not played when the transfer
destination/target hangs up after answering.

ASTERISK-25697 #close

Change-Id: I97f142fe4fc2805d1a24b7c16143069dc03d9ded
2016-01-14 16:00:50 -06:00
Mark Michelson
935d641f3b Remove res/ari/* content during 'make clean'.
'make clean' and 'make distclean' can leave behind .o files in the
res/ari/ directory. One observed consequence of this is that running
Asterisk with MALLOC_DEBUG can cause Asterisk to crash immediately on
startup sometimes.

By ensuring that we are making a clean build, we can be sure that stale
files are not being included in the build and causing problems when
build options should have caused files to be re-built.

ASTERISK-25683 #close
Reported by yaron nahum

Change-Id: I1f48baa904d2468eddeefb42ee68a56af7adc7b7
2016-01-14 13:22:46 -06:00
Joshua Colp
236896f391 Merge "pjsip: Add option global/regcontext" into 13 2016-01-14 06:32:04 -06:00
Daniel Journo
46f21df302 pjsip/alembic: Fix qualify_timeout column definition
Corrects the qualify_timeout column type from Integer to Decimal

ASTERISK-25686 #close
Reported-by: Marcelo Terres

Change-Id: I757d0e3c011ee9be6cd5abd48bc92441a405d3c8
2016-01-13 21:58:22 +00:00
Mark Michelson
caba57631d Merge "app: Queue hangup if channel is hung up during sub or macro execution." into 13 2016-01-13 15:10:42 -06:00
Joshua Colp
32b29d7b02 app: Queue hangup if channel is hung up during sub or macro execution.
This issue was exposed when executing a connected line subroutine.
When connected or redirected subroutines or macros are executed it is
expected that the underlying applications and logic invoked are fast
and do not consume frames. In practice this constraint is not enforced
and if not adhered to will cause channels to continue when they shouldn't.
This is because each caller of the connected or redirected logic does not
check whether the channel has been hung up on return. As a result the
the hung up channel continues.

This change makes it so when the API to execute a subroutine or
macro is invoked the channel is checked to determine if it has hung up.
If it has then a hangup is queued again so the caller will see it
and stop.

ASTERISK-25690 #close

Change-Id: I1f9a8ceb1487df0389f0d346ce0f6dcbcaf476ea
2016-01-13 12:58:36 -04:00
Mark Michelson
f18ad96b77 Merge "res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts"." into 13 2016-01-13 09:48:54 -06:00
Sean Bright
e7cfda0b38 res_musiconhold: Prevent multiple simultaneous reloads.
There are two ways in which the reload() function in res_musiconhold can be
called from the CLI:

  * module reload res_musiconhold.so
  * moh reload

In the former case, the module loader holds a lock that prevents multiple
concurrent calls, but in the latter there is no such protection.

This patch changes the 'moh reload' CLI command to invoke the module loader
directly, rather than call reload() explicitly.

ASTERISK-25687 #close

Change-Id: I408968b4c8932864411b7f9ad88cfdc7b9ba711c
2016-01-13 07:50:19 -06:00
Richard Mudgett
5586abc957 res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".
PJPROJECT has a function available to dump the compile time
options used when building the library.

* Add CLI "pjsip show buildopts" command.

* Update contrib/scripts/autosupport to get pjproject information.

Change-Id: Id93a6a916d765b2a2e5a1aeb54caaf83206be748
2016-01-12 20:24:15 -06:00
Joshua Colp
092c0db493 Merge "pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address" into 13 2016-01-12 19:45:34 -06:00
Joshua Colp
b91dfcd1fb Merge "res_pjsip: Create human friendly serializer names." into 13 2016-01-12 13:59:42 -06:00
Joshua Colp
b41f69dcbc Merge "res_sorcery_realtime: Remove leading ^ requirement." into 13 2016-01-12 13:59:32 -06:00
Joshua Colp
56d1162dc2 Merge topic 'update_taskprocessor_commands' into 13
* changes:
  Sorcery: Create human friendly serializer names.
  Stasis: Create human friendly taskprocessor/serializer names.
  taskprocessor.c: New API for human friendly taskprocessor names.
  taskprocessor.c: Sort CLI "core show taskprocessors" output.
2016-01-12 13:25:40 -06:00
Joshua Colp
25c0ed2f64 Merge "taskprocessor.c: Fix CLI "core show taskprocessors" output format." into 13 2016-01-12 13:18:51 -06:00