]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agoapp: Queue hangup if channel is hung up during sub or macro execution. 97/1997/2
Joshua Colp [Tue, 12 Jan 2016 17:14:29 +0000 (13:14 -0400)] 
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

9 years agores_musiconhold: Prevent multiple simultaneous reloads. 00/2000/3
Sean Bright [Wed, 13 Jan 2016 13:20:24 +0000 (08:20 -0500)] 
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

9 years agoMerge topic 'update_taskprocessor_commands' into 11
Joshua Colp [Tue, 12 Jan 2016 19:18:42 +0000 (13:18 -0600)] 
Merge topic 'update_taskprocessor_commands' into 11

* changes:
  taskprocessor.c: Fix CLI "core show taskprocessors" unref.
  taskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.

9 years agoMerge "ccss.c: Replace space in taskprocessor name." into 11
Joshua Colp [Tue, 12 Jan 2016 19:17:40 +0000 (13:17 -0600)] 
Merge "ccss.c: Replace space in taskprocessor name." into 11

9 years agoMerge "app_queue: Add member flag "in_call" to prevent reading wrong lastcall time...
Joshua Colp [Tue, 12 Jan 2016 12:05:16 +0000 (06:05 -0600)] 
Merge "app_queue: Add member flag "in_call" to prevent reading wrong lastcall time" into 11

9 years agoMerge "pbx: Deadlock between contexts container and context_merge locks" into 11
Joshua Colp [Mon, 11 Jan 2016 23:37:05 +0000 (17:37 -0600)] 
Merge "pbx: Deadlock between contexts container and context_merge locks" into 11

9 years agoMerge "pbx_dundi: Run cleanup on failed load." into 11
Joshua Colp [Mon, 11 Jan 2016 22:55:03 +0000 (16:55 -0600)] 
Merge "pbx_dundi: Run cleanup on failed load." into 11

9 years agoMerge "res_crypto: Perform cleanup at shutdown." into 11
Joshua Colp [Mon, 11 Jan 2016 22:35:23 +0000 (16:35 -0600)] 
Merge "res_crypto: Perform cleanup at shutdown." into 11

9 years agoMerge "res_calendar: Cleanup scheduler context at unload." into 11
Joshua Colp [Mon, 11 Jan 2016 20:35:45 +0000 (14:35 -0600)] 
Merge "res_calendar: Cleanup scheduler context at unload." into 11

9 years agoMerge "manager: Cleanup manager_channelvars during shutdown." into 11
Joshua Colp [Mon, 11 Jan 2016 20:35:29 +0000 (14:35 -0600)] 
Merge "manager: Cleanup manager_channelvars during shutdown." into 11

9 years agopbx: Deadlock between contexts container and context_merge locks 60/1960/2
Kevin Harwell [Wed, 6 Jan 2016 19:03:28 +0000 (13:03 -0600)] 
pbx: Deadlock between contexts container and context_merge locks

Recent changes (ASTERISK-25394 commit 2bd27d12223fe33b58c453965ed5c6ed3af7c4f5)
introduced the possibility of a deadlock. Due to the mentioned modifications
ast_change_hints now needs to keep both merge/delete and state callbacks from
occurring while it executes. Unfortunately, sometimes ast_change_hints can be
called with the contexts container locked. When this happens it's possible for
another thread to grab the context_merge_lock before the thread calling into
ast_change_hints does and then try to obtain the contexts container lock. This
of course causes a deadlock between the two threads. The thread calling into
ast_change_hints waits for the other thread to release context_merge_lock and
the other thread is waiting on that one to release the contexts container lock.

Unfortunately, there is not a great way to fix this problem. When hints change,
the subsequent state callbacks cannot run at the same time as a merge/delete,
nor when the usual state callbacks do. This patch alleviates the problem by
having those particular callbacks (the ones run after a hint change) occur in a
serialized task. By moving the context_merge_lock to a task it can now safely be
attempted or held without a deadlock occurring.

ASTERISK-25640 #close
Reported by: Krzysztof Trempala

Change-Id: If2210ea241afd1585dc2594c16faff84579bf302

9 years agodevicestate: Cleanup engine thread during graceful shutdown. 85/1985/1
Corey Farrell [Sun, 10 Jan 2016 23:08:16 +0000 (18:08 -0500)] 
devicestate: Cleanup engine thread during graceful shutdown.

ASTERISK-25681 #close

Change-Id: I64337c70f0ebd8c77f70792042684607c950c8f1

9 years agomanager: Cleanup manager_channelvars during shutdown. 81/1981/1
Corey Farrell [Sun, 10 Jan 2016 19:40:11 +0000 (14:40 -0500)] 
manager: Cleanup manager_channelvars during shutdown.

ASTERISK-25680 #close

Change-Id: I3251d781cbc3f48a6a7e1b969ac4983f552b2446

9 years agores_calendar: Cleanup scheduler context at unload. 78/1978/1
Corey Farrell [Sun, 10 Jan 2016 19:27:57 +0000 (14:27 -0500)] 
res_calendar: Cleanup scheduler context at unload.

ASTERISK-25679 #close

Change-Id: I839159bf6882cccc1b23494c7aa2bc2a2624613f

9 years agopbx_dundi: Run cleanup on failed load. 70/1970/1
Corey Farrell [Sun, 10 Jan 2016 00:04:34 +0000 (19:04 -0500)] 
pbx_dundi: Run cleanup on failed load.

During failed startup of pbx_dundi no cleanup was performed.  Add a call
to unload_module before returning AST_MODULE_LOAD_DECLINE.

ASTERISK-25677 #close

Change-Id: I8ffa226fda4365ee7068ac1f464473f1a4ebbb29

9 years agores_crypto: Perform cleanup at shutdown. 67/1967/1
Corey Farrell [Sat, 9 Jan 2016 19:28:31 +0000 (14:28 -0500)] 
res_crypto: Perform cleanup at shutdown.

This change causes res_crypto to unregister CLI at shutdown while still
preventing the module from being unloaded.

ASTERISK-25673 #close

Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc

9 years agoinclude/asterisk/time.h: Renamed global declaration:tv 35/1935/1
Diederik de Groot [Thu, 7 Jan 2016 09:21:03 +0000 (10:21 +0100)] 
include/asterisk/time.h: Renamed global declaration:tv

Renamed global declaration:tv to dummy_tv_var_for_types,
which would oltherwise cause 'shadow' warnings when 'tv'
was declared as a local variable elsewhere.

Added comment to note that dummy_tv_var_for_types is never
really exported and only used as a place holder.

ASTERISK-25627 #close

