4 years agoMerge "Revert "Revert "Add API for channel frame deferral."""
George Joseph [Wed, 16 Nov 2016 23:43:46 +0000 (17:43 -0600)]
Merge "Revert "Revert "Add API for channel frame deferral."""

4 years agoMerge "res/ari/resource_bridges: Add the ability to manipulate the video source"
zuul [Wed, 16 Nov 2016 22:48:09 +0000 (16:48 -0600)]
Merge "res/ari/resource_bridges: Add the ability to manipulate the video source"

4 years agoMerge "apps/app_echo: Only relay a single video source change frame"
Joshua Colp [Wed, 16 Nov 2016 20:59:50 +0000 (14:59 -0600)]
Merge "apps/app_echo: Only relay a single video source change frame"

4 years agoMerge "file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type"
George Joseph [Wed, 16 Nov 2016 20:17:34 +0000 (14:17 -0600)]
Merge "file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type"

4 years agoMerge "cli: Fix ast_el_read_char to work with libedit >= 3.1"
Joshua Colp [Wed, 16 Nov 2016 18:18:27 +0000 (12:18 -0600)]
Merge "cli:  Fix ast_el_read_char to work with libedit >= 3.1"

4 years agoMerge "pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS"
Joshua Colp [Wed, 16 Nov 2016 11:33:42 +0000 (05:33 -0600)]
Merge "pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS"

4 years agofile.c/__ast_file_read_dirs: Fix issues on filesystems without d_type
George Joseph [Tue, 15 Nov 2016 18:01:04 +0000 (11:01 -0700)]
file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type

One of the code paths in __ast_file_read_dirs will only get executed if
the OS doesn't support dirent->d_type OR if the filesystem the
particular file is on doesn't support it.  So, while standard Linux
systems support the field, some filesystems like XFS do not.  In this
case, we need to call stat() to determine whether the directory entry
is a file or directory so we append the filename to the supplied
directory path and call stat.  We forgot to truncate path back to just
the directory afterwards though so we were passing a complete file name
to the callback in the dir_name parameter instead of just the directory

The logic has been re-written to only create a full_path if we need to
call stat() or if we need to descend into another directory.

Change-Id: I54e4228bd8355fad65200c6df3ec4c9c8a98dfba

4 years agoMerge "manager: Bump AMI version number."
Joshua Colp [Wed, 16 Nov 2016 01:23:08 +0000 (19:23 -0600)]
Merge "manager: Bump AMI version number."

4 years agoMerge "res_ari: Add support for channel variables in ARI events."
Joshua Colp [Tue, 15 Nov 2016 20:49:15 +0000 (14:49 -0600)]
Merge "res_ari: Add support for channel variables in ARI events."

4 years agomanager: Bump AMI version number.
Joshua Colp [Tue, 15 Nov 2016 14:07:03 +0000 (14:07 +0000)]
manager: Bump AMI version number.

During the development of Asterisk 14 the behavior of
the Command AMI action was altered such that the result
was returned on lines with a prefix of "Output: ". While
this was documented in the UPGRADE.txt file it is also
reasonable that this should bump the AMI version number.


Change-Id: Idf1bf01608e53f7bfdf43ddb4d0683e53f74ee42

4 years agopjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS
Matt Jordan [Mon, 14 Nov 2016 21:57:08 +0000 (15:57 -0600)]
pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS

The PJ_ICE_MAX_CHECKS constant is used by pjproject to determine how
many pairs of local/remote candidates will be made. If for some reason
we reach this upper bound, ICE will generally fail and no media will
flow between the browser and Asterisk.

This patch makes PJ_ICE_MAX_CHECKS set to the total possible number of
pairs of candidates we'd theoretically allow, which is
PJ_ICE_MAX_CAND^2. Prior to this patch, we simply multiplied
PJ_ICE_MAX_CAND by two; on systems with multiple interfaces (I blame
Docker), this is far too low to allow WebRTC calls to succeed.

Setting this to be PJ_ICE_MAX_CAND^2 allowed WebRTC calls to succeed
even when the system Asterisk was running on had quite a few virtual

Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55

4 years agoapps/app_echo: Only relay a single video source change frame
Matt Jordan [Mon, 14 Nov 2016 21:32:14 +0000 (15:32 -0600)]
apps/app_echo: Only relay a single video source change frame

In 9785e8d0, app_echo was updated to relay video source updates to the
channel for the purposes of displaying video in WebRTC tests.
Unfortunately, this can cause a Kafkaesque nightmare if two or more
Local channels are in a bridge together where their ends are in
app_echo. When this situation occurs, a video update sent into app_echo
will cause the video update to be relayed to the other Local channels,
causing another round of video updates, etc. In not much time at all,
the channel length queues will be overwhelmed, channel alert pipes will
fail, and all hell will break loose as Asterisk merrily continues to
throw more video update requests onto the channels.

This patch updates app_echo to *only* relay a single video update. Once
a video update has been made, all further video updates are dropped.
This meets the intended purpose of the original patch: if we get a video
update and we're in app_echo, go ahead and ask the sender to update
themselves. However, once we've got that video stream sync'd up, don't
keep spamming the world.

Change-Id: I9210780b08d4c17ddb38599d1c64453adfc34f74

4 years agores/ari/resource_bridges: Add the ability to manipulate the video source
Matt Jordan [Tue, 8 Nov 2016 16:11:41 +0000 (10:11 -0600)]
res/ari/resource_bridges: Add the ability to manipulate the video source

In multi-party bridges, Asterisk currently supports two video modes:
 * Follow the talker, in which the speaker with the most energy is shown
   to all participants but the speaker, and the speaker sees the
   previous video source
 * Explicitly set video sources, in which all participants see a locked
   video source

