Commit Graph

8735 Commits

Author SHA1 Message Date
Naveen Albert 5f60caa402 chan_iax2: Allow compiling without OpenSSL.
ASTERISK_30007 accidentally made OpenSSL a
required depdendency. This adds an ifdef so
the relevant code is compiled only if OpenSSL
is available, since it only needs to be executed
if OpenSSL is available anyways.

ASTERISK-30083 #close

Change-Id: Iad05c1a9a8bd2a48e7edf8d234eaa9f80779e34d
2022-07-11 04:11:09 -05:00
Naveen Albert 97f278a94a sig_analog: Fix broken three-way conferencing.
Three-way calling for analog lines is currently broken.
If party A is on a call with party B and initiates a
three-way call to party C, the behavior differs depending
on whether the call is conferenced prior to party C
answering. The post-answer case is correct. However,
if A flashes before C answers, then the next flash
disconnects B rather than C, which is incorrect.

This error occurs because the subs are not swapped
in the misbehaving case. This is because the flash
handler only swaps the subs if C has answered already,
which is wrong. To fix this, we swap the subs regardless
of whether C has answered or not when the call is
conferenced. This ensures that C is disconnected
on the next hook flash, rather than B as can happen
currently.

ASTERISK-30043 #close

Change-Id: I96c5bf6c9b7eb2636136b716c677c82c079b6f06
2022-06-15 13:19:03 -05:00
Naveen Albert 169e553320 chan_iax2: Prevent deadlock due to duplicate autoservice.
If a switch is invoked using chan_iax2, deadlock can result
because the PBX core is autoservicing the channel while chan_iax2
also then attempts to service it while waiting for the result
of the switch. This removes servicing of the channel to prevent
any conflicts.

ASTERISK-30064 #close

Change-Id: Ie92f206d32f9a36924af734ddde652b21106af22
2022-06-06 17:43:59 -05:00
Maximilian Fridrich a03b53bb7b chan_pjsip: Only set default audio stream on hold.
When a PJSIP channel is set on hold or off hold, all streams were set
on/off hold. This is not the desired behaviour and caused issues
when there were multiple streams in the topology.

Now, only the default audio stream is set on/off hold when a hold is
indicated.

ASTERISK-30051

Change-Id: I04f1110565fd05fea565f5539b534b54549d4f71
2022-06-02 11:37:33 -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
Naveen Albert a24979a2d7 chan_dahdi: Fix broken operator mode clearing.
Currently, the operator services mode in DAHDI is broken and unusable.
The actual operator recall functionality works properly; however,
when the operator hangs up (which is the only way that such a call
is allowed to end), both lines are permanently taken out of service
until "dahdi restart" is run. This prevents this feature from being
used.

Operator mode is one of the few factors that can cause the general
analog event handling in sig_analog not to be used. Several years
back, much of the analog handling was moved from chan_dahdi to
sig_analog. However, this was not done fully or consistently at
the time, and when operator mode is active, sig_analog does not
get used. Generally this is correct, but in the case of hangup
it should be using sig_analog regardless of the operator mode;
otherwise, the lines do not properly clear and they become unusable.

This bug is fixed so the operator can now hang up and properly
release the call. It is treated just like any other hangup. The
operator mode functionality continues to work as it did before.

ASTERISK-29993 #close

Change-Id: Ib2e3ddb40d9c71e8801e0b4bb0a12e2b52f51d24
2022-05-09 08:47:39 -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 892c06564f chan_dahdi: Document dial resource options.
Documents the Dial syntax for DAHDI, namely the channel group,
distinctive ring, answer confirmation, and digital call options
that are specified in the resource itself.

ASTERISK-24827 #close

Change-Id: Ib95e78497fb00dc5cbfde1c93a69f034bfd08c30
2022-05-02 15:47:26 -05:00
Naveen Albert 0a8b3d3467 chan_dahdi: Don't allow MWI FSK if channel not idle.
For lines that have mailboxes configured on them, with
FSK MWI, DAHDI will periodically try to dispatch FSK
to update MWI. However, this is never supposed to be
done when a channel is not idle.

There is currently an edge case where MWI FSK can
extraneously get spooled for the channel if a caller
hook flashes and hangs up, which triggers a recall ring.
After one ring, the on hook time threshold in this if
condition has been satisfied and an MWI update is spooled.
This means that when the phone is picked up again, the
answerer gets an FSK spill before being reconnected to
the party on hold.

To prevent this, we now explicitly check to ensure that
subchannel 0 has no owner. There is no owner when DAHDI
channels are idle, but if the channel is "in use" in some
way (such as in the aforementioned scenario), then there
is an owner, and we shouldn't process MWI at this time.

ASTERISK-28518 #close

Change-Id: Ia3904434fd81688d71742f7e84358b7e1c38e92a
2022-05-02 15:46:31 -05:00
Naveen Albert 19c841950b chan_dahdi: Don't append cadences on dahdi restart.
Currently, if any custom ring cadences are specified, they are
appended to the array of cadences from wherever we left off
last time. This works properly the first time, but on subsequent
dahdi restarts, it means that the existing cadences are left
alone and (most likely) the same cadences are then re-added
afterwards. In short order, the cadence array gets maxed out
and the user begins seeing warnings that the array is full
and no more cadences may be added.

This buggy behavior persists until Asterisk is completely
restarted; however, if and when dahdi restart is run again,
then the same problem is reintroduced.