Change-Id: I9a6e17995006584f3627efe8988e3f8aa0f5dc28

9 years agotaskprocessor.c: Fix CLI "core show taskprocessors" unref. 40/1940/1
Richard Mudgett [Fri, 8 Jan 2016 03:07:49 +0000 (21:07 -0600)] 
taskprocessor.c: Fix CLI "core show taskprocessors" unref.

Change-Id: I1d9f4e532caa6dfabe034745dd16d06134efdce5

9 years agoccss.c: Replace space in taskprocessor name. 38/1938/1
Richard Mudgett [Thu, 7 Jan 2016 01:00:27 +0000 (19:00 -0600)] 
ccss.c: Replace space in taskprocessor name.

The CLI "core ping taskprocessor" command does not work very
well with taskprocessor names that have spaces in them.  You
have to put quotes around the name so using tab completion
becomes awkward.

Change-Id: I29e806dd0a8a0256f4e2e0a7ab88c9e19ab0eda0

9 years agotaskprocessor.c: Add CLI "core ping taskprocessor" missing unlock. 39/1939/1
Richard Mudgett [Tue, 5 Jan 2016 22:54:06 +0000 (16:54 -0600)] 
taskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.

Change-Id: I78247e0faf978bf850b5ba4e9f4933ab3c59d17b

9 years agoMerge "cel/cel_radius: Fix wrong pointer." into 11
Joshua Colp [Wed, 6 Jan 2016 18:02:52 +0000 (12:02 -0600)] 
Merge "cel/cel_radius: Fix wrong pointer." into 11

9 years agocel/cel_radius: Fix wrong pointer. 22/1922/1
Aaron An [Mon, 4 Jan 2016 10:26:55 +0000 (18:26 +0800)] 
cel/cel_radius: Fix wrong pointer.

The macro ADD_VENDOR_CODE defined in the cel_radius.c should use the parameter
y not the address of y.

I capture the radius UDP packet via tcpdump, and the AV pairs are not correct,
then i review the source code and compare it with cdr/cdr_radius.c. Fix it and
 it works.

ASTERISK-25647 #close
Reported by: Aaron An
Tested by: Aaron An

Change-Id: I72889bccd8fde120d47aa659edc0e7e6d4d019f0

9 years agoasterisk.h: Add ASTERISK_REGISTER_FILE macro 19/1919/1
George Joseph [Tue, 5 Jan 2016 20:52:16 +0000 (13:52 -0700)] 
asterisk.h: Add ASTERISK_REGISTER_FILE macro

The 11/13 branches and master use 2 different file version macros. 11/13
uses ASTERISK_FILE_VERSION but master uses ASTERISK_REGISTER_FILE. This
means a new file added to 11/13 can't just be cherry-picked to master
because the macro has to be changed.

To make cherry-picking possible, ASTERISK_REGISTER_FILE was added
to asterisk.h as a simple alias for ASTERISK_FILE_VERSION(__FILE__, NULL)
The "$Revision$" tag doesn't do anything since Asterisk moved to git so
just passing NULL as the verison works fine.  asterisk.h was also
annotated to deprecate ASTERISK_FILE_VERSION and suggest using
ASTERISK_REGISTER_FILE for all new files.

Change-Id: I5867ed898818d26ee49bb6e5c7d4c1a45d4789a5

9 years agoapp_queue: Add member flag "in_call" to prevent reading wrong lastcall time 81/1881/3
Martin Tomec [Tue, 29 Dec 2015 11:44:29 +0000 (12:44 +0100)] 
app_queue: Add member flag "in_call" to prevent reading wrong lastcall time

Member lastcall time is updated later than member status. There was chance to
check wrapuptime for available member with wrong (old) lastcall time.
New boolean flag "in_call" is set to true right before connecting call, and
reset to false after update of lastcall time. Members with "in_call" set to true
are treat as unavailable.

ASTERISK-19820 #close

Change-Id: I1923230cf9859ee51563a8ed420a0628b4d2e500

9 years agoapp_dial: Immediately exit dial if the caller is already hung up. 02/1902/1
Richard Mudgett [Fri, 4 Dec 2015 23:22:29 +0000 (17:22 -0600)] 
app_dial: Immediately exit dial if the caller is already hung up.

If a caller hangs up before dial is executed within an AGI then the AGI
has likely eaten all queued frames before executing the dial in DeadAGI
mode.  With the caller hung up and no pending frames from the caller's
read queue, dial would not know that the call has hung up until a called
channel answers.  It is rather annoying to whoever just answered the
non-existent call.

Dial should not continue execution in DeadAGI mode, hangup handlers, or
the h exten.

* Added a check early in dial to abort dialing if the caller has hungup.

ASTERISK-25307 #close
Reported by: David Cunningham

Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418

9 years agoMerge "res_http_websocket.c: prevent avoidable disconnections caused by write errors...
Joshua Colp [Thu, 31 Dec 2015 00:43:28 +0000 (18:43 -0600)] 
Merge "res_http_websocket.c: prevent avoidable disconnections caused by write errors" into 11

9 years agotest_time: Provide a timeout when waiting. 75/1875/1
Joshua Colp [Mon, 28 Dec 2015 20:02:19 +0000 (16:02 -0400)] 
test_time: Provide a timeout when waiting.

The test_timezone_watch unit test is written to expect a
condition to be signaled when the inotify daemon thread runs.
There exists a small window where the test_timezone_watch
thread can signal the inotify daemon thread while it is not
reading on the underlying file descriptor. If this occurs
the test_timezone_watch thread will wait indefinitely for a
signal that will never arrive.

This change adds a timeout to the condition so it will return
regardless after a period of time.

Change-Id: Ifed981879df6de3d93acd3ee0a70f92546517390

9 years agores_http_websocket.c: prevent avoidable disconnections caused by write errors 63/1863/2
Dade Brandon [Fri, 25 Dec 2015 04:19:59 +0000 (20:19 -0800)] 
res_http_websocket.c: prevent avoidable disconnections caused by write errors

Updated ast_websocket_write to encode the entire frame in to one
write operation, to ensure that we don't end up with a situation
where the websocket header has been sent, while the body can not
be written.

Previous to August's patch in commit b9bd3c14, certain network
conditions could cause the header to be written, and then the
sub-sequent body to fail - which would cause the next successful
write to contain a new header, and a new body (resulting in
the peer receiving two headers - the second of which would be
read as part of the body for the first header).

This was patched to have both write operations individually fail
by closing the websocket.

In a case available to the submitter of this patch, the same
body which would consistently fail to write, would succeed
if written at the same time as the header.