Prior to this patch, ARI had no ability to manipulate the video source.
This isn't important for two-party bridges, in which Asterisk merely
relays the video between the participants. However, in a multi-party
bridge, it can be advantageous to allow an external application to
manipulate the video source.

This patch provides two new routes to accomplish this:
(1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId}
    Sets a video source to an explicit channel
(2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource
    Removes any explicit video source, and sets the video mode to talk

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621

4 years agoRevert "Revert "Add API for channel frame deferral.""
George Joseph [Mon, 14 Nov 2016 19:54:36 +0000 (14:54 -0500)]
Revert "Revert "Add API for channel frame deferral.""

This reverts commit fa749866c17f91860d3e9f89742eab3e6f03ecbc.

Change-Id: Idcd1b88fa0766b1326dcc87d8905dbc314c71bd7

4 years agoMerge "res_pjsip.c: Rework endpt_send_request() req_wrapper code."
Joshua Colp [Mon, 14 Nov 2016 19:21:21 +0000 (13:21 -0600)]
Merge "res_pjsip.c: Rework endpt_send_request() req_wrapper code."

4 years agores_ari: Add support for channel variables in ARI events.
Sebastien Duthil [Fri, 11 Nov 2016 16:45:37 +0000 (11:45 -0500)]
res_ari: Add support for channel variables in ARI events.

This works the same as for AMI manager variables. Set
"channelvars=foo,bar" in your ari.conf general section, and then the
channel variables "foo" and "bar" (along with their values), will
appear in every Stasis websocket channel event.

ASTERISK-26492 #close
  ari_vars.diff submitted by Mark Michelson

Change-Id: I5609ba239259577c0948645df776d7f3bc864229

4 years agocli: Fix ast_el_read_char to work with libedit >= 3.1
George Joseph [Mon, 14 Nov 2016 18:16:03 +0000 (11:16 -0700)]
cli:  Fix ast_el_read_char to work with libedit >= 3.1

Libedit 3.1 is not build with unicode on as a default and so the
prototype for the el_gets callback changed from expecting a char buffer
to accepting a wchar buffer.  If ast_el_read_char isn't changed,
the cli reads garbage from teh terminal.

Added a configure test for (*el_rfunc_t)(EditLine *, wchar_t *) and
updated ast_el_read_char to use the HAVE_ define to detemrine whether
to use char or wchar.

ASTERISK-26592 #close

Change-Id: I9099b46f68e06d0202ff80e53022a2b68b08871a

4 years agoMerge "res_pjsip: Fix tdata leaks in off nominal paths."
Joshua Colp [Mon, 14 Nov 2016 12:47:37 +0000 (06:47 -0600)]
Merge "res_pjsip: Fix tdata leaks in off nominal paths."

4 years agoMerge "Fix closing rtp ports after call finished in chan_unistim."
Joshua Colp [Mon, 14 Nov 2016 12:38:18 +0000 (06:38 -0600)]
Merge "Fix closing rtp ports after call finished in chan_unistim."

4 years agores_pjsip_sdp_rtp: Reject offer of required SRTP without res_srtp.
Joshua Colp [Thu, 10 Nov 2016 16:57:49 +0000 (16:57 +0000)]
res_pjsip_sdp_rtp: Reject offer of required SRTP without res_srtp.

When optimistic SRTP was on it was possible for us to still
set up a call without an audio stream if an offer was received
with required SRTP.

This change makes it so this scenario will now fail with a 488


Change-Id: I7d14187037681f48879bd20319ac79d0877318f3

4 years agoMerge "res_pjsip: Perform resolution when explicit IPv6 transport is used."
Joshua Colp [Fri, 11 Nov 2016 10:37:15 +0000 (04:37 -0600)]
Merge "res_pjsip: Perform resolution when explicit IPv6 transport is used."

4 years agoMerge "build: Fix default values for some SANITIZER options"
Joshua Colp [Fri, 11 Nov 2016 10:36:44 +0000 (04:36 -0600)]
Merge "build:  Fix default values for some SANITIZER options"

4 years agoFix closing rtp ports after call finished in chan_unistim.
Igor Goncharovskiy [Fri, 11 Nov 2016 08:41:36 +0000 (11:41 +0300)]
Fix closing rtp ports after call finished in chan_unistim.

Fix ASTERISK-26565 by adding ast_rtp_instance_stop before
rtp instance destroy for chan_unistim. Also several fixes
for displayed text translation.

Change-Id: If42a03eea09bd1633471406bdc829cf98bf6affc

4 years agoMerge "chan_sip: Fix typo and re-wrap surrounding docs"
zuul [Fri, 11 Nov 2016 05:46:23 +0000 (23:46 -0600)]
Merge "chan_sip: Fix typo and re-wrap surrounding docs"

4 years agores_pjsip.c: Rework endpt_send_request() req_wrapper code.
Richard Mudgett [Fri, 23 Sep 2016 22:54:07 +0000 (17:54 -0500)]
res_pjsip.c: Rework endpt_send_request() req_wrapper code.

* Don't hold the req_wrapper lock too long in endpt_send_request().  We
could block the PJSIP monitor thread if the timeout timer expires.
sip_get_tpselector_from_endpoint() does a sorcery access that could take
awhile accessing a database.  pjsip_endpt_send_request() might take awhile
if selecting a transport.

* Shorten the time that the req_wrapper lock is held in the callback

* Simplify endpt_send_request() req_wrapper->timeout code.

* Removed some redundant req_wrapper->timeout_timer->id assignments.

Change-Id: I3195e3a8e0207bb8e7f49060ad2742cf21a6e4c9

4 years agores_pjsip: Fix tdata leaks in off nominal paths.
Richard Mudgett [Wed, 21 Sep 2016 20:10:29 +0000 (15:10 -0500)]
res_pjsip: Fix tdata leaks in off nominal paths.

Change-Id: Ie83e06e88c2d60157775263b07e40b61718ac97b

4 years agores_pjsip_registrar_expire.c: Remove extra linefeed in debug message.
Richard Mudgett [Mon, 24 Oct 2016 17:41:38 +0000 (12:41 -0500)]
res_pjsip_registrar_expire.c: Remove extra linefeed in debug message.

Change-Id: I1f9adb911f23376503396ec8867e8005b755eb94

4 years agochan_sip: Fix typo and re-wrap surrounding docs
C.J. Collier [Thu, 10 Nov 2016 19:38:25 +0000 (11:38 -0800)]
chan_sip: Fix typo and re-wrap surrounding docs

Correct typo of end-pints to end-points
Re-wrap session timer parameter docs to max 80 chars wide; this
eases reading on terminals with lower resolution, commonly the case
for those with visual impairments.


Change-Id: I22c94459f4bb6b8a2f6713cfd22e87c32f204e6b
Signed-off-by: C.J. Collier <>

4 years agoMerge "app_queue: Add mention of 'ABANDON' variable to CHANGES."
Joshua Colp [Thu, 10 Nov 2016 16:21:54 +0000 (10:21 -0600)]
Merge "app_queue: Add mention of 'ABANDON' variable to CHANGES."

4 years agoMerge "app_queue: new variable set when abandoned"
Joshua Colp [Thu, 10 Nov 2016 16:21:28 +0000 (10:21 -0600)]
Merge "app_queue: new variable set when abandoned"

4 years agores_pjsip: Perform resolution when explicit IPv6 transport is used.
Joshua Colp [Wed, 9 Nov 2016 21:14:09 +0000 (21:14 +0000)]
res_pjsip: Perform resolution when explicit IPv6 transport is used.

This change fixes the SIP resolver such that if an IPv6 transport
is explicitly used it will resolve NAPTR, SRV, and AAAA records.

You can explicitly use one by specifying it on an endpoint.


Change-Id: I2ed3ce81b43a6a8a937c0ebc1b8ed2da5ac2ef36

4 years agoapp_queue: Add mention of 'ABANDON' variable to CHANGES.
Joshua Colp [Thu, 10 Nov 2016 14:33:41 +0000 (14:33 +0000)]
app_queue: Add mention of 'ABANDON' variable to CHANGES.


Change-Id: I1127010181e79c8ac291f72f036cb8e430dc7f7e

4 years agoMerge "Revert "Add API for channel frame deferral.""
George Joseph [Thu, 10 Nov 2016 13:35:19 +0000 (07:35 -0600)]
Merge "Revert "Add API for channel frame deferral.""

4 years agoMerge "Revert "AGI: Only defer frames when in an interception routine.""
George Joseph [Thu, 10 Nov 2016 13:35:08 +0000 (07:35 -0600)]
Merge "Revert "AGI: Only defer frames when in an interception routine.""

4 years agoMerge "Revert "autoservice: Use frame deferral API""
George Joseph [Thu, 10 Nov 2016 13:34:55 +0000 (07:34 -0600)]
Merge "Revert "autoservice: Use frame deferral API""

4 years agoMerge "Revert "channel: Use frame deferral API for safe sleep.""
George Joseph [Thu, 10 Nov 2016 13:34:35 +0000 (07:34 -0600)]
Merge "Revert "channel: Use frame deferral API for safe sleep.""

4 years agoRevert "Add API for channel frame deferral."
George Joseph [Thu, 10 Nov 2016 13:34:10 +0000 (08:34 -0500)]
Revert "Add API for channel frame deferral."

This reverts commit f073f648b87d45e4729969fd2d83695c300757d1.
Multiple testsuite failures were detected after the fact.

Change-Id: I968c380418bf65c7166f6ecff30fe8e247ea6682

4 years agoRevert "AGI: Only defer frames when in an interception routine."
George Joseph [Thu, 10 Nov 2016 13:33:49 +0000 (08:33 -0500)]
Revert "AGI: Only defer frames when in an interception routine."

This reverts commit 28926d1c81540bbeb16802814d3f2e63c2347bd2.
Multiple testsuite failures were detected after the fact.

Change-Id: I8d4f5ccbb421a351d616254844ae7e5a31053edb

4 years agoRevert "autoservice: Use frame deferral API"
George Joseph [Thu, 10 Nov 2016 13:32:50 +0000 (08:32 -0500)]
Revert "autoservice: Use frame deferral API"

This reverts commit afef1b8e4a311d33b3e485b9bab3c6e7fd13fbc9.
Multiple testsuite failures were detected after the fact.

Change-Id: Ib4cb0c0a6475681ce817f71b4050be25640ab67f

4 years agoRevert "channel: Use frame deferral API for safe sleep."
George Joseph [Thu, 10 Nov 2016 13:31:52 +0000 (08:31 -0500)]
Revert "channel: Use frame deferral API for safe sleep."

This reverts commit 392202304d248147378f1e16f1f012285dc1221f.

Multiple testsuite issues were discovered after the fact.

Change-Id: I848c4196dca2994b1a368087004326ea354cff95

4 years agobuild: Fix default values for some SANITIZER options
George Joseph [Thu, 10 Nov 2016 00:18:00 +0000 (17:18 -0700)]
build:  Fix default values for some SANITIZER options

2 of the sanitizers didn't have default values so in systems that
don't support sanitizers menuselect would spit out warnings.  They
were harmless but confusing.  They've now been set to "0".

Change-Id: I08dc495e3b83f1feac3160b421f538c375fc5d58

4 years agoapp_queue: new variable set when abandoned
Sebastian Gutierrez [Sun, 6 Nov 2016 12:04:00 +0000 (09:04 -0300)]
app_queue: new variable set when abandoned

sets the variable ABANDONED to TRUE if the call was not answered.


Change-Id: I4729af9bff4eba436d8a776afd3374065d0036d3

4 years agores_pjsip_session: Do not call session supplements when it's too late.
Mark Michelson [Tue, 8 Nov 2016 16:48:32 +0000 (10:48 -0600)]
res_pjsip_session: Do not call session supplements when it's too late.

res_pjsip_sesssion was hooking into transaction and invite state
changes. One of the reasons for doing so was due to the
PJSIP_EVENT_TX_MSG event. The idea was that we were hooking into the
message sending process, and so we should call session supplements to
alter the outgoing message.

In reality, this event was meant to indicate that the message either
a) had already been sent, or
b) required a DNS lookup and would be sent when the DNS query