This fixes this behavior so that cadence parsing is more
idempotent, that is so running dahdi restart multiple times
starts adding cadences from the beginning, rather than from
wherever the last cadence was added.

As before, it is still not possible to revert to the default
cadences by simply removing all cadences in this manner, nor
is it possible to delete existing cadences. However, this
does make it possible to update existing cadences, which
was not possible before, and also ensures that the cadences
remain unchanged if the config remains unchanged.

ASTERISK-29990 #close

Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d
2022-05-02 08:57:22 -05:00
Naveen Albert fbe960ca42 chan_iax2: Prevent crash if dialing RSA-only call without outkey.
Currently, if attempting to place a call to a peer that only allows
RSA authentication, if we fail to provide an outkey when placing
the call, Asterisk will crash.

This exposes the broader issue that IAX2 is prone to causing a crash
if encryption or decryption is attempted but we never initialized
the encryption and decryption keys. In other words, if the logic
to use encryption in chan_iax2 is not perfectly aligned with the
decision to build keys in the first place, then a crash is not
only possible but probable. This was demonstrated by ASTERISK_29264,
for instance.

This permanently prevents such events from causing a crash by explicitly
checking that keys are initialized properly before setting the flags
to use encryption for the call. Instead of crashing, the call will
now abort.

ASTERISK-30007 #close

Change-Id: If925c3d86099ceac7f621804f2532baac5050c9a
2022-05-02 08:56:53 -05:00
Naveen Albert fe50f049c4 chan_dahdi: Fix insufficient array size for round robin.
According to chan_dahdi.conf, up to 64 groups (numbered
0 through 63) can be used when dialing DAHDI channels.

However, currently dialing round robin with a group number
greater than 31 fails because the array for the round robin
structure is only size 32, instead of 64 as it should be.

This fixes that so the round robin array size is consistent
with the actual groups capacity.

ASTERISK-29994

Change-Id: I4caa08d7025f78ac75a0539f71aaf3eb3e85b3b7
2022-04-27 11:40:49 -05:00
Mark Petersen a3abc868db chan_sip.c Session timers get removed on UPDATE
If Asterisk receives a SIP REFER with Session-Timers UAC
maintain Session-Timers when sending UPDATE"

ASTERISK-29843

Change-Id: I8e9a21c13bf757fa34d778f49ba3cf859b29ae5c
2022-04-27 03:28:42 -05:00
Naveen Albert 193b7a81fe chan_pjsip: Add ability to send flash events.
PJSIP currently is capable of receiving flash events
and converting them to FLASH control frames, but it
currently lacks support for doing the reverse: taking
a FLASH control frame and converting it into a flash
event in the SIP domain.

This adds the ability for PJSIP to process flash control
frames by converting them into the appropriate SIP INFO
message, which can then be sent to the peer. This allows,
for example, flash events to be sent between Asterisk
systems using PJSIP.

ASTERISK-29941 #close

Change-Id: I1590221a4d238597f79672fa5825dd4a920c94dd
2022-04-26 18:40:36 -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
Mark Petersen eab489b22e chan_sip: SIP route header is missing on UPDATE
if Asterisk need to send an UPDATE before answer
on a channel that uses Record-Route:
it will not include a Route header

ASTERISK-29955

Change-Id: Id1920ecbfea7739a038b14dc94487ecfe7b57eef
2022-04-26 16:48:12 -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 30cefc97a6 deprecation cleanup: remove leftover files
Several modules removal and deprecations occurred in 19.0.0 (initial
19 release), but associated UPGRADE files were not removed from
staging for some reason in the master branch.

This patch removes those files, and also removes a spurious leftover
header, chan_phone.h (associated module removed in 19).

Change-Id: Ib92142c846b45c882d6b2b6caca7225253c83add
2022-03-30 16:08:21 -05:00
Naveen Albert 0d11938e92 chan_iax2: Fix spacing in netstats command
The iax2 show netstats command previously didn't contain
enough spacing in the header to properly align the table
header with the table body. This caused column headers
to not align with the values on longer channel names.

Some spacing is added to account for the longest channel
names that display (before truncation occurs) so that
columns are always properly aligned.

ASTERISK-29895 #close
patches:
  61205_misaligned2.patch submitted by Birger Harzenetter (license 5870)

Change-Id: I450ce6bb81157b9d6d149007e53b749f237b6d9f
2022-03-28 15:12:04 -05:00
Naveen Albert 7bc8ef2681 chan_iax2: Fix perceived showing host address.
ASTERISK_22025 introduced a regression that shows
the host IP and port as the perceived IP and port
again, as opposed to showing the actual perceived
address. This fixes this by showing the correct
information.

ASTERISK-29048 #close

Change-Id: I0ad3e25bc6b449e83ce72ea5d1a1cdba72aa304a
2022-03-25 17:32:16 -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
Mark Petersen e505337065 chan_sip.c Fix pickup on channel that are in AST_STATE_DOWN
resolve issue with pickup on device that uses "183" and not "180"

ASTERISK-29832

Change-Id: I4c7d223870f8ce9a7354e0f73d4e4cb2e8b58841
2022-02-01 08:25:58 -06:00
Sean Bright 0d62735f99 utils.c: Remove all usages of ast_gethostbyname()
gethostbyname() and gethostbyname_r() are deprecated in favor of
getaddrinfo() which we use in the ast_sockaddr family of functions.

ASTERISK-29819 #close

