Commit Graph

32582 Commits

Author SHA1 Message Date
traud bb28ed0d1b test_stasis: Avoid always true warning with clang.
ASTERISK-28808

Change-Id: I5e76831373532d7b8065d024e66cd1fb75dedd80
2020-04-07 19:04:42 -05:00
Sean Bright 60925c68e8 Revert "res_config_odbc: Preserve empty strings returned by the database"
This reverts commit a3a2fbaec6.

Reason for revert: There is a lot of code that relies on the broken
behavior that this fixes.

Change-Id: I410c395a0168acbdaf89e616e3cb5e1312d190cb
2020-04-07 18:11:55 -05:00
Jaco Kroon c5f3836bcc main/backtrace: binutils-2.34 fix.
My tester missed this one previously, have confirmed a positive build
this time round.

Change-Id: Id06853375954a200f03f9a1b9c97fe0b10d31fbf
2020-04-06 10:23:20 -05:00
Joshua C. Colp d845464c76 res_pjsip: Don't set endpoint to unavailable in all cases.
When an AOR is modified endpoints are updated that reference
the AOR so they can start receiving updates and reflect the
correct state. If this is the case then we shouldn't change
the endpoint to be offline if it does not reference the AOR
but instead only when the endpoint is completely updated for
all its AORs.

ASTERISK-28056
patches:
  pjsip_options-aor.diff submitted by jhord (license 6978)

Change-Id: I3ee00023be2393113cd4e056599f23f3499ef164
2020-04-06 09:05:55 -05:00
George Joseph 7ba6d43083 test_res_pjsip_session_caps: Create unit test
This unit test runs through combinations of...
	* Local codecs
	* Remote Codecs
	* Codec Preference
	* Incoming/Outgoing

A few new APIs were created to make it easier to test
the functionality but didn't result in any actual
functional change.

ASTERISK_28777

Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164
2020-04-06 08:02:53 -05:00
George Joseph 2ee455958e codec_negotiation: Implement outgoing_call_offer_pref
Based on this new endpoint setting, a joint list of preferred codecs
between those received from the Asterisk core (remote), and those
specified in the endpoint's "allow" parameter (local) is created and
is used to create the outgoing SDP offer.

* Add outgoing_call_offer_pref to pjsip_configuration (endpoint)

* Add "call_direction" to res_pjsip_session.

* Update pjsip_session_caps.c to make the functions more generic
  so they could be used for both incoming and outgoing.

* Update ast_sip_session_create_outgoing to create the
  pending_media_state->topology with the results of
  ast_sip_session_create_joint_call_stream().

* The endpoint "preferred_codec_only" option now automatically sets
  AST_SIP_CALL_CODEC_PREF_FIRST in incoming_call_offer_pref.

* A helper function ast_stream_get_format_count() was added to
  streams to return the current count of formats.

ASTERISK-28777

Change-Id: Id4ec0b4a906c2ae5885bf947f101c59059935437
2020-04-06 08:00:49 -05:00
Ben Ford 57a457c26c res_stir_shaken: Implemented signing of JSON payload.
This change provides functions that take in a JSON payload, verify that
the contents contain all the mandatory fields and required values (if
any), and signs the payload with the private key. Four fields are added
to the payload: x5u, attest, iat, and origid. As of now, these are just
placeholder values that will be set to actual values once the logic is
implemented for what to do when an actual payload is received, but the
functions to add these values have all been implemented and are ready to
use. Upon successful signing and the addition of those four values, a
ast_stir_shaken_payload is returned, containing other useful information
such as the algorithm and signature.

Change-Id: I74fa41c0640ab2a64a1a80110155bd7062f13393
2020-04-03 11:08:29 -05:00
Kevin Harwell 3c345ec56d channel: write to a stream on multi-frame writes
If a frame handling routine returns a list of frames (vs. a single frame)
those frames are never passed to a tech's write_stream handler even if one is
available. For instance, if a codec translation occurred and that codec
returned multiple frames then those particular frames were always only sent
to the tech's "write" handler. If that tech (pjsip for example) was stream
capable then those frames were essentially ignored. Thus resulting in bad
audio.

This patch makes it so the "write_stream" handler is appropriately called
for all cases, and for all frames if available.