In case (a), this meant we were altering an already-sent
request/response for no reason. In case (b), this potentially meant we
could be trying to alter a request/response at the same time that the
DNS resolution completed. In this case, it meant we might be stomping on
memory being used by the thread actually sending the message. This
caused potential crashes and memory corruption.

This patch removes the calls to session supplements from the case where
the PJSIP_EVENT_TX_MSG event occurs. In all of these cases, trying to
alter the message at this point is too late, and it can cause nothing
but harm to try to do it. Because there were no longer any calls to the
handle_outgoing() function, it has been removed.

Change-Id: Ibcc223fb1c3a237927f38754e0429e80ee301e92

4 years agoMerge "automon: restore mixing of the both channels after recording stops"
Joshua Colp [Tue, 8 Nov 2016 19:28:02 +0000 (13:28 -0600)]
Merge "automon: restore mixing of the both channels after recording stops"

4 years agochannel: Use frame deferral API for safe sleep.
Mark Michelson [Thu, 3 Nov 2016 21:46:41 +0000 (16:46 -0500)]
channel: Use frame deferral API for safe sleep.

This is another case where manual frame deferral can be replaced with
centralized routines instead.

Change-Id: I42cdf205f8f29a7977e599751a57efbaac07c30e
(cherry picked from commit d149c4b9e07eeb880d8428ad52c6fdb315cc15f5)