This update merges the two operations in to one, adds debug messages
indicating the reason for a websocket connection being closed during
a write operation, and clarifies some variable names for code legibility.

Change-Id: I4db7a586af1c7a57184c31d3d55bf146f1a40598

9 years agochan_sip.c: fix websocket_write_timeout default value 68/1868/1
Dade Brandon [Fri, 25 Dec 2015 15:56:44 +0000 (07:56 -0800)] 
chan_sip.c: fix websocket_write_timeout default value

websocket_write_timeout was not being set to its default value
during sip config reload, which meant that prior to this commit,
1) the default value of 100 was not used, unless an invalid value
(or 1) was specified in sip.conf for websocket_write_timeout, and
2) if the websocket_write_timeout directive was removed from sip.conf
without a full restart of asterisk, then the previous value would
continue to be used indefinitely.

This essentially lead to a 0ms write timeout (the first write attempt
in ast_careful_fwrite must have succeeded) in websocket write requests
from chan_sip, unless websocket_write_timeout was explicitely set in sip.conf.

Changes to websocket_write_timeout still only apply to new websocket
sessions, after the sip reload -- timeouts on existing sessions are
not adjusted during sip reload.

Change-Id: Ibed3816ed29cc354af6564c5ab3e75eab72cb953

9 years agores_rtp_asterisk: rtp->ice check not wrapped in USE_PJPROJECT ifdef 50/1850/2
Kevin Harwell [Thu, 24 Dec 2015 16:10:53 +0000 (10:10 -0600)] 
res_rtp_asterisk: rtp->ice check not wrapped in USE_PJPROJECT ifdef

Change-Id: I19b49112e1b630bd04e859f14ccf96f8ebd6b151

9 years agoMerge "app_amd: Correct documentation to reflect functionality" into 11
Matt Jordan [Wed, 23 Dec 2015 02:22:15 +0000 (20:22 -0600)] 
Merge "app_amd: Correct documentation to reflect functionality" into 11

9 years agoapp_amd: Correct documentation to reflect functionality 44/1844/2
Dade Brandon [Mon, 21 Dec 2015 03:33:02 +0000 (19:33 -0800)] 
app_amd: Correct documentation to reflect functionality

Update documentation to reflect that maximum_number_of_words
has functionality inconsistent with the variable name (and inconsistent
with prior documentation.)

Update documentation for silence_threshold, which previously implied
that it was measuring time, rather than noise averages in the sample.

Update the comments in amd.conf.sample.

ASTERISK-25639 #close
Change-Id: I4b1451e5dc9cb3cb06d59b6ab872f5275ba79093

9 years agores_rtp_asterisk: Resolve further timing issues with DTLS negotiation 38/1838/2
Dade Brandon [Fri, 18 Dec 2015 01:05:00 +0000 (17:05 -0800)] 
res_rtp_asterisk: Resolve further timing issues with DTLS negotiation

Resolves an edge case dtls negotiation delay for certain networks which
somehow manage to drop the rtcp side's packet when these are both sent
ast_rtp_remote_address_set, causing it to have to time-out and restart
the handshake.

Move dtls pending bio flush in to it's own function, and call it from
ast_rtp_on_ice_complete, when we're rtp->ice, rather than when
ast_rtp_remote_address_set.

Keep the existing flush from the recent change to res_rtp_remote_address_set
if ice is not being used.

ASTERISK-25614 #close
Reported-by: XenCALL
Tested by: XenCALL

Change-Id: Ie2caedbdee1783159f375589b6fd3845c8577ba5

9 years agoapp_queue: update RT members when the 1st call joins a queue with no agents 43/1843/1
Carlos Oliva [Fri, 18 Dec 2015 15:54:41 +0000 (16:54 +0100)] 
app_queue: update RT members when the 1st call joins a queue with no agents

If a call enters on a queue and the members on that queue are updated in
realtime (ex: using mysql inserting a new agent) the queue members are
never refreshed and the call will stay in the queue until other event occurs.
This happens only if this is the first call of the queue and there is no
agents servicing.
This patch prevent this issue, ensuring realtime members are updated if
there is one call in the queue and no available agents

ASTERISK-25442 #close

Change-Id: If1e036d013a5c1d8b0bf60d71d48fe98694a8682

9 years agoMerge "AMI: Fixed OriginateResponse message" into 11
Matt Jordan [Wed, 16 Dec 2015 03:12:33 +0000 (21:12 -0600)] 
Merge "AMI: Fixed OriginateResponse message" into 11

9 years agoAMI: Fixed OriginateResponse message 16/1816/11
pchero [Wed, 9 Dec 2015 23:23:59 +0000 (00:23 +0100)] 
AMI: Fixed OriginateResponse message

When asterisk sends the OriginateResponse event message, it
doesn't send the correct information for origination to an
application.

ASTERISK-25624 #close

Change-Id: I8fb6bc533d7f812c66a24cc2b0354ddb09d0f640

9 years agores_rtp_asterisk.c: Fix DTLS negotiation delays. 13/1813/2
server-pandora [Mon, 14 Dec 2015 19:53:20 +0000 (11:53 -0800)] 
res_rtp_asterisk.c: Fix DTLS negotiation delays.

- Trigger pending DTLS packets to send out, once the RTP instance's remote
  address is set.
- Avoids locking the DTLS structure unnecessarily by only doing this if
  DTLS is passive.
- Add DTLS locks around the structurally sensitive calls in the SSL
  portion of __rtp_recvfrom, since dtls_srtp_check_pending does not lock
  inside of itself, and we're dealing with the SSL BIO in at least two
  threads.

WebRTC channels may receive a DTLS handshake before
ast_rtp_remote_address_set is called, which causes there to be a pending
response to send out.   Previous to 1ad827, this was handled by calling
dtls_srtp_check_pending on receipt of any RTP packet - a STUN or RTP
packet could trigger the pending handshake response.  Since that was
rightfully removed, whenever the DTLS handshake is received before the
remote address is set, we would have to wait until another SSL packet
arrives.

As of Chrome M47's optimizations to their handshake process, WebRTC
conversations between Chrome M47+ and Asterisk, where Asterisk is passive,
experience a 1 second delay without this patch, because the SSL handshake
is received before ICE negotation stores the remote_address, and the next
SSL packet isn't received until after a 1 second timeout in Chrome, which
causes a new handshake request.

ASTERISK-25614 #close

Change-Id: I547f1be7e302dbf71f6553dd8cbc0657b1d0b908