ASTERISK-28795 #close

Change-Id: I868faea0b73a07ed5a32c2b05bb9cf4b586f739d
2020-03-31 13:06:03 -05:00
traud fc07eeaba1 test_utils: Avoid incorrect error message on load.
In case of no OpenSSL headers, the module was built but did not load.

ASTERISK-28789

Change-Id: Ie007e84296bcf2bd4237f19d68ba5f932b84cd02
2020-03-31 12:48:15 -05:00
traud cd8cbf7384 func_aes: Avoid incorrect error message on load.
In case of no OpenSSL headers, the module func_aes was built but did not load.

ASTERISK-28788

Change-Id: I0b99b8468cbeb3b0eab23069cbd64062ef885ffc
2020-03-31 12:07:23 -05:00
sungtae kim dbddb6725d dial.c: Removed dial string 80 character limitation
The dial application had 80 characters of destination length
limitation. But this limitation causes unexpected dial string
cut if the dial string is long.

Removed unnecessary limited buffer to support longer dial
destination.

ASTERISK-27946

Change-Id: I72c8f0319a4b47e8180817a66a7e9bde063cb330
2020-03-31 11:58:48 -05:00
Torrey Searle e12244153a res_pjsip_session: implement processing of Content-Disposition
RFC5621 requires any content type with a Content-Disposition
with handling=required to be rejected with a 415 response

ASTERISK-28782 #close

Change-Id: Iad969df75936730254b95c1a8bc3b48497070bb4
2020-03-31 11:32:10 -05:00
Jaco Kroon d32e559e8a acl: implement a centralized ACL output mechanism for HAs and ACLs.
named_acl.c (which is really a named_ha) now uses ast_ha_output.

I've also updated main/manager.c to output the actual ACL on "manager
show user <username>" if one is set.  If this works then we can add
similar to other modules as required.

Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f
2020-03-31 11:08:45 -05:00
Joshua C. Colp 1b6c58896f chan_sip: Send 403 when ACL fails.
Change-Id: I0910c79196f2b7c7e5ad6f1db95e83800ac737a2
2020-03-31 10:16:27 -05:00
Joshua C. Colp 3ed80fc57b CHANGES: Change md file extension to txt.
Change-Id: I168e2d3a65d444fb0961bd228257441fe718f6a7
(cherry picked from commit c9cd681261)
2020-03-26 11:51:39 -05:00
Joshua C. Colp 21e9051461 res_pjsip_session: Apply intention behind requested formats.
When an outgoing channel is created a list of formats may
optionally be provided which is used as a request that the
formats be used if possible. If an endpoint is not configured
for any of the formats we ignore this request and use what is
configured. This has the side effect of also including other
stream types (such as video) that were not present in the
requested formats.

This change makes it so that the intention of the request is
preserved - that is if only an audio format is requested then
even if there is no joint audio format between the request and
the configuration we will still only place an audio stream in
the outgoing call.

ASTERISK-28787

Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f
2020-03-26 11:51:31 -05:00
Joshua C. Colp 96e8d411e1 res_rtp_asterisk: Ensure sufficient space for worst case NACK.
ASTERISK-28790

Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99
2020-03-26 08:37:22 -05:00
Kevin Harwell 26713dc88b ast_coredumper: add Asterisk information dump
This patch makes it so ast_coredumper now outputs the following information to
a *-info.txt file when processing a core file:

  asterisk version and "built by" string
  BUILD_OPTS
  system start, and last reloaded date/time
  taskprocessor list
  equivalent of "bridge show all"
  equivalent of "core show channels verbose"

Also a slight modification was made when trying to obtain the pid(s) of a
running Asterisk. If it fails to retrieve any it now reports an error.

Change-Id: I54f35c19ab69b8f8dc78cc933c3fb7c99cef346b
2020-03-26 08:27:55 -05:00
Jaco Kroon 6f731f153b netsock2: compile fixes.
This fixes ast_addressfamily_to_sockaddrsize to reference the
provided argument, and ast_sockaddr_from_sockaddr to not use the name of
a structure as argument.