Change-Id: Ie277c0ef768d753b169c121ef570a71665692ab7
2022-01-06 09:45:56 -06:00
Naveen Albert 97f400100c chan_sip: Fix crash when accessing RURI before initiating outgoing call
Attempting to access ${CHANNEL(ruri)} in a pre-dial handler before
initiating an outgoing call will cause Asterisk to crash. This is
because a null field is accessed, resulting in an offset from null and
subsequent memory access violation.

Since RURI is not guaranteed to exist, we now check if the base
pointer is non-null before calculating an offset.

ASTERISK-29772

Change-Id: Icd3b02f07256bbe6615854af5717074087b95a83
2021-12-13 13:39:26 -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
Alexander Traud affe7ee879 progdocs: Fix grouping for latest Doxygen.
Since Doxygen 1.8.16, a special comment block is required. Otherwise
(pure C comment), the group command is ignored. Additionally, several
unbalanced group commands were fixed.

ASTERISK-29732

Change-Id: I4687857b9d56e6f44fd440b73af156691660202e
2021-12-02 10:26:08 -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 726d6dd166 channels: Fix for Doxygen.
ASTERISK-29762

Change-Id: Ia8811ac12b93ff8c18164699c6fbc604cb0a23f7
2021-11-19 09:02:06 -06:00
Alexander Traud 4051434be4 chan_iax2: Fix for Doxygen.
ASTERISK-29737

Change-Id: I282003cc553989fd5c19ceeac9e478fa4ee06cec
2021-11-18 12:48:49 -06:00
Josh Soref d46ba42910 channels: Spelling fixes
Correct typos of the following word families:

appease
permanently
overriding
residue
silliness
extension
channels
globally
reference
japanese
group
coordinate
registry
information
inconvenience
attempts
cadence
payloads
presence
provisioning
mimics
behavior
width
natively
syslabel
not owning
unquelch
mostly
constants
interesting
active
unequipped
brodmann
commanding
backlogged
without
bitstream
firmware
maintain
exclusive
practically
structs
appearance
range
retransmission
indication
provisional
associating
always
whether
cyrillic
distinctive
components
reinitialized
initialized
capability
switches
occurring
happened
outbound

ASTERISK-29714

Change-Id: Ife52ee89cd2170b684fa651ca72b1cb911a57339
2021-11-16 05:35:29 -06:00
Naveen Albert f9ba1ee7c9 sig_analog: Fix truncated buffer copy
Fixes compiler warning caused by a truncated copy of the ANI2 into a
buffer of size 10. This could prevent the null terminator from being
copied if the copy value exceeds the size of the buffer. This increases
the buffer size to 101 to ensure there is no way for truncation to occur.

ASTERISK-29702 #close

Change-Id: Ief9052212952840fa44de6463b8699fdb3e163d0
2021-11-08 12:29:54 -06:00
Naveen Albert df9aeea4c8 chan_iax2: Allow both secret and outkey at dial time
Historically, the dial syntax for IAX2 has held that
an outkey (used only for RSA authenticated calls)
and a secret (used only for plain text and MD5 authenticated
calls, historically) were mutually exclusive, and thus
the same position in the dial string was used for both
values.

Now that encryption is possible with RSA authentication,
this poses a limitation, since encryption requires a
secret and RSA authentication requires an outkey. Thus,
the dial syntax is extended so that both a secret and
an outkey can be specified.

The new extended syntax is backwards compatible with the
old syntax. However, a secret can now be specified after
the outkey, or the outkey can be specified after the secret.
This makes it possible to spawn an encrypted RSA authenticated
call without a corresponding peer being predefined in iax.conf.

ASTERISK-29707 #close

Change-Id: I1f8149313ed760169d604afbb07720a8b07dd00e
2021-11-08 11:26:21 -06:00
Mike Bradeen 99a1a427a9 various: Fix GCC 11 compilation issues.
test_voicemail_api: Use empty char* for empty_msg_ids.
chan_skinny: Fix size of calledParty to be maximum extension.
menuselect: Change Makefile to stop deprecated warnings. Added comments
test_linkedlist: 'bogus' variable was manually allocated from a macro
and the test fails if this happens but the compiler couldn't 'see' this
and returns a warning. memset to all 0's after allocation.
chan_ooh323: Fixed various indentation issues that triggered misleading
 indentation warnings.

ASTERISK-29682
Reported by: George Joseph

Change-Id: If4fe42222c8444dc16828a42731ee53b4ce5cbbe
2021-10-21 13:18:41 -05:00
Naveen Albert 7ff6c43760 chan_iax2: Add encryption for RSA authentication
Adds support for encryption to RSA-authenticated
calls. Also prevents crashes if an RSA IAX2 call
is initiated to a switch requiring encryption
but no secret is provided.

ASTERISK-20219

Change-Id: I18f1f9d7c59b4f9cffa00f3b94a4c875846efd40
2021-10-07 18:23:48 -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
Naveen Albert 3072c540bb chan_iax2: Add ANI2/OLI information element
Adds an information element for ANI2 so that
Originating Line Information can be transmitted
over IAX2 channels.

ASTERISK-29605 #close

Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2
2021-09-02 14:17:11 -05:00
Sarah Autumn 466eb4a52b sig_analog: Changes to improve electromechanical signalling compatibility
This changeset is intended to address compatibility issues encountered
when interfacing Asterisk to electromechanical telephone switches that
implement ANI-B, ANI-C, or ANI-D.

