Commit Graph

32968 Commits

Author SHA1 Message Date
Kevin Harwell
d86cd96c87 Merge "addons/res_config_mysql: silense warnings about printf format errors." into 16 2020-02-27 14:44:29 -06:00
Kevin Harwell
082f571668 Merge "app_queue: Refactor odd placement of if's around say_position" into 16 2020-02-27 14:42:10 -06:00
Torrey Searle
9ecb651564 res/res_pjsip_sdp_rtp: Fix MOH transitions
Update the state of remote_hold immediately on receipt of remote
SDP so that the information is available when building the SDP
answer

ASTERISK-28754 #close

Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f
2020-02-27 14:21:51 -06:00
Kevin Harwell
ed68feeca4 Merge "say: Remove unused "plural" option from main/say" into 16 2020-02-27 13:42:51 -06:00
Kevin Harwell
a421759d63 Merge "format_cap: make function parameters 'const'" into 16 2020-02-27 13:15:33 -06:00
Kevin Harwell
333f64ce83 Merge "pjsip: Update ACLs on named ACL changes." into 16 2020-02-27 12:53:32 -06:00
Walter Doekes
ad5a81aac4 say: Remove unused "plural" option from main/say
There are exceptions for plural objects, but they are detected using the
supplied NUMBER, not using an extra option.

Change-Id: I95d1d1b2796b1aba92048a2dbae8a3856ed8a113
2020-02-25 10:00:25 -06:00
Walter Doekes
b12ecbe27f app_queue: Refactor odd placement of if's around say_position
Change-Id: Icba97905e331812f129e5966e91a59b104c7a748
2020-02-25 09:59:31 -06:00
Kevin Harwell
dd959bf8d0 format_cap: make function parameters 'const'
There were a couple places where the format cap function parameter was not
'const' when it should have been. This patch makes them 'const'.

Change-Id: Ife753fb16a962d842a6b44f45363a61a66bfdb2e
2020-02-24 13:37:31 -06:00
Jaco Kroon
7d1305ac21 addons/res_config_mysql: silense warnings about printf format errors.
Warnings without this:

res_config_mysql.c: In function 'update2_mysql':
res_config_mysql.c:741:15: warning: format '%llu' expects argument of type
    'long long unsigned int', but argument 6 has type 'my_ulonglong'
    {aka 'long unsigned int'} [-Wformat=]
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n",
    numrows, tablename);

(reformatted for readability within line-wrap)

Change-Id: I2af4d419a37c1a7eeee750cf9ae4a9a2b3a37fd3
2020-02-24 08:21:51 -06:00
George Joseph
dd313ceda5 Merge "tcptls.c: Log more informative OpenSSL errors" into 16 2020-02-21 09:01:21 -06:00
George Joseph
0cf988e72b Merge "bridging: Add better support for adding/removing streams." into 16 2020-02-20 13:43:07 -06:00
George Joseph
75648945a2 Merge "ast_tls_cert: Allow private key size to be set on command line" into 16 2020-02-20 10:52:07 -06:00
George Joseph
97789b1749 Merge "app_mixmonitor: Set MIXMONITOR_FILENAME to correct value when wav49 is used" into 16 2020-02-20 10:51:01 -06:00
George Joseph
0319e80ff6 Merge "RTP/ICE: Send on first valid pair." into 16 2020-02-20 09:23:29 -06:00
Joshua C. Colp
b20a215ea7 pjsip: Update ACLs on named ACL changes.
This change extends the Sorcery API to allow a wizard to be
told to explicitly reload objects or a specific object type
even if the wizard believes that nothing has changed.

This has been leveraged by res_pjsip and res_pjsip_acl to
reload endpoints and PJSIP ACLs when a named ACL changes.

ASTERISK-28697

Change-Id: Ib8fee9bd9dd490db635132c479127a4114c1ca0b
2020-02-19 19:32:16 +00:00
Sean Bright
c32b4c7dc0 tcptls.c: Log more informative OpenSSL errors
Dump OpenSSL's error stack to the error log when things fail.

ASTERISK-28750 #close
Reported by: Martin Zeh

Change-Id: Ib63cd0df20275586e68ac4c2ddad222ed7bd9c0a
2020-02-19 14:32:04 -05:00
Sean Bright
cf1f2dfe8e ast_tls_cert: Allow private key size to be set on command line
The default size in release branches will be 1024 but we'll use 2048 in master.

ASTERISK~28750