Change-Id: Ibf5db469c47c3b4214edf8456326086174e8edd7
2020-03-26 07:46:50 -05:00
Ben Ford 211bb8a79c res_stir_shaken: Initial commit and reading private key.
This commit sets up some of the initial framework for the module and
adds a way to read the private key from the specified file, which will
then be appended to the certificate object. This works fine for now, but
eventually some other structure will likely need to be used to store all
this information. Similarly, the caller_id_number is specified on the
certificate config object, but in the end we will want that information
to be tied to the certificate itself and read it from there.

A method has been added that will retrieve the private key associated
with the caller_id_number passed in. Tab completion for certificates and
stores has also been added.

Change-Id: Ic4bc1416fab5d6afe15a8e2d32f7ddd4e023295f
2020-03-25 18:04:22 -05:00
Jaco Kroon 4f92dcd66b dahdiras: Only set plugin dahdi.so to pppd if we're running as root.
Users of this should set plugin dahdi.so in their options file.

ASTERISK-16676

Change-Id: I6d01ad0a10e9fea477876d0941c3f38aac357e91
2020-03-25 17:24:30 -05:00
Jaco Kroon 40e93b0240 dundi: fix NULL dereference.
If a negative (error) return is received from dundi_lookup_internal,
this is not handled correctly when assigning the result to the buffer.
As such, use a signed integer in the assignment and do a proper
comparison.

ASTERISK-21205

Change-Id: I5214ebb6491e2bd14f90c7d3ce229da86888f739
2020-03-25 17:22:20 -05:00
Joshua C. Colp 34750d2068 res_pjsip_sdp_rtp: Only do hold/unhold on default audio stream.
When examining a stream to determine hold/unhold information we
only care about the default audio stream. Other streams aren't
used for hold/unhold.

ASTERISK-28784

Change-Id: I7a1f10f07822c4aee1f98a38b9628849b578afe4
2020-03-25 15:22:10 -05:00
Sungtae Kim 8147f43756 res_pjsip_session: Fixed wrong session termination
When the Asterisk receives 200 OK with invalid SDP,
the Asterisk/PJPROJECT terminating the session.
But if the channel was in the Bridge, Asterisk tries send
the Re-Invite before terminating the session.
And when the Asterisk sending the Re-Invite, it doesn't check
the SDP is NULL or not. This crashes the Asterisk.

Fixed it to close the session correctly if the UAS sends the
200 OK with wrong SDP.

ASTERISK-28743

Change-Id: Ifa864e0e125b1a7ed2f3abd4164187e1dddc56da
2020-03-25 07:33:23 -05:00
Jaco Kroon a699e016dd build: enable building with uClibc
This patch has been included in Gentoo distribution for at least since
asterisk 1.8, but there are references in the logs going back as far as
1.0.0 - not sure if this is still required in any way, it does apply,
and it doesn't (as far as we can determine) cause build failures.

Change-Id: I46d8845e30200205e80580680bf060aa3012ba54
2020-03-25 07:18:35 -05:00
Jaco Kroon f824cd6a13 build: search from newest to oldest for gmime.
We (Gentoo distribution) reckon that in the case of multiple versions of
gmime installed we should prefer the newest one.

Change-Id: Idf7be613230232eb1d573d93c4a5a8297f4ecd2d
2020-03-25 06:41:32 -05:00
Joshua C. Colp 9620ecbf80 res_pjsip_session: Don't restrict non-audio default streams to sendrecv.
The state of the default audio stream is used for hold/unhold so we
restrict it to sendrecv as the core does not handle when it changes as
a result of hold/unhold.

This restriction does not apply to other media types though so we now
only restrict it to audio. This allows the other default streams to
store their state at all values, and not just sendrecv and removed.

ASTERISK-28783

Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625
2020-03-25 05:48:23 -05:00
Michael Neuhauser 5562fb2ea0 chan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active
Do not hang up a PJSIP channel on RTP timeout if that channel is in
a direct-media bridge. Also reset the time of the last received RTP packet when
direct-media ends (wait full rtp_timeout period before checking first time after
audio came back to Asterisk).