In particular the behaviours that this impacts include:

 - FGC-CAMA did not work at all when using MF signaling. Modified the
   switch case block to send calls to the correct part of the
   signaling-handling state machine.

 - For FGC-CAMA operation, the delay between called number ST and
   second wink for ANI spill has been made configurable; previously
   all calls were made to wait for one full second.

 - After the ANI spill, previous behavior was to require a 'ST' tone
   to advance the call.  This has been changed to allow 'STP' 'ST2P'
   or 'ST3P' as well, for compatibility with ANI-D.

 - Store ANI2 (ANI INFO) digits in the CALLERID(ANI2) channel variable.

 - For calls with an ANI failure, No. 1 Crossbar switches will send
   forward a single-digit failure code, with no calling number digits
   and no ST pulse to terminate the spill.  I've made the ANI timeout
   configurable so to reduce dead air time on calls with ANI fail.

 - ANI info digits configurable.  Modern digital switches will send 2
   digits, but ANI-B sends only a single info digit.  This caused the
   ANI reported by Asterisk to be misaligned.

 - Changed a confusing log message to be more informative.

ASTERISK-29518

Change-Id: Ib7e27d987aee4ed9bc3663c57ef413e21b404256
2021-08-20 12:26:18 -07:00
Naveen Albert 0ca3ebe7cd chan_alsa, chan_sip: Add replacement to moduleinfo
Adds replacement modules to the moduleinfo for
chan_alsa and chan_sip.

ASTERISK-29601 #close

Change-Id: I7a4877b0d5c0c17e088e8fa8ebbfa9a195223cbc
2021-08-19 07:58:39 -05:00
Joshua C. Colp 20b2741232 chan_vpb: Remove deprecated module.
ASTERISK-29597

Change-Id: I19bb39eed0257ddfef453eb2df5646d073d50fe1
2021-08-17 10:38:05 -03:00
Joshua C. Colp 1eb2d85c99 chan_misdn: Remove deprecated module.
ASTERISK-29596

Change-Id: Ibae9490c1b35cadbf7028d24610f745277c8535e
2021-08-17 10:37:40 -03:00
Joshua C. Colp 6ecc48086c chan_nbs: Remove deprecated module.
ASTERISK-29595

Change-Id: Ib5c7d43a780f2fb94cee90738e4c1af211ae4a33
2021-08-17 10:36:19 -03:00
Joshua C. Colp 6cc948f94e chan_phone: Remove deprecated module.
ASTERISK-29594

Change-Id: I79a9961cb5062fadbccb0ea93f087bdd32685316
2021-08-17 10:36:11 -03:00
Joshua C. Colp 95f3a4a9ad chan_oss: Remove deprecated module.
ASTERISK-29593

Change-Id: Ib53a42ad974c63871344b95078c61c188e43da99
2021-08-17 10:35:43 -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
Kevin Harwell 1b62831f2c AST-2021-008 - chan_iax2: remote crash on unsupported media format
If chan_iax2 received a packet with an unsupported media format, for
example vp9, then it would set the frame's format to NULL. This could
then result in a crash later when an attempt was made to access the
format.

This patch makes it so chan_iax2 now ignores/drops frames received
with unsupported media format types.

ASTERISK-29392 #close

Change-Id: Ifa869a90dafe33eed8fd9463574fe6f1c0ad3eb1
2021-07-22 16:17:05 -05:00
Naveen Albert fd40752954 chan_sip: Expand hook flash recognition.
Some ATAs send hook flash events as application/hook-flash, rather than a DTMF
event. Now, we also recognize hook-flash as a flash event.

ASTERISK-29370

Change-Id: I1c3b82a040dff3affcd94bad8ce33edc90c04725
2021-05-17 08:55:57 -05:00
Sean Bright 1b41629447 chan_pjsip: Correct misleading trace message
ASTERISK-29358 #close

Change-Id: I050daff67066873df4e8fc7f4bd977c1ca06e647
2021-05-12 21:21:25 -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
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
Alexander Traud 8c461845c8 chan_iax2: System Header strings is included via asterisk.h/compat.h.
The system header strings was included mistakenly with commit 3de0204.
That header is included via asterisk.h and there via the compat.h.

Change-Id: I3dc49060e275295f785670c87cc65fd3c3abd24a
2021-03-10 04:21:40 -06:00
Holger Hans Peter Freyther 48ed4f670f pjsip: Generate progress (once) when receiving a 180 with a SDP
ASTERISK-29105

Change-Id: If1615fe7115fe544ef974b044d3cea5c48b94a38
2021-03-02 11:22:33 -06:00
Alexander Traud 5894535fed chan_sip: Filter pass-through audio/video formats away, again.
Instead of looking for pass-through formats in the list of transcodable
formats (which is going to find nothing), go through the result which
is going to be the jointcaps of the tech_pvt of the channel. Finally,
only with that list, ast_format_cap_remove(.) is going to succeed.

This restores the behaviour of Asterisk 1.8. However, it does not fix
ASTERISK_29282 because that issue report is about chan_sip and PJSIP.
Here, only chan_sip is fixed because PJSIP does not even call
ast_rtp_instance_available_formats -> ast_translate_available_format.

Change-Id: Icade2366ac2b82935b95a9981678c987da2e8c34
2021-02-23 12:41:15 -06:00
Alexander Traud 1f77c33c02 chan_sip: Allow [peer] without audio (text+video).
Two previous commits, 620d9f4 and 6d980de, allow to set up a call
without audio, again. That was introduced originally with commit f04d5fb
but changed and broke over time. The original commit missed one
scenario: A [peer] section in sip.conf, which does not allow audio at
all. In that case, chan_sip rejected the call, although even when the
requester offered no audio. Now, chan_sip does not check whether there
is no audio format but checks whether there is no format in general. In
other words, if there is at least one format to offer, the call succeeds.