4 years agoautoservice: Use frame deferral API
Mark Michelson [Thu, 3 Nov 2016 21:46:03 +0000 (16:46 -0500)]
autoservice: Use frame deferral API

Rather than use manual frame deferral, just let the channel API do it
for us.


Change-Id: I688386f36e765dbc07be863943a43f26bd5eac49
(cherry picked from commit 8ba3e2fc27f9966b8c7ce75c1eca6208613a9315)

4 years agoAGI: Only defer frames when in an interception routine.
Mark Michelson [Thu, 3 Nov 2016 21:42:40 +0000 (16:42 -0500)]
AGI: Only defer frames when in an interception routine.

AGI recently was modified to defer important frames. This was because
when AGI was used in a connected line interception routine, the
resulting connected line frame would end up getting discarded by the

However, this caused bad behavior in other cases. Specifically, during a
transfer, if someone attempted to manually set the Caller ID on a
channel in an AGI, the deferred connected line frame would end up
overwriting what had been manually set in the AGI.

Since the initial issue was specific to interception routines, this
change removes the manual frame deferral from AGI and instead uses the
new frame deferral API in interception routines.

ASTERISK-26343 #close
Reported by Morton Tryfoss

Change-Id: Iab7d39436d0ee99bfe32ad55ef91e9bd88db4208

4 years agoAdd API for channel frame deferral.
Mark Michelson [Thu, 3 Nov 2016 21:36:13 +0000 (16:36 -0500)]
Add API for channel frame deferral.

There are several places in Asterisk that have duplicated logic
for deferring important frames until later.

This commit adds a couple of API calls to facilitate this automatically.

ast_channel_start_defer_frames(): Future reads of deferrable frames on
this channel will be deferred until later.

ast_channel_stop_defer_frames(): Any frames that have been deferred get
requeued onto the channel.


Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641

4 years agoMerge "res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems"
Joshua Colp [Tue, 8 Nov 2016 10:59:53 +0000 (04:59 -0600)]
Merge "res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems"

4 years agoMerge "res_stasis: Don't unsubscribe from a NULL bridge."
Joshua Colp [Tue, 8 Nov 2016 10:59:24 +0000 (04:59 -0600)]
Merge "res_stasis: Don't unsubscribe from a NULL bridge."

4 years agoMerge "chan_ooh323: reset rrq count on gk registration"
Joshua Colp [Tue, 8 Nov 2016 10:59:12 +0000 (04:59 -0600)]
Merge "chan_ooh323: reset rrq count on gk registration"

4 years agoMerge "chan_ooh323: Fixes to work right with Cisco devices"
Joshua Colp [Tue, 8 Nov 2016 10:58:04 +0000 (04:58 -0600)]
Merge "chan_ooh323: Fixes to work right with Cisco devices"

4 years agoMerge "stasis_recording/stored: remove calls to deprecated readdir_r function."
Joshua Colp [Tue, 8 Nov 2016 10:57:55 +0000 (04:57 -0600)]
Merge "stasis_recording/stored: remove calls to deprecated readdir_r function."

4 years agoMerge "res_stasis: Set a video source mode on Stasis created bridges"
Joshua Colp [Tue, 8 Nov 2016 01:07:55 +0000 (19:07 -0600)]
Merge "res_stasis: Set a video source mode on Stasis created bridges"

