Commit Graph

32582 Commits

Author SHA1 Message Date
George Joseph 7c4fc2e39a Merge "config.c: Skip UTF-8 BOMs if present when reading config files" 2019-12-27 13:12:03 -06:00
Joshua C. Colp dd823e50e4 Merge "main/file.c: Limit media cache usage to remote files." 2019-12-19 18:41:11 -06:00
Joshua C. Colp d21427cadd Merge "app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR." 2019-12-19 18:40:11 -06:00
Friendly Automation c3cf0e330c Merge "chan_sip: in case of tcp/tls, be less annoying about tx errors." 2019-12-19 10:44:45 -06:00
Friendly Automation 07b7c6f50a Merge "confbridge: Add support for specifying maximum sample rate." 2019-12-19 10:00:43 -06:00
Sean Bright 40b5cf8f52 config.c: Skip UTF-8 BOMs if present when reading config files
ASTERISK-28667 #close

Change-Id: I4767ed365c98f3e1587b7653321048a31d8a53b2
2019-12-19 04:48:58 -06:00
Kevin Reeves c626ccec12 main/file.c: Limit media cache usage to remote files.
When testing for the existance of a file, the media cache is searched even if
the file has no chance of being in it.  This can cause performance issues
as the media cache size increases.

As a result, calls to applications like Read and Playback using local files
must scan through the media cache before playing.  Under load and with a
large cache, this can delay the playback of those files.

This patch updates the function that checks for the existance of a file to
only consult the media cache database if the requested file is a remote path.
It introduces a new is_remote_path() function in main/file.c.

ASTERISK-28625  #close
Reported-by: kevin@phoneburner.com

Change-Id: If91137493732d9034dafa381c081c69274a7dcc9
2019-12-18 18:45:24 -06:00
George Joseph 657ada8bfd Merge "res_rtp_asterisk: Add frame list cleanups to ast_rtp_read" 2019-12-18 08:54:16 -06:00
Friendly Automation 308592a681 Merge "sip_to_pjsip.py: Fix trustrpid typo" 2019-12-18 07:26:45 -06:00
Joshua C. Colp c29b7c00e5 Merge "configure: Add check for MySQL client bool and my_bool type usage." 2019-12-18 06:37:06 -06:00
Joshua C. Colp 2779189689 Merge "res_pjsip_session: Set stream state on created streams for incoming SDP." 2019-12-18 05:38:29 -06:00
Snuffy 095c204fe0 contrib/valgrind: Fix use of frame-level suppression
Fix use of frame-level wildcard usage in suppression file.

ASTERISK-27243 #close
Reported-by: Richard Kenner

Change-Id: I1c0c64c5f305d2c9aa124e11f1f64a2eec52dc51
2019-12-18 11:20:49 +11:00
Pascal Cadotte Michaud e494d5fd76
sip_to_pjsip.py: Fix trustrpid typo
ASTERISK-28664 #close

Change-Id: I6c28b1002fd7075ae0ed36f026f8c1855c9418a6
2019-12-17 13:10:17 -05:00
Frederic LE FOLL a83625b366 app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.
Temporary channel lifespan is very short and CDR deactivation request
through ast_cdr_set_property() may happen when CDR is not available
yet. Use CDR_PROP() dialplan function instead, it will first wait
for pending CDR insertion requests to be processed.

ASTERISK-28636

Change-Id: I1cbe09e8d2169c0962c1195133ff260d291f2074
2019-12-16 15:02:49 -06:00
George Joseph 8587ef3a0c Merge "res_pjsip_nat: Restore original contact for REGISTER responses" 2019-12-16 11:03:47 -06:00
Joshua C. Colp ed394ce5b1 configure: Add check for MySQL client bool and my_bool type usage.
Instead of trying to use the defined MySQL client version from the
header use a configure check to determine whether the bool or my_bool
type should be used for defining a boolean.

ASTERISK-28604

Change-Id: Id2225b3785115de074c50c123ff1a68005b4a9c7
2019-12-16 10:36:25 -06:00
Joshua C. Colp 89b7144fbd confbridge: Add support for specifying maximum sample rate.
ConfBridge has the ability to move between different sample
rates for mixing the conference bridge. Up until now there has
only been the ability to set the conference bridge to mix at
a specific sample rate, or to let it move between sample rates
as necessary. This change adds the ability to configure a
conference bridge with a maximum sample rate so it can move
between sample rates but only up to the configured maximum.

ASTERISK-28658