However, to prevent calls with no-audio, chan_sip still rejects calls
when both call parties (caller = requester of the call *and* callee =
[peer] section in sip.conf) included audio. In such a case, it is
expected that the call should have audio.

ASTERISK-29280

Change-Id: I0fb74faf51ef22a60c10b467df6a4d1c1943b73e
2021-02-12 07:19:26 -06:00
George Joseph 91b0778791 chan_iax2.c: Require secret and auth method if encryption is enabled
If there's no secret specified for an iax2 peer and there's no secret
specified in the dial string, Asterisk will crash if the auth method
requested by the peer is MD5 or plaintext.  You also couldn't specify
a default auth method in the [general] section of iax.conf so if you
don't have static peers defined and just use the dial string, Asterisk
will still crash even if you have a secret specified in the dial string.

* Added logic to iax2_call() and authenticate_reply() to print
  a warning and hanhup the call if encryption is requested and
  there's no secret or auth method.  This prevents the crash.

* Added the ability to specify a default "auth" in the [general]
  section of iax.conf.

ASTERISK-29624
Reported by: N A

Change-Id: I5928e16137581f7d383fcc7fa04ad96c919e6254
2021-02-09 09:16:07 -06:00
Alexander Traud 620d9f4782 chan_sip: Set up calls without audio (text+video), again.
The previous commit 6d980de fixed this issue in the core of Asterisk.
With that, each channel technology can be used without audio
theoretically. Practically, the channel-technology driver chan_sip
turned out to have an invalid check preventing that. chan_sip tested
whether there is at least one audio format. However, chan_sip has to
test whether there is at least one format. More cannot be tested while
requesting chan_sip because only the [general] capabilities but not the
[peer] caps are known yet. And the [peer] caps might not be a subset or
show any intersection with the [general] caps. This change here fixes
this.

The original commit f04d5fb, thirteen years ago, contained a software
bug as it passed ANY audio capability to the channel-technology driver.
Instead, it should have passed NO audio format. Therefore, this
addressed issue here was not noticed in Asterisk 1.6.x and Asterisk 1.8.
Then, Asterisk 10 changed that from ANY to NO, but nobody reported since
then.

ASTERISK-29265

Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f
2021-02-03 10:00:22 +01:00
Dan Cropp 55891227e8 chan_pjsip, app_transfer: Add TRANSFERSTATUSPROTOCOL variable
When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is
0 when no protocl specific error
SIP example of failure, 3xx-6xx for the SIP error code received

This allows applications to perform actions based on the failure
reason.

ASTERISK-29252 #close
Reported-by: Dan Cropp

Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
2021-01-27 11:42:42 -06:00
Alexander Traud 4aff42b274 chan_sip: SDP: Reject audio streams correctly.
This completes the fix for ASTERISK_24543. Only when the call is an
outgoing call, consult and append the configured format capabilities
(p->caps). When all audio formats got rejected the negotiated format
capabilities (p->jointcaps) contain no audio formats for incoming
calls. This is required when there are other accepted media streams.

ASTERISK-29258

Change-Id: I8bab31c7f3f3700dce204b429ad238a524efebb9
2021-01-27 10:47:27 -06:00
Ben Ford 948ceb1228 chan_pjsip.c: Add parameters to frame in indicate.
There are a couple of parameters (datalen and data) that do not get set
in chan_pjsip_indicate which could cause an Invalid message to pop up
for things such as fax. This patch adds them to the frame.

Change-Id: Ia51be086a0708be905e73d1f433572c49c7e38f8
2021-01-18 10:02:04 -06:00
Alexander Traud 1c05667cfc chan_sip: SDP: Sidestep stream parsing when its media is disabled.
Previously, chan_sip parsed all known media streams in an SDP offer
like video (and text) even when videosupport=no (and textsupport=no).
This wasted processor power. Furthermore, chan_sip accepted SDP offers,
including no audio but just video (or text) streams although
videosupport=no (or textsupport=no). Finally, chan_sip denied the whole
offer instead of individual streams when they had encryption (SDES-sRTP)
unexpectedly enabled.

ASTERISK-29238
ASTERISK-29237
ASTERISK-29222

Change-Id: Ie49e4e2a11f0265f914b684738348ba8c0f89755
2021-01-13 08:29:23 -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
Ivan Poddubnyi 134d2e729d chan_pjsip: Stop queueing control frames twice on outgoing channels
The fix for ASTERISK-27902 made chan_pjsip process SIP responses twice.
This resulted in extra noise in logs (for example, "is making progress"
and "is ringing" get logged twice by app_dial), as well as in noise in
signalling: one incoming 183 Session Progress results in 2 outgoing 183-s.

This change splits the response handler into 2 functions:
 - one for updating HANGUPCAUSE, which is still called twice,
 - another that does the rest, which is called only once as before.

ASTERISK-28016
Reported-by: Alex Hermann

ASTERISK-28549
Reported-by: Gant Liu

ASTERISK-28185
Reported-by: Julien