4 years agoMerge "main/bridge: Add some verbose logging for video source changes"
Joshua Colp [Mon, 7 Nov 2016 23:49:23 +0000 (17:49 -0600)]
Merge "main/bridge: Add some verbose logging for video source changes"

4 years agoMerge "main/bridge_channel: Fix channel reference leak on video source"
Joshua Colp [Mon, 7 Nov 2016 22:43:42 +0000 (16:43 -0600)]
Merge "main/bridge_channel: Fix channel reference leak on video source"

4 years agoMerge "bridges/bridge_softmix: Remove SSRC changes on join/leave; update video source"
Joshua Colp [Mon, 7 Nov 2016 22:01:03 +0000 (16:01 -0600)]
Merge "bridges/bridge_softmix: Remove SSRC changes on join/leave; update video source"

4 years agoMerge "pjproject_bundled: Fix issue with libasteriskpj needing libresample"
Joshua Colp [Mon, 7 Nov 2016 16:40:14 +0000 (10:40 -0600)]
Merge "pjproject_bundled:  Fix issue with libasteriskpj needing libresample"

4 years agores_stasis: Don't unsubscribe from a NULL bridge.
Joshua Colp [Wed, 2 Nov 2016 15:52:13 +0000 (15:52 +0000)]
res_stasis: Don't unsubscribe from a NULL bridge.

A NULL bridge has special meaning in res_stasis for
unsubscribing. It means that a subscription to ALL
bridges should be removed. This should not be done
as part of the normal subscription management in
the res_stasis channel loop.


Change-Id: I6d5bea8246dd13a22ef86b736aefbf2a39c15af0

4 years agochan_ooh323: Fixes to work right with Cisco devices
Alexander Anikin [Thu, 3 Nov 2016 12:42:20 +0000 (16:42 +0400)]
chan_ooh323: Fixes to work right with Cisco devices

Changed output packets queue processing algo to one read-one write
instead of all read-all send

Remove h.245 tunneling parameter from ReleaseComplete packet

ASTERISK-24400 #close
Reported by: Dmitry Melekhov
Tested by: Dmitry Melekhov

Change-Id: I0b31933b062a21011dbac9a82b8bcfe345f406f6

4 years agochan_ooh323: reset rrq count on gk registration
Alexander Anikin [Thu, 3 Nov 2016 18:10:53 +0000 (22:10 +0400)]
chan_ooh323: reset rrq count on gk registration

reset registration attempts count on success registration on gatekeeper

Change-Id: I5f47351852e0ca76c9ac78421659600e0f106336

4 years agoMerge "chan_ooh323: Fix infinite loop on read second part of H.225 packet"
Joshua Colp [Mon, 7 Nov 2016 14:07:10 +0000 (08:07 -0600)]
Merge "chan_ooh323: Fix infinite loop on read second part of H.225 packet"

4 years agoMerge "rtp_engine: Allow more than 32 dynamic payload types."
zuul [Mon, 7 Nov 2016 12:48:38 +0000 (06:48 -0600)]
Merge "rtp_engine: Allow more than 32 dynamic payload types."

4 years agoautomon: restore mixing of the both channels after recording stops
Michael Kuron [Sun, 6 Nov 2016 09:46:30 +0000 (10:46 +0100)]
automon: restore mixing of the both channels after recording stops

This is a regression over Asterisk 11, introduced by
2dc8a060064f359a17f5ebcd515d85fe5203c019. Previously, recordings started via
the automon DTMF code would automatically be mixed together using sox because
app_monitor would be called with the m option. This commit restores this

Change-Id: Ibaf58684285c3f1b6ca3714524e6d638ae3b3759

4 years agores_http_websocket: Increase the buffer size for non-LOW_MEMORY systems
Matt Jordan [Fri, 4 Nov 2016 20:42:09 +0000 (15:42 -0500)]
res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems

Not surprisingly, using Respoke (and possibly other systems) it is
possible to blow past the 16k limit for a WebSocket packet size. This
patch bumps it up to 32k, which, at least for Respoke, is sufficient.
For now.

Because 32k is laughable on a LOW_MEMORY system (as is 16k, for that
matter), this patch adds a LOW_MEMORY directive that sets the buffer to
8k for systems who have asked for their reduced memory availability to
be considered.

Change-Id: Id235902537091b58608196844dc4b045e383cd2e

4 years agores_stasis: Set a video source mode on Stasis created bridges
Matt Jordan [Fri, 4 Nov 2016 20:40:58 +0000 (15:40 -0500)]
res_stasis: Set a video source mode on Stasis created bridges

When a bridge is created via ARI (through res_stasis), no video source
mode is set by default. As a result, any endpoint sending video media
won't ever see any video reflected back to it.

This patch defaults a bridge to a 'follow the talker' video mode.
Further work can be done to add routes that allow for the video mode to
be controlled through the /bridges resource.

Change-Id: I7e9d530a5d7a97a4524a9ee4e468e1a6b3443866

4 years agomain/bridge_channel: Fix channel reference leak on video source
Matt Jordan [Fri, 4 Nov 2016 20:37:57 +0000 (15:37 -0500)]
main/bridge_channel: Fix channel reference leak on video source

When a channel is made the video source, the bridge holds a reference to
it. Whenever the video source changes, that reference is released.
However, a ref leak does occur if the channel leaves the bridge (such as
being hung up) while it is the video source, as the bridge never
releases the ref in such a case.

This patch adds a line to the bridge_channel_internal_join routine such
that, when a channel finishes its time in the bridge, it notifies the
bridge via ast_bridge_remove_video_src that if it is a video source its
reference should be released.