9 years agoMerge "main/utils: Don't emit an ERROR message if the read end of a pipe closes"...
Matt Jordan [Mon, 14 Dec 2015 12:44:58 +0000 (06:44 -0600)] 
Merge "main/utils: Don't emit an ERROR message if the read end of a pipe closes" into 11

9 years agomain/utils: Don't emit an ERROR message if the read end of a pipe closes 10/1810/3
Matt Jordan [Sun, 13 Dec 2015 19:13:55 +0000 (13:13 -0600)] 
main/utils: Don't emit an ERROR message if the read end of a pipe closes

An ERROR or WARNING message should generally indicate that something has gone
wrong in Asterisk. In the case of writing to a file descriptor, Asterisk is not
in control of when the far end closes its reading on a file descriptor. If the
far end does close the file descriptor in an unclean fashion, this isn't a bug
or error in Asterisk, particularly when the situation can be gracefully
handled in Asterisk.

Currently, when this happens, a user would see the following somewhat cryptic
ERROR message:

  "utils.c: write() returned error: Broken pipe"

There's a few problems with this:
(1) It doesn't provide any context, other than 'something broke a pipe'
(2) As noted, it isn't actually an error in Asterisk
(3) It can get rather spammy if the thing breaking the pipe occurs often, such
    as a FastAGI server
(4) Spammy ERROR messages make Asterisk appear to be having issues, or can even
    mask legitimate issues

This patch changes ast_carefulwrite to only log an ERROR if we actually had one
that was reasonably under our control. For debugging purposes, we still emit
a debug message if we detect that the far side has stopped reading.

Change-Id: Ia503bb1efcec685fa6f3017bedf98061f8e1b566

9 years agochan_sip: Add TCP/TLS keepalive to TCP/TLS server 99/1799/2
Jonathan Rose [Thu, 10 Dec 2015 17:44:03 +0000 (11:44 -0600)] 
chan_sip: Add TCP/TLS keepalive to TCP/TLS server

Adds the TCP Keep Alive option to TCP and TLS server sockets. Previously
this option was only being set on session sockets.
http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
According to the link above, the SO_KEEPALIVE option is useful for knowing
when a TCP connected endpoint has severed communication without indicating
it or has become unreachable for some reason. Without this patch, keep
alive is not set on the socket listening for incoming TCP sessions and
in Komatsu's report this resulted in the thread listening for TCP becoming
stuck in a waiting state.

ASTERISK-25364 #close
Reported by: Hiroaki Komatsu

Change-Id: I7ed7bcfa982b367dc64b4b73fbd962da49b9af36

9 years agoapp_meetme: Set default value for audio_buffers. 93/1793/2
Corey Farrell [Mon, 7 Dec 2015 19:07:32 +0000 (14:07 -0500)] 
app_meetme: Set default value for audio_buffers.

The default value was never set for audio_buffers, causing bad
audio quality.  This ensures the default is always set.

ASTERISK-25569 #close

Change-Id: I2d2ee3e644120b0f9f6ea6ab9286d7d590942a44

9 years agochan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c) 91/1791/1
Filip Jenicek [Tue, 8 Dec 2015 07:57:22 +0000 (08:57 +0100)] 
chan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c)

Asterisk may crash when calling ast_channel_get_t38_state(c)
on a locked channel which is being hung up.

ASTERISK-25609 #close

Change-Id: Ifaa707c04b865a290ffab719bd2e5c48ff667c7b

9 years agoMerge "chan_sip.c: Start ICE negotiation when response is sent or received." into 11
Joshua Colp [Wed, 9 Dec 2015 14:54:09 +0000 (08:54 -0600)] 
Merge "chan_sip.c: Start ICE negotiation when response is sent or received." into 11

9 years agochan_sip.c: Start ICE negotiation when response is sent or received. 51/1751/3
Eugene Voityuk [Wed, 2 Dec 2015 18:42:15 +0000 (20:42 +0200)] 
chan_sip.c: Start ICE negotiation when response is sent or received.

The current logic for ICE negotiation starts it
when receiving an SDP with ICE candidates. This is
incorrect as ICE negotiation can only start when each
call party have at least one pair of local and remote
candidate. Starting ICE negotiation early would result
in negotiation failure and ultimately no audio.

This change makes it so ICE negotiation is only started
when a response with SDP is received or when a response
with SDP is sent.

ASTERISK-24146

Change-Id: I55a632bde9e9827871b09141d82747e08379a8ca

9 years agoMerge "translate: Avoid a warning message when doing FEC within Opus Codec." into 11
Joshua Colp [Tue, 8 Dec 2015 19:14:36 +0000 (13:14 -0600)] 
Merge "translate: Avoid a warning message when doing FEC within Opus Codec." into 11

9 years agocodec_resample: Increase buffer for Opus Codec with FEC. 84/1784/1
Alexander Traud [Tue, 8 Dec 2015 14:39:03 +0000 (15:39 +0100)] 
codec_resample: Increase buffer for Opus Codec with FEC.

ASTERISK-25599 #close

Change-Id: Idbd187f711b2ec63dda949ca0f79aa0c1a0a0b6e

9 years agotranslate: Avoid a warning message when doing FEC within Opus Codec. 79/1779/1
Alexander Traud [Tue, 8 Dec 2015 09:46:21 +0000 (10:46 +0100)] 
translate: Avoid a warning message when doing FEC within Opus Codec.

ASTERISK-25616 #close

Change-Id: Ibe729aaf2e6e25506cff247cec5149ec1e589319

9 years agochan_sip: Fix crash involving the bogus peer during sip reload. 64/1764/2
Richard Mudgett [Fri, 4 Dec 2015 21:36:45 +0000 (15:36 -0600)] 
chan_sip: Fix crash involving the bogus peer during sip reload.

A crash happens sometimes when performing a CLI "sip reload".  The bogus
peer gets refreshed while it is in use by a new call which can cause the
crash.

* Protected the global bogus peer object with an ao2 global object
container.

ASTERISK-25610 #close

Change-Id: I5b528c742195681abcf713c6e1011ea65354eeed

9 years agoMerge "build: Fix building with newer GCC." into 11
Matt Jordan [Fri, 4 Dec 2015 17:34:26 +0000 (11:34 -0600)] 
Merge "build: Fix building with newer GCC." into 11

9 years agobuild: Fix building with newer GCC. 63/1763/2
Joshua Colp [Fri, 4 Dec 2015 14:22:08 +0000 (10:22 -0400)] 
build: Fix building with newer GCC.

Newer GCC is upset that the features flags are uninitialized.
Zero them out so it is less upset.