Change-Id: I0a1874be5bb5ed12d572d17c7f80de6e5e542940
2021-01-11 12:46:05 -06:00
Dan Cropp ffa87ecade chan_pjsip: Incorporate channel reference count into transfer_refer().
Add channel reference count for PJSIP REFER. The call could be terminated
prior to the result of the transfer. In that scenario, when the SUBSCRIBE/NOTIFY
occurred several minutes later, it would attempt to access a session which was
no longer valid.  Terminate event subscription if pjsip_xfer_initiate() or
pjsip_xfer_send_request() fails in transfer_refer().

ASTERISK-29201 #close
Reported-by: Dan Cropp

Change-Id: I3fd92fd14b4e3844d3d7b0f60fe417a4df5f2435
2021-01-06 10:45:41 -06:00
Alexander Traud 80c14f74bc codecs: Remove test-law.
This was dead code, test code introduced with Asterisk 13. This was
found while analyzing ASTERISK_28416 and ASTERISK_29185. This change
partly fixes, not closes those two issues.

Change-Id: I42d0daa37f6f334c7d86672f06f085858a3f3940
2021-01-04 05:00:58 -06:00
Richard Mudgett 058bc0d593 chan_vpb.cc: Fix compile errors.
Fix the usual compile problem when someone adds a new callback to struct
ast_channel_tech.

Change-Id: I9bdeb8a8cc65f03b2d6e4f2eb5809af47c906c32
2020-12-31 13:13:53 -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
Alexander Traud 103d7da3bb chan_sip: Remove unused sip_socket->port.
12 years ago, with ASTERISK_12115 the last four get/uses of socket.port
vanished. However, the struct member itself and all seven set/uses
remained as dead code.

ASTERISK-28798

Change-Id: Ib90516a49eca3d724a70191278aaf2144fb58c59
2020-11-19 15:36:46 -06:00
Alexander Traud 57ee79a563 Compiler fixes for GCC with -Og
ASTERISK-29144

Change-Id: I2a72c072083b4492a223c6f9d73d21f4f424db62
2020-11-03 17:08:07 -06:00
Alexander Traud 28faafd1c4 Compiler fixes for GCC when printf %s is NULL
ASTERISK-29146

Change-Id: Ib04bdad87d729f805f5fc620ef9952f58ea96d41
2020-11-03 15:47:33 -06:00
Alexander Traud cd32317691 chan_sip: On authentication, pick MD5 for sure.
RFC 8760 added new digest-access-authentication schemes. Testing
revealed that chan_sip does not pick MD5 if several schemes are offered
by the User Agent Server (UAS). This change does not implement any of
the new schemes like SHA-256. This change makes sure, MD5 is picked so
UAS with SHA-2 enabled, like the service www.linphone.org/freesip, can
still be used. This should have worked since day one because SIP/2.0
already envisioned several schemes (see RFC 3261 and its augmented BNF
for 'algorithm' which includes 'token' as third alternative; note: if
'algorithm' was not present, MD5 is still assumed even in RFC 7616).

Change-Id: I61ca0b1f74b5ec2b5f3062c2d661cafeaf597fcd
2020-11-03 15:12:32 -06:00
Sean Bright 52ca2323aa chan_sip.c: Don't build by default
ASTERISK-29083 #close

Change-Id: I9ea25fba3ba8f63a47886894bd966e0f08d5e003
2020-09-22 09:03:33 -05:00
Sean Bright 5a0e1d256d audiosocket: Fix module menuselect descriptions
The module description needs to be on the same line as the
AST_MODULE_INFO or it is not parsed correctly.

Change-Id: I9ba11df1415369790e8656fcb527bb2749373c21
2020-09-22 09:02:20 -05:00
George Joseph 44bb0858cb debugging: Add enough to choke a mule
Added to:
 * bridges/bridge_softmix.c
 * channels/chan_pjsip.c
 * include/asterisk/res_pjsip_session.h
 * main/channel.c
 * res/res_pjsip_session.c

There NO functional changes in this commit.

Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
2020-09-14 09:28:29 -05:00
Kevin Harwell 3c4a1722b6 chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
This patch makes it so if the PJSIP_SEND_SESSION_REFRESH dialplan function
is called on a channel prior to answering a warning is issued and the
function returns unsuccessful.

ASTERISK-28878 #close

Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb
2020-08-28 13:21:48 -05:00
Dennis Buteyn aab666bb9d chan_sip: Clear ToHost property on peer when changing to dynamic host
The ToHost parameter was not cleared when a peer's host value was
changed to dynamic. This causes invites to be sent to the original host.

ASTERISK-29011 #close

Change-Id: I9678d512741f71baca8f131a65b7523020b07d5c
2020-08-18 09:01:54 -05:00
George Joseph 9bd1d686a1 ACN: Add tracing to existing code
Prior to making any modifications to the pjsip infrastructure
for ACN, I've added the tracing functions to the existing code.
This should make the final commit easier to review, but we can also
now run a "before and after" trace.

No functional changes were made with this commit.

Change-Id: Ia83a1a2687ccb96f2bc8a2a3928a5214c4be775c
2020-07-08 09:24:42 -05:00
Kevin Harwell 4eba6b9eb2 PJSIP_MEDIA_OFFER: override configuration on refresh
When using the PSJIP_MEDIA_OFFER dialplan function it was not
overriding an endpoint's configured codecs on refresh unless
they had a shared codec between the two.

This patch makes it so whatever is set using PJSIP_MEDIA_OFFER
is used when creating the SDP for a refresh no matter what.