ASTERISK-26555 #close

Change-Id: I3a2f5238a9d2fc49c591f0e65199d782ab0be76a

4 years agomain/bridge: Add some verbose logging for video source changes
Matt Jordan [Fri, 4 Nov 2016 20:36:42 +0000 (15:36 -0500)]
main/bridge: Add some verbose logging for video source changes

It's actually quite useful to see the source of a video stream change.
This doesn't happen terribly often, even with talk detection - but when
it does, it's nice to know which channel is now providing your video

As a verbose 5 level message, it shouldn't be terribly spammy or costly
to have, and is 'lower level' then most other verbose messages that the
bridge system emits.


Change-Id: Ia1c20ecafa9670171fd38bddcf3beccae47fb15c

4 years agobridges/bridge_softmix: Remove SSRC changes on join/leave; update video source
Matt Jordan [Fri, 4 Nov 2016 20:33:35 +0000 (15:33 -0500)]
bridges/bridge_softmix: Remove SSRC changes on join/leave; update video source

WebRTC clients really, really want to know the SSRC of the media they're
getting. Changing the SSRC is generally not a good thing.

bridge_softmix, starting in Asterisk 12, started changing the SSRC of
parties as they joined or left the bridge. With most phones, this isn't
a problem: phones just play back the stream they're getting. With WebRTC
clients, however, the SSRC is tied to a media stream that may be
negotiated. When a new SSRC just shows up, the media can be dropped.

As it turns out, the SSRC change shouldn't even be necessary. From the
perspective of the client, it's still talking to Asterisk with the same
media stream: why indicate that the far party has suddenly changed to a
different source of media?

This patch opts to just remove the SSRC changes. With this patch, video
clients that join/leave a softmix bridge actually get the video stream
instead of freaking out.


Change-Id: I27fec098b32e7c8718b4b65f3fd5fa73527968bf

4 years agostasis_recording/stored: remove calls to deprecated readdir_r function.
Kevin Harwell [Fri, 28 Oct 2016 20:11:35 +0000 (15:11 -0500)]
stasis_recording/stored: remove calls to deprecated readdir_r function.

The readdir_r function has been deprecated and should no longer be used. This
patch removes the readdir_r dependency (replaced it with readdir) and also moves
the directory search code to a more centralized spot (file.c)

Also removed a strict dependency on the dirent structure's d_type field as it
is not portable. The code now checks to see if the value is available. If so,
it tries to use it, but defaults back to using the stats function if necessary.

Lastly, for most implementations of readdir it *should* be thread-safe to make
concurrent calls to it as long as different directory streams are specified.
glibc falls into this category. However, since it is possible that there exist
some implementations that are not safe, locking has been added for those other
than glibc.

ASTERISK-26509 #close

Change-Id: Id8f54689b1e2873e82a09d0d0d2faf41964e80ba

4 years agoRevert "chan_sip: Fix lastrtprx always updated"
Kevin Harwell [Fri, 4 Nov 2016 15:57:43 +0000 (10:57 -0500)]
Revert "chan_sip: Fix lastrtprx always updated"

This reverts commit 93332cb1d0eea18021ea6538237297e627d6e2fc.

Unfortunately, the aforementioned commit caused a regression (incoming calls
would eventually disconnect). Thus it is being removed.

ASTERISK-26523 #close

Change-Id: Ibf5586adc303073a8eac667a4cbfdb6be184a64d

4 years agochan_ooh323: Fix infinite loop on read second part of H.225 packet
Alexander Anikin [Thu, 3 Nov 2016 18:45:37 +0000 (22:45 +0400)]
chan_ooh323: Fix infinite loop on read second part of H.225 packet

Fix logic on read second part of H.225 packet. There was infinite loop on
wrong connections due to read before poll.

Change-Id: I42b4bf75c46e4a5c5df5c5ca1f0bd74b8944e7ff

4 years agopjproject_bundled: Fix issue with libasteriskpj needing libresample
George Joseph [Thu, 3 Nov 2016 16:55:06 +0000 (10:55 -0600)]
pjproject_bundled:  Fix issue with libasteriskpj needing libresample

libresample is only needed by pjproject if we're building pjsua, which
we only do if TEST_FRAMEWORK is selected.  It's required by pjsua to
process audio which is needed by some testsuite tests.  Unfortunately,
pjproject relies on a newer version of libresample than the version
that ships by most distros so we need to compile the version that's
bundled with pjproject.  Since we only need it for pjsua, we DON'T want
it's symbols exposed when we actually build asterisk.

There was a problem however... TEST_FRAMEWORK is only known AFTER we've
already run ./configure on both asterisk and pjproject but pjproject's
./configure needs to test it to know whether to set up to build
libresample or not.  The previous way of figuring this out was to
always tell ./configure "yes" but not actually build the library.  This
caused an issue where building libasteriskpj was being told to include
libresample but it wasn't actually there.

The solution is to still do a default pjproject configure during an
asterisk ./configure but if makeopts or menuselect.makeopts changes
subsequently, we now reconfigure pjproject, taking into account the
current state of TEST_FRAMEWORK.  Previously, if makeopts or
menuselect.makeopts changed, only a recompile of pjproject was done.

Change-Id: I9b5d84c61384a3ae07fe30e85c49698378cc4685

4 years agoMerge "chan_sip: add missing account code"
Joshua Colp [Thu, 3 Nov 2016 10:39:33 +0000 (05:39 -0500)]
Merge "chan_sip: add missing account code"

4 years agoMerge "app_dial: Fix incorrect device state when channel is picked up."
zuul [Wed, 2 Nov 2016 19:08:37 +0000 (14:08 -0500)]
Merge "app_dial: Fix incorrect device state when channel is picked up."