Change-Id: Idff80896ccfb8a58a816e4ce9ac4ebde785963ee
2019-12-16 09:54:21 -06:00
Friendly Automation 7e441d6b25 Merge "PJSIP_CONTACT: add missing argument documentation" 2019-12-16 06:56:16 -06:00
Joshua C. Colp a603d7d324 res_pjsip_session: Set stream state on created streams for incoming SDP.
A previous review, 13174, made a change whereby on an incoming offer SDP
the pending topology was initialized to the configured. This caused a problem
for bundle with WebRTC where bundle could reference a stream that did not
actually exist if the configuration had both audio and video but the
offer SDP only contained audio.

This change undoes that review and instead fixes the original problem it
sought to solve by setting the state of created streams based on the
contents of the offer SDP. This way the stream state is not inactive
until negotiation later completes.

ASTERISK-28659

Change-Id: Ic5ae5a86437d3e686ac5afd91d133cc916198355
2019-12-16 05:23:50 -06:00
Kevin Harwell b6f5607359 res_fax: wrap v21 detected Asterisk initiated negotiation with config option
A previous patch:

Gerrit Change-Id: I73bb24799bfe1a48adae9c034a2edbae54cc2a39

made it so a T.38 Gateway tries to negotiate with both sides by sending T.38
negotiation request to both endpoints supported T.38 versus the previous
behavior of forwarding negotiation to the "other" channel once a preamble
was detected.

This had the unfortunate side effect of breaking some setups. Specifically
ones that set the max datagram option on an endpoint configuration (configured
max datagram was not propagated since Asterisk now initiates negotiations).

This patch adds a configuration option, "negotiate_both", that when enabled
makes it so Asterisk initiates the negotiation requests to both endpoints vs.
the previous behavior of waiting, and forwarding the request.

The default is disabled keeping with the old behavior.

ASTERISK-28660

Change-Id: I5deb875f3485e20bc75119ec743090655d864a1a
2019-12-13 14:24:10 -06:00
Jaco Kroon 32160cb456 ACL: ast_apply_acl_nolog - identical to ast_apply_acl but without logging.
Due to use in res_rtp_asterisk there is a need to be able to apply an
ACL without logging any invalid/denies.  It's probably sensible to at
least validate the ACL once directly after load and report invalid ACLs.

Change-Id: I256169229d945ca7c1bbf228fc492d91df345843
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2019-12-12 02:14:55 -06:00
Pascal Cadotte Michaud bf4dd3d837
PJSIP_CONTACT: add missing argument documentation
add missing argument "rtt" and "status" to the documentation

The change to the dtd file allow an enumlist to contain one or many
configOptionToEnum or enum.

This is different from the previous patch I submitted when you could have a
configOptionToEnum or (a configOptionToEnum followed by one or manu enums) or
(one or many enums)

ASTERISK-28626

Change-Id: Ia71743ee7ec813f40297b0ddefeee7909db63b6d
2019-12-11 12:05:27 -05:00
George Joseph 91cdb9537e Merge "Revert "PJSIP_CONTACT: add missing argument documentation"" 2019-12-11 10:36:58 -06:00
Joshua Colp d0b198b330 Revert "PJSIP_CONTACT: add missing argument documentation"
This reverts commit 7e3015d779.

Reason for revert: Regression in XML validation.

validity error : Content model of enumlist is not determinist:
(configOptionToEnum | (configOptionToEnum , enum+) | enum+)

As we are preparing to do releases and this is not critical
I am reverting this for now until resolved.

Change-Id: I30c2295f9d7f0a0475674ee77071a7ebabf5b83f
2019-12-11 07:01:32 -06:00
George Joseph 39c920ac78 res_rtp_asterisk: Add frame list cleanups to ast_rtp_read
In Asterisk 16+, there are a few places in ast_rtp_read where we've
allocated a frame list but return a null frame instead of the list.
In these cases, any frames left in the list won't be freed.  In the
vast majority of the cases, the list is empty when we return so
there's nothing to free but there have been leaks reported in the
wild that can be traced back to frames left in the list before
returning.

The escape paths now all have logic to free frames left in the
list.

ASTERISK-28609
Reported by: Ted G

Change-Id: Ia1d7075857ebd26b47183c44b1aebb0d8f985f7a
2019-12-10 12:48:32 -06:00
George Joseph d8dac784f4 Merge "res_pjsip_registrar.c: Prevent potential double free if AOR is not found" 2019-12-09 11:47:43 -06:00
Jaco Kroon 365d007eb6 chan_sip: in case of tcp/tls, be less annoying about tx errors.
chan_sip.c:3782 __sip_xmit: sip_xmit of 0x7f1478069230 (len 600) to
213.150.203.60:1492 returned -2: Interrupted system call