ASTERISK-28878 #close

Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
2020-07-06 09:05:41 -05:00
George Joseph 8d1064eaaf Streams: Add features for Advanced Codec Negotiation
The Streams API becomes the home for the core ACN capabilities.
These include...

 * Parsing and formatting of codec negotation preferences.
 * Resolving pending streams and topologies with those configured
   using configured preferences.
 * Utility functions for creating string representations of
   streams, topologies, and negotiation preferences.

For codec negotiation preferences:
 * Added ast_stream_codec_prefs_parse() which takes a string
   representation of codec negotiation preferences, which
   may come from a pjsip endpoint for example, and populates
   a ast_stream_codec_negotiation_prefs structure.
 * Added ast_stream_codec_prefs_to_str() which does the reverse.
 * Added many functions to parse individual parameter name
   and value strings to their respectrive enum values, and the
   reverse.

For streams:
 * Added ast_stream_create_resolved() which takes a "live" stream
   and resolves it with a configured stream and the negotiation
   preferences to create a new stream.
 * Added ast_stream_to_str() which create a string representation
   of a stream suitable for debug or display purposes.

For topology:
 * Added ast_stream_topology_create_resolved() which takes a "live"
   topology and resolves it, stream by stream, with a configured
   topology stream and the negotiation preferences to create a new
   topology.
 * Added ast_stream_topology_to_str() which create a string
   representation of a topology suitable for debug or display
   purposes.
 * Renamed ast_format_caps_from_topology() to
   ast_stream_topology_get_formats() to be more consistent with
   the existing ast_stream_get_formats().

Additional changes:
 * A new function ast_format_cap_append_names() appends the results
   to the ast_str buffer instead of replacing buffer contents.

Change-Id: I2df77dedd0c72c52deb6e329effe057a8e06cd56
2020-07-01 09:27:14 -05:00
Frederic LE FOLL a423f935c9 chan_sip: chan_sip does not process 400 response to an INVITE.
chan_sip handle_response() function, for a 400 response to an INVITE,
calls handle_response_invite() and does not generate ACK.
handle_response_invite() does not recognize 400 response and has no
default response processing for unexpected responses, thus it does not
generate ACK either.
The ACK on response repetition comes from handle_response() mechanism
"We must re-send ACKs to re-transmitted final responses".

According to code history, 400 response specific processing was
introduced with commit
"channels/chan_sip: Add improved support for 4xx error codes"
This commit added support for :
- 400/414/493 in handle_response_subscribe() handle_response_register()
  and handle_response().
- 414/493 only in handle_response_invite().

This fix adds 400 response support in handle_response_invite().

ASTERISK-28957

Change-Id: Ic71a087e5398dfc7273946b9ec6f9a36960218ad
2020-06-25 09:47:08 -05:00
Kevin Harwell 8b925fbda3 chan_pjsip: don't use PJSIP_SC_NULL as it only exists pjproject 2.8+
A patch made a reference to the PJSIP_SC_NULL enumeration value, which
was added to pjproject 2.8 and above thus making it so Asterisk would
fail to compile with prior versions of pjproject.

This patch removes the reference, and instead initializes the value
to '0'.

ASTERISK-28886 #close

Change-Id: I68491c80da1a0154b2286c9458440141c98db9d7
2020-06-22 15:33:04 -05:00
Guido Falsi d88e230037 chan_dadhi: Fix setvar in dahdi channels
The change to how setvar works for various channels performed in
ASTERISK~23756 missed some required change in the dahdi channel,
where the variables are actually set while reading configuration.
This change should fix the issue.

ASTERISK-28955

Change-Id: Ibfeb7f8cbdd735346dc4028de6a265f24f9df274
2020-06-19 09:12:31 -05:00
George Joseph 41f3a7da4d res_fax: Don't start a gateway if either channel is hung up
When fax_gateway_framehook is called and a gateway hasn't already
been started, the framehook gets the t38 state for both the current
channel and the peer.  That call trickles down to the channel
driver which determines the state.  If either channel is hung up
(or in the process of being hung up), the channel driver's tech_pvt
is going to be NULL which, in the case of chan_pjsip, will cause a
segfault.

* Added a hangup check for both the channel and peer channel
  before starting a fax gateway.

* Added a check for NULL tech_pvt to chan_pjsip_queryoption
  so we don't attempt to reference a tech_pvt that's already
  gone.

ASTERISK-28923
Reported by: Yury Kirsanov

Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c
2020-06-10 13:59:06 -05:00
Joshua C. Colp 1c5e68580a stream: Enforce formats immutability and ensure formats exist.
Some places in Asterisk did not treat the formats on a stream
as immutable when they are.

The ast_stream_get_formats function is now const to enforce this
and parts of Asterisk have been updated to take this into account.
Some violations of this were also fixed along the way.

An additional minor tweak is that streams are now allocated with
an empty format capabilities structure removing the need in various
places to check that one is present on the stream.

ASTERISK-28846

Change-Id: I32f29715330db4ff48edd6f1f359090458a9bfbe
2020-04-23 09:16:51 -05:00
Alexander Traud 52f07176b6 chan_sip: externhost/externaddr with non-default TCP/TLS ports.
ASTERISK-28372
Reported by: Anton Satskiy

ASTERISK-24428
Reported by: sstream

Change-Id: I2b7432a9bf3b09dc8515297ff955636db7a6224c
2020-04-21 10:20:26 -05:00
Alexander Traud 4d0ab620be chan_sip: DiffServ/ToS not only on UDP but also on TCP and TLS sockets.
ASTERISK-27195
Reported by: Joshua Roys

