Commit Graph

5499 Commits

Author SHA1 Message Date
Alexei Gradinari d49fbc5f4e chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no
The sending codec is switched to the receiving codec and then
is switched back to the best native codec on EVERY receiving RTP packets.
This is because after call of ast_channel_set_rawwriteformat there is call
of ast_set_write_format which calls set_format which sets rawwriteformat
to the best native format.

This patch adds a new function ast_set_write_format_path which set
specific write path on channel and uses this function to switch
the sending codec.

ASTERISK-26603 #close

Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
2016-11-30 07:55:08 -05:00
gestoip2 f8f197a6ee res_rtp_asterisk: RTT miscalculation in RTCP
When retrieving RTCP stats for PJSIP channels, RTT values are unreliable.
RTT calculation is correct, but the data representation isn't.  RTT is
represented by a 32-bit fixed-point number with the integer part in the
first 16 bits and the fractional part in the last 16 bits.  In order to
get the RTT value, the fractional part is miscalculated, there is an
unnecessary 16 bit shift that causes overflow.  Besides this there is
another mistake, when transforming the integer value to the fixed point
fractional part via bitwise operation, that loses precision.

* RTT fractional part is no longer shifted, avoiding overflow.

* RTT fractional part is transformed to its fixed-point value more
precisely.

* Fixed timeval2ntp() and ntp2timeval() second fraction conversions.

* Fixed NTP timestamp report logging.  The usec was inexplicably
multiplied by 4096.

ASTERISK-26566 #close
Reported by Hector Royo Concepcion

Change-Id: Ie09bdabfee75afb3f1b8ddfd963e5219ada3b96f
2016-11-23 11:15:25 -05:00
zuul bba4204fa1 Merge "Add support for older name resolving version libraries like openBSD" into 14 2016-11-22 11:51:31 -06:00
George Joseph 34a763415f pjproject_bundled: Use $(LIB_RT) for link of libasteriskpj
libasteriskpj was hard coded to use -lrt but librt is linux specific
so we now use the LIB_RT variable which gets set by configure.

Change-Id: I41148884517e3031f7675a413d524c86e8614694
2016-11-21 11:47:45 -05:00
snuffy 729f1b63e2 Add support for older name resolving version libraries like openBSD
Fix support of OS's like openBSD that use an older nameser.h,
this change reverts the defines to the older style which on other
systems is found in nameser_compat.h

Tested on openBSD 6.0, Debian 8

ASTERISK-26608 #close

Change-Id: Iffb36caab8c5aa9dece0ce2d009041f7b56cc86a
2016-11-19 17:32:15 -05:00
Joshua Colp 002a8e4f10 Merge "main/app.c: Transmit Silence on ControlPlayback pause" into 14 2016-11-18 15:47:01 -06:00
Joshua Colp 3a151b5205 Merge "build: Various OpenBSD issues" into 14 2016-11-18 08:35:57 -06:00
misha 4e64e4f35f main/app.c: Transmit Silence on ControlPlayback pause
ASTERISK-26562 #close

Change-Id: Ie6cb0ffc2b8c775639ce7784fe96f4ea00cfa2f8
2016-11-17 12:32:16 -05:00
George Joseph 54d7e65014 build: Various OpenBSD issues
OpenBSD's 'find' doesn't take the -delete argument so you have to pipe
through 'xargs rm -rf'.

'echo -e' doesn't like \t starting a line. It just prints 't' which
causes the libasteriskpj.exports file to be garbage.  They were just
cosmetic so they were removed.

librt doesn't exist so the link of libasteriskpj.so fails. It's not
actually needed for linux anyway so -lrt was removed from the link.

res_rtp_asterisk was failing to load because of an undefined
DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if
so DTLSv1_method is used instead.

ASTERISK-26608

Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c
2016-11-16 19:24:08 -07:00
Joshua Colp 0ee5b4dbe9 Merge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded." into 14 2016-11-16 19:25:55 -06:00
George Joseph 0825528322 Revert "Revert "AGI: Only defer frames when in an interception routine.""
This reverts commit 7155020c96.

Change-Id: I4e1681d2ca8bf36eda849f129bc0dcbc39ef5bc6
2016-11-16 16:54:27 -07:00
George Joseph 6b2efc116f Revert "Revert "autoservice: Use frame deferral API""
This reverts commit 8b9996a90c.