Change-Id: I435cea18bdd58824ed2b55259575c7ec7133842a
2020-02-19 08:39:21 -06:00
George Joseph
c255dbd836 Merge "res_pjsip_outbound_registration: Fix SRV failover on timeout" into 16 2020-02-18 14:53:41 -06:00
George Joseph
7eab841093 res_pjsip_outbound_registration: Fix SRV failover on timeout
In order to retry outbound registrations for some situations, we
need access to the tdata from the original request.  For instance,
for 401/407 responses we need it to properly construct the
subsequent request with the authentication.  We also need it if
we're iterating over a DNS SRV response record set so we can skip
entries we've already tried.

We've been getting the tdata from the server response rdata and
transaction but that only works for the failures where there was
actually a response (4XX, 5XX, etc).  For timeouts there's no
response and therefore no rdata or transaction from which to get
the tdata.  When processing a single A/AAAA record for a server,
this wasn't an issue as we just retried that same server after the
retry timer expired.  If we got an SRV record set for the server
though, without the state from the tdata, we just kept trying the
first entry in the set repeatedly instead of skipping to the next
one in the list.

* Added a "last_tdata" member to the client state structure to keep
  track of the sent tdata.

* Updated registration_client_send() to save the tdata it used into
  the client_state.

* Updated sip_outbound_registration_response_cb() to use the tdata
  saved in client_state when we don't get a response from the
  server. We still use the tdata from the transaction when we DO
  get a response from the server so we can properly handle 4XX
  responses where our new request depends on it.

General note on timeouts:

Although res_pjsip_outbound_registration skips to the next record
immediately when a timeout occurs during SRV set traversal, it's
pjproject that determines how long to wait before a timeout is
declared.  As with other SIP message types, pjproject will continue
trying the same server at an interval specified by "timer_t1" until
"timer_b" expires.  Both of those timers are set in the pjsip.conf
"system" section.

ASTERISK-28746

Change-Id: I199b8274392d17661dd3ce3b4d69a3968368fa06
2020-02-18 12:05:57 -07:00
Joshua C. Colp
423b0e68ce bridging: Add better support for adding/removing streams.
This change adds support to bridge_softmix to allow the addition
and removal of additional video source streams. When such a change
occurs each participant is renegotiated as needed to reflect the
update. If another video source is added then each participant
gets another source. If a video source is removed then it is
removed from each participant. This functionality allows you to
have both your webcam and screenshare providing video if you
desire, or even more streams. Mapping has been changed to use
the topology index on the source channel as a unique identifier
for outgoing participant streams, this will never change and
provides an easy way to establish the mapping.

The bridge_simple and bridge_native_rtp modules have also been
updated to renegotiate when the stream topology of a party changes
allowing the same behavior to occur as added to bridge_softmix.
If a screen share is added then the opposite party is renegotiated.
If that screen share is removed then the opposite party is
renegotiated again.

Some additional fixes are also included in here. Stream state is
now conveyed in SDP so sendonly/recvonly/inactive streams can
be requested. Removed streams now also remove previous state
from themselves so consumers don't get confused.

ASTERISK-28733

Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5
2020-02-18 16:22:27 +00:00
George Joseph
e213bc530f Merge "res_pjsip_sdp_rtp: implement hold state handling on moh_passthrough" into 16 2020-02-18 10:08:26 -06:00
Ben Ford
411d3a2f75 RTP/ICE: Send on first valid pair.
When handling ICE negotiations, it's possible that there can be a delay
between STUN binding requests which in turn will cause a delay in ICE
completion, preventing media from flowing. It should be possible to send
media when there is at least one valid pair, preventing this scenario
from occurring.

A change was added to PJPROJECT that adds an optional callback
(on_valid_pair) that will be called when the first valid pair is found
during ICE negotiation. Asterisk uses this to start the DTLS handshake,
allowing media to flow. It will only be called once, either on the first
valid pair, or when ICE negotiation is complete.

ASTERISK-28716

Change-Id: Ia7b68c34f06d2a1d91c5ed51627b66fd0363d867
2020-02-18 09:50:32 -06:00
George Joseph
4c3721afa8 Merge "res_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup" into 16 2020-02-17 11:27:51 -06:00
Sean Bright
cd8b27dcc2 app_mixmonitor: Set MIXMONITOR_FILENAME to correct value when wav49 is used
When opening a file for writing, Asterisk silently converts filenames
ending with 'wav49' to 'WAV.' We aren't taking that in to account when
setting the MIXMONITOR_FILENAME variable in MixMonitor.

* If the user wants to write to a wav49 file, make sure that it is
  reflected properly in MIXMONITOR_FILENAME.

* Add a note to the documentation describing this behavior.

* Add a note in main/file.c indicating that app_mixmonitor needs to be
  changed if the logic in build_filename was changed.