4 years agoMerge "chan_dahdi: remove by_name support"
zuul [Wed, 2 Nov 2016 15:51:59 +0000 (10:51 -0500)]
Merge "chan_dahdi: remove by_name support"

4 years agochan_sip: add missing account code
Sebastian Gutierrez [Wed, 2 Nov 2016 00:48:50 +0000 (21:48 -0300)]
chan_sip: add missing account code

Added missing account to AMI event of sip show peers

ASTERISK-26176 #close

Change-Id: Ieb6c2c80a838a1b59c82103eba4c63ba238dc482

4 years agoapp_dial: Fix incorrect device state when channel is picked up.
Joshua Colp [Wed, 2 Nov 2016 14:15:14 +0000 (14:15 +0000)]
app_dial: Fix incorrect device state when channel is picked up.

Given the scenario where multiple channels are dialed using Dial()
but the caller is picked up using PickupChan() all outgoing channels
except the channel specified to PickupChan() would be marked
as ringing until the call had been hung up.

When using the PickupChan application the channel executing the
application is swapped into place of another channel. As part
of this process the channel is answered. The Dial application
has explicit logic which checks if the channel is answered,
cancels all other outgoing channels, and bridges. This logic is
different than the normal logic that is executed when an outgoing
channel is answered. This different logic failed to publish dial
events stating that the other outgoing channels had been canceled.
As a result references to the outgoing channels were held onto by
the dial masquerade process until the call had been ended and
the channels had gone away. This would result in the channels
appearing in the "core show channels" list despite not being present
anymore and would also result in incorrect device state.

This change makes it so that this logic also publishes
dial events stating that the other outgoing channels have been


Change-Id: Iea7168e6e82f7d4609ec0366153804e4f55ea64f

4 years agortp_engine: Allow more than 32 dynamic payload types.
Alexander Traud [Tue, 13 Sep 2016 09:08:34 +0000 (11:08 +0200)]
rtp_engine: Allow more than 32 dynamic payload types.

Since adding all remaining rates of Signed Linear (ASTERISK-24274), SILK
(Gerrit 3136) and Codec 2 (ASTERISK-26217), no RTP Payload Type is left in the
dynamic range (96-127). RFC 3551 section 3 allows to reassign other ranges.
Consequently, when the dynamic range is exhausted, this change utilizes payload
types in the range between 35 and 63 giving room for another 29 payload types.

ASTERISK-26311 #close

Change-Id: I7bc96ab764bc30098a178b841cbf7146f9d64964

4 years agoMerge "res_pjsip_sdp_rtp: Limit number of formats to defined maximum."
Joshua Colp [Wed, 2 Nov 2016 13:14:09 +0000 (08:14 -0500)]
Merge "res_pjsip_sdp_rtp: Limit number of formats to defined maximum."

4 years agoMerge "define PATH_MAX for HURD"
Joshua Colp [Wed, 2 Nov 2016 10:26:14 +0000 (05:26 -0500)]
Merge "define PATH_MAX for HURD"

4 years agoMerge "netsock.c: fix includes for HURD"
Joshua Colp [Wed, 2 Nov 2016 10:24:21 +0000 (05:24 -0500)]
Merge "netsock.c: fix includes for HURD"

4 years agoMerge "bundled pjproject: Fix DNS write to freed memory."
zuul [Wed, 2 Nov 2016 06:21:45 +0000 (01:21 -0500)]
Merge "bundled pjproject: Fix DNS write to freed memory."

4 years agoMerge "pjproject_bundled: Fix compile of pjsua so it handles audio"
zuul [Wed, 2 Nov 2016 02:15:08 +0000 (21:15 -0500)]
Merge "pjproject_bundled:  Fix compile of pjsua so it handles audio"

4 years agoMerge "codecs.conf.sample: Add sample and option descriptions for codec_opus"
Joshua Colp [Tue, 1 Nov 2016 23:58:28 +0000 (18:58 -0500)]
Merge "codecs.conf.sample: Add sample and option descriptions for codec_opus"

4 years agoMerge "res_pjsip_outbound_publish: Fix crash when publishing device state."
Joshua Colp [Tue, 1 Nov 2016 23:32:54 +0000 (18:32 -0500)]
Merge "res_pjsip_outbound_publish: Fix crash when publishing device state."

4 years agoMerge "res/stasis: Add CLI commands for displaying/debugging ARI apps"
Joshua Colp [Tue, 1 Nov 2016 21:05:03 +0000 (16:05 -0500)]
Merge "res/stasis: Add CLI commands for displaying/debugging ARI apps"

4 years agobundled pjproject: Fix DNS write to freed memory.
Richard Mudgett [Tue, 1 Nov 2016 18:13:13 +0000 (13:13 -0500)]
bundled pjproject: Fix DNS write to freed memory.

PJPROJECT 2.5.5 introduced a race condition with the -r5349 IPv6 DNS

The patch below fixes a write to freed memory under cartain DNS lookup


Reported by:  Richard Mudgett

Change-Id: Ifdfae9ecf1e41b53080f33aab44ce1a220f349c5

4 years agoMerge "chan_sip: Incorrect display option Outbound reg. retry 403"
zuul [Tue, 1 Nov 2016 19:09:00 +0000 (14:09 -0500)]
Merge "chan_sip: Incorrect display option Outbound reg. retry 403"

4 years agores_pjsip_sdp_rtp: Limit number of formats to defined maximum.
Joshua Colp [Tue, 1 Nov 2016 11:56:24 +0000 (11:56 +0000)]
res_pjsip_sdp_rtp: Limit number of formats to defined maximum.