Change-Id: Ibb2fccfc37188dc54f3776c2d5b41cc425d5cd9c
2016-11-16 16:47:12 -07:00
George Joseph f6acb765a8 Revert "Revert "channel: Use frame deferral API for safe sleep.""
This reverts commit 97679ee846.

Change-Id: Ib68f76e75882c0230378c4fed97964988e690f3c
2016-11-16 16:46:28 -07:00
Joshua Colp aa1482aed4 Merge "channel: Fix issues in hangup scenarios caused by frame deferral" into 14 2016-11-16 16:55:39 -06:00
Joshua Colp caa207bc4f Merge "Revert "Revert "Add API for channel frame deferral.""" into 14 2016-11-16 16:55:32 -06:00
zuul fdea7fe9e4 Merge "res/ari/resource_bridges: Add the ability to manipulate the video source" into 14 2016-11-16 16:48:03 -06:00
George Joseph 42254406ad Merge "cli: Fix ast_el_read_char to work with libedit >= 3.1" into 14 2016-11-16 14:15:21 -06:00
Richard Mudgett d89a1645fc codec_opus: Fix warning when Opus negotiated but codec_opus not loaded.
When Opus is negotiated but not loaded, the log is spammed with messages
because the system does not know how to calculate the number of samples in
a frame.

* Suppress the warning by supplying a function that assumes 20ms of
samples in the frame.  For pass through support it doesn't really seem to
matter what number of samples is returned anyway.

ASTERISK-26605 #close

Change-Id: Icf2273692f040dc2c45b01e72a790d11092f9e0f
2016-11-16 14:56:09 -05:00
George Joseph d6f9e2b54a 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
name.

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
2016-11-15 21:21:28 -05:00
Matt Jordan 62cbcb2e54 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
    detection

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621
2016-11-14 15:56:45 -06:00
George Joseph ac6051c302 channel: Fix issues in hangup scenarios caused by frame deferral
ASTERISK-26343

Change-Id: I06dbf7366e26028251964143454a77d017bb61c8
(cherry picked from commit 0be46aaf6b)
(cherry picked from commit 7263a17ca0)
(cherry picked from commit ebf8d94eb2)
2016-11-14 13:47:14 -07:00
George Joseph 88111da235 Revert "Revert "Add API for channel frame deferral.""
This reverts commit b640f18a44.

Change-Id: I4ad8e7f66b3e6457ac07e7965822ae39ac08464d
2016-11-14 13:44:43 -07:00
Sebastien Duthil eb5077fb26 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
patches:
  ari_vars.diff submitted by Mark Michelson

Change-Id: I5609ba239259577c0948645df776d7f3bc864229
2016-11-14 14:00:54 -05:00
George Joseph e2046bfaf3 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
2016-11-14 11:16:03 -07:00
George Joseph c7511029c3 Merge "Revert "AGI: Only defer frames when in an interception routine."" into 14 2016-11-10 07:40:26 -06:00
George Joseph 6384ac9f39 Merge "Revert "channel: Use frame deferral API for safe sleep."" into 14 2016-11-10 07:40:25 -06:00
George Joseph b55bdb0740 Merge "Revert "Add API for channel frame deferral."" into 14 2016-11-10 07:40:25 -06:00
George Joseph 588336b738 Merge "Revert "autoservice: Use frame deferral API"" into 14 2016-11-10 07:40:24 -06:00
George Joseph b640f18a44 Revert "Add API for channel frame deferral."
This reverts commit 4a8b1940b8.
Multiple testsuite failures were detected after the fact.

Change-Id: Ife9f86872d323adb9c068d2942339c7be9499257
2016-11-10 08:38:18 -05:00
George Joseph 7155020c96 Revert "AGI: Only defer frames when in an interception routine."
This reverts commit 8d8323b142.
Multiple testsuite failures were detected after the fact.

Change-Id: I322684ed82ba32cfce226a94fe19b87a4ec02567
2016-11-10 08:37:46 -05:00
George Joseph 8b9996a90c Revert "autoservice: Use frame deferral API"
This reverts commit 0288fba2f0.
Multiple testsuite failures were detected after the fact.

Change-Id: I9951207019a0f528787f735ccfed7c4b76335505
2016-11-10 08:37:31 -05:00
George Joseph 97679ee846 Revert "channel: Use frame deferral API for safe sleep."
This reverts commit 1db9e7886c.
Multiple testsuite failures were detected after the fact.