ASTERISK-28774
Reported-by: Michael Neuhauser

Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1
2020-03-20 10:17:49 -05:00
Jaco Kroon 82c3939c38 res_rtp_asterisk: implement ACL mechanism for ICE and STUN addresses.
A pure blacklist is not good enough, we need a whitelist mechanism as
well, and the simplest way to do that is to re-use existing ACL
infrastructure.

This makes it simpler to blacklist say an entire block (/24) except a
smaller block (eg, a /29 or even a /32).  Normally you'd need to
recursively split the block, so if you want to blacklist a /24 except
for a /29 you'd end up with a blacklit for a /25, /26, /27 and /28.  I
feel that having an ACL instead of a blacklist only is clearer.

Change-Id: Id57a8df51fcfd3bd85ea67c489c85c6c3ecd7b30
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2020-03-20 08:41:02 -05:00
Jaco Kroon 2ad64e97c0 Update main/backtrace.c to deal with changes in binutils 2.34.
binutils 2.34 merged this commit:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;\
	h=fd3619828e94a24a92cddec42cbc0ab33352eeb4

Which effectively does things like:

-#define bfd_section_size(bfd, ptr) ((ptr)->size)
-#define bfd_get_section_size(ptr) ((ptr)->size)

+#define bfd_section_size(sec) ((sec)->size)

So in order to remain backwards compatible we need to detect this API
change, and adjust accordingly.  The simplest is to notice that the
bfd_get_section_size and bfd_get_section_vma MACROs are no longer
defined, and define then onto the new API.  The alternative is to litter
the code with a number of #ifdef #else #endif splatters right through
the code.

Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f
2020-03-17 09:14:29 -05:00
Sean Bright c4e0983742 func_odbc.conf.sample: Clarify sample documentation
ASTERISK-20325 #close

Change-Id: I06cb9b467b0fd06c8af2a5aee049f872c09cc4b6
2020-03-17 08:18:37 -05:00
Sean Bright 49cf84578e chan_vpb: Fix 'catching polymorphic type ... by value' error
Fixes the following compile error:

    chan_vpb.cc:2688:26: error: catching polymorphic type
        ‘class std::exception’ by value

Change-Id: Ic87bc357d72427d77626735c83200fd278a7a649
2020-03-13 13:45:04 -05:00
Sean Bright d68f940f6e dns_txt: Add TXT record parsing support
Change-Id: Ie0eca23b8e6f4c7d9846b6013d79099314d90ef5
2020-03-13 09:58:59 -05:00
Joshua C. Colp 98d10d0a16 audiohook: Don't allow audiohooks to attach to hung up channels.
Given a scenario where MixMonitor was initiated over AMI it
was possible for the channel and MixMonitor thread to remain
alive past hang up of the channel. This scenario required
the AMI initiated MixMonitor to retrieve the channel, a
hangup to occur on the channel in another thread, and then
for MixMonitor to actually start. If this occurred the
MixMonitor thread would remain alive indefinitely and
the channel reference would remain.

This change ensures that audiohooks are never able to
be attached to channels that have been hung up. An
additional fix has also been done in app_mixmonitor to
properly release the channel reference if this occurs.

ASTERISK-28780

Change-Id: I8044c06daa06f0f16607788c596f55623be26f58
2020-03-13 09:56:40 -05:00
George Joseph 00a7e4b51d CI: Create generic jenkinsfile
This is a generic jenkinsfile to build Asterisk and optionally
perform one or more of the following:
 * Publish the API docs to the wiki
 * Run the Unit tests
 * Run Testsuite Tests

This job can be triggered manually from Jenkins or be triggered
automatically on a schedule based on a cron string.

Change-Id: Id9d22a778a1916b666e0e700af2b9f1bacda0852
2020-03-13 08:38:20 -05:00
Torrey Searle a1dba820cf res_rtp_asterisk: Send correct sender SSRC when p2p bridge in use
bridge_p2p_rtp_write will forward rtp to the bridged rtp instance
without modifying the ssrc.  However, it is not updating the SSRC
in the bridged rtp.  Thus, when SSRC packets are generated, they
have the correct SSRC for the sender.

ASTERISK-28773 #close