Change-Id: I6e72ecb874200dec7a3865c7babaf5ac0d3101de
2020-04-16 10:20:36 -05:00
traud da9554d925 chan_sip: TCP/TLS client without server.
It is possible to configure a TCP/TLS client without having a TCP/TLS
server. In that case, no error or warning was printed but the headers
Contact and Via in SIP REGISTER were "(null)".

ASTERISK-28798

Change-Id: I387ca5cb6a65f1eb675a29c5e41df8ec6c242ab2
2020-04-13 16:38:43 -05:00
Kevin Harwell fa3c8f94e0 chan_pjsip: digit_begin - constant DTMF tone if RTP is not setup yet
If chan_pjsip is configured for DTMF_RFC_4733, and the core triggers a
digit begin before media, or rtp has been setup then it's possible the
outgoing channel will hear a constant DTMF tone upon answering.

This happens because when there is no media, or rtp chan_pjsip notifies
the core to initiate inband DTMF. However, upon digit end if media, and
rtp become available then chan_pjsip does not notify the core to stop
inband DTMF. Thus the tone continues playing.

This patch makes it so chan_pjsip only notifies the core to start
inband DTMF in only the required cases. Now if there is no media, or
rtp availabe upon digit begin chan_pjsip does nothing, but tells the
core it handled it.

ASTERISK-28817 #close

Change-Id: I0dbea9fff444a2595fb18c64b89653e90d2f6eb5
2020-04-13 11:05:20 -05:00
traud b38f664250 chan_unistim: Avoid tautological warnings with clang.
ASTERISK-28803

Change-Id: I15449621b68d0ad4d57b7c337c1167adb15135af
2020-04-08 08:33:05 -05:00
Joshua C. Colp 1b6c58896f chan_sip: Send 403 when ACL fails.
Change-Id: I0910c79196f2b7c7e5ad6f1db95e83800ac737a2
2020-03-31 10:16:27 -05:00
Michael Neuhauser 5562fb2ea0 chan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active
Do not hang up a PJSIP channel on RTP timeout if that channel is in
a direct-media bridge. Also reset the time of the last received RTP packet when
direct-media ends (wait full rtp_timeout period before checking first time after
audio came back to Asterisk).

ASTERISK-28774
Reported-by: Michael Neuhauser

Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1
2020-03-20 10:17:49 -05:00
Sean Bright 49cf84578e chan_vpb: Fix 'catching polymorphic type ... by value' error
Fixes the following compile error:

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

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

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

ASTERISK-28759

Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec
2020-03-09 04:55:09 -06:00
Walter Doekes 43620cbf6c chan_sip: Return 503 if we're out of RTP ports
If you're for some reason out of RTP ports, chan_sip would previously
responde to an INVITE with a 403, which will fail the call.

Now, it returns a 503, allowing the device/proxy to retry the call on a
different machine.

ASTERISK-28718

Change-Id: I968dcf6c1e30ecddcce397dcda36db727c83ca90
2020-01-31 13:58:30 +01:00
Friendly Automation f29ddd8925 Merge "chan_sip: Always process updated SDP on media source change" 2020-01-27 18:29:34 -06:00
Walter Doekes 711a3fed56 chan_sip: Always process updated SDP on media source change
Fixes no-audio issues when the media source is changed and
strictrtp is enabled (default).

If the peer media source changes, the SDP session version also changes.
If it is lower than the one we had stored, chan_sip would ignore it.

This changeset keeps track of the remote media origin identifier,
comparing that as well. If it changes, the session version needn't be
higher for us to accept the SDP.

Common scenario where this would've caused problems: a separate media
gateway that informs the caller about premium rates before handing off
the call to the final destination.

(An alternative fix would be to set ignoresdpversion=yes on the peer.)

ASTERISK-28686

Change-Id: I88fdbc5aeb777b583e7738c084254c482a7776ee
2020-01-24 10:29:23 -06:00
Sean Bright 313189aae2 chan_pjsip: Ignore RTP that we haven't negotiated
If chan_pjsip receives an RTP packet whose payload differs from the
channel's native format, and asymmetric_rtp_codec is disabled (the
default), Asterisk will switch the channel's native format to match
that of the incoming packet without regard to the negotiated payloads.

We now check that the received frame is in a format we have negotiated
before switching payloads which results in these packets being dropped
instead of causing the session to terminate.

ASTERISK-28139 #close
Reported by: Paul Brooks

Change-Id: Icc3b85cee1772026cee5dc1b68459bf9431c14a3
2020-01-23 10:22:00 -06:00
Joshua Colp 093f349daf Merge "chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"" 2020-01-22 07:48:49 -06:00
Andrew Siplas 5bd7281442 chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"
The no-entry timeout set to 999999 == 16⅔ minutes, change to INT_MAX
to match behavior of "no timeout" defined in comment.

ASTERISK-28702 #close

Change-Id: I4ea015986e061374385dba247b272f7aac60bf11
2020-01-21 08:12:31 -06:00
Sean Bright f309b86e36 chan_sip.c: Stop handling continuation lines after reading headers
lws2sws() does not stop trying to handle header continuation lines
even after all headers have been found. This is problematic if the
first character of a SIP message body is a space or tab character, so
we update to recognize the end of the message header.

ASTERISK-28693 #close
Reported by: Frank Matano

Change-Id: Idec8fa58545cd3fd898cbe0075d76c223f8d33df
2020-01-16 09:17:32 -06:00