Change-Id: I05162699e1b36bce4145f58a63b47ad19c6975ac

9 years agoFix crash in audiohook translate to slin 62/1762/1
Joshua Colp [Fri, 4 Dec 2015 14:15:24 +0000 (10:15 -0400)] 
Fix crash in audiohook translate to slin

This patch fixes a crash which would occur when an audiohook was
applied to a channel using an audio codec that could not be translated
to signed linear (such as when using pass-through codecs like OPUS or
when the codec translator module for the format in use is not loaded).

ASTERISK-25498 #close
Reported by: Ben Langfeld

Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384

9 years agoMerge "codec_resample: Increase buffer for Opus Codec." into 11
Joshua Colp [Thu, 3 Dec 2015 18:38:14 +0000 (12:38 -0600)] 
Merge "codec_resample: Increase buffer for Opus Codec." into 11

9 years agosched.c: Make not return a sched id of 0. 37/1737/2
Richard Mudgett [Mon, 30 Nov 2015 22:42:47 +0000 (16:42 -0600)] 
sched.c: Make not return a sched id of 0.

According to the API doxygen a sched ID of 0 is valid.  Unfortunately, 0
was never returned historically and several users incorrectly coded usage
of the returned sched ID assuming that 0 was invalid.

ASTERISK-25476

Change-Id: Ib19c7ebb44ec9fd393ef6646dea806d4f34e3a20

9 years agoAudit improper usage of scheduler exposed by 5c713fdf18f. 36/1736/2
Richard Mudgett [Tue, 24 Nov 2015 18:44:53 +0000 (12:44 -0600)] 
Audit improper usage of scheduler exposed by 5c713fdf18f.

channels/chan_iax2.c:
* Initialize struct chan_iax2_pvt scheduler ids earlier because of
iax2_destroy_helper().

channels/chan_sip.c:
channels/sip/config_parser.c:
* Fix initialization of scheduler id struct members.  Some off nominal
paths had 0 as a scheduler id to be destroyed when it was never started.

chan_skinny.c:
* Fix some scheduler id comparisons that excluded the valid 0 id.

channel.c:
* Fix channel initialization of the video stream scheduler id.

pbx_dundi.c:
* Fix channel initialization of the packet retransmission scheduler id.

ASTERISK-25476

Change-Id: I07a3449f728f671d326a22fcbd071f150ba2e8c8

9 years agocodec_resample: Increase buffer for Opus Codec. 30/1730/1
Alexander Traud [Tue, 1 Dec 2015 14:13:13 +0000 (15:13 +0100)] 
codec_resample: Increase buffer for Opus Codec.

ASTERISK-25599 #close

Change-Id: I1f88a88c59fb4e1e62bbdbb100c7152d48e73f10

9 years agoMerge "fastagi: record file closed after sending result" into 11
Matt Jordan [Thu, 26 Nov 2015 04:19:12 +0000 (22:19 -0600)] 
Merge "fastagi: record file closed after sending result" into 11

9 years agofastagi: record file closed after sending result 21/1721/1
Kevin Harwell [Wed, 25 Nov 2015 21:26:35 +0000 (15:26 -0600)] 
fastagi: record file closed after sending result

The fastagi record-file testsuite test sometimes fails reporting an empty
recorded file. This was happening because Asterisk was sending the agi result
notification prior to actually closing the file and the data, being buffered,
had not been written to the file yet when the test attempts to check the file
size.

This patch makes it so the record file stream is closed prior to sending the
agi result notification.

ASTERISK-25593 #close

Change-Id: I6b2b3be3ae37f7c7b18e672c419a89b3b8513cde

9 years agomain: Slight refactor of main. Improve color situation. 98/1698/6
Walter Doekes [Wed, 25 Nov 2015 19:29:30 +0000 (20:29 +0100)] 
main: Slight refactor of main. Improve color situation.

Several issues are addressed here:
- main() is large, and half of it is only used if we're not rasterisk;
  fixed by spliting up the daemon part into a separate function.
- Call ast_term_init from rasterisk as well.
- Remove duplicate code reading/writing asterisk history file.
- Attempt to tackle background color issues and color changes that
  occur. Tested by starting asterisk -c until the colors stopped
  changing at odd locations.

ASTERISK-25585 #close

Change-Id: Ib641a0964c59ef9fe6f59efa8ccb481a9580c52f

9 years agohashtab: Add NULL check when destroying iterator. 32/1632/1
Joshua Colp [Sat, 14 Nov 2015 13:02:10 +0000 (09:02 -0400)] 
hashtab: Add NULL check when destroying iterator.

The hashtab API is pretty NULL tolerant which has resulted
in remaining callers not doing much checks themselves.
Unfortunately the function to destroy an iterator does not
do a NULL check and will result in a crash if passed NULL.
This change fixes that.

ASTERISK-25552 #close

Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619

9 years agoMerge "Further fixes to improper usage of scheduler" into 11
Joshua Colp [Thu, 12 Nov 2015 13:56:24 +0000 (07:56 -0600)] 
Merge "Further fixes to improper usage of scheduler" into 11

9 years agoMerge "rtp_engine: Init a format-attribute module to its RFC defaults." into 11
Matt Jordan [Wed, 11 Nov 2015 14:09:42 +0000 (08:09 -0600)] 
Merge "rtp_engine: Init a format-attribute module to its RFC defaults." into 11

9 years agoMerge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." into 11
Matt Jordan [Wed, 11 Nov 2015 14:06:49 +0000 (08:06 -0600)] 
Merge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." into 11

9 years agoFurther fixes to improper usage of scheduler 97/1597/2
Steve Davies [Wed, 11 Nov 2015 10:16:22 +0000 (10:16 +0000)] 
Further fixes to improper usage of scheduler

When ASTERISK-25449 was closed, a number of scheduler issues mentioned in
the comments were missed. These have since beed raised in ASTERISK-25476
and elsewhere.

This patch attempts to collect all of the scheduler issues discovered so
far and address them sensibly.

ASTERISK-25476 #close

Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b

9 years agoMerge "func_callerid: Document that CALLERID(pres) is available." into 11
Joshua Colp [Tue, 10 Nov 2015 16:04:44 +0000 (10:04 -0600)] 
Merge "func_callerid: Document that CALLERID(pres) is available." into 11

9 years agortp_engine: Init a format-attribute module to its RFC defaults. 94/1594/1
Alexander Traud [Tue, 10 Nov 2015 15:29:35 +0000 (16:29 +0100)] 
rtp_engine: Init a format-attribute module to its RFC defaults.