returned -2 implies this wasn't actually an OS error, so errno makes no
sense either.  Internal error was already logged higher up, and -2
generally means that either there isn't a valid connection available, or
the pipe notification failed, and that is already correctly logged.

ASTERISK-28651 #close

Change-Id: I46eb82924beeff9dfd86fa6c7eb87d2651b950f2
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2019-12-07 14:07:21 +02:00
Friendly Automation 616f702865 Merge "app_queue: Fix old confusing comment about when the members are called" 2019-12-06 13:33:26 -06:00
George Joseph cbc1136704 res_pjsip_nat: Restore original contact for REGISTER responses
RFC3261 Section 10 "Registrations", specifically paragraph
"10.2.4: Refreshing Bindings", states that a user agent compares
each contact address (in a 200 REGISTER response) to see if it
created the contact.  If the Asterisk endpoint has the
rewrite_contact option set however, the contact host and port sent
back in the 200 response will be the rewritten one and not the
one sent by the user agent.  This prevents the user agent from
matching its own contact.  Some user agents get very upset when
this happens and will not consider the registration successful.
While this is rare, it is acceptable behavior especially if more
than 1 user agent is allowed to register to a single endpoint/aor.

This commit updates res_pjsip_nat (where rewrite_contact is
implemented) to store the original incoming Contact header in
a new "x-ast-orig-host" URI parameter before rewriting it, and to
restore the original host and port to the Contact headers in the
outgoing response.

This is only done if the request is a REGISTER and rewrite_contact
is enabled.

pjsip_message_filter was also updated to ensure that if a request
comes in with any existing x-ast-* URI parameters, we remove them
so they don't conflict.  Asterisk will never send a request
with those headers in it but someone might just decide to add them
to a request they craft and send to Asterisk.

NOTE: If a device changes its contact address and registers again,
it's a NEW registration.  If the device didn't unregister the
original registration then all existing behavior based
on aor/remove_existing and aor/max_contacts apply.

ASTERISK-28502
Reported-by: Ross Beer

Change-Id: Idc263ad2d2d7bd8faa047e5804d96a5fe1cd282e
2019-12-06 12:48:08 -06:00
Friendly Automation ec559c34db Merge "res_pjsip_outbound_registration: add support for SRV failover" 2019-12-06 09:30:20 -06:00
Friendly Automation e99cdeeff3 Merge "res_pjsip_registrar.c: Prevent possible buffer overflow with domain aliases" 2019-12-06 09:17:49 -06:00
Friendly Automation fd00a2bd10 Merge "channel.c: Resolve issue with receiving SIP INFO packets for DTMF" 2019-12-06 08:46:26 -06:00
Joshua Colp 702581647f Merge "chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime." 2019-12-05 07:53:56 -06:00
Friendly Automation 2587b7e45f Merge "PJSIP_CONTACT: add missing argument documentation" 2019-12-04 18:25:19 -06:00
Kevin Harwell bb2a59e171 Merge "res_pjsip_session.c: Prevent use-after-free with TEST_FRAMEWORK enabled" 2019-12-04 18:03:18 -06:00
Friendly Automation 0f1a429945 Merge "parking: Fall back to parker channel name even if it matches parkee." 2019-12-04 17:19:24 -06:00
Sean Bright b1be06df8d res_pjsip_registrar.c: Prevent potential double free if AOR is not found
The simple fix here is simply to NULL out username and password after we call
ast_free on them. Unfortunately, I noticed that we weren't checking for
allocation failures for username and password, and adding those checks made
things noisy and cumbersome.

So instead we partially rollback the recent LGTM patch, and move the alloca
calls into find_aor_name().

ASTERISK-28641 #close
Reported by: Ross Beer

Change-Id: Ic9d01624e717a020be0b0aee31f0814e7f1ffbe2
2019-12-04 16:19:23 -06:00
Sean Bright 0183e2bc67 res_pjsip_registrar.c: Prevent possible buffer overflow with domain aliases
We're appropriately sizing the id_domain_alias buffer, but then copying the data
into the id_domain one. We were then using the uninitialized id_domain_alias
buffer we just allocated.

This is ASTERISK~28641 adjacent, but significant enough to warrant its own
patch.

Change-Id: I81c38724d18deab8c6573153e2b99dbb6e2f33d9
2019-12-04 16:15:26 -06:00
Jean Aunis 9c9296c635 chan_sip: voice frames are no longer transmitted after emitting a COLP
The SIP transaction state was reset when emitting an UPDATE or a re-INVITE
related to a COLP, preventing RTP packets to be emitted.

