Commit Graph

5474 Commits

Author SHA1 Message Date
Naveen Albert f5378f63c4 general: Improve logging levels of some log messages.
Adjusts some logging levels to be more or less important,
that is more prominent when actual problems occur and less
prominent for less noteworthy things.

ASTERISK-30153 #close

Change-Id: Ifc8f7df427aa018627db462125ae744986d3261b
2022-08-01 11:03:43 -05:00
Michael Neuhauser 37c16f9eef res_pjsip: delay contact pruning on Asterisk start
Move the call to ast_sip_location_prune_boot_contacts() *after* the call
to ast_res_pjsip_init_options_handling() so that
res/res_pjsip/pjsip_options.c is informed about the contact deletion and
updates its sip_options_contact_statuses list. This allows for an AMI
event to be sent by res/res_pjsip/pjsip_options.c if the endpoint
registers again from the same remote address and port (i.e., same URI)
as used before the Asterisk restart.

ASTERISK-30109
Reported-by: Michael Neuhauser

Change-Id: I1ba4478019e4931a7085f62708d9b66837e901a8
2022-07-14 08:25:36 -05:00
George Joseph 80d6f5eb20 geoloc_eprofile.c: Fix setting of loc_src in set_loc_src()
line 196:    loc_src = '\0';
should have been
line 196:    *loc_src = '\0';

The issue was caught by the gcc optimizer complaining that
loc_src had a zero length because the pointer itself was being
set to NULL instead of the _contents_ of the pointer being set
to the NULL terminator.

ASTERISK-30138
Reported-by: Sean Bright

Change-Id: Id247be113cc8510f043ca053d5b4f5f3d32acd29
2022-07-13 13:44:22 -05:00
George Joseph 1fa568e76f Geolocation: chan_pjsip Capability Preview
This commit adds res_pjsip_geolocation which gives chan_pjsip
the ability to use the core geolocation capabilities.

This commit message is intentionally short because this isn't
a simple capability.  See the documentation at
https://wiki.asterisk.org/wiki/display/AST/Geolocation
for more information.

THE CAPABILITIES IMPLEMENTED HERE MAY CHANGE BASED ON
USER FEEDBACK!

ASTERISK-30128

Change-Id: Ie2e2bcd87243c2cfabc43eb823d4427c7086f4d9
2022-07-12 13:34:17 -05:00
George Joseph 639d72e98c Geolocation: Core Capability Preview
This commit adds res_geolocation which creates the core capabilities
to manipulate Geolocation information on SIP INVITEs.

An upcoming commit will add res_pjsip_geolocation which will
allow the capabilities to be used with the pjsip channel driver.

This commit message is intentionally short because this isn't
a simple capability.  See the documentation at
https://wiki.asterisk.org/wiki/display/AST/Geolocation
for more information.

THE CAPABILITIES IMPLEMENTED HERE MAY CHANGE BASED ON
USER FEEDBACK!

ASTERISK-30127

Change-Id: Ibfde963121b1ecf57fd98ee7060c4f0808416303
2022-07-12 07:52:12 -05:00
Naveen Albert bcc18ca9f5 general: Fix various typos.
ASTERISK-30089 #close

Change-Id: I1f5db911fd05a3a211c522c13e990fa1d0e62275
2022-07-12 07:46:03 -05:00
Kevin Harwell 4cbe12d6d1 cel_odbc & res_config_odbc: Add support for SQL_DATETIME field type
See also: ASTERISK_30023

ASTERISK-30096 #close
patches:
  inline on issue - submitted by Morvai Szabolcs

Change-Id: I79c0b74862100acd9c8319dca5cc456a654d02eb
2022-07-11 04:13:13 -05:00
Joshua C. Colp 68bcf4c4c5 websocket / aeap: Handle poll() interruptions better.
A sporadic test failure was happening when executing the AEAP
Websocket transport tests. It was originally thought this was
due to things not getting cleaned up fast enough, but upon further
investigation I determined the underlying cause was poll()
getting interrupted and this not being handled in all places.

This change adds EINTR and EAGAIN handling to the Websocket
client connect code as well as the AEAP Websocket transport code.
If either occur then the code will just go back to waiting
for data.

The originally disabled failure test case has also been
re-enabled.

ASTERISK-30099

Change-Id: I1711a331ecf5d35cd542911dc6aaa9acf1e172ad
2022-07-11 04:10:19 -05:00
Naveen Albert f5680a7568 res_cliexec: Add dialplan exec CLI command.
Adds a CLI command similar to "dialplan eval function" except for
applications: "dialplan exec application", useful for quickly
testing certain application behavior directly from the CLI
without writing any dialplan.

ASTERISK-30062 #close

Change-Id: I42e9fa9b60746c21450d40f99a026d48d2486dde
2022-07-08 09:28:23 -05:00
Jose Lopes d52e2b0f1d res_pjsip_header_funcs: Add functions PJSIP_RESPONSE_HEADER and PJSIP_RESPONSE_HEADERS
These new functions allow retrieving information from headers on 200 OK
INVITE response.

ASTERISK-29999

Change-Id: I264a610a9333359297a0825feb29a1bb4f4ad144
2022-07-06 15:08:24 -05:00
Boris P. Korzun 77f6c50814 res_prometheus: Optional load res_pjsip_outbound_registration.so
Switched res_pjsip_outbound_registration.so dep to optional. Added
module loaded check before using it.

ASTERISK-30101 #close

Change-Id: Ia34f1684d984e821fbdd4de8911f930337703666
2022-07-05 06:34:12 -05:00
Naveen Albert e5553fbd15 res_calendar_icalendar: Send user agent in request.
Microsoft recently began rejecting all requests for
ICS calendars on Office 365 with 400 errors if
the request doesn't contain a user agent. See:

https://docs.microsoft.com/en-us/answers/questions/883904/34the-remote-server-returned-an-error-400-bad-requ.html

Accordingly, we now send a user agent on requests for
ICS files so that requests to Office 365 will work as
they did before.

ASTERISK-30106

Change-Id: Ie9dcaef12ae8adf37533c684499eb11005fac8f7
2022-06-30 18:32:10 -05:00
Kevin Harwell a3b2daf127 res_pjsip: allow TLS verification of wildcard cert-bearing servers
Rightly the use of wildcards in certificates is disallowed in accordance
with RFC5922. However, RFC2818 does make some allowances with regards to
their use when using subject alt names with DNS name types.

As such this patch creates a new setting for TLS transports called
'allow_wildcard_certs', which when it and 'verify_server' are both enabled
allows DNS name types, as well as the common name that start with '*.'
to match as a wildcard.

For instance: *.example.com
will match for: foo.example.com

Partial matching is not allowed, e.g. f*.example.com, foo.*.com, etc...
And the starting wildcard only matches for a single level.

For instance: *.example.com
will NOT match for: foo.bar.example.com

The new setting is disabled by default.

ASTERISK-30072 #close

Change-Id: If0be3fdab2e09c2a66bb54824fca406ebaac3da4
2022-06-30 16:20:07 -05:00
Naveen Albert 4a11ae7ecf pbx: Add helper function to execute applications.
Finding an application and executing it if found is
a common task throughout Asterisk. This adds a helper
function around pbx_exec to do this, to eliminate
redundant code and make it easier for modules to
substitute variables and execute applications by name.

ASTERISK-30061 #close

Change-Id: Ifee4d2825df7545fb515d763d393065675140c84
2022-06-30 15:19:56 -05:00
Naveen Albert ddc2cca659 res_parking: Add music on hold override option.
An m option to Park and ParkAndAnnounce now allows
specifying a music on hold class override.

ASTERISK-30087

Change-Id: I03de8d97b100e451b2611b5a621d48750f5d6a9e
2022-06-09 04:46:09 -05:00
Naveen Albert 51d262af12 xmldocs: Improve examples.
Use example tags instead of regular para tags
where possible.

ASTERISK-30090

Change-Id: Iada8bbfda08f30b118cedf2d040bbb21e4966ec5
2022-06-09 03:47:41 -05:00
Naveen Albert 31dc28ab09 res_pjsip_outbound_registration: Make max random delay configurable.
Currently, PJSIP will randomly wait up to 10 seconds for each
outbound registration's initial attempt. The reason for this
is to avoid having all outbound registrations attempt to register
simultaneously.

This can create limitations with the test suite where we need to
be able to receive inbound calls potentially within 10 seconds of
starting up. For instance, we might register to another server
and then try to receive a call through the registration, but if
the registration hasn't happened yet, this will fail, and hence
this inconsistent behavior can cause tests to fail. Ultimately,
this requires a smaller random value because there may be no good
reason to wait for up to 10 seconds in these circumstances.

To address this, a new config option is introduced which makes this
maximum delay configurable. This allows, for instance, this to be
set to a very small value in test systems to ensure that registrations
happen immediately without an unnecessary delay, and can be used more
generally to control how "tight" the initial outbound registrations
are.

ASTERISK-29965 #close

Change-Id: Iab989a8e94323e645f3a21cbb6082287c7b2f3fd
2022-06-09 03:45:15 -05:00
Trevor Peirce 5f0581c5f5 res_pjsip: Actually enable session timers when timers=always
When a pjsip endpoint is defined with timers=always, this has been a
functional noop.  This patch correctly sets the feature bitmap to both
enable support for session timers and to enable them even when the
endpoint itself does not request or support timers.

ASTERISK-29603
Reported-By: Ray Crumrine

Change-Id: I8b5eeaa9ec7f50cc6d96dd34c2b4aa9c53fb5440
2022-06-08 21:52:29 -05:00
Alexei Gradinari 044a08ae7b res_pjsip_pubsub: delete scheduled notification on RLS update
If there is scheduled notification, we must delete it
to avoid using destroyed subscriptions.

ASTERISK-29906

Change-Id: I1c644e5e15a8fe43eed8e4f9112f113cbf87a40f
2022-06-08 21:46:26 -05:00
Alexei Gradinari 355c07e2e6 res_pjsip_pubsub: XML sanitized RLS display name
ASTERISK-29891

Change-Id: Ic8c9697e616446e06e6302653eae902aa23372ad
2022-06-08 20:48:49 -05:00
Naveen Albert 64a764c33e res_calendar: Prevent assertion if event ends in past.
res_calendar will trigger an assertion currently
if the ending time is calculated to be in the past.
Unlike the reminder and start times, however, there
is currently no check to catch non-positive times
and set them to 1. As a result, if we get a negative
value by happenstance, this can cause a crash.

To prevent the assertion from begin triggered, we now
use the same logic as the reminder and start events
to catch this issue before it can cause a problem.

ASTERISK-29981 #close

Change-Id: Idfb3204d195f350d2575fb4bc72a54a597d6e93c
2022-06-06 16:49:29 -05:00
Naveen Albert bae8092826 res_parking: Warn if out of bounds parking spot requested.
Emits a warning if the user has requested a parking spot that
is out of bounds for the requested parking lot.

ASTERISK-30086

Change-Id: I1080371e4f63e94724455003753014fbd3f95fbf
2022-06-06 16:45:04 -05:00
Alexei Gradinari 42b191ad64 res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI
The change "Add LOCAL/REMOTE tags in dialog-info+xml" set both "local"
Identity Element URI and Target Element URI to the same value -
the channel Caller Number.
For Identity Element it's ok to set as Caller ID.
But Local Target URI should be set as local URI.

In this case the Local Target URI can be used for Directed Call Pickup
by Polycom ip-phones (parameter useLocalTargetUriforLegacyPickup).

Also XML sanitized Display names.

ASTERISK-24601

Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343
2022-06-02 09:25:54 -05:00
Shloime Rosenblum 7dcea19ce8 res_agi: Evaluate dialplan functions and variables in agi exec if enabled
Agi commnad exec can now evaluate dialplan functions and
variables if variable AGIEXECFULL is set to yes. this can
be useful when executing Playback or Read from agi.

ASTERISK-30058 #close

Change-Id: I669991f540496e7bddd096fec82b52c083036832
2022-05-26 09:36:45 -05:00
Moritz Fain 4bf2473ac4 ari: expose channel driver's unique id to ARI channel resource
This change exposes the channel driver's unique id (i.e. the Call-ID
for chan_sip/chan_pjsip based channels) to ARI channel resources
as `protocol_id`.

ASTERISK-30027
Reported by: Moritz Fain
Tested by: Moritz Fain

Change-Id: I7cc6e7a9d29efe74bc27811d788dac20fe559b87
2022-05-22 15:40:33 -05:00
Joshua C. Colp 63ff0ccadf res_pjsip_transport_websocket: Also set the remote name.
As part of PJSIP 2.11 a behavior change was done to require
a matching remote hostname on an established transport for
secure transports. Since the Websocket transport is considered
a secure transport this caused the existing connection to not
be found and used.