Change-Id: Ifd5817e90371e05c4011d5cc97da145c196d60fe
2016-11-10 08:37:19 -05:00
Mark Michelson 1db9e7886c 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 d149c4b9e0)
2016-11-08 06:01:27 -07:00
Mark Michelson 0288fba2f0 autoservice: Use frame deferral API
Rather than use manual frame deferral, just let the channel API do it
for us.

ASTERISK-26343

Change-Id: I688386f36e765dbc07be863943a43f26bd5eac49
(cherry picked from commit 8ba3e2fc27)
2016-11-08 06:01:06 -07:00
Mark Michelson 8d8323b142 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
AGI.

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
2016-11-08 06:00:13 -07:00
Mark Michelson 4a8b1940b8 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.

ASTERISK-26343

Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641
2016-11-08 05:59:43 -07:00
Joshua Colp 1be6c9d26a Merge "stasis_recording/stored: remove calls to deprecated readdir_r function." into 14 2016-11-08 04:57:36 -06:00
Joshua Colp a4d145e465 Merge "main/bridge_channel: Fix channel reference leak on video source" into 14 2016-11-07 16:04:26 -06:00
Joshua Colp 51ff8e3899 Merge "main/bridge: Add some verbose logging for video source changes" into 14 2016-11-07 16:04:22 -06:00
Matt Jordan 62d60c1f58 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
2016-11-04 15:47:42 -05:00
Matt Jordan be254aa8e3 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
stream.

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.

ASTERISK-26555

Change-Id: Ia1c20ecafa9670171fd38bddcf3beccae47fb15c
2016-11-04 15:47:34 -05:00
Kevin Harwell 25895897f8 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-26412
ASTERISK-26509 #close

Change-Id: Id8f54689b1e2873e82a09d0d0d2faf41964e80ba
2016-11-04 13:57:12 -05:00
Alexander Traud 6445f21caa rtp_engine: Allow more than 32 dynamic payload types.
Since adding all remaining rates of Signed Linear (ASTERISK-24274) and SILK
(Gerrit 3136), only one 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, you can go for "rtp_pt_dynamic = 35" (or 0) in
asterisk.conf. This enables the range 35-63 (or 0-63) giving room for another
29 (or 64) payload types.

ASTERISK-26311 #close

Change-Id: I7bc96ab764bc30098a178b841cbf7146f9d64964
2016-11-02 14:55:17 +01:00
Joshua Colp eaf04cb6d0 Merge "netsock.c: fix includes for HURD" into 14 2016-11-02 05:25:53 -05:00
Tzafrir Cohen 2897fc9ab0 netsock.c: fix includes for HURD
ASTERISK-25070

Change-Id: I43bf94d2d36d3d8a8d0df40cd6c027d65a462814
2016-11-01 12:37:22 -05:00
Etienne Lessard d9f9691d31 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
2016-10-31 13:52:50 -05:00
Corey Farrell 39ba7aa91f astobj2: Declare private variable data_size for AO2_DEBUG only.
Every ao2 object contains storage for a private variable data_size,
though the value is never read if AO2_DEBUG is disabled.  This change
makes the variable conditional, reducing memory usage.

ASTERISK-26524 #close

Change-Id: If859929e507676ebc58b0f84247a4231e11da07f
2016-10-29 10:28:40 -05:00
George Joseph d84eaa46fa pjproject_bundled: Fix issue where "/version.mak" wasn't found
main/Makefile includes third-party/pjproject/build.mak but
doesn't set PJDIR beforehand so "include $(PJDIR)/version.mak"
evaluates to "/version.mak".  Fix is to set PJDIR in main/Makefile
before the include.

Change-Id: I0f7c67d60209049056fe9c4b041bf0463aa95604
2016-10-28 17:03:23 -05:00
Corey Farrell b76afa5e4f Fix shutdown crash caused by modules being left open.
It is only safe to run ast_register_cleanup callbacks when all modules
have been unloaded.  Previously these callbacks were run during graceful
shutdown, making it possible to crash during shutdown.

ASTERISK-26513 #close

Change-Id: Ibfa635bb688d1227ec54aa211d90d6bd45052e21
2016-10-28 10:24:13 -05:00
Joshua Colp 1567ccfc82 Merge "ARI: Detect duplicate channel IDs" into 14 2016-10-24 19:53:06 -05:00