ASTERISK-24798 #close
Reported by: xrobau

Change-Id: I384691ce624eb55c80a125b9ca206d2d691c574c
2020-02-17 10:58:25 -06:00
Torrey Searle
afcc838796 res_pjsip_sdp_rtp: implement hold state handling on moh_passthrough
When moh_passthrough is used, asterisk is only generating invites
of type sendonly and sendrecv instead of taking fully into account
the on hold state of the local and remote parties

ASTERISK-28738 #close

Change-Id: Iaaad9fbc033cb14803d433b8a4071bc337047761
2020-02-17 08:33:51 -06:00
Joshua C. Colp
df52f713f5 stasis: Use format specifier for size_t.
Change-Id: Ic9b4afcc5398e7f46314419fc3c90433d818e35c
2020-02-15 08:04:35 -06:00
Kevin Harwell
bb783b0c11 res_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup
There was a race condition between client initiated DTLS setup, and handling
of server side ice completion that caused the underlying SSL object to get
cleared during DTLS initialization. If this happened Asterisk would be left
in a partial DTLS setup state. RTP packets were sent and received, but were
not being encrypted and decrypted. This resulted in no audio, or static.

Specifically, this occurred when '__rtp_recvfrom' was processing the handshake
sequence from the client to the server, and then 'ast_rtp_on_ice_complete'
gets called from another thread and clears the SSL object when calling the
'dtls_perform_setup' function. The timing had to be just right in the sense
that from the external SSL library perspective SSL initialization completed
(rtp recv), Asterisk clears/resets the SSL object (ice done), and then checks
to see if SSL is intialized (rtp recv). Since it was cleared, Asterisk thinks
it is not finished, thus not completing 'dtls_srtp_setup'.

This patch removes calls to 'dtls_perform_setup', which clears the SSL object,
in 'ast_rtp_on_ice_complete'. When ice completes, there is no reason to clear
the underlying SSL object. If an ice candidate changes a full protocol level
renegotiation occurs. Also, in the case of bundled ICE candidates are reused
when a stream is added. So no real reason to have to clear, and reset in this
instance.

Also, this patch adds a bit of extra logging to aid in diagnosis of any future
problems.

ASTERISK-28742 #close

Change-Id: I34c9e6bad5a39b087164646e2836e3e48fe6892f
2020-02-14 10:52:28 -06:00
Joshua Colp
0d0f2b4569 Merge "res_pjsip_session: Fix off-nominal session refreshes." into 16 2020-02-13 19:02:10 -06:00
Joshua Colp
1b3de98db5 Merge "res_musiconhold: Avoid spurious warning when 'format' is the empty string" into 16 2020-02-13 19:01:39 -06:00
George Joseph
918e79aae5 Merge "doc: Fix CHANGES entries to have .txt suffix and update READMEs" into 16 2020-02-13 08:30:26 -06:00
Sean Bright
1e94cfdf4c res_musiconhold: Avoid spurious warning when 'format' is the empty string
The change to res_config_odbc that allowed empty strings to be
returned to realtime consumers¹ causes a warning to be emitted when
loading MoH classes. So we need to treat an empty 'format' as if it
was not specified to avoid the warning.

ASTERISK-28735 #close
Reported by: Ross Beer

[1] https://gerrit.asterisk.org/c/asterisk/+/13722

Change-Id: I9a271d721e1a0973e80ebe7d75b46a0d8fa0e5a5
2020-02-11 08:55:31 -05:00
Sean Bright
65ff4d80a1 func_odbc: Prevent snprintf() truncation warning
For reasons that are not clear to me - this only appears for me when
_not_ building in dev-mode.

Change-Id: Ib45c54daaea8e0d571cb470cab1daaae2edba968
2020-02-10 15:42:37 -06:00
Joshua C. Colp
b438d1d9ad res_pjsip_session: Fix off-nominal session refreshes.
Given a scenario where session refreshes occur close to
each other while another is finishing it was possible for
the session refreshes to occur out of order. It was
also possible for session refreshes to be delayed for
quite some time if a session refresh did not result in
a topology change.

For the out of order session refreshes the first session
refresh would be queued due to a transaction in progress.
This transaction would then finish. When finished a
separate task to process the delayed requests queue
would be queued for handling. A second refresh would
be requested internally before this delayed request
queued task was processed. As no transaction was in
progress this session refresh would be immediately
handled before the queued session refresh.

The code will now check if any delayed requests exist
before allowing a session refresh to immediately occur.
If any exist then the session refresh is queued.

For the delayed session refreshes if a session refresh
did not result in a topology change the attempt would
be immediately stopped and no other delayed requests would
be processed.