We now set the remote hostname and the transport can be found.

ASTERISK-30065

Change-Id: Ia1cdef33e1411f927985b4b852c95e163c080e94
2022-05-17 07:20:40 -05:00
Thomas Guebels 4848d6eeb9 res_pjsip_transport_websocket: save the original contact host
This is needed to be able to restore it in REGISTER responses,
otherwise the client won't be able to find the contact it created.

ASTERISK-30042

Change-Id: I0c5823918199acf09246b3b206fbde66773688f6
2022-05-13 09:06:35 -05:00
Naveen Albert 604785f931 res_pjsip_outbound_registration: Show time until expiration
Adjusts the pjsip show registration(s) commands to show
the amount of seconds remaining until a registration
expires.

ASTERISK-29845 #close

Change-Id: Ic4fea15a1a1056c424416def49d1ca8e776c0483
2022-05-13 08:14:04 -05:00
George Joseph 4aa541683b GCC12: Fixes for 16+
Most issues were in stringfields and had to do with comparing
a pointer to an constant/interned string with NULL.  Since the
string was a constant, a pointer to it could never be NULL so
the comparison was always "true".  gcc now complains about that.

There were also a few issues where determining if there was
enough space for a memcpy or s(n)printf which were fixed
by defining some of the involved variables as "volatile".

There were also a few other miscellaneous fixes.

ASTERISK-30044

Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570
2022-05-09 08:21:45 -05:00
Naveen Albert 0c70d497bc documentation: Adds versioning information.
Adds version information for applications, functions,
and manager events/actions.

This is not completely exhaustive by any means but
covers most new things added that have release
versioning information in the issue tracker.

ASTERISK-29940 #close

Change-Id: I506401e93c799715dbbe97c0a8ba18af2bf5e131
2022-04-26 17:40:39 -05:00
Mark Petersen 1cdaeb8161 chan_pjsip: add allow_sending_180_after_183 option
added new global config option "allow_sending_180_after_183"
that if enabled will preserve 180 after a 183

ASTERISK-29842

Change-Id: I8a53f8c35595b6d16d8e86e241b5f110d92f3d18
2022-04-26 16:50:03 -05:00
Kevin Harwell 272bac70dd res_aeap & res_speech_aeap: Add Asterisk External Application Protocol
Add framework to connect to, and read and write protocol based
messages from and to an external application using an Asterisk
External Application Protocol (AEAP). This has been divided into
several abstractions:

 1. transport - base communication layer (currently websocket only)
 2. message - AEAP description and data (currently JSON only)
 3. transaction - links/binds requests and responses
 4. aeap - transport, message, and transaction handler/manager

This patch also adds an AEAP implementation for speech to text.
Existing speech API callbacks for speech to text have been completed
making it possible for Asterisk to connect to a configured external
translator service and provide audio for STT. Results can also be
received from the external translator, and made available as speech
results in Asterisk.

Unit tests have also been created that test the AEAP framework, and
also the speech to text implementation.

ASTERISK-29726 #close

Change-Id: Iaa4b259f84aa63501e5fd2a6fb107f900b4d4ed2
2022-04-26 14:26:48 -05:00
Ben Ford f593b1e93b res_pjsip_stir_shaken.c: Fix enabled when not configured.
There was an issue with the conditional where STIR/SHAKEN would be
enabled even when not configured. It has been changed to ensure that if
a profile does not exist and stir_shaken is not set in pjsip.conf, then
the conditional will return from the function without performing
STIR/SHAKEN operations.

ASTERISK-30024

Change-Id: I41286a3d35b033ccbfbe4129427a62cb793a86e6
2022-04-26 11:11:59 -05:00
Joshua C. Colp fdc1c750f3 res_pjsip: Always set async_operations to 1.
The async_operations setting on a transport configures how
many simultaneous incoming packets the transport can handle
when multiple threads are polling and waiting on the transport.
As we only use a single thread this was needlessly creating
incoming packets when set to a non-default value, wasting memory.

ASTERISK-30006

Change-Id: I1915973ef352862dc2852a6ba4cfce2ed536e68f
2022-04-26 05:00:03 -05:00
Ben Ford 0724b767a3 AST-2022-002 - res_stir_shaken/curl: Add ACL checks for Identity header.
Adds a new configuration option, stir_shaken_profile, in pjsip.conf that
can be specified on a per endpoint basis. This option will reference a
stir_shaken_profile that can be configured in stir_shaken.conf. The type
of this option must be 'profile'. The stir_shaken option can be
specified on this object with the same values as before (attest, verify,
on), but it cannot be off since having the profile itself implies wanting
STIR/SHAKEN support. You can also specify an ACL from acl.conf (along
with permit and deny lines in the object itself) that will be used to
limit what interfaces Asterisk will attempt to retrieve information from
when reading the Identity header.

ASTERISK-29476

Change-Id: I87fa61f78a9ea0cd42530691a30da3c781842406
2022-04-14 16:58:17 -05:00
Ben Ford 8f3dd86b8d AST-2022-001 - res_stir_shaken/curl: Limit file size and check start.
Put checks in place to limit how much we will actually download, as well
as a check for the data we receive at the start to ensure it begins with
what we would expect a certificate to begin with.

ASTERISK-29872

Change-Id: Ifd3c6b8bd52b8b6192a04166ccce4fc8a8000b46
2022-04-14 16:56:56 -05:00
Naveen Albert 94df607771 build: Remove obsolete leftover build references.
Removes some leftover build and config references to
modules that have since been removed from Asterisk.

ASTERISK-29935 #close

Change-Id: Iaefc73a23f4b2de3c6c14d928050135b6d0ef6af
2022-03-30 17:10:51 -05:00
Kevin Harwell 0e31df6c93 res_pjsip_header_funcs: wrong pool used tdata headers
When adding headers to an outgoing request the headers were cloned using
the dialog's pool when they should have been cloned using tdata's pool.
Under certain circumstances it was possible for the dialog object, and
its pool to be freed while tdata is still active and available. Thus the
cloned header "disappeared", and when tdata tried to later access it a
crash would occur.

This patch makes it so all added headers are cloned appropriately using
tdata's pool.

ASTERISK-29411 #close
ASTERISK-29535 #close

Change-Id: I9852025b5ee93ce1c038209150ee9dba1e0767c5
2022-03-30 16:09:28 -05:00
Sean Bright 5ac5c2b0ab openssl: Supress deprecation warnings from OpenSSL 3.0
There is work going on to update our OpenSSL usage to avoid the
deprecated functions but in the meantime make it possible to compile
in devmode.

Change-Id: Ib082eb8b3751f0185d8aa8fe127da664c93f0726
2022-03-28 12:19:42 -05:00
Boris P. Korzun 6624e34580 res_pjsip_sdp_rtp: Improve detecting of lack of RTP activity
Change RTP timer behavior for detecting RTP only after two-way
SDP channel establishment. Ignore detecting after receiving 183
with SDP or while direct media is used.
Make rtp_timeout and rtp_timeout_hold options consistent to rtptimeout
and rtpholdtimeout options in chan_sip.

ASTERISK-26689 #close
ASTERISK-29929 #close

Change-Id: I07326d5b9c40f25db717fd6075f6f3a8d77279eb
2022-03-25 17:30:28 -05:00
Philip Prindeville 287a1a9126 time: add support for time64 libcs
Treat time_t's as entirely unique and use the POSIX API's for
converting to/from strings.

Lastly, a 64-bit integer formats as 20 digits at most in base10.
Don't need to have any 100 byte buffers to hold that.

ASTERISK-29674 #close

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Id7b25bdca8f92e34229f6454f6c3e500f2cd6f56
2022-03-24 12:00:58 -05:00
Alexei Gradinari d1900d4a4c res_pjsip_pubsub: RLS 'uri' list attribute mismatch with SUBSCRIBE request
When asterisk generates the RLMI part of NOTIFY request,
the asterisk uses the local contact uri instead of the URI to which
the SUBSCRIBE request is sent.
Because of this mismatch some IP phones (for example Cisco 5XX) ignore
this list.

According
https://datatracker.ietf.org/doc/html/rfc4662#section-5.2
  The first mandatory <list> attribute is "uri", which contains the uri
  that corresponds to the list. Typically, this is the URI to which
  the SUBSCRIBE request was sent.
https://datatracker.ietf.org/doc/html/rfc4662#section-5.3
  The "uri" attribute identifies the resource to which the <resource>
  element corresponds. Typically, this will be a SIP URI that, if
  subscribed to, would return the state of the resource.

This patch makes asterisk to generate URI using SUBSCRIBE request URI.

ASTERISK-29961 #close

Change-Id: I1fcfc08fd589677f40608c59a4e143c45ee05f6c
2022-03-23 18:13:13 -05:00
Sean Bright d3abdf0b8d stasis_recording: Perform a complete match on requested filename.
Using the length of a file found on the filesystem rather than the
file being requested could result in filenames whose names are
substrings of another to be erroneously matched.

We now ensure a complete comparison before returning a positive
result.

ASTERISK-29960 #close

Change-Id: Id3ffc77681b9b75b8569062f3d952a128a21c71a
2022-03-23 18:08:17 -05:00
Sean Bright 686c386b05 download_externals: Use HTTPS for downloads
ASTERISK-29980 #close

Change-Id: I7b347665822ea2774dd322276c09be67914d2065
2022-03-23 18:06:37 -05:00
Alexei Gradinari edce853123 res_pjsip_pubsub: update RLS to reflect the changes to the lists
This patch makes the Resource List Subscriptions (RLS) dynamic.
The asterisk updates the current subscriptions to reflect the changes
to the list on the subscriptions refresh. If list items are added,
removed, updated or do not exist anymore, the asterisk regenerates
the resource list.

ASTERISK-29906 #close

Change-Id: Icee8c00459a7aaa43c643d77ce6f16fb7ab037d3
2022-03-15 11:12:38 -05:00
Naveen Albert 37ece75677 res_agi: Fix xmldocs bug with set music.
The XML documentation for the SET MUSIC AGI
command is invalid, as the parameter does not
have a name and the on/off enum options for
the on/off argument are listed separately, which
is incorrect. The cumulative effect of these currently
is that the Asterisk Wiki documentation for SET MUSIC
is broken and external documentation generators crash
on SET MUSIC due to the malformed documentation.

These issues are corrected so that the documentation
can be successfully parsed as with other similar AGI
commands.

ASTERISK-29939 #close
ASTERISK-28891 #close

Change-Id: I8c3d59897531bcbc401cbc7b00c9e2829dcb35f8
2022-03-14 10:26:50 -05:00
Boris P. Korzun 636d43caa3 res_config_pgsql: Add text-type column check in require_pgsql()
Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.

ASTERISK-29924 #close

Change-Id: I48061a7d469426859670db07f1ed8af1eb814712
2022-03-14 09:06:08 -05:00
George Joseph 9c36c055c1 xmldoc: Fix issue with xmlstarlet validation
Added the missing xml-stylesheet and Xinclude namespace
declarations in pjsip_config.xml and pjsip_manager.xml.

Updated make_xml_documentation to show detailed errors when
xmlstarlet is the validator.  It's now run once with the '-q'
option to suppress harmless/expected messages and if it actually
fails, it's run again without '-q' but with '-e' to show
the actual errors.

Change-Id: I4bdc9d2ea6741e8d2e5eb82df60c68ccc59e1f5e
2022-03-01 11:04:17 -06:00
George Joseph 2e00b5edbd Makefile: Allow XML documentation to exist outside source files
Moved the xmldoc build logic from the top-level Makefile into
its own script "make_xml_documentation" in the build_tools
directory.

Created a new utility script "get_sourceable_makeopts", also in
the build_tools directory, that dumps the top-level "makeopts"
file in a format that can be "sourced" from shell sscripts.
This allows scripts to easily get the values of common make
build variables such as the location of the GREP, SED, AWK, etc.
utilities as well as the AST* and library *_LIB and *_INCLUDE
variables.

Besides moving logic out of the Makefile, some optimizations
were done like removing "third-party" from the list of
subdirectories to be searched for documentation and changing some
assignments from "=" to ":=" so they're only evaluated once.
The speed increase is noticeable.

The makeopts.in file was updated to include the paths to
REALPATH and DIRNAME.  The ./conifgure script was setting them
but makeopts.in wasn't including them.

So...

With this change, you can now place documentation in any"c"
source file AND you can now place it in a separate XML file
altogether.  The following are examples of valid locations:

res/res_pjsip.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_configuration.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_doc.xml
    A fully-formed XML file.  The "configInfo", "manager",
    "managerEvent", etc. elements that would be in the "c"
    file DOCUMENTATION fragment should be wrapped in proper
    XML.  Example for "somemodule.xml":

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE docs SYSTEM "appdocsxml.dtd">
    <docs>
        <configInfo>
        ...
        </configInfo>
    </docs>