Previously, format-attribute modules relied on an existing fmtp line in SDP
negotiation. However, fmtp is optional for several formats like the Opus Codec.
Now, the format-attribute module is called with an empty fmtp, which allows the
module to initialise itself to RFC defaults. Furthermore now, Asterisk is able
to differentiate between internally and externally created formats.

ASTERISK-25537 #close

Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52

9 years agofunc_callerid: Document that CALLERID(pres) is available. 84/1584/3
Walter Doekes [Fri, 6 Nov 2015 13:54:59 +0000 (14:54 +0100)] 
func_callerid: Document that CALLERID(pres) is available.

CALLERPRES() says that it's deprecated in favor of CALLERID(num-pres)
and CALLERID(name-pres).  But for channel driver that don't make a
distinction between the two (e.g. SIP), it makes more sense to get/set
both at once.  This change reveals the availability of CALLERID(pres),
CONNECTEDLINE(pres), REDIRECTING(orig-pres), REDIRECTING(to-pres) and
REDIRECTING(from-pres).

ASTERISK-25373 #close

Change-Id: I5614ae4ab7d3bbe9c791c1adf147e10de8698d7a

9 years agodocs: Fix a few typo's in app docs (more then, resourse). 79/1579/2
Walter Doekes [Fri, 6 Nov 2015 13:52:00 +0000 (14:52 +0100)] 
docs: Fix a few typo's in app docs (more then, resourse).

Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7

9 years agoxmldoc: Improve xmldoc wrapping of 'core show ...' output. 76/1576/1
Walter Doekes [Fri, 6 Nov 2015 13:36:40 +0000 (14:36 +0100)] 
xmldoc: Improve xmldoc wrapping of 'core show ...' output.

Previously, the wrapping did both lookahead and lookback, which,
together with color escape sequences, caused some lines to be wrapped
way earlier than other lines.  This led to inconsistent output.

This simplifies the wrapping code and makes it more sane: if maxcolumns
is hit, we simply jump back to the last space and wrap there.

ASTERISK-25527 #close

Change-Id: I56d01c6f9a812642b1b05535c98d4db48d17c957

9 years agoFix cli display of build options. 65/1565/1
Corey Farrell [Wed, 4 Nov 2015 14:25:52 +0000 (09:25 -0500)] 
Fix cli display of build options.

A previous commit reduced the AST_BUILDOPTS compiler define to
only include options that affected ABI.  This included some options
that were previously displayed by cli "core show settings".  This
change corrects the CLI display while still restricting buildopts.h
to ABI effecting options only.

ASTERISK-25434 #close
Reported by: Rusty Newton

Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325

9 years agoMerge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues...
Joshua Colp [Mon, 26 Oct 2015 16:27:44 +0000 (11:27 -0500)] 
Merge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues" into 11

9 years agobuild: GCC 5.1.x catches some new const, array bounds and missing paren issues 25/1525/1
George Joseph [Sat, 24 Oct 2015 18:08:41 +0000 (12:08 -0600)] 
build: GCC 5.1.x catches some new const, array bounds and missing paren issues

Fixed 1 issue in each of the affected files.

ASTERISK-25494 #close
Reported-by: George Joseph
Tested-by: George Joseph
Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77

9 years agoformat: Update the maximum packetization time for iLBC 30. 63/1463/2
Alexander Traud [Wed, 21 Oct 2015 13:06:29 +0000 (15:06 +0200)] 
format: Update the maximum packetization time for iLBC 30.

In September 2006, the maximum packetization time (ptime) were set to such a
low value, packetization was disabled for many codecs actually. This was fixed
for many codecs but not for iLBC 30. This enables packetization for iLBC which
can be enabled for example via allow=ilbc:60,gsm,alaw,ulaw in the file sip.conf.

ASTERISK-7803

Change-Id: I3ac61235097808216b6a15a1c7e321b3fdeb7ff1

9 years agoMerge topic 'ASTERISK-25461' into 11
Matt Jordan [Fri, 16 Oct 2015 15:35:53 +0000 (10:35 -0500)] 
Merge topic 'ASTERISK-25461' into 11

* changes:
  config.c: Fix off-nominal memory leak.
  config.c: Fix potential memory corruption after [section](+).
  config.c: Fix #include after [section](+).

9 years agoMerge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 11
Joshua Colp [Thu, 15 Oct 2015 19:41:46 +0000 (14:41 -0500)] 
Merge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 11

9 years agoMerge "Build: Add menuselect options for using compiler sanitizers" into 11
Joshua Colp [Thu, 15 Oct 2015 19:40:41 +0000 (14:40 -0500)] 
Merge "Build: Add menuselect options for using compiler sanitizers" into 11

9 years agores_config_pgsql.c: Fix deadlock loading realtime configuration. 39/1439/1
Richard Mudgett [Wed, 14 Oct 2015 19:15:53 +0000 (14:15 -0500)] 
res_config_pgsql.c: Fix deadlock loading realtime configuration.

On v13, loading several thousand PJSIP endpoints on Asterisk start causes
a deadlock most of the time.

Thanks to mdu113 for discovering that there was a call to pgsql_exec() not
protected by the pgsql_lock reentrancy lock.

{quote}
I believe a code path exists that attempts to use pgsql connection without
locking pgsql_lock.  I believe what happens during that deadlock that I
see is two concurrent threads are both attempting to send query to pgsql,
one of the thread is using a code path without locking pgsql_lock.  If
they managed to send queries at the same time, it seems postgres ignores
one of the queries and replies only to the one of them.  If it happens so
that the thread holding the lock didn't receive the reply it will wait for
it (and hold the lock) forever (or at least for very long time), thus
completely blocking all access to db.
{quote}

* Added missing reentrancy locking around pgsql_exec() in find_table().

* Moved unlock of pgsql_lock in unload_module() to avoid locking inversion
between the psql_tables list lock and the pgsql_lock.

ASTERISK-25455 #close
Reported by:  mdu113
Patches:
      res_config_pgsql.c-connlock2.diff (license #5543) patch uploaded by mdu113

Change-Id: Id9e7cdf8a3b65ff19964b0cf942ace567938c4e2

9 years agochannels/chan_sip: Set cause code to 44 on RTP timeout 32/1432/1
Matt Jordan [Tue, 13 Oct 2015 19:13:54 +0000 (14:13 -0500)] 
channels/chan_sip: Set cause code to 44 on RTP timeout

To quote Olle:

"When issuing a hangup due to RTP timeouts the cause code is not set. I have
selected 44 based on Cisco's implementation..."

ASTERISK-25135 #close
Reported by: Olle Johansson
patches:
  rtp-timeout-cause-1.8.diff uploaded by Olle Johansson (License 5267)

Change-Id: Ia62100c55077d77901caee0bcae299f8dc7375fc

9 years agoconfig.c: Fix off-nominal memory leak. 21/1421/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:39 +0000 (11:21 -0500)] 
config.c: Fix off-nominal memory leak.

Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0