ASTERISK-28647

Change-Id: Ie7a30fa7a97f711e7ba6cc17f221a0993d48bd8b
2019-12-04 16:44:34 +01:00
Frederic LE FOLL 7624cbb155 chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime.
During capabilities selection (joint capabilities of us and peer,
configured capability for this peer, or general configured
capabilities), if sip_new() does not keep framing information,
then directmedia activation will fail for any framing different
from default framing.

ASTERISK-28637

Change-Id: I99257502788653c2816fc991cac7946453082466
2019-12-04 05:10:59 -06:00
Walter Doekes 0e750cdd10
app_queue: Fix old confusing comment about when the members are called
ASTERISK-28644

Change-Id: I2771a931d00a8fc2b9f9a4d1a33ea8f1ad24e06b
2019-12-04 10:33:44 +01:00
Sean Bright 6ee1f1f507 res_pjsip_session.c: Prevent use-after-free with TEST_FRAMEWORK enabled
We need to copy the endpoint name before we call ao2_cleanup() on it,
otherwise we might try to access memory that has been reclaimed.

ASTERISK-28445 #close
Reported by: Bernhard Schmidt

Change-Id: I404b952608aa606e0babd3c4108346721fb726b3
2019-12-03 15:45:11 -06:00
George Joseph c1ad1ea391 Merge "media_cache.c: Various CLI improvements" 2019-12-02 16:01:57 -06:00
George Joseph fd823225a6 channel.c: Resolve issue with receiving SIP INFO packets for DTMF
The problem is essentially the same as in ASTERISK~28245. Besides
the direct media scenario we have an additional scenario where a
special client is involved. This device mutes audio by default in
transmit direction (no rtp frames) and activates audio only by a
foot switch. In this situation dtmf input (pin for conferences,
transfer features codes , etc) using SIP INFO mode is not
understood properly especially when SIP INFO messages are sent
quickly.

This patch ensures that SIP INFO frames are properly queued and
processed in the above scenario. The patch also corrects situations
where successive dtmf events are received quicker than the
signalled event duration (plus minimum gap/pause) allows, i.e. DTMF
events have to be buffered in the ast channel read queue and
emulation has to be processed asynchronously at slower speed.

Reported by: Thomas Arimont
patches:
  trigger_dtmf_emulation.patch submitted by Thomas Arimont (license 5525)

Change-Id: I309bf61dd065c9978c8e48f5b9a936ab47de64c2
2019-12-02 08:39:57 -06:00
George Joseph 366da90f74 CI: Turn off shallow cloning altogether
Change-Id: I73ed4aef33a92f20080128aafc34e19fd4457196
2019-12-02 07:54:39 -05:00
Joshua Colp cd3a2a478f Merge "core: Improve MALLOC_DEBUG for frames." 2019-12-02 06:45:24 -06:00
Joshua Colp 811ae88da4 parking: Fall back to parker channel name even if it matches parkee.
ASTERISK-28631

Change-Id: Ia74d084799fbb9bee3403e30d2391aacd46243cc
2019-11-25 07:57:36 -05:00
Sean Bright 91c3b5b09d media_cache.c: Various CLI improvements
* Use ast_cli_completion_add() to improve performance when large number of
  cached items are present.

* Only complete one URI for commands that only accept a single URI.

* Change command documentation to wrap at 80 characters to improve
  readability.

Change-Id: Iedb0a2c3541e49561bc231dca2dcc0ebd8612902
2019-11-22 16:38:23 -05:00
Rodrigo Ramírez Norambuena 48161dfc71 queue_log: Add alembic script for generate db table for queue_log
Change-Id: I35b928a6251f9da9a1742b2cd14c63a00c3d0f0c
2019-11-22 15:33:29 +00:00
Salah Ahmed 330ffa2bce res_pjsip_t38: T.38 error correction mode selection at 200 ok received
if asterisk offer T38 SDP with none error correction scheme and
the endpoint respond with redundancy EC scheme, asterisk switch
to that mode. Since we configure the endpoint as none EC mode
we should not switch to any other mode except none.
following logic implemented in code.

1. If asterisk offer none, and anything except none in answer
   will be ignored.
2. If asterisk offer fec, answer with fec, redundancy and none will
   be accepted.
3. If asterisk offer redundancy, answer with redundancy and none
   will be accepted.

ASTERISK-28621

Change-Id: I343c62253ea4c8b7ee17abbfb377a4d484a14b19
2019-11-21 16:10:46 -05:00