The res_pjsip_sdp_rtp module did not restrict the number of
formats added to a media stream in the SDP to the defined
limit. If allow=all was used with additional loaded codecs this
could result in the next media stream being overwritten some.

This change restricts the module to limit it to the defined
maximum and also increases the maximum in our bundled pjproject.

ASTERISK-26541 #close

Change-Id: I0dc5f59d3891246cafa2f3df5ec406f088559ee8

4 years agocodecs.conf.sample: Add sample and option descriptions for codec_opus
Kevin Harwell [Mon, 31 Oct 2016 22:35:47 +0000 (17:35 -0500)]
codecs.conf.sample: Add sample and option descriptions for codec_opus

codecs.conf.sample was missing codec opus's configuration options, descriptions,
and examples. This patch adds the configuration options and examples to
codecs.conf.sample that can be used with codec_opus.

ASTERISK-26538 #close

Change-Id: I1d89bb5e01d3e3b5bd78951b8dd0ff077a83dc8b

4 years agores/stasis: Add CLI commands for displaying/debugging ARI apps
Matt Jordan [Thu, 20 Oct 2016 12:27:21 +0000 (07:27 -0500)]
res/stasis: Add CLI commands for displaying/debugging ARI apps

This patch adds three new CLI commands:
 - ari show apps: list the registered ARI applications
 - ari show app: show detailed information about an ARI application
 - ari set debug: dump events being sent to an ARI application

Note that while these CLI commands live in the res_stasis module, we use
the 'ari' family for these commands. This was done as most users of
Asterisk aren't aware of the semantic differences between ARI and
res_stasis, and some 'ari' CLI commands already exist.

ASTERISK-26488 #close

Change-Id: I51ad6ff0cabee0d69db06858c13f18b1c513c9f5

4 years agochan_sip: Incorrect display option Outbound reg. retry 403
Grachev Sergey [Tue, 1 Nov 2016 13:32:35 +0000 (16:32 +0300)]
chan_sip: Incorrect display option Outbound reg. retry 403

If in sip.conf (general section) set option register_retry_403=no,
the command "sip show settings" return value:
Outbound reg. retry 403:0
If in sip.conf (general section) set option register_retry_403=yes,
the command "sip show settings" return value:
Outbound reg. retry 403:-1

* In static char "sip show settings" for "Outbound.reg. retry 403"
option use AST_CLI_YESNO

ASTERISK-26476 #close

Change-Id: I3c14272f05f1067bd2aeaa8b3ef9cf8fcb12dcf9

4 years agonetsock.c: fix includes for HURD
Tzafrir Cohen [Tue, 1 Nov 2016 09:18:49 +0000 (11:18 +0200)]
netsock.c: fix includes for HURD


Change-Id: I43bf94d2d36d3d8a8d0df40cd6c027d65a462814

4 years agodefine PATH_MAX for HURD
Tzafrir Cohen [Tue, 1 Nov 2016 09:00:21 +0000 (11:00 +0200)]
define PATH_MAX for HURD

PATH_MAX is not guaranteed to be defined. In parctice, all but the HURD
define it to a constant. It is indeed not safe to assume there won't be
longer paths and Asterisk generally does err safely on such cases.

So even for HURD we'll just pretend PATH_MAX is 4096.

ASTERISK-25070 #close

Change-Id: I53d10ba18c34c132bcb640a5fd8e0da1d9b22db3

4 years agopjproject_bundled: Fix compile of pjsua so it handles audio
George Joseph [Mon, 31 Oct 2016 21:12:57 +0000 (15:12 -0600)]
pjproject_bundled:  Fix compile of pjsua so it handles audio

In order for pjsua and its python binding to actually negotiate
audio for the testsuite tests, it needs g711 and resample.  The
pj* libraries themselves do not.  Unfortunately, pjproject relies
on a brand new libresample that most distros don't ship so we need
to use the libresample already bundled with pjproject.  Only the pjsua
executable and the python library are linked with it so it
shouldn't interfere with asterisk itself.

Also it was pointed out that apply_patches couldn't handle multiple
patches that depended on each other during the dry-run, so the
dry-run was removed.

Change-Id: I24f397462b486dcdde0dcafe40e6c55a6593f098

4 years agomanager: Add documentation for NewConnectedLine event.
Etienne Lessard [Mon, 31 Oct 2016 18:46:54 +0000 (14:46 -0400)]
manager: Add documentation for NewConnectedLine event.

The NewConnectedLine event has been added by commit fe7671f, but the
documentation was missing.

ASTERISK-26537 #close

Change-Id: I7fc331f18caa28492da9303e576f70884ca8c9e6

4 years agoMerge "bundled pjproject: Crashes while resolving DNS names."
zuul [Mon, 31 Oct 2016 17:44:45 +0000 (12:44 -0500)]
Merge "bundled pjproject: Crashes while resolving DNS names."

4 years agoMerge "astobj2: Declare private variable data_size for AO2_DEBUG only."
zuul [Mon, 31 Oct 2016 16:35:16 +0000 (11:35 -0500)]
Merge "astobj2: Declare private variable data_size for AO2_DEBUG only."

4 years agovector: Prevent NULL argument to memcpy.
Corey Farrell [Sun, 30 Oct 2016 18:33:12 +0000 (14:33 -0400)]
vector: Prevent NULL argument to memcpy.

Headers declare that memcpy does not accept NULL argument for the first
two parameters.  Add a conditional block to prevent memcpy and ast_free
from running on vectors with NULL element array.

ASTERISK-26526 #close

Change-Id: I988a476bb5fcfcbd3f6d6c6b3e7769e4f9629b71