9 years agoconfig.c: Fix potential memory corruption after [section](+). 20/1420/1
Richard Mudgett [Mon, 12 Oct 2015 16:20:29 +0000 (11:20 -0500)] 
config.c: Fix potential memory corruption after [section](+).

The memory corruption could happen if the [section](+) is the last section
in the file with trailing comments.  In this case process_text_line() has
left *last_cat is set to newcat and newcat is destroyed.

Change-Id: I0d1d999f553986f591becd000e7cc6ddfb978d93

9 years agoconfig.c: Fix #include after [section](+). 19/1419/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:55 +0000 (11:21 -0500)] 
config.c: Fix #include after [section](+).

An #include right after a [section](+) would associate any variable
assignments before a new section in the #include with the wrong section.

* Fix section association by setting the current section to the appended
section.

* Fix '+' and '!' section flag interaction corner case depending upon
which flag came first.  If the '!' came first then it would be ignored.
If the '!' came after then it would affect the appended section.  The '!'
will now no longer be ignored.

ASTERISK-25461 #close
Reported by: Sean Pimental

Change-Id: Ic9d3191c8758048e2cbce6432f854b32531731c3

9 years agoBuild: Add menuselect options for using compiler sanitizers 17/1417/1
Ivan Poddubny [Sat, 10 Oct 2015 20:20:55 +0000 (23:20 +0300)] 
Build: Add menuselect options for using compiler sanitizers

This patch adds menuselect options for building Asterisk with
various sanitizers provided by gcc and clang.

When one of *SANITIZER flags is set in menuselect, the appropriate
option is added to CFLAGS ad LDFLAGS for the build.

Information on sanitizers in the project wiki:
https://github.com/google/sanitizers/wiki

GCC Manual:
https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html

Clang Compiler User's Manual:
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation

ASTERISK-24718 #close
Reported by: Badalian Vyacheslav

Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0

9 years agofunc_presencestate: Return "not_set" when no data is set in AstDB 10/1410/1
Ivan Poddubny [Wed, 7 Oct 2015 06:24:31 +0000 (09:24 +0300)] 
func_presencestate: Return "not_set" when no data is set in AstDB

Return AST_PRESENCE_NOT_SET when CustomPresence AstDB key does not
exist, i.e. when a new CustomPresence is added in the dialplan.

ASTERISK-25400 #close
Reported by: Andrew Nagy

Change-Id: I6fb17b16591b5a55fbffe96f3994ec26b1b1723a

9 years agores/res_rtp_asterisk: Fix assignment after ao2 decrement 01/1401/1
Matt Jordan [Wed, 7 Oct 2015 01:43:58 +0000 (20:43 -0500)] 
res/res_rtp_asterisk: Fix assignment after ao2 decrement

When we decide we will no longer schedule an RTCP write, we remove the
reference to the RTP instance, then assign -1 to the stored scheduler ID
in case something else comes along and wants to see if anything is scheduled.

That scheduler ID is on the RTP instance. After 60a9172d7ef2 was merged to
fix the regression introduced by 3cf0f29310, this improper assignment on a
potentially destroyed object started getting tripped on the build agents.

Frankly, this should have been crashing a lot more often earlier. I can only
assume that the timing was changed just enough by both changes to start
actually hitting this problem.

As it is, simply moving the assignment prior to the ao2 deference is sufficient
to keep the RTP instance from being referenced when it is very, truly,
aboslutely dead.

(Note that it is still good practice to assign -1 to the scheduler ID when we
know we won't be scheduling it again, as the ao2 deref *may* not always destroy
the ao2 object.)

ASTERISK-25449

Change-Id: Ie6d3cb4adc7b1a6c078b1c38c19fc84cf787cda7

9 years agochan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 91/1391/2
Florian Sauerteig [Tue, 6 Oct 2015 17:40:22 +0000 (19:40 +0200)] 
chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.

If a Via header containes an IPv6 address and a port number is ommitted,
as it is the standard port, we now leave the port empty and to not set it
to the value after the first colon of the IPv6 address.

ASTERISK-25443 #close

Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70

9 years agoFix improper usage of scheduler exposed by 5c713fdf18f 84/1384/2
Matt Jordan [Tue, 6 Oct 2015 02:34:41 +0000 (21:34 -0500)] 
Fix improper usage of scheduler exposed by 5c713fdf18f

When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of
'0' returned. While this was valid per the documentation for the API, it was
apparently never returned previously. As a result, several users of the
scheduler API viewed the result as being invalid, causing them to reschedule
already scheduled items or otherwise fail in interesting ways.

This patch corrects the users such that they view '0' as valid, and a returned
ID of -1 as being invalid.

Note that the failing HEP RTCP tests now pass with this patch. These tests
failed due to a duplicate scheduling of the RTCP transmissions.

ASTERISK-25449 #close

Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39

9 years agomanager: Fix GetConfigJSON returning invalid JSON 72/1372/1
Ivan Poddubny [Sat, 3 Oct 2015 11:27:27 +0000 (14:27 +0300)] 
manager: Fix GetConfigJSON returning invalid JSON

When GetConfigJSON was introduced back in 1.6, it returned each
section as an array of strings: ["key=value", "key2=value2"].
Afterwards, it was changed a few times and became
["key": "value", "key2": "value2"], which is not a correct JSON.
This patch fixes that by constructing a JSON object {} instead of
an array [].

ASTERISK-25391 #close
Reported by: Bojan Nemčić

Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8

9 years agoMerge "sched.c: Add warning about negative time interval request." into 11
Joshua Colp [Fri, 2 Oct 2015 21:27:02 +0000 (16:27 -0500)] 
Merge "sched.c: Add warning about negative time interval request." into 11

9 years agosched.c: Add warning about negative time interval request. 49/1349/1
Richard Mudgett [Mon, 28 Sep 2015 20:31:38 +0000 (15:31 -0500)] 
sched.c: Add warning about negative time interval request.

Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc

9 years agores_rtp_asterisk: Move "Set role" warning to be debug. 46/1346/1
Joshua Colp [Wed, 30 Sep 2015 18:42:40 +0000 (15:42 -0300)] 
res_rtp_asterisk: Move "Set role" warning to be debug.