Change-Id: I39f923bde28ebb4f0fddc926b92494aed294a478
2020-03-12 10:33:04 -05:00
George Joseph 0cde95ec89 Merge "res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated" 2020-03-10 13:37:28 -05:00
George Joseph e828a596c5 Merge "chan_pjsip: Check audio frame when remote SSRC changes." 2020-03-10 12:00:48 -05:00
George Joseph 99efe1f868 Merge "codec negotiation: add incoming_call_offer_prefs option" 2020-03-09 15:07:09 -05:00
George Joseph 7b09d9c5aa Merge "enum.c: Make ast_get_txt() actually do something." 2020-03-09 10:15:49 -05:00
George Joseph 2ff7c9d875 Merge "enum.c: Add support for regular expression flag in NAPTR record" 2020-03-09 10:02:45 -05:00
Joshua Colp e8468eee13 Merge "res_rtp_asterisk: Add 'rtp show settings' cli command" 2020-03-09 08:57:09 -05:00
Torrey Searle 14ba1806f3 res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated
If ICE support is enabled but not negotiated, the rtp->ice structure is
not being destroyed. This leads to Asterisk waiting for ICE to complete
instead of immediately starting the DTLS handshake, resulting in the
call leg having no RTP.

ASTERISK-28769 #close

Change-Id: I17c137546dc9ecfb9583c24dcf4c2ced8bbd7a27
2020-03-09 06:32:55 -06:00
Paulo Vicentini ed2a7e3eaf chan_pjsip: Check audio frame when remote SSRC changes.
If the SSRC of a received RTP packet differed from the previous SSRC
an SSRC change control frame would be queued ahead of the media
frame. In the case of audio this would result in the format of the
audio frame not being checked, and if it differed or was not allowed
then it could cause the call to drop due to failure to set up a
translation path.

The chan_pjsip module will now no longer assume the first frame
will be the audio frame and instead goes through the complete list
to find it.

ASTERISK-28759

Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec
2020-03-09 04:55:09 -06:00
Sean Bright 517224ce85 enum.c: Add support for regular expression flag in NAPTR record
A regular expression in a NAPTR response record can have a trailing
'i' flag to indicate that the expression should be evaluated in a
case-insensitive way. We were not checking for that flag which caused
the record parsing to fail on otherwise valid input.

Although this change will initially go into Asterisk 13, 16, and 17,
it is my intention to replace the majority of this code in 16 and up -
including this fix - by changing enum.c to consume the new DNS API
which duplicates most of this logic already. Asterisk 13 doesn't have
the DNS API, so this fix will be as good as it gets.

ASTERISK-26711 #close
Reported by: Vitold

Change-Id: I33943a5b3e7539c6dca3a5079982ee15a08186f0
2020-03-06 15:06:42 -06:00
Jared Smith 0a7fe3097f indications.conf.sample: Add indication tones for Indonesia
These tones come from http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf

ASTERISK-23407

Change-Id: I48e2285f1e5bb29b3335f762006f66c423d0fcb8
2020-03-06 08:42:25 -06:00
Kevin Harwell 1ce0dfd144 Merge "res_pjsip_refer: ensure refer progress is still sent after Proceeding()" 2020-03-05 11:03:34 -06:00
Rodrigo Ramírez Norambuena e089779908 res_rtp_asterisk: Add 'rtp show settings' cli command
This change introduce a CLI command for the RTP to display the general
configuration.

In the first step add the follow fields of the configurations:
  - rtpstart
  - rtpend
  - dtmftimeout
  - rtpchecksum
  - strictrtp
  - learning_min_sequential
  - icesupport

Change-Id: Ibe5450898e2c3e1ed68c10993aa1ac6bf09b821f
2020-03-05 15:48:27 +00:00
Sean Bright ab63f0cd0f enum.c: Make ast_get_txt() actually do something.
The ast_get_txt() API function (and by extension, the TXTCIDNAME
dialplan function) were broken in
65b8381550 such that we would never
actually make a DNS TXT query as described.

This patch restores the documented behavior.

ASTERISK-19460 #close
Reported by: George Joseph

Change-Id: I1b19aea711488cb1ecd63843cddce05010e39376
2020-03-04 17:02:21 -06:00
Joshua Colp 5a8018875d Merge "check_expr2: fix cross-compile/hardening issues" 2020-03-04 06:10:36 -06:00