It's the "appdocsxml.dtd" that tells make_xml_documentation
that this is a documentation XML file and not some other XML file.
It also allows many XML-capable editors to do formatting and
validation.

Other than the ".xml" suffix, the name of the file is not
significant.

As a start... This change also moves the documentation that was
in res_pjsip.c to 2 new XML files in res/res_pjsip:
pjsip_config.xml and pjsip_manager.xml.  This cut the number of
lines in res_pjsip.c in half. :)

Change-Id: I486c16c0b5a44d7a8870008e10c941fb19b71ade
2022-02-28 08:13:11 -06:00
Naveen Albert e26b57984f asterisk: Add macro for curl user agent.
Currently, each module that uses libcurl duplicates the standard
Asterisk curl user agent.

This adds a global macro for the Asterisk user agent used for
curl requests to eliminate this duplication.

ASTERISK-29861 #close

Change-Id: I9fc37935980384b4daf96ae54fa3c9adb962ed2d
2022-02-25 13:04:14 -06:00
Naveen Albert 1633410161 res_stir_shaken: refactor utility function
Refactors temp file utility function into file.c.

ASTERISK-29809 #close

Change-Id: Ife478708c8f2b127239cb73c1755ef18c0bf431b
2022-02-23 17:04:52 -06:00
Alexei Gradinari a2aa881dcb res_pjsip_pubsub: fix Batched Notifications stop working
If Subscription refresh occurred between when the batched notification
was scheduled and the serialized notification was to be sent,
then new schedule notification task would never be added.

There are 2 threads:

thread #1. ast_sip_subscription_notify is called,
if notification_batch_interval then call schedule_notification.
1.1. The schedule_notification checks notify_sched_id > -1
not true, then
send_scheduled_notify = 1
notify_sched_id =
  ast_sched_add(sched, sub_tree->notification_batch_interval, sched_cb....
1.2. The sched_cb pushes task serialized_send_notify to serializer
and returns 0 which means no reschedule.
1.3. The serialized_send_notify checks send_scheduled_notify if it's false
the just returns. BUT notify_sched_id is still set, so no more ast_sched_add.

thread #2. pubsub_on_rx_refresh is called
2.1 it pushes serialized_pubsub_on_refresh_timeout to serializer
2.2. The serialized_pubsub_on_refresh_timeout calls pubsub_on_refresh_timeout
which calls send_notify
2.3. The send_notify set send_scheduled_notify = 0;

The serialized_send_notify should always unset notify_sched_id.

ASTERISK-29904 #close

Change-Id: Ifc50c00b213c396509e10326a1ed89d8cf8c7875
2022-02-23 16:09:47 -06:00
Alexei Gradinari c12cb899de res_pjsip_pubsub: provide a display name for RLS subscriptions
Whereas BLFs allow to show a display name for each RLS entry,
the asterisk provides only the extension now.
This is not end user friendly.

This commit adds a new resource_list option, resource_display_name,
to indicate whether display name of resource or the resource name being
provided for RLS entries.
If this option is enabled, the Display Name will be provided.
This option is disabled by default to remain the previous behavior.
If the 'event' set to 'presence' or 'dialog' the non-empty HINT name
will be set as the Display Name.
The 'message-summary' is not supported yet.

ASTERISK-29891 #close

Change-Id: Ic5306bd5a7c73d03f5477fe235e9b0f41c69c681
2022-02-23 15:20:49 -06:00
Naveen Albert 335c69ead4 documentation: Adds missing default attributes.
The configObject tag contains a default attribute which
allows the default value to be specified, if applicable.
This allows for the default value to show up specially on
the wiki in a way that is clear to users.

There are a couple places in the tree where default values
are included in the description as opposed to as attributes,
which means these can't be parsed specially for the wiki.
These are changed to use the attribute instead of being
included in the text description.

ASTERISK-29898 #close

Change-Id: I9d7ea08f50075f41459ea7b76654906b674ec755
2022-02-23 13:26:22 -06:00
Mark Petersen 427bee9beb res_prometheus.c: missing module dependency
added res_pjsip_outbound_registration to .requires in AST_MODULE_INFO
which fixes issue with module crashes on load "FRACK!, Failed assertion"

ASTERISK-29871

Change-Id: Ia0f49d048427a40e1b763296b834a52a03610096
2022-02-10 12:58:34 -06:00
Sean Bright e1b050d8a3 res_pjsip.c: Correct minor typos in 'realm' documentation.
Change-Id: I886936b808def5540d40071321e72f6bfa19063a
2022-02-03 17:00:23 -06:00
George Joseph 8d571ea6b5 res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup
In dev mode, if you call pjsip_auth_clt_deinit() with an auth_sess
that hasn't been initialized, it'll assert and abort.  If
digest_create_request_with_auth() fails to find the proper
auth object however, it jumps to its cleanup which does exactly
that.  So now we no longer attempt to call pjsip_auth_clt_deinit()
if we never actually initialized it.

ASTERISK-29888

Change-Id: Ib6171c25c9fe8e61cc8d11129e324c021bc30b62
2022-02-01 05:27:53 -06:00
Naveen Albert 70f8ea0d1a res_tonedetect: Fixes some logic issues and typos
Fixes some minor logic issues with the module:

Previously, the OPT_END_FILTER flag was getting
tested before options were parsed, so it could
never evaluate to true (wrong ordering).

Additionally, the initially parsed timeout (float)
needs to be compared with 0, not the result int
which is set afterwards (wrong variable).

ASTERISK-29857 #close

Change-Id: I0062bce3b391c15e5df7a714780eeaa96dd93d4c
2022-01-31 08:56:11 -06:00
Torrey Searle 7b15ced930 res/res_rtp_asterisk: fix skip in rtp sequence numbers after dtmf
When generating dtmfs, asterisk can incorrectly think packet loss
occured during the dtmf generation, resulting in a jump in sequence
numbers when forwarding voice frames resumes.  This patch forces
asterisk to re-learn the expected sequence number after each DTMF
to avoid this

ASTERISK-29869 #close

Change-Id: Icc7de3d947b207b82c99d3c327af8095884df853
2022-01-31 07:52:30 -06:00
Kevin Harwell 851a759619 res_http_websocket: Add a client connection timeout
Previously there was no way to specify a connection timeout when
attempting to connect a websocket client to a server. This patch
makes it possible to now do such.

Change-Id: I5812f6f28d3d13adbc246517f87af177fa20ee9d
2022-01-31 07:18:51 -06:00
Luke Escude 5875c7bb6c res_pjsip_sdp_rtp.c: Support keepalive for video streams.
ASTERISK-28890 #close

Change-Id: Iad269a8dc36f892ede90fe8ceb3010560c0f70d1
2022-01-20 08:15:01 -06:00
Naveen Albert d35e292ae4 res_rtp_asterisk: Fix typo in flag test/set
The code currently checks to see if an RFC3389
warning flag is set, except if it is, it merely
sets the flag again, the logic of which doesn't
make any sense.

This adjusts the if comparison to check if the
flag has NOT been set, and if so, emit a notice
log event and set the flag so that future frames
do not cause an event to be logged.

ASTERISK-29856 #close

Change-Id: Ib7098c947c63537d087a03b4646199fbb963f8e1
2022-01-19 08:50:45 -06:00
George Joseph b1dfc9c805 res_pjsip: Make message_filter and session multipart aware
Neither pjsip_message_filter's filter_on_tx_message() nor
res_pjsip_session's session_outgoing_nat_hook() were multipart
aware and just assumed that an SDP would be the only thing in
a message body.  Both were changed to use the new
pjsip_get_sdp_info() function which searches for an sdp in
both single- and multi- part message bodies.

ASTERISK-29813

Change-Id: I8f5b8cfdc27f1d4bd3e7491ea9090951a4525c56
2022-01-17 11:20:19 -06:00
George Joseph 921ab52cf3 res_pjsip: Add utils for checking media types
Added two new functions to assist checking media types...

* ast_sip_are_media_types_equal compares two pjsip_media_types.
* ast_sip_is_media_type_in tests if one media type is in a list
  of others.

Added static definitions for commonly used media types to
res_pjsip.h.

Changed several modules to use the new functions and static
definitions.

ASTERISK_29813
(not ready to close)

Change-Id: Ief77675235bd3bf00a6b095d4673fd878d0801b9
2022-01-17 08:25:58 -06:00
George Joseph bc59b66de3 bundled_pjproject: Make it easier to hack
There are times when you need to troubleshoot issues with bundled
pjproject or add new features that need to be pushed upstream
but...

* The source directory created by extracting the pjproject tarball
  is not scanned for code changes so you have to keep forcing
  rebuilds.
* The source directory isn't a git repo so you can't easily create
  patches, do git bisects, etc.
* Accidentally doing a make distclean will ruin your day by wiping
  out the source directory, and your changes.
* etc.

This commit makes that easier.
See third-party/pjproject/README-hacking.md for the details.

ASTERISK-29824

Change-Id: Idb1251040affdab31d27cd272dda68676da9b268
2022-01-07 08:45:02 -06:00
Florentin Mayer dd41572f99 res_pjsip_sdp_rtp: Preserve order of RTP codecs
The ast_rtp_codecs_payloads functions do not preserve the order in which
the payloads were specified on an incoming SDP media line. This leads to
a problem with the codec negotiation functionality, as the format
capabilities of the stream are extracted from the ast_rtp_codecs. This
commit moves the ast_rtp_codec to ast_format conversion to the place
where the order is still known.

ASTERISK-28863
ASTERISK-29320

Change-Id: I3aabcfed3f379c36654f59c1872c313d0cb57e25
2022-01-05 07:18:33 -06:00
Alexander Traud 826233b550 progdocs: Fix Doxygen left-overs.
Change-Id: I5b5cf9c9cbbe00ba8b379a8d162ac67445d39016
2021-12-13 08:57:26 -06:00
Alexander Traud f6df28ce87 res_pjsip_sdp_rtp: Do not warn on unknown sRTP crypto suites.
res_sdp_crypto_parse_offer(.) emits many log messages already.

ASTERISK-29785

Change-Id: I1a191ebe4fec1102946d4e31887e5197ca02dfe8
2021-12-06 10:57:40 -06:00
Mike Bradeen 59fcd1e7e2 res_rtp_asterisk: Addressing possible rtp range issues
res/res_rtp_asterisk.c: Adding 1 to rtpstart if it is deteremined
that rtpstart was configured to be an odd value. Also adding a loop
counter to prevent a possible infinite loop when looking for a free
port.

ASTERISK-27406

Change-Id: I90f07deef0716da4a30206e9f849458b2dbe346b
2021-12-06 10:05:07 -06:00
Alexander Traud a85f2bf34d res: Fix for Doxygen.
These are the remaining issues found in /res.

ASTERISK-29761

Change-Id: I572e6019c422780dde5ce8448b6c85c77af6046d
2021-12-03 10:38:39 -06:00
Dustin Marquess e93fb874b4 res_fax_spandsp: Add spandsp 3.0.0+ compatibility
Newer versions of spandsp did refactoring of code to add new features
like color FAXing. This refactoring broke backwards compatibility.
Add support for the new version while retaining support for 0.0.6.

ASTERISK-29729 #close

Change-Id: I3bd74550604ebcf0304528d647fa39abc62fbaa1
2021-12-03 07:44:02 -06:00
Alexander Traud 9440f6ec58 main: Fix for Doxygen.
ASTERISK-29763

Change-Id: Ib8359e3590a9109eb04a5376559d040e5e21867e
2021-12-02 15:02:09 -06:00
Alexander Traud cc025026b7 progdocs: Fix for Doxygen, the hidden parts.
ASTERISK-29779

Change-Id: If338163488498f65fa7248b60e80299c0a928e4b
2021-12-02 10:37:38 -06:00
Naveen Albert 24a04054ad documentation: Standardize examples
Most examples in the XML documentation use the
example tag to demonstrate examples, which gets
parsed specially in the Wiki to make it easier
to follow for users.

This fixes a few modules to use the example
tag instead of vanilla para tags to bring them
in line with the standard syntax.

ASTERISK-29777 #close

Change-Id: I9acb6cc5faf1d220e73c6dd28592371d768d279b
2021-12-01 12:27:30 -06:00
Alexander Traud ecffdab059 stir/shaken: Avoid a compiler extension of GCC.
ASTERISK-29776

Change-Id: I86e5eca66fb775a5744af0c929fb269e70575a73
2021-11-29 11:15:45 -06:00
Naveen Albert 4468fc11d6 res_tonedetect: Add call progress tone detection
Makes basic call progress tone detection available
in a tech-agnostic manner with the addition of the
ToneScan application. This can determine if the channel
has encountered a busy signal, SIT tones, dial tone,
modem, fax machine, etc. A few basic async progress
tone detect options are also added to the TONE_DETECT
function.

ASTERISK-29720 #close

Change-Id: Ia02437e0450473031e294798b8cb421fb8f24e90
2021-11-19 08:05:26 -06:00
Alexander Traud 00fc7212bd odbc: Fix for Doxygen.
ASTERISK-29754

Change-Id: Ia09eb68d283d201d9a6fbeccfc0efe83fe0502a5
2021-11-19 02:50:36 -06:00
Alexander Traud 241dbb1ec0 parking: Fix for Doxygen.
ASTERISK-29753

Change-Id: I7a61974584f6169502e6860fc711919fe7bbfaa7
2021-11-18 16:59:26 -06:00
Alexander Traud 634e3ebdb8 res_ari: Fix for Doxygen.
ASTERISK-29756

Change-Id: I2f1c1eea1c902492b77b74de9950f20ebbb7e758
2021-11-18 16:25:51 -06:00
Alexander Traud acd1cd66b8 stasis: Fix for Doxygen.
ASTERISK-29750

Change-Id: Iea50173e785b2e9d49bc24c0af7111cfd96d44a9
2021-11-18 14:46:42 -06:00
Alexander Traud 845ece8bc4 res_xmpp: Fix for Doxygen.
ASTERISK-29749

Change-Id: I7885793b63bdeaa883e76edb899bbba9660eb1c5
2021-11-18 14:44:28 -06:00
Alexander Traud 463f6c83e8 res_pjsip: Fix for Doxygen.
ASTERISK-29747

Change-Id: Ic7a1e9453f805a6264fe86c96b7d18b87b376084
2021-11-18 12:14:54 -06:00
Alexander Traud 57fef28dc9 progdocs: Avoid 'name' with Doxygen \file.
Fixes four misuses of the parameter 'name'. Additionally, for
consistency and to avoid such an issue in future, those few other
places, which used '\file name', were changed just to '\file'. Then,
Doxygen uses the name of the current file.

ASTERISK-29733

Change-Id: I0c18b4c863c6988b138c77448057349a9ee7052d
2021-11-18 08:17:56 -06:00
Naveen Albert 126de2839b res_pjsip_callerid: Fix OLI parsing
Fix parsing of ANI2/OLI information, since it was previously
parsing the user, when it should have been parsing other_param.

Also improves the parsing by using pjproject native functions
rather than trying to parse the parameters ourselves like
chan_sip did. A previous attempt at this caused a crash, but
this works correctly now.

ASTERISK-29703 #close

Change-Id: I8f3c79032d9ea1a21d16f8e11f22bd8d887738a1
2021-11-16 12:46:24 -06:00
Josh Soref 9ae9893c63 res: Spelling fixes
Correct typos of the following word families:

identifying
structures
actcount
initializer
attributes
statement
enough
locking
declaration
userevent
provides
unregister
session
execute
searches
verification
suppressed
prepared
passwords
recipients
event
because
brief
unidentified
redundancy
character
the
module
reload
operation
backslashes
accurate
incorrect
collision
initializing
instance
interpreted
buddies
omitted
manually
requires
queries
generator
scheduler
configuration has
owner
resource
performed
masquerade
apparently
routable

ASTERISK-29714

Change-Id: I88485116d2c59b776aa2e1f8b4ce8239a21decda
2021-11-15 16:37:34 -06:00
Ben Ford 1031a1805b STIR/SHAKEN: Option split and response codes.
The stir_shaken configuration option now has 4 different choices to pick
from: off, attest, verify, and on. Off and on behave the same way they
do now. Attest will only perform attestation on the endpoint, and verify
will only perform verification on the endpoint.

Certain responses are required to be sent based on certain conditions
for STIR/SHAKEN. For example, if we get a Date header that is outside of
the time range that is considered valid, a 403 Stale Date response
should be sent. This and several other responses have been added.

Change-Id: I4ac1ecf652cd0e336006b0ca638dc826b5b1ebf7
2021-10-27 08:39:56 -05:00
Kevin Harwell 8beac820c0 res_speech: Add a type conversion, and new engine unregister methods
Add a new function that converts a speech results type to a string.
Also add another function to unregister an engine, but returns a
pointer to the unregistered engine object instead of a success/fail
integer.

Change-Id: I0f7de17cb411021c09fb03988bc2b904e1380192
2021-10-21 16:25:22 -05:00
Matthew Kern 5e9799a42e res_pjsip_t38: bind UDPTL sessions like RTP
In res_pjsip_sdp_rtp, the bind_rtp_to_media_address option and the
fallback use of the transport's bind address solve problems sending
media on systems that cannot send ipv4 packets on ipv6 sockets, and
certain other situations. This change extends both of these behaviors
to UDPTL sessions as well in res_pjsip_t38, to fix fax-specific
problems on these systems, introducing a new option
endpoint/t38_bind_udptl_to_media_address.

ASTERISK-29402

Change-Id: I87220c0e9cdd2fe9d156846cb906debe08c63557
2021-10-01 08:57:07 -05:00
Jean Aunis 6bc747b639 res_rtp_asterisk: fix memory leak
Add missing reference decrement in rtp_deallocate_transport()

ASTERISK-29671

Change-Id: I8d22dbedb90e8dade0829b7a28372f404b07caa9
2021-09-29 09:51:13 -05:00
Joseph Nadiv 47cb177baf res_pjsip_registrar: Remove unavailable contacts if exceeds max_contacts
The behavior of max_contacts and remove_existing are connected.  If
remove_existing is enabled, the soonest expiring contacts are removed.
This may occur when there is an unavailable contact.  Similarly,
when remove_existing is not enabled, registrations from good
endpoints are rejected in favor of retaining unavailable contacts.

This commit adds a new AOR option remove_unavailable, and the effect
of this setting will depend on remove_existing.  If remove_existing
is set to no, we will still remove unavailable contacts when they
exceed max_contacts, if there are any. If remove_existing is set to
yes, we will prioritize the removal of unavailable contacts before
those that are expiring soonest.

ASTERISK-29525

Change-Id: Ia2711b08f2b4d1177411b1be23e970d7fdff5784
2021-09-24 11:47:22 -05:00
Joshua C. Colp 0aac38c0ac ari: Ignore invisible bridges when listing bridges.
When listing bridges we go through the ones present in
ARI, get their snapshot, turn it into JSON, and add it
to the payload we ultimately return.

An invisible "dial bridge" exists within ARI that would
also try to be added to this payload if the channel
"create" and "dial" routes were used. This would ultimately
fail due to invisible bridges having no snapshot
resulting in the listing of bridges failing.

This change makes it so that the listing of bridges
ignores invisible ones.

ASTERISK-29668

Change-Id: I14fa4b589b4657d1c2a5226b0f527f45a0cd370a
2021-09-23 09:19:37 -05:00
Sean Bright 02f54e2751 res_http_media_cache.c: Compare unaltered MIME types.
Rather than stripping parameters from Content-Type headers before
comparison, first try to compare the whole string. If no match is
found, strip the parameters and try that way.

ASTERISK-29275 #close

Change-Id: I2963c8ecbb3a9605b78b6421c415108d77a66a0f
2021-09-21 13:05:23 -05:00
Guido Falsi 29ad5b18f1 res_rtp_asterisk.c: Fix build failure when not building with pjproject.
Some code has been added referencing symbols defined in a block
protected by #ifdef HAVE_PJPROJECT. Protect those code parts in
ifdef blocks too.

ASTERISK-29660

Change-Id: Ib18d4392d51ac80ca5481dabf6e498a4e3e49e6f
2021-09-20 15:49:24 -05:00
Naveen Albert 5b5c358e4b res_pjsip_caller_id: Add ANI2/OLI parsing
Adds parsing of ANI II digits (Originating
Line Information) to PJSIP, on par with
what currently exists in chan_sip.

ASTERISK-29472

Change-Id: Ifc938a7a7d45ce33999ebf3656a542226f6d3847
2021-09-15 10:27:40 -05:00
Sungtae Kim a1fa8df0ae resource_channels.c: Fix external media data option
Fixed the external media creation handle to handle the 'data' option correctly.

ASTERISK-29629

Change-Id: I22e57fe8ebf3d3e08fb2121aa4a8a52cc62e8129
2021-09-10 16:32:24 -05:00
Naveen Albert 7df69633cf res_tonedetect: Tone detection module
dsp.c contains arbitrary tone detection functionality
which is currently only used for fax tone recognition.
This change makes this functionality publicly
accessible so that other modules can take advantage
of this.

Additionally, a WaitForTone and TONE_DETECT app and
function are included to allow users to do their
own tone detection operations in the dialplan.

ASTERISK-29546

Change-Id: Ie38c395000f4fd4d04e942e8658e177f8f499b26
2021-09-10 11:08:11 -05:00
George Joseph 448962d056 res_snmp: Add -fPIC to _ASTCFLAGS
With gcc 11, res/res_snmp.c and res/snmp/agent.c need the
-fPIC option added to its _ASTCFLAGS.

ASTERISK-29634

Change-Id: I34649c85e075fd954e578378fabf798c3f038f50
2021-09-10 10:42:41 -05:00
Jasper Hafkenscheid c07d531191 res_srtp: Disable parsing of not enabled cryptos
When compiled without extended srtp crypto suites also disable parsing
these from received SDP. This prevents using these, as some client
implementations are not stable.

ASTERISK-29625

Change-Id: I7dafb29be1cdaabdc984002573f4bea87520533a
2021-09-08 18:24:44 -05:00
sungtae kim 79d6d222d6 resource_channels.c: Fix wrong external media parameter parse
Fixed ARI external media handler to accept body parameters.

ASTERISK-29622

Change-Id: I49509c48a6cbc0fb4165bfa4f834b5e8b9ace20d
2021-09-02 15:18:01 -05:00
Sebastien Duthil 6fbf55ac11 res_rtp_asterisk: Automatically refresh stunaddr from DNS
This allows the STUN server to change its IP address without having to
reload the res_rtp_asterisk module.

The refresh of the name resolution occurs first when the module is
loaded, then recurringly, slightly after the previous DNS answer TTL
expires.

ASTERISK-29508 #close

Change-Id: I7955a046293f913ba121bbd82153b04439e3465f
2021-09-01 10:29:39 -05:00
Alexander Traud 63d27af3ca res_rtp_asterisk: sqrt(.) requires the header math.h.
ASTERISK-29616

Change-Id: I6c01623926bf10ccac32612687a50fdab3ba0900
2021-08-25 18:04:36 -05:00
Alexander Traud fbdd8a7f8a
dialplan: Add one static and fix two whitespace errors.
Change-Id: Ia14d515ab63e773097adc6af772ca7123a392f83
2021-08-25 16:29:09 +02:00
George Joseph 84f2bf4307 res_pjproject: Allow mapping to Asterisk TRACE level
Allow mapping pjproject log messages to the Asterisk TRACE
log level.  The defaults were also changes to log pjproject
levels 3,4 to DEBUG and 5,6 to TRACE.  Previously 3,4,5,6
all went to DEBUG.

ASTERISK-29582

Change-Id: I859a37a8dec263ed68099709cfbd3e665324c72d
2021-08-19 13:00:31 -05:00
Alexander Traud 137bd7fe65 BuildSystem: Remove two dead exceptions for compiler Clang.
Commit 305ce3d added -Wno-parentheses-equality to Makefile.rules,
turning the previous two warning suppressions from commit e9520db
redundant. Let us remove the latter.

Change-Id: I0b471254b31e6e05902062761dded4b3e626c7ac
2021-08-19 09:02:41 -05:00
Joshua C. Colp 0ddeac0e36 res_monitor: Disable building by default.
ASTERISK-29602

Change-Id: I6f0af0a959409cdbc6b185b1604301bafc872a5a
2021-08-18 11:15:11 -05:00
Joshua C. Colp 800fd84af6 res_config_sqlite: Remove deprecated module.
ASTERISK-29598

Change-Id: I8ef17023f55bf01f2e309b06f4778a8ca7252c91
2021-08-17 10:38:34 -03:00
Sean Bright 743e057bb4 mgcp: Remove dead debug code
ASTERISK-20339 #close

Change-Id: I36f364aaa1971241d8f3ea1a5909b463d185a2d5
2021-08-16 12:33:09 -05:00
Joshua C. Colp 93870e7bb4 policy: Deprecate modules and add versions to others.
app_meetme is deprecated in 19, to be removed in 21.
app_osplookup is deprecated in 19, to be removed in 21.
chan_alsa is deprecated in 19, to be removed in 21.
chan_mgcp is deprecated in 19, to be removed in 21.
chan_skinny is deprecated in 19, to be removed in 21.
res_pktccops is deprecated in 19, to be removed in 21.
app_macro was deprecated in 16, to be removed in 21.
chan_sip was deprecated in 17, to be removed in 21.
res_monitor was deprecated in 16, to be removed in 21.

ASTERISK-29548
ASTERISK-29549
ASTERISK-29550
ASTERISK-29551
ASTERISK-29552
ASTERISK-29553
ASTERISK-29558
ASTERISK-29567
ASTERISK-29572

Change-Id: Ic3bee31a10d42c4b3bbc913d893f7b2a28a27131
2021-08-11 08:14:51 -05:00
Igor Goncharovsky 4f437ea1f4 res_pjsip_header_funcs: Add PJSIP_HEADERS() ability to read header by pattern
PJSIP currently does not provide a function to replace SIP_HEADERS() function to get a list of headers from INVITE request.
It may be used to get all X- headers in case the actual set and names of headers unknown.

ASTERISK-29389

Change-Id: Ic09d395de71a0021e0d6c5c29e1e19d689079f8b
2021-08-03 08:47:53 -05:00
Rijnhard Hessel 728a52fb61 res_statsd: handle non-standard meter type safely
Meter types are not well supported,
lacking support in telegraf, datadog and the official statsd servers.
We deprecate meters and provide a compliant fallback for any existing usages.

A flag has been introduced to allow meters to fallback to counters.


ASTERISK-29513

Change-Id: I5fcb385983a1b88f03696ff30a26b55c546a1dd7
2021-08-03 08:12:33 -05:00
Sean Bright 6428124b06 res_http_media_cache: Cleanup audio format lookup in HTTP requests
Asterisk first looks at the end of the URL to determine the file
extension of the returned audio, which in many cases will not work
because the URL may end with a query string or a URL fragment. If that
fails, Asterisk then looks at the Content-Type header and then finally
parses the URL to get the extension.

The order has been changed such that we look at the Content-Type
header first, followed by looking for the extension of the parsed
URL. We no longer look at the end of the URL, which was error prone.

ASTERISK-29527 #close

Change-Id: I1e3f83b339ef2b80661704717c23568536511032
2021-08-02 13:21:13 -05:00
Joshua C. Colp ec16d2ecbd AST-2021-007 - res_pjsip_session: Don't offer if no channel exists.
If a re-INVITE is received after we have sent a BYE request then it
is possible for no channel to be present on the session. If this
occurs we allow PJSIP to produce the offer instead. Since the call
is being hung up if it produces an incorrect offer it doesn't
actually matter. This also ensures that code which produces SDP
does not need to handle if a channel is not present.

ASTERISK-29381

Change-Id: I673cb88c432f38f69b2e0851d55cc57a62236042
2021-07-22 13:26:01 -05:00
Andre Barbosa f4d3f021f9 res_stasis_playback: Check for chan hangup on play_on_channels
Verify `ast_check_hangup` before looping to the next sound file.
If the call is already hangup we just break the cycle.
It also ensures that the PlaybackFinished event is sent if the call was hangup.

This is also use-full when we are playing a big list of file for a channel that is hangup.
Before this patch Asterisk will give a warning for every sound not played and fire a PlaybackStart for every sound file on the list tried to be played.

With the patch we just break the playback cycle when the chan is hangup.

ASTERISK-29501 #close

Change-Id: Ic4e1c01b974c9a1f2d9678c9d6b380bcfc69feb8
2021-07-20 13:18:40 -05:00
Sean Bright d5bb27a06f res_http_media_cache.c: Fix merge errors from 18 -> master
ASTERISK-27871 #close

Change-Id: I6624f2d3a57f76a89bb372ef54a124929a0338d7
2021-07-19 12:38:25 -05:00
Sean Bright 237285a9a8 res_pjsip_stir_shaken: RFC 8225 compliance and error message cleanup.
From RFC 8225 Section 5.2.1:

    The "dest" claim is a JSON object with the claim name of "dest"
    and MUST have at least one identity claim object.  The "dest"
    claim value is an array containing one or more identity claim JSON
    objects representing the destination identities of any type
    (currently "tn" or "uri").  If the "dest" claim value array
    contains both "tn" and "uri" claim names, the JSON object should
    list the "tn" array first and the "uri" array second.  Within the
    "tn" and "uri" arrays, the identity strings should be put in
    lexicographical order, including the scheme-specific portion of
    the URI characters.

Additionally, make it clear that there was a failure to sign the JWT
payload and not necessarily a memory allocation failure.

Change-Id: Ia8733b861aef6edfaa9c2136e97b447a01578dc9
2021-07-19 10:48:06 -05:00
Sean Bright d568326807 res_http_media_cache.c: Parse media URLs to find extensions.
Use cURL's URL parsing API, falling back to the urlparser library, to
parse playback URLs in order to find their file extensions.

For backwards compatibility, we first look at the full URL, then at
any Content-Type header, and finally at just the path portion of the
URL.

ASTERISK-27871 #close

Change-Id: I16d0682f6d794be96539261b3e48f237909139cb
2021-07-19 06:53:50 -05:00
Igor Goncharovsky 99d44f0c5a res_ari: Fix audiosocket segfault
Add check that data parameter specified when audiosocket used for externalMedia.

ASTERISK-29514 #close

Change-Id: Ie562f03c5d6c3835a3631f376b3d43e75b8f9617
2021-07-08 18:31:15 -05:00
Sean Bright 0ac9c83561 res_pjsip_config_wizard.c: Add port matching support.
In f8b0c2c9 we added support for port numbers in 'match' statements
but neglected to include that support in the PJSIP config wizard.

The removed code would have also prevented IPv6 addresses from being
successfully used in the config wizard as well.

ASTERISK-29503 #close

Change-Id: Idd5bbfd48009e7a741757743dbaea68e2835a34d
2021-07-08 10:31:35 -05:00
Andre Barbosa a47308ccb2 res_stasis_playback: Send PlaybackFinish event only once for errors
When we try to play a list of sound files in the same Play command,
we get only one PlaybackFinish event, after all sounds are played.

But in the case where the Play fails (because channel is destroyed
for example), Asterisk will send one PlaybackFinish event for each
sound file still to be played. If the list is big, Asterisk is
sending many events.

This patch adds a failed state so we can understand that the play
failed. On that case we don't send the event, if we still have a
list of sounds to be played.

When we reach the last sound, we send the PlaybackFinish with
the failed state.

ASTERISK-29464 #close

Change-Id: I4c2e5921cc597702513af0d7c6c2c982e1798322
2021-06-24 10:43:19 -05:00
Bernd Zobl c30f68a57b res_pjsip_sdp_rtp: Evaluate remotely held for Session Progress
With the fix for ASTERISK_28754 channels are no longer put on hold if an
outbound INVITE is answered with a "Session Progress" containing
"inactive" audio.

The previous change moved the evaluation of the media attributes to
`negotiate_incoming_sdp_stream()` to have the `remotely_held` status
available when building the SDP in `create_outgoing_sdp_stream()`.
This however means that an answer to an outbound INVITE, which does not
traverse `negotiate_incoming_sdp_stream()`, cannot set the
`remotely_held` status anymore.

This change moves the check so that both, `negotiate_incoming_sdp_stream()` and
`apply_negotiated_sdp_stream()` can do the checks.

ASTERISK-29479

Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75
2021-06-17 07:24:09 -05:00
George Joseph b7027de195 res_pjsip_messaging: Overwrite user in existing contact URI
When the MessageSend destination is in the form
PJSIP/<number>@<endpoint> and the endpoint's contact
URI already has a user component, that user component
will now be replaced with <number> when creating the
request URI.

ASTERISK_29404

Change-Id: I80e5910fa25c803d1440da0594a0d6b34b6b4ad5
2021-06-16 09:29:30 -05:00
Bernd Zobl f160725fc4 res_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter
Set preferred transport when querying the local address to use in
filter_on_tx_messages(). This prevents the module to erroneously select
the wrong transport if more than one transports of the same type (TCP or
TLS) are configured.

ASTERISK-29241

Change-Id: I598e60257a7f92b29efce1fb3e9a2fc06f1439b6
2021-06-15 09:06:36 -05:00
Sean Bright c0fc8adbb6 menuselect: Fix description of several modules.
The text description needs to be the last thing on the AST_MODULE_INFO
line to be pulled in properly by menuselect.

Change-Id: I0c913e36fea8b661f42e56920b6c5513ae8fd832
2021-06-10 16:30:28 -05:00
Naveen Albert 1b38e89734 res_pjsip_dtmf_info: Hook flash
Adds hook flash recognition support
for application/hook-flash.

ASTERISK-29460

Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
2021-06-08 15:47:19 -05:00
George Joseph c3654a9959 res_pjsip_messaging: Refactor outgoing URI processing
* Implemented the new "to" parameter of the MessageSend()
   dialplan application.  This allows a user to specify
   a complete SIP "To" header separate from the Request URI.

 * Completely refactored the get_outbound_endpoint() function
   to actually handle all the destination combinations that
   we advertized as supporting.

 * We now also accept a destination in the same format
   as Dial()...  PJSIP/number@endpoint

 * Added lots of debugging.

ASTERISK-29404
Reported by Brian J. Murrell

Change-Id: I67a485196d9199916468f7f98bfb9a0b993a4cce
2021-05-27 11:16:38 -05:00
Ben Ford 12e8600849 STIR/SHAKEN: Add Date header, dest->tn, and URL checking.
STIR/SHAKEN requires a Date header alongside the Identity header, so
that has been added. Still on the outgoing side, we were missing the
dest->tn section of the JSON payload, so that has been added as well.
Moving to the incoming side, URL checking has been added to the public
cert URL to ensure that it starts with http.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Idee5b1b5e45bc3b483b3070e46ce322dca5b3f1c
2021-05-26 12:45:54 -05:00
Joshua C. Colp 44fde9f428 res_pjsip: On partial transport reload also move factories.
For connection oriented transports PJSIP uses factories to
produce transports. When doing a partial transport reload
we need to also move the factory of the transport over so
that anything referencing the transport (such as an endpoint)
has the factory available.

ASTERISK-29441

Change-Id: Ieae0fb98eab2d9257cad996a1136e5a62d307161
2021-05-26 11:24:15 -05:00
Evgenios_Greek 2193cf1b26 stasis: Fix "FRACK!, Failed assertion bad magic number" when unsubscribing
When unsubscribing from an endpoint technology a FRACK
would occur due to incorrect reference counting. This fixes
that issue, along with some other issues.

Fixed a typo in get_subscription when calling ao2_find as it
needed to pass the endpoint ID and not the entire object.

Fixed scenario where a subscription would get returned when
it shouldn't have been when searching based on endpoint
technology.

A doulbe unreference has also been resolved by only explicitly
releasing the reference held by tech_subscriptions.

ASTERISK-28237 #close
Reported by: Lucas Tardioli Silveira

Change-Id: Ia91b15f8e5ea68f850c66889a6325d9575901729
2021-05-26 11:13:58 -05:00
Joseph Nadiv 98e4119642 res_pjsip.c: Support endpoints with domain info in username
In multidomain environments, it is desirable to create
PJSIP endpoints with the domain info in the endpoint name
in pjsip_endpoint.conf.  This resulted in an error with
registrations, NOTIFY, and OPTIONS packet generation.

This commit will detect if there is an @ in the endpoint
identifier and generate the URI accordingly so NOTIFY and
OPTIONS From headers will generate correctly.

ASTERISK-28393

Change-Id: I96f8d01dfdd5573ba7a28299e46271dd4210b619
2021-05-26 10:37:39 -05:00
Joshua C. Colp a985e5069c res_rtp_asterisk: Set correct raddr port on RTCP srflx candidates.
RTCP ICE candidates use a base address derived from the RTP
candidate. The port on the base address was not being updated to
the RTCP port.

This change sets the base port to the RTCP port and all is well.

ASTERISK-29433

Change-Id: Ide2d2115b307bfd3c2dfbc4d187515d724519040
2021-05-26 10:35:44 -05:00
Jeremy Lainé d162789c4d res_rtp_asterisk: make it possible to remove SOFTWARE attribute
By default Asterisk reports the PJSIP version in a SOFTWARE attribute
of every STUN packet it sends. This may not be desired in a production
environment, and RFC5389 recommends making the use of the SOFTWARE
attribute a configurable option:

https://datatracker.ietf.org/doc/html/rfc5389#section-16.1.2

This patch adds a `stun_software_attribute` yes/no option to make it
possible to omit the SOFTWARE attribute from STUN packets.

ASTERISK-29434

Change-Id: Id3f2b1dd9584536ebb3a1d7e8395fd8b3e46860b
2021-05-21 10:37:23 -05:00
George Joseph 9cc1d6fc22 res_pjsip_outbound_authenticator_digest: Be tolerant of RFC8760 UASs
RFC7616 and RFC8760 allow more than one WWW-Authenticate or
Proxy-Authenticate header per realm, each with different digest
algorithms (including new ones like SHA-256 and SHA-512-256).
Thankfully however a UAS can NOT send back multiple Authenticate
headers for the same realm with the same digest algorithm.  The
UAS is also supposed to send the headers in order of preference
with the first one being the most preferred.  We're supposed to
send an Authorization header for the first one we encounter for a
realm that we can support.

The UAS can also send multiple realms, especially when it's a
proxy that has forked the request in which case the proxy will
aggregate all of the Authenticate headers and then send them all
back to the UAC.

It doesn't stop there though... Each realm can require a
different username from the others.  There's also nothing
preventing each digest algorithm from having a unique password
although I'm not sure if that adds any benefit.

So now... For each Authenticate header we encounter, we have to
determine if we support the digest algorithm and, if not, just
skip the header.  We then have to find an auth object that
matches the realm AND the digest algorithm or find a wildcard
object that matches the digest algorithm. If we find one, we add
it to the results vector and read the next Authenticate header.
If the next header is for the same realm AND we already added an
auth object for that realm, we skip the header. Otherwise we
repeat the process for the next header.

In the end, we'll have accumulated a list of credentials we can
pass to pjproject that it can use to add Authentication headers
to a request.

NOTE: Neither we nor pjproject can currently handle digest
algorithms other than MD5.  We don't even have a place for it in
the ast_sip_auth object. For this reason, we just skip processing
any Authenticate header that's not MD5.  When we support the
others, we'll move the check into the loop that searches the
objects.

Changes:

 * Added a new API ast_sip_retrieve_auths_vector() that takes in
   a vector of auth ids (usually supplied on a call to
   ast_sip_create_request_with_auth()) and populates another
   vector with the actual objects.

 * Refactored res_pjsip_outbound_authenticator_digest to handle
   multiple Authenticate headers and set the stage for handling
   additional digest algorithms.

 * Added a pjproject patch that allows them to ignore digest
   algorithms they don't support.  This patch has already been
   merged upstream.

 * Updated documentation for auth objects in the XML and
   in pjsip.conf.sample.

 * Although res_pjsip_authenticator_digest isn't affected
   by this change, some debugging and a testsuite AMI event
   was added to facilitate testing.

Discovered during OpenSIPit 2021.

ASTERISK-29397

Change-Id: I3aef5ce4fe1d27e48d61268520f284d15d650281
2021-05-20 11:13:38 -05:00
Joseph Nadiv 3cccdf6d98 res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml
RFC 4235 Section 4.1.6 describes XML elements that should be
sent to subscribed endpoints to identify the local and remote
participants in the dialog.

This patch adds this functionality to PJSIP by iterating through the
ringing channels causing the NOTIFY, and inserts the channel info
into the dialog so that information is properly passed to the endpoint
in dialog-info+xml.

ASTERISK-24601
Patch submitted: Joshua Elson
Modified by: Joseph Nadiv and Sean Bright
Tested by: Joseph Nadiv

Change-Id: I20c5cf5b45f34d7179df6573c5abf863eb72964b
2021-05-19 12:17:09 -05:00
Ben Ford 0564d12280 STIR/SHAKEN: Switch to base64 URL encoding.
STIR/SHAKEN encodes using base64 URL format. Currently, we just use
base64. New functions have been added that convert to and from base64
encoding.

The origid field should also be an UUID. This means there's no reason to
have it as an option in stir_shaken.conf, as we can simply generate one
when creating the Identity header.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Icf094a2a54e87db91d6b12244c9f5ba4fc2e0b8c
2021-05-12 06:42:55 -05:00
Ben Ford 05f7bc9c66 STIR/SHAKEN: OPENSSL_free serial hex from openssl.
We're getting the serial number of the certificate from openssl and
freeing it with ast_free(), but it needs to be freed with OPENSSL_free()
instead. Now we duplicate the string and free the one from openssl with
OPENSSL_free(), which means we can still use ast_free() on the returned
string.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia6e1a4028c1933a0e1d204b769ebb9f5a11f00ab
2021-05-11 13:15:11 -05:00
Ben Ford 259ecfa289 STIR/SHAKEN: Fix certificate type and storage.
During OpenSIPit, we found out that the public certificates must be of
type X.509. When reading in public keys, we use the corresponding X.509
functions now.

We also discovered that we needed a better naming scheme for the
certificates since certificates with the same name would cause issues
(overwriting certs, etc.). Now when we download a public certificate, we
get the serial number from it and use that as the name of the cached
certificate.

The configuration option public_key_url in stir_shaken.conf has also
been renamed to public_cert_url, which better describes what the option
is for.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia00b20835f5f976e3603797f2f2fb19672d8114d
2021-05-11 09:29:57 -05:00
George Joseph 09303e8e22 Updates for the MessageSend Dialplan App
Enhancements:

 * The MessageSend dialplan application now takes an optional
   third argument that can set the message's "To" field on
   outgoing messages.  It's an alternative to using the
   MESSAGE(to) dialplan function.

   NOTE: No channel driver currently implements this field.  A
   follow-on commit for res_pjsip_messaging will implement it for
   the chan_pjsip channel driver.

 * To prevent confusion with the first argument, currently named
   "to", it's been renamed to "destination". Its function,
   creating the request URI, hasn't changed.

 * The documentation for MessageSend was updated to be
   more clear about the parameters and how they interact
   the MESSAGE() dialplan function.

 * With the rename of MessageSend's first parameter, and the fact
   that message.c references <info> elements in chan_sip.c,
   res_pjsip_messaging.c and res_xmpp, they each needed
   documentation updates to use MessageDestinationInfo instead of
   MessageToInfo.

 * appdocsxml.dtd was updated to include a missing element
   declaration for "dataType".  This was showing up as an error
   in Eclipse's dtd editor.

 * Despite the changes in this commit, there should be
   no impact to current users of MessageSend.

Change-Id: I6fb5b569657a02866a66ea352fd53d30d8ac965a
2021-05-06 06:23:51 -05:00
Sean Bright b1807d440e res_rtp_asterisk: More robust timestamp checking
We assume that a timestamp value of 0 represents an 'uninitialized'
timestamp, but 0 is a valid value. Add a simple wrapper to be able to
differentiate between whether the value is set or not.

This also removes the fix for ASTERISK~28812 which should not be
needed if we are checking the last timestamp appropriately.

ASTERISK-29030 #close

Change-Id: Ie70d657d580d9a1f2877e25a6ef161c5ad761cf7
2021-04-30 09:03:39 -05:00
Sean Bright 4a843e00ef res_pjsip.c: OPTIONS processing can now optionally skip authentication
ASTERISK-27477 #close

Change-Id: I68f6715bba92a525149e35d142a49377a34a1193
2021-04-28 16:39:06 -05:00
George Joseph 512d38868c res_pjsip: Update documentation for the auth object
Change-Id: I2f76867ce02ec611964925159be099de83346e38
2021-04-21 09:31:12 -05:00
Ben Ford 45a1977de4 res_aeap: Add basic config skeleton and CLI commands.
Added support for a basic AEAP configuration read from aeap.conf.
Also added 2 CLI commands for showing individual configurations as
well as all of them: aeap show server <id> and aeap show servers.

Only one configuration option is required at the moment, and that one is
server_url. It must be a websocket URL. The other option, codecs, is
optional and will be used over the codecs specified on the endpoint if
provided.

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=45482453

Change-Id: I567ac5148c92b98d29d2ad83421b416b75ffdaa3
2021-04-19 10:09:04 -05:00
George Joseph 53c702e1cc res_prometheus: Clone containers before iterating
The channels, bridges and endpoints scrape functions were
grabbing their respective global containers, getting the
count of entries, allocating metric arrays based on
that count, then iterating over the container.  If the
global container had new objects added after the count
was taken and the metric arrays were allocated, we'd run
out of metric entries and attempt to write past the end
of the arrays.

Now each of the scape functions clone their respective
global containers and all operations are done on the
clone.  Since the clone is stable between getting the
count and iterating over it, we can't run past the end
of the metrics array.

ASTERISK-29130
Reported-By: Francisco Correia
Reported-By: BJ Weschke
Reported-By: Sébastien Duthil

Change-Id: If0c8e40853bc0e9429f2ba9c7f5f358d90c311af
2021-04-02 07:37:41 -05:00
Kevin Harwell 0fc906a5e1 res_rtp_asterisk: Fix standard deviation calculation
For some input to the standard deviation algorithm extremely large,
and wrong numbers were being calculated.

This patch uses a new formula for correctly calculating both the
running mean and standard deviation for the given inputs.

ASTERISK-29364 #close

Change-Id: Ibc6e18be41c28bed3fde06d612607acc3fbd621f
2021-04-01 08:43:20 -05:00
Kevin Harwell c4a376aac2 res_rtp_asterisk: Don't count 0 as a minimum lost packets
The calculated minimum lost packets represents the lowest number of
lost packets missed during an RTCP report interval. Zero of course
is the lowest, but the idea is that this value contain the lowest
number of lost packets once some have been missed.

This patch checks to make sure the number of lost packets over an
interval is not zero before checking and setting the minimum value.

Also, this patch updates the rtp lost packet test to check for
packet loss over several reports vs one.

Change-Id: I07d6e21cec61e289c2326138d6bcbcb3c3d5e008
2021-03-31 15:09:39 -05:00
Kevin Harwell 65b68fd060 res_rtp_asterisk: Statically declare rtp_drop_packets_data object
This patch makes the drop_packets_data object static.

Change-Id: If4f9b21fa0c47d41a35b6b05941d978efb4da87b
2021-03-31 14:09:01 -06:00
Joshua C. Colp 8bd13a995a res_rtp_asterisk: Only raise flash control frame on end.
Flash in RTP is conveyed the same as DTMF, just with a
specific digit. In Asterisk however we do flash as a
single control frame.

This change makes it so that only on end do we provide
the flash control frame to the core. Previously we would
provide a flash control frame on both begin and end,
causing flash to work improperly.

ASTERISK-29373

Change-Id: I1accd9c6e859811336e670e698bd8bd124f33226
2021-03-31 11:55:12 -05:00
Kevin Harwell b86f1ef54c res_rtp_asterisk: Add a DEVMODE RTP drop packets CLI command
This patch makes it so when Asterisk is compiled in DEVMODE a CLI
command is available that allows someone to drop incoming RTP
packets. The command allows for dropping of packets once, or on a
timed interval (e.g. drop 10 packets every 5 seconds). A user can
also specify to drop packets by IP address.

Change-Id: I25fa7ae9bad6ed68e273bbcccf0ee51cae6e7024
2021-03-31 11:54:17 -05:00
Joshua C. Colp 623abc2b6a res_pjsip: Give error when TLS transport configured but not supported.
Change-Id: I058af496021ff870ccec2d8cbade637b348ab80b
2021-03-31 10:17:03 -05:00
George Joseph a03a05195a res_pjsip_session: Make reschedule_reinvite check for NULL topologies
When the check for equal topologies was added to reschedule_reinvite()
it was assumed that both the pending and active media states would
actually have non-NULL topologies.  We since discovered this isn't
the case.

We now only test for equal topologies if both media states have
non-NULL topologies.  The logic had to be rearranged a bit to make
sure that we cloned the media states if their topologies were
non-NULL but weren't equal.

ASTERISK-29215

Change-Id: I61313cca7fc571144338aac826091791b87b6e17
2021-03-22 09:39:28 -05:00
Joshua C. Colp 71dfbdc7b9 res_pjsip: Add support for partial transport reload.
Some configuration items for a transport do not result in
the underlying transport changing, but instead are just
state we keep ourselves and use. It is perfectly reasonable
to change these items.

These include local_net and external_* information.

ASTERISK-29354

Change-Id: I027857ccfe4419f460243e562b5f098434b3d43a
2021-03-22 04:09:18 -05:00
Joshua C. Colp cce5ee5b7a res_rtp_asterisk: Force resync on SSRC change.
When an SSRC change occurs the timestamps are likely
to change as well. As a result we need to reset the
timestamp mapping done in the calc_rxstamp function
so that they map properly from timestamp to real
time.

This previously occurred but due to packet
retransmission support the explicit setting
of the marker bit was not effective.

ASTERISK-29352

Change-Id: I2d4c8f93ea24abc1030196706de2d70facf05a5a
2021-03-17 11:43:35 -06:00
Joshua C. Colp 149e5e5b86 xml: Embed module information into core XML documentation.
This change embeds the MODULEINFO block of modules
into the core XML documentation. This provides a shared
mechanism for use by both menuselect and Asterisk for
information and a definitive source of truth.

ASTERISK-29335

Change-Id: Ifbfd5c700049cf320a3e45351ac65dd89bc99d90
2021-03-16 10:30:43 -05:00
Joshua C. Colp 7438586d8e documentation: Fix non-matching module support levels.
Some modules have a different support level documented in their
MODULEINFO XML and Asterisk module definition. This change
brings the two in sync for the modules which were not matching.

ASTERISK-29336

Change-Id: If2f819103d4a271e2e0624ef4db365e897fa3d35
2021-03-16 10:26:16 -05:00
Jaco Kroon 41389bfdbd func_callerid+res_agi: Fix compile errors related to -Werror=zero-length-bounds
Change-Id: I75152cece8a00b7523d542e5ac22796f9595692b
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-03-10 08:57:27 -06:00
Alexander Traud 1ae40e502d res_format_attr_*: Parameter Names are Case-Insensitive.
see RFC 4855:
parameter names are case-insensitive both in media type strings and
in the default mapping to the SDP a=fmtp attribute.

This change is required for H.263+ because some implementations are
known to use even mixed-case. This does not fix ASTERISK~29268 because
H.264 was not fixed. This approach here lowers/uppers both parameter
names and parameter values. H.264 needs a different approach because
one of its parameter values is not case-insensitive:
sprop-parameter-sets is Base64.

Change-Id: Idf2a73457be231647aed3c87b1da197afba86892
2021-03-10 04:22:36 -06:00
Sean Bright df37b8181c res_musiconhold.c: Plug ref leak caused by ao2_replace() misuse.
ao2_replace() bumps the reference count of the object that is doing the
replacing, which is not what we want. We just want to drop the old ref
on the old object and update the pointer to point to the new object.

Pointed out by George Joseph in #asterisk-dev

Change-Id: Ie8167ed3d4b52b9d1ea2d785f885e8c27206743d
2021-03-08 17:21:39 -06:00
Torrey Searle 8c247e2a94 res/res_rtp_asterisk: generate new SSRC on native bridge end
For RTCP to work, we update the ssrc to be the one corresponding to
the native bridge while active.  However when the bridge ends we
should generate a new SSRC as the sequence numbers will not continue
from the native bridge left off.

ASTERISK-29300 #close

Change-Id: I23334b6934d2bf6490bda4bbf6414d96b8d17d10
2021-03-08 08:14:34 -06:00
Joshua C. Colp 304f8ddfb2 sorcery: Add support for more intelligent reloading.
Some sorcery objects actually contain dynamic content
that can change despite the underlying configuration
itself not changing. A good example of this is the
res_pjsip_endpoint_identifier_ip module which allows
specifying hostnames. While the configuration may not
change between reloads the DNS information of the
hostnames can.

This change adds the ability for a sorcery object to be
marked as having dynamic contents which is then taken
into account when reloading by the sorcery file based
config module. If there is an object with dynamic content
then a reload will be forced while if there are none
then the existing behavior of not reloading occurs.

ASTERISK-29321

Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
2021-03-05 10:32:28 -06:00
George Joseph 607603cf89 res_pjsip_refer: Move the progress dlg release to a serializer
Although the dlg session count was incremented in a pjsip servant
thread, there's no guarantee that the last thread to unref this
progress object was one.  Before we decrement, we need to make
sure that this is either a servant thread or that we push the
decrement to a serializer that is one.

Because pjsip_dlg_dec_session requires the dialog lock, we don't
want to wait on the task to complete if we had to push it to a
serializer.

Change-Id: I8ff2d5d94be3ff04298394070434e22a7d3cbc41
2021-03-05 08:19:20 -06:00
Joshua C. Colp 6f67f24afd res_pjsip_registrar: Include source IP and port in log messages.
When registering it can be useful to see the source IP address and
port in cases where multiple devices are using the same endpoint
or when anonymous is in use.

ASTERISK-29325

Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0
2021-03-05 08:14:20 -06:00
Ben Ford fd560ad9fa AST-2021-006 - res_pjsip_t38.c: Check for session_media on reinvite.
When Asterisk sends a reinvite negotiating T38 faxing, it's possible a
crash can occur if the response contains a m=image and zero port. The
reinvite callback code now checks session_media to see if it is null or
not before trying to access the udptl variable on it.

ASTERISK-29305

Change-Id: I1dfc51c5fa586e38579ede4bc228edee213ccaa9
2021-03-04 07:58:34 -07:00
Alexander Traud a34e7de61c res_format_attr_h263: Generate valid SDP fmtp for H.263+.
Fixed:
* RFC 4629 does not allow the value "0" for MPI, K, and N.
* Allow value "0" for PAR.
* BPP is printed only when specified because "0" has a meaning.

New:
* Added CPCF and MaxBR.
* Some implementations provide CIF without MPI: a=fmtp:xx CIF;F=1
  Although a violation of RFC 3555 section 3, we can support that.

Changed:
* Resorts the CIFs from large to small which partly fixes ASTERISK~29267.

Change-Id: I95a650c715007b8dde11a77cb37d9c6c123a441e
2021-03-03 12:27:59 -06:00
Joshua C. Colp 2c1b6b7b15 res_pjsip_nat: Don't rewrite Contact on REGISTER responses.
When sending a SIP response to an incoming REGISTER request
we don't want to change the Contact header as it will
contain the Contacts registered to the AOR and not our own
Contact URI.

ASTERISK-29235

Change-Id: I35a0723545281dd01fcd5cae497baab58720478c
2021-03-03 12:08:40 -06:00
Salah Ahmed 5d42dd2e6a res_rtp_asterisk: Check remote ICE reset and reset local ice attrb
This change will check is the remote ICE session got reset or not by
checking the offered ufrag and password with session. If the remote ICE
reset session then Asterisk reset its local ufrag and password to reject
binding request with Old ufrag and Password.

ASTERISK-29266

Change-Id: I9c55e79a7af98a8fbb497d336b828ba41bc34eeb
2021-03-03 09:53:59 -06:00
Nick French 8f6e0f9367 res_pjsip: dont return early from registration if init auth fails
If set_outbound_initial_authentication_credentials() fails,
handle_client_registration() bails early without creating or
sending a register message.

[set_outbound_initial_authentication_credentials() failures
can occur during the process of retrieving an oauth access
token.]

The return from handle_client_registration is ignored, so
returning an error doesn't do any good.

This is a real problem when the registration request is a
re-register, because then the registration will still be
marked 'active' despite the re-register never being sent at all.

So instead, log a warning but let the registration be created
and sent (and probably fail) and follow the normal registration
failed retry/abort logic.

ASTERISK-29315 #close

Change-Id: I2e03b1ea7fba1fa1a8279086aa4b17679e7fa7fa
2021-03-02 11:18:00 -06:00
Alexei Gradinari d2f623bae2 res_fax: validate the remote/local Station ID for UTF-8 format
If the remote Station ID contains invalid UTF-8 characters
the asterisk fails to publish the Stasis and ReceiveFax status messages.

json.c: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
0: /usr/sbin/asterisk(ast_json_vpack+0x98) [0x4f3f28]
1: /usr/sbin/asterisk(ast_json_pack+0x8c) [0x4f3fcc]
2: /usr/sbin/asterisk(ast_channel_publish_varset+0x2b) [0x57aa0b]
3: /usr/sbin/asterisk(pbx_builtin_setvar_helper+0x121) [0x530641]
4: /usr/lib64/asterisk/modules/res_fax.so(+0x44fe) [0x7f27f4bff4fe]
...
stasis_channels.c: Error creating message

json.c: Error building JSON from '{s: s, s: s, s: s, s: s, s: s, s: s, s: o}': Invalid UTF-8 string.
0: /usr/sbin/asterisk(ast_json_vpack+0x98) [0x4f3f28]
1: /usr/sbin/asterisk(ast_json_pack+0x8c) [0x4f3fcc]
2: /usr/lib64/asterisk/modules/res_fax.so(+0x5acd) [0x7f27f4c00acd]
...
res_fax.c: Error publishing ReceiveFax status message

This patch replaces the invalid UTF-8 Station IDs with an empty string.

ASTERISK-29312 #close

Change-Id: Ieb00b6ecf67db3bfca787649caa8517f29d987db
2021-03-02 11:16:48 -06:00
George Joseph 4c9c5c985b res_pjsip_refer: Refactor progress locking and serialization
Although refer_progress_notify() always runs in the progress
serializer, the pjproject evsub module itself can cause the
subscription to be destroyed which then triggers
refer_progress_on_evsub_state() to clean it up.  In this case,
it's possible that refer_progress_notify() could get the
subscription pulled out from under it while it's trying to use
it.

At one point we tried to have refer_progress_on_evsub_state()
push the cleanup to the serializer and wait for its return before
returning to pjproject but since pjproject calls its state
callbacks with the dialog locked, this required us to unlock the
dialog while waiting for the serialized cleanup, then lock it
again before returning to pjproject. There were also still some
cases where other callers of refer_progress_notify() weren't
using the serializer and crashes were resulting.

Although all callers of refer_progress_notify() now use the
progress serializer, we decided to simplify the locking so we
didn't have to unlock and relock the dialog in
refer_progress_on_evsub_state().

Now, refer_progress_notify() holds the dialog lock for its
duration and since pjproject also holds the dialog lock while
calling refer_progress_on_evsub_state() (which does the cleanup),
there should be no more chances for the subscription to be
cleaned up while still being used to send NOTIFYs.

To be extra safe, we also now increment the session count on
the dialog when we create a progress object and decrement
the count when the progress is destroyed.

ASTERISK-29313

Change-Id: I97a8bb01771a3c85345649b8124507f7622a8480
2021-02-26 08:13:08 -06:00
Kevin Harwell e5e49d7ecd res_rtp_asterisk: Add packet subtype during RTCP debug when relevant
For some RTCP packet types the report count is actually the packet's subtype.
This was not being reflected in the packet debug output.

This patch makes it so for some RTCP packet types a "Packet Subtype" is
now output in the debug replacing the "Reception reports" (i.e count).

Change-Id: Id4f4b77bb37077a4c4f039abd6a069287bfefcb8
2021-02-26 08:06:28 -06:00
Joshua C. Colp a81d07ea56 res_pjsip_session: Always produce offer on re-INVITE without SDP.
When PJSIP receives a re-INVITE without an SDP offer the INVITE
session library will first call the on_create_offer callback and
if unavailable then use the active negotiated SDP as the offer.

In some cases this would result in a different SDP then was
previously used without an incremented SDP version number. The two
known cases are:

1. Sending an initial INVITE with a set of codecs and having the
remote side answer with a subset. The active negotiated SDP would
have the pruned list but would not have an incremented SDP version
number.

2. Using re-INVITE for unhold. We would modify the active negotiated
SDP but would not increment the SDP version.

To solve these, and potential other unknown cases, the on_create_offer
callback has now been implemented which produces a fresh offer with
incremented SDP version number. This better fits within the model
provided by the INVITE session library.

ASTERISK-28452

Change-Id: I2d81048d54edcb80fe38fdbb954a86f0a58281a1
2021-02-25 08:49:33 -06:00
Jaco Kroon 6d2614be68 res_odbc_transaction: correctly initialise forcecommit value from DSN.
Also improve the in-process documentation to clarify that the value is
initialised from the DSN and not default false, but that the DSN's value
is default false if unset.

ASTERISK-29311 #close

Change-Id: I46e2379f7b0656034442bce77cb37ccd4e61098d
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-02-25 08:45:30 -06:00
Ben Ford e1126ffc10 res_pjsip_session.c: Check topology on re-invite.
Removes an unnecessary check for the conditional that compares the
stream topologies to see if they are equal to suppress re-invites. This
was a problem when a Digium phone received an INVITE that offered codecs
different than what it supported, causing Asterisk to send the
re-invite.

ASTERISK-29303

Change-Id: I04dc91befb2387904e28a9aaeaa3bcdbcaa7fa63
2021-02-25 08:43:33 -06:00
Boris P. Korzun b046e960af res_config_pgsql: Limit realtime_pgsql() to return one (no more) record.
Added a SELECT 'LIMIT' clause to realtime_pgsql() and refactored the function.

ASTERISK-29293 #close

Change-Id: If5a6d4b1072ea2e6e89059b21139d554a74b34f5
2021-02-25 07:59:02 -06:00
Kevin Harwell 5e998d8bd3 AST-2021-002: Remote crash possible when negotiating T.38
When an endpoint requests to re-negotiate for fax and the incoming
re-invite is received prior to Asterisk sending out the 200 OK for
the initial invite the re-invite gets delayed. When Asterisk does
finally send the re-inivite the SDP includes streams for both audio
and T.38.

This happens because when the pending topology and active topologies
differ (pending stream is not in the active) in the delayed scenario
the pending stream is appended to the active topology. However, in
the fax case the pending stream should replace the active.

This patch makes it so when a delay occurs during fax negotiation,
to or from, the audio stream is replaced by the T.38 stream, or vice
versa instead of being appended.

Further when Asterisk sent the re-invite with both audio and T.38,
and the endpoint responded with a declined T.38 stream then Asterisk
would crash when attempting to change the T.38 state.

This patch also puts in a check that ensures the media state has a
valid fax session (associated udptl object) before changing the
T.38 state internally.

ASTERISK-29203 #close

Change-Id: I407f4fa58651255b6a9030d34fd6578cf65ccf09
2021-02-18 10:37:54 -06:00
Alexander Traud 389b8b0774 rtp: Enable srtp replay protection
Add option "srtpreplayprotection" rtp.conf to enable srtp
replay protection.

ASTERISK-29260
Reported by: Alexander Traud

Change-Id: I5cd346e3c6b6812039d1901aa4b7be688173b458
2021-02-18 10:36:22 -06:00
Ivan Poddubnyi 7d15655f9d res_pjsip_diversion: Fix adding more than one histinfo to Supported
New responses sent within a PJSIP sessions are based on those that were
sent before. Therefore, adding/modifying a header once causes it to be
sent on all responses that follow.

Sending 181 Call Is Being Forwarded many times first adds "histinfo"
duplicated more and more, and eventually overflows past the array
boundary.

This commit adds a check preventing adding "histinfo" more than once,
and skipping it if there is no more space in the header.

Similar overflow situations can also occur in res_pjsip_path and
res_pjsip_outbound_registration so those were also modified to
check the bounds and suppress duplicate Supported values.

ASTERISK-29227
Reported by: Ivan Poddubny

Change-Id: Id43704a1f1a0293e35cc7f844026f0b04f2ac322
2021-02-18 10:34:53 -06:00
Sean Bright e7b13df394 res_rtp_asterisk.c: Fix signed mismatch that leads to overflow
ASTERISK-29205 #close

Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea
2021-02-18 10:33:12 -06:00
George Joseph 15b4080679 res_pjsip_refer: Always serialize calls to refer_progress_notify
refer_progress_notify wasn't always being called from the progress
serializer.  This could allow clearing notification->progress->sub
in one thread while another was trying to use it.

* Instances where refer_progress_notify was being called in-line,
  have been changed to use ast_sip_push_task().

Change-Id: Idcf1934c4e873f2c82e2d106f8d9f040caf9fa1e
2021-02-17 11:05:05 -06:00
roadkill 9b5d20e3d5 res/res_pjsip.c: allow user=phone when number contain *#
if From number contain * or # asterisk will not add user=phone

Currently only number that uses AST_DIGIT_ANYNUM can have "user=phone" but the validation should use AST_DIGIT_ANY
this is a problem when you want to send call to ISUP
as they will disregard the From header and either replace From with anonymous or with p-asserted-identity

ASTERISK-29261
Reported by: Mark Petersen
Tested by: Mark Petersen

Change-Id: I3307bdbf757582740bfee4110e85f7b6c9291cc4
2021-01-27 11:04:23 -06:00
Boris P. Korzun 92f5cf7f2d res_musiconhold: Add support of various URL-schemes by MoH.
Provided a support of variuos URL-schemes for res_musiconhold,
registered by ast_bucket_scheme_register().

ASTERISK-29262 #close

Change-Id: If0ea8697587353dce358a70035d82649fd4632b6
2021-01-25 10:38:44 -06:00
Alexander Traud 10a0a0c59b pjsip_scheduler: Fix pjsip show scheduled_tasks like for compiler Clang.
Otherwise, Clang 10 warned because of logical-not-parentheses.

Change-Id: Ia8fb493f727b08070eb2dcf520c08df34ed11d79
2021-01-18 10:37:28 -06:00
Alexander Traud df6afadf26 res_pjsip_session: Avoid sometimes-uninitialized warning with Clang.
ASTERISK-29248

Change-Id: I2b17bd5ffb246bc64c463402c9831413da78a556
2021-01-18 10:30:27 -06:00
Sean Bright 6d2bec7028 res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet
The last argument to ast_copy_string() is the buffer size, not the
number of characters, so we add 1 to avoid stamping out the final \n
in the persisted SUBSCRIBE message.

Change-Id: I019b78942836f57965299af15d173911fcead5b2
2021-01-18 10:27:33 -06:00
Robert Cripps 24e678b9bb res/res_pjsip_session.c: Check that media type matches in
function ast_sip_session_media_state_add.

Check ast_media_type matches when a ast_sip_session_media is found
otherwise when transitioning from say image to audio, the wrong
session is returned in the first if statement.

ASTERISK-29220 #close

Change-Id: I6f6efa9b821ebe8881bb4c8c957f8802ddcb4b5d
2021-01-14 00:57:38 -06:00
Jean Aunis c559667868 Stasis/messaging: tech subscriptions conflict with endpoint subscriptions.
When both a tech subscription and an endpoint subscription exist for a given
endpoint, TextMessageReceived events are dispatched to the tech subscription
only.

ASTERISK-29229

Change-Id: I9eac4cba5f9e27285a282509395347abc58fc2b8
2021-01-13 09:37:39 -06:00
Ivan Poddubnyi f2aa6c7017 chan_pjsip: Assign SIPDOMAIN after creating a channel
session->channel doesn't exist until chan_pjsip creates it, so intead of
setting a channel variable every new incoming call sets one and the same
global variable.

This patch moves the code to chan_pjsip so that SIPDOMAIN is set on
a newly created channel, it also removes a misleading reference to
channel->session used to fetch call pickup configuraion.

ASTERISK-29240

Change-Id: I90c9bbbed01f5d8863585631a29322ae4e046755
2021-01-13 08:27:41 -06:00
George Joseph 9a4486e9fb Revert "res_pjsip_outbound_registration.c: Use our own scheduler and other stuff"
This reverts commit 2fe76dd816.

Reason for revert: Too many issues reported.  Need to research and correct.

ASTERISK-29230
ASTERISK-29231
Reported by: Michael Maier

Change-Id: I6453af680e17d8ffe7af2c5de7e1b2a58c8793cb
2021-01-11 09:26:06 -06:00
Nick French 505939c9ed res_pjsip: Prevent segfault in UDP registration with flow transports
Segfault occurs during outbound UDP registration when all
transport states are being iterated over. The transport object
in the transport is accessed, but flow transports have a NULL
transport object.

Modify to not iterate over any flow transport

ASTERISK-29210 #close

Change-Id: If28dc3a18bdcbd0a49598b09b7fe4404d45c996a
2021-01-04 05:01:30 -06:00
Torrey Searle 51e2187a14 res/res_pjsip_diversion: prevent crash on tel: uri in History-Info
Add a check to see if the URI is a Tel URI and prevent crashing on
trying to retrieve the reason parameter.

ASTERISK-29191
ASTERISK-29219

Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
(cherry picked from commit a7aea71e60)
2021-01-04 04:09:30 -06:00
Richard Mudgett 6d7af72559 res_pjsip_session.c: Fix compiler warnings.
AST_VECTOR_SIZE() returns a size_t.  This is not always equivalent to an
unsigned long on all machines.

Change-Id: I0a4189a104e6e3a2e2273de06620eaef19df9338
2020-12-28 08:27:14 -06:00
Sungtae Kim 02c4b2ac60 res_pjsip_session: Fixed NULL active media topology handle
Added NULL pointer check to prevent Asterisk crash.

ASTERISK-29215

Change-Id: If07e50ea8d78cb610af9195fc13b5dca4bfcef95
2020-12-23 13:55:28 -06:00
Sean Bright 357510cec3 app_chanspy: Spyee information missing in ChanSpyStop AMI Event
The documentation in the wiki says there should be spyee-channel
information elements in the ChanSpyStop AMI event.

    https://wiki.asterisk.org/wiki/x/Xc5uAg

However, this is not the case in Asterisk <= 16.10.0 Version. We're
using these Spyee* arguments since Asterisk 11.x, so these arguments
vanished in Asterisk 12 or higher.

For maximum compatibility, we still send the ChanSpyStop event even if
we are not able to find any 'Spyee' information.

ASTERISK-28883 #close

Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
2020-12-17 14:03:38 -06:00
Sungtae Kim 91fc57f56b res_ari: Fix wrong media uri handle for channel play
Fixed wrong null object handle in
/channels/<channel_id>/play request handler.

ASTERISK-29188

Change-Id: I6691c640247a51ad15f23e4a203ca8430809bafe
2020-12-17 11:06:48 -06:00
Pirmin Walthert 0b10995811 res_pjsip_nat.c: Create deep copies of strings when appropriate
In rewrite_uri asterisk was not making deep copies of strings when
changing the uri. This was in some cases causing garbage in the route
header and in other cases even crashing asterisk when receiving a
message with a record-route header set. Thanks to Ralf Kubis for
pointing out why this happens. A similar problem was found in
res_pjsip_transport_websocket.c. Pjproject needs as well to be patched
to avoid garbage in CANCEL messages.

ASTERISK-29024 #close

Change-Id: Ic5acd7fa2fbda3080f5f36ef12e46804939b198b
2020-12-17 09:11:10 -06:00
Nathan Bruning 5e426987c2 res_musiconhold: Don't crash when real-time doesn't return any entries
ASTERISK-29211 #close

Change-Id: Ifbf0a4f786ab2a52342f9d1a1db4c9907f069877
2020-12-16 09:20:12 -06:00
Joshua C. Colp 9ee1f7154f res_pjsip_pidf_digium_body_supplement: Support Sangoma user agent.
This adds support for both Digium and Sangoma user agent strings
for the Sangoma specific body supplement.

Change-Id: Ib99362b24b91d3cbe888d8b2fce3fad5515d9482
2020-12-16 08:01:11 -06:00
Joshua C. Colp 6475fe3dd7 pjsip: Match lifetime of INVITE session to our session.
In some circumstances it was possible for an INVITE
session to be destroyed while we were still using it.
This occurred due to the reference on the INVITE session
being released internally as a result of its state
changing to DISCONNECTED.

This change adds a reference to the INVITE session
which is released when our own session is destroyed,
ensuring that the INVITE session remains valid for
the lifetime of our session.

ASTERISK-29022

Change-Id: I300c6d9005ff0e6efbe1132daefc7e47ca6228c9
2020-12-09 13:06:42 -06:00
Sean Bright 90fd1fd96a res_http_media_cache.c: Set reasonable number of redirects
By default libcurl does not follow redirects, so we explicitly enable
it by setting CURLOPT_FOLLOWLOCATION. Once that is enabled, libcurl
will follow up to CURLOPT_MAXREDIRS redirects, which by default is
configured to be unlimited.

This patch sets CURLOPT_MAXREDIRS to a more reasonable default (8). If
we determine at some point that this needs to be increased on
configurable it is a trivial change.

ASTERISK-29173 #close

Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
2020-12-09 13:05:27 -06:00
Stanislav ab7a08b4ef res_pjsip_stir_shaken: Fix module description
the 'J' is missing in module description.
"PSIP STIR/SHAKEN Module for Asterisk" -> "PJSIP STIR/SHAKEN Module for Asterisk"

ASTERISK-29175 #close

Change-Id: I17da008540ee2e8496b644d05f995b320b54ad7a
2020-12-01 11:25:15 -06:00
Alexander Traud b91fb3c396 loader: Sync load- and build-time deps.
In MODULEINFO, each depend has to be listed in .requires of AST_MODULE_INFO.

ASTERISK-29148

Change-Id: I254dd33194ae38d2877b8021c57c2a5deb6bbcd2
2020-11-20 13:51:02 -06:00
Alexander Greiner-Baer fba10fb54c res_pjsip: set Accept-Encoding to identity in OPTIONS response
RFC 3261 says that the Accept-Encoding header should be present
in an options response. Permitted values according to RFC 2616
are only compression algorithms like gzip or the default identity
encoding. Therefore "text/plain" is not a correct value here.
As long as the header is hard coded, it should be set to "identity".

Without this fix an Alcatel OmniPCX periodically logs warnings like
"[sip_acceptIncorrectHeader] Header Accept-Encoding is malformed"
on a SIP Trunk.

ASTERISK-29165 #close

Change-Id: I0aa2211ebf0b4c2ed554ac7cda794523803a3840
2020-11-19 16:14:33 -06:00