In practice the set_role API callback can be invoked even
when no ICE is present on an RTP instance. This can occur
if ICE has not been enabled on it.

ASTERISK-25438 #close

Change-Id: I0e17e4316f0f0d7f095c78c3d4fd73a913b6ba69

9 years agoMerge "channel.c: Fix NewCallerid AMI event not been sent on Caller ID change" into 11
Matt Jordan [Tue, 29 Sep 2015 02:05:18 +0000 (21:05 -0500)] 
Merge "channel.c: Fix NewCallerid AMI event not been sent on Caller ID change" into 11

9 years agochannel.c: Fix NewCallerid AMI event not been sent on Caller ID change 34/1334/3
Ivan Poddubny [Mon, 28 Sep 2015 06:36:30 +0000 (09:36 +0300)] 
channel.c: Fix NewCallerid AMI event not been sent on Caller ID change

Currently, NewCallerid is sent only when pointers to number or name
strings change, which is not always the case. The newly allocated string
may use the same memory, so pointers match, while the content
is different. As a result, Caller ID updates are often not reported.

With this patch, actual strings are compared, not the pointers.

ASTERISK-25427 #close
Reported by: Ivan Poddubny

Change-Id: I2a1ac3a842f0e092c6058d1cd3e35443bece1b36

9 years agoMerge "translate: Fix transcoding while different in frame size." into 11
Matt Jordan [Mon, 28 Sep 2015 16:20:38 +0000 (11:20 -0500)] 
Merge "translate: Fix transcoding while different in frame size." into 11

9 years agocore/logging: Fix logging to more than one syslog channel 93/1293/1
Elazar Broad [Mon, 21 Sep 2015 13:16:46 +0000 (09:16 -0400)] 
core/logging: Fix logging to more than one syslog channel

Currently, Asterisk will log to the last configured syslog
channel in logger.conf. This is due to the fact that the
final call to openlog() supersedes all of the previous calls.
This commit removes the call to openlog() and passes the
facility to ast_log_vsyslog(), along with utilizing the
LOG_MAKEPRI macro to ensure that the message is routed to
the correct facility and with the correct priority.

ASTERISK-25407 #close
Reported by: Elazar Broad
Tested by: Elazar Broad

Change-Id: Ie2a2416bc00cce1b04e99ef40917c2011953ddd2

9 years agoMerge "app_record: RECORDED_FILE variable not being populated" into 11
Matt Jordan [Tue, 22 Sep 2015 12:40:29 +0000 (07:40 -0500)] 
Merge "app_record: RECORDED_FILE variable not being populated" into 11

9 years agoMerge "pbx: Update device and presence state when changing a hint extension." into 11
Joshua Colp [Tue, 22 Sep 2015 10:29:42 +0000 (05:29 -0500)] 
Merge "pbx: Update device and presence state when changing a hint extension." into 11

9 years agoapp_record: RECORDED_FILE variable not being populated 91/1291/1
Kevin Harwell [Mon, 21 Sep 2015 23:06:15 +0000 (18:06 -0500)] 
app_record: RECORDED_FILE variable not being populated

The RECORDED_FILE variable is empty unless a '%d' is specified in the filename.
This patch makes it so the variable is always set to the filename.

ASTERISK-25410 #close

Change-Id: I4ec826d8eb582ae2ad184e717be8668b74d37653

9 years agopbx: Update device and presence state when changing a hint extension. 62/1262/3
Joshua Colp [Wed, 16 Sep 2015 13:22:35 +0000 (10:22 -0300)] 
pbx: Update device and presence state when changing a hint extension.

When changing a hint extension without removing the hint first the
device state and presence state is not updated. This causes the state
of the hint to be that of the previous extension and not the current
one. This state is kept until a state change occurs as a result of
something (presence state change, device state change).

This change updates the hint with the current device and presence
state of the new extension when it is changed. Any state callbacks
which may have been added before the hint extension is changed are
also informed of the new device and presence state if either have
changed.

ASTERISK-25394 #close

Change-Id: If268f1110290e502c73dd289c9e7e7b27bc8432f

9 years agochan_sip: Fix From header truncation for extremely long CALLERID(name). 69/1269/2
Walter Doekes [Thu, 17 Sep 2015 09:52:09 +0000 (11:52 +0200)] 
chan_sip: Fix From header truncation for extremely long CALLERID(name).

The CALLERID(num) and CALLERID(name) and other info are placed into the
`char from[256]` in initreqprep. If the name was too long, the addr-spec
and params wouldn't fit.

Code is moved around so the addr-spec with params is placed there first,
and then fitting in as much of the display-name as possible.

ASTERISK-25396 #close

Change-Id: I33632baf024f01b6a00f8c7f35c91e5f68c40260

9 years agotranslate: Fix transcoding while different in frame size. 56/1156/5
Alexander Traud [Fri, 28 Aug 2015 21:06:02 +0000 (23:06 +0200)] 
translate: Fix transcoding while different in frame size.

When Asterisk translates between codecs each with a different frame size (for
example between iLBC 30 and Speex-WB), too large frames were created by
ast_trans_frameout. Now, ast_trans_frameout is called with the correct frame
length, creating several frames when necessary. Affects all transcoding modules
which used ast_trans_frameout: GSM, iLBC, LPC10, and Speex.

ASTERISK-25353 #close

Change-Id: I84b59f7a745955820f10e20f5999eb69495a68b9

9 years agoscheduler: Use queue for allocating sched IDs. 58/1258/3
Mark Michelson [Thu, 10 Sep 2015 22:19:26 +0000 (17:19 -0500)] 
scheduler: Use queue for allocating sched IDs.

It has been observed that on long-running busy systems, a scheduler
context can eventually hit INT_MAX for its assigned IDs and end up
overflowing into a very low negative number. When this occurs, this can
result in odd behaviors, because a negative return is interpreted by
callers as being a failure. However, the item actually was successfully
scheduled. The result may be that a freed item remains in the scheduler,
resulting in a crash at some point in the future.

The scheduler can overflow because every time that an item is added to
the scheduler, a counter is bumped and that counter's current value is
assigned as the new item's ID.

This patch introduces a new method for assigning scheduler IDs. Instead
of assigning from a counter, a queue of available IDs is maintained.
When assigning a new ID, an ID is pulled from the queue. When a
scheduler item is released, its ID is pushed back onto the queue. This
way, IDs may be reused when they become available, and the growth of ID
numbers is directly related to concurrent activity within a scheduler
context rather than the uptime of the system.

Change-Id: I532708eef8f669d823457d7fefdad9a6078b99b2