The code will now go through the entire delayed requests
queue until a delayed request results in a request
actually being sent.

ASTERISK-28730

Change-Id: Ied640280133871f77d3f332be62265e754605088
2020-02-10 08:10:48 -04:00
George Joseph
1544f74932 doc: Fix CHANGES entries to have .txt suffix and update READMEs
Although the wiki page for the new CHANGES and UPGRADE scheme
states that the files must have the ".txt" suffix, the READMEs
didn't.

Change-Id: I490306aa2cc24d6f014738e9ebbc78592efe0f05
(cherry picked from commit 7416703f04)
2020-02-07 14:08:21 -06:00
Joshua Colp
b3360fa5df Merge "pjproject_bundled: Allow brackets in via parameters" into 16 2020-02-07 07:05:56 -06:00
Joshua Colp
ba8a9b5eed Merge "chan_sip: Return 503 if we're out of RTP ports" into 16 2020-02-06 07:24:24 -06:00
Friendly Automation
40751c2769 Merge "install_prereq: Install aptitude non-interactively" into 16 2020-02-06 07:22:36 -06:00
Friendly Automation
3d20251085 Merge "chan_sip: Clarify in sample docs how directmediapermit/-acl should be used" into 16 2020-02-05 10:25:10 -06:00
Friendly Automation
bb73edad37 Merge "res_config_odbc: Preserve empty strings returned by the database" into 16 2020-02-05 09:48:50 -06:00
Friendly Automation
98f451771f Merge "res_stasis_playback: Prevent media_index from going out of bounds" into 16 2020-02-05 09:45:09 -06:00
Sylvain Afchain
40b834ad8c install_prereq: Install aptitude non-interactively
Currently aptitude is installed using interactive mode. This patch
changes this to use the non-interactive mode as it can block
automatic dependencies installation, ex: CI, Docker build.

ASTERISK-28726 #close

Change-Id: I271ee00d230513a6f044810351a32d83b2181133
(cherry picked from commit 0c02d0a450)
2020-02-05 14:21:47 +01:00
Walter Doekes
34ce90a9e7 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-02-05 06:32:59 -06:00
Walter Doekes
35b4f1686b chan_sip: Clarify in sample docs how directmediapermit/-acl should be used
It said "restrict [...] which peers should be able to pass [audio]
to each other".

However, these settings are not global (for which you would expect
signaling IPs to be checked). These settings are available per peer
only, and the IPs being checked, are the RTP IPs.

Change-Id: I2a6c6cd7c2f5f30d1df4844e3e0308a077021660
2020-02-05 06:27:06 -06:00
Joshua C. Colp
f4132eec19 res_rtp_asterisk: Don't produce transport-cc if no packets.
The code assumed that when the transport-cc feedback
function was called at least one packet will have been
received. In practice this isn't always true, so now
we just reschedule the sending and do nothing.

Change-Id: Iabe7b358704da446fc3b0596b847bff8b8a0da6a
2020-02-04 10:18:13 -04:00
George Joseph
d6574cb7c7 message.c: Add option to suppress the Message channel AMI and ARI events
In order to reduce the amount of AMI and ARI events generated,
the global "Message/ast_msg_queue" channel can be set to suppress
it's normal channel housekeeping events such as "Newexten",
"VarSet", etc. This can greatly reduce load on the manager
and ARI applications when the Digium Phone Module for Asterisk
is in use.  To enable, set "hide_messaging_ami_events" in
asterisk.conf to "yes"  In Asterisk versions <18, the default
is "no" preserving existing behavior.  Beginning with
Asterisk 18, the option will default to "yes".

NOTE:  This change does not affect UserEvents or the ARI
TextMessageReceived events.

* Added the "hide_messaging_ami_events" option to asterisk.conf.

* Changed message.c to set the AST_CHAN_TP_INTERNAL property on
  the "Message/ast_msg_queue" channel if the option is set in
  asterisk.conf.  This suppresses the reporting of the events.

Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b
2020-02-03 12:57:59 -07:00
Friendly Automation
48d5433cdd Merge "res_pjsip_messaging: Allow Content-Type to be overridden" into 16 2020-02-03 06:06:56 -06:00
Friendly Automation
88e67b51f2 Merge "res_stasis: trigger cleanup after update" into 16 2020-01-30 10:02:16 -06:00
George Joseph
b5b00e5299 Merge "stasis/app: don't lock an app before a call to send" into 16 2020-01-30 09:24:24 -06:00
George Joseph
1e78b2cf0a Merge "res_pjsip_pubsub: Increment persistence data ref when recreating." into 16 2020-01-30 09:22:39 -06:00