Commit Graph

31298 Commits

Author SHA1 Message Date
Friendly Automation
815d0f8e5a Merge "res_pjsip_registrar.c: Prevent potential double free if AOR is not found" into 13 2019-12-09 10:24:11 -06:00
Jaco Kroon
72d51ab8f5 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:08:04 +02:00
Friendly Automation
40b1fdbba4 Merge "app_queue: Fix old confusing comment about when the members are called" into 13 2019-12-06 13:29:35 -06:00
George Joseph
02576bfef7 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 11:47:54 -07:00
Friendly Automation
bf179634c0 Merge "res_pjsip_registrar.c: Prevent possible buffer overflow with domain aliases" into 13 2019-12-06 08:44:54 -06:00
Friendly Automation
4df3b39e10 Merge "channel.c: Resolve issue with receiving SIP INFO packets for DTMF" into 13 2019-12-06 08:35:01 -06:00
Jaco Kroon
6e79028020 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-05 18:05:50 +02:00
Friendly Automation
5386b674e1 Merge "PJSIP_CONTACT: add missing argument documentation" into 13 2019-12-04 18:27:10 -06:00
Friendly Automation
575f4d9639 Merge "chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime." into 13 2019-12-04 18:03:59 -06:00
Friendly Automation
1e200cf2b2 Merge "res_pjsip_session.c: Prevent use-after-free with TEST_FRAMEWORK enabled" into 13 2019-12-04 17:18:21 -06:00
Friendly Automation
f9b10259e5 Merge "parking: Fall back to parker channel name even if it matches parkee." into 13 2019-12-04 17:11:05 -06:00
Sean Bright
1750847fc0 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:17:57 -06:00
Sean Bright
890f8a79d4 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:14:37 -06:00
Walter Doekes
d8063c1cf9 app_queue: Fix old confusing comment about when the members are called
ASTERISK-28644

Change-Id: I2771a931d00a8fc2b9f9a4d1a33ea8f1ad24e06b
2019-12-04 11:38:29 -06:00
Frederic LE FOLL
3a32b75c33 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 04:52:19 -06:00
Sean Bright
2b5259b7e8 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:44:32 -06:00
George Joseph
5aee4f7655 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 07:16:06 -07:00
Friendly Automation
5554082d88 Merge "CI: Turn off shallow cloning altogether" into 13 2019-12-02 07:08:31 -06:00
George Joseph
cec947525b CI: Turn off shallow cloning altogether
Change-Id: I73ed4aef33a92f20080128aafc34e19fd4457196
2019-12-02 05:48:01 -07:00
Joshua Colp
032f5d8971 Merge "res_pjsip_t38: T.38 error correction mode selection at 200 ok received" into 13 2019-12-02 06:47:34 -06:00
Joshua Colp
e401f725d1 parking: Fall back to parker channel name even if it matches parkee.
ASTERISK-28631

Change-Id: Ia74d084799fbb9bee3403e30d2391aacd46243cc
2019-11-25 12:55:27 +00:00
Benjamin Keith Ford
2652720df4 Merge "res_pjsip_session.c: Check for port of zero on incoming SDP." into 13 2019-11-21 13:42:39 -06:00
Friendly Automation
80e9e986ad Merge "manager.c: Prevent the Originate action from running the Originate app" into 13 2019-11-21 12:17:47 -06:00
Ben Ford
c2279540ba chan_sip.c: Prevent address change on unauthenticated SIP request.
If the name of a peer is known and a SIP request is sent using that
peer's name, the address of the peer will change even if the request
fails the authentication challenge. This means that an endpoint can
be altered and even rendered unusuable, even if it was in a working
state previously. This can only occur when the nat option is set to the
default, or auto_force_rport.

This change checks the result of authentication first to ensure it is
successful before setting the address and the nat option.

ASTERISK-28589 #close

Change-Id: I581c5ed1da60ca89f590bd70872de2b660de02df
2019-11-21 09:45:35 -06:00
George Joseph
1b9281a5de manager.c: Prevent the Originate action from running the Originate app
If an AMI user without the "system" authorization calls the
Originate AMI command with the Originate application,
the second Originate could run the "System" command.

Action: Originate
Channel: Local/1111
Application: Originate
Data: Local/2222,app,System,touch /tmp/owned

If the "system" authorization isn't set, we now block the
Originate app as well as the System, Exec, etc. apps.

ASTERISK-28580
Reported by: Eliel Sardañons

Change-Id: Ic4c9dedc34c426f03c8c14fce334a71386d8a5fa
2019-11-21 09:40:28 -06:00
Ben Ford
c257794330 res_pjsip_session.c: Check for port of zero on incoming SDP.
If a re-invite comes in initiating T.38, but there is no c line in the
SDP and the port is also 0, a crash can occur. A check is now done on
the port to see if the steam is already declined, preventing the crash.
The logic was moved to res_pjsip_session.c because it is handled in a
similar manner in later versions of Asterisk.

ASTERISK-28612
Reported by: Salah Ahmed

Change-Id: Ifc4a0d05b32c7f2156e77fc8435a6ecaa6abada0
2019-11-21 09:35:00 -06:00
George Joseph
bb732e4292 Merge "app_senddtmf: Add receive mode to AMI Action PlayDTMF" into 13 2019-11-21 09:20:10 -06:00
Friendly Automation
955e331174 Merge "chan_dahdi: PRI span status may stay "Down, Active" after a short alarm" into 13 2019-11-21 08:44:55 -06:00
Pascal Cadotte Michaud
3778e1abcd PJSIP_CONTACT: add missing argument documentation
add missing argument "rtt" and "status" to the documentation

ASTERISK-28626
Change-Id: I8419e4c8203e411b87d93dc395acdbcf7526dedf
2019-11-21 09:23:49 -05:00
Kevin Harwell
e00381d8d0 Merge "res_pjsip_registrar: Fix uninitlized variable warning" into 13 2019-11-20 16:13:23 -06:00
Friendly Automation
7bcfcd3433 Merge "app_amd: Fixed timeout issue" into 13 2019-11-20 10:34:25 -06:00
Friendly Automation
243c1af2b9 Merge "func_curl.c: Support custom http headers" into 13 2019-11-20 09:55:01 -06:00
Salah Ahmed
9c586e5be7 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-20 09:44:39 -06:00
George Joseph
95213b01d2 CI: Fix missing script block in jenkinsfiles
Change-Id: I9f44a3d5085ea7880fad1a3883a4820907e29ea3
2019-11-19 11:11:06 -07:00
Sean Bright
b03af8ba3c res_pjsip_registrar: Fix uninitlized variable warning
Fixes: error: ‘domain_name’ may be used uninitialized in this function

Found with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008

Change-Id: I44413b49ea1205aa25538142161deb73883c79e8
2019-11-19 11:41:47 -06:00
George Joseph
d60f23ecbd CI: Fix missing script block in jenkinsfiles
Change-Id: Ib4b6e4887695f230ea7a5b0c879b29fc5a13be4f
2019-11-19 10:41:22 -07:00
George Joseph
7702ea986e CI: Increase clone depth and do better cleanup
The original clone depth of 10 was causing the need to rebase
changes whose parent was older than the 10 commits.  The clone
depth has been increased to 100.

Workspace cleanup was only happening for successful builds which
wasn't enough to keep the 8G workspace in-memory drives on the
docker slaves from filling up.  Now the workspaces are cleaned up
after every build regardless of success/failure.  If you need to
preserve builds temporarily, you can log into Jenkins/Manage
Jenkins/Configure System and change the CLEANUP_WS_* environment
variable for the job type you're troubleshooting to "FALSE".

Change-Id: I0d7366e87cea714e5dbc9488caf718802fce75ca
2019-11-19 11:58:41 -05:00
Friendly Automation
8508a06706 Merge "serializer: set high/low alert levels on whole pool" into 13 2019-11-19 10:10:23 -06:00
George Joseph
c79db42573 Merge "parking: Fix case where we can't get the parker." into 13 2019-11-19 09:23:05 -06:00
Frederic LE FOLL
ad50410568 chan_dahdi: PRI span status may stay "Down, Active" after a short alarm
Upon a short PRI disconnection, libpri may maintain Q.921 layer 'up' and
may thus not send PRI_EVENT_DCHAN_DOWN / PRI_EVENT_DCHAN_UP events.
If pri_event_alarm() clears DCHAN_UP status bit upon alarm detection
and no Q.921 reconnection sequence occurs, chan_dahdi will keep
seeing span status "Down" at the end of alarm.

This patch modifies pri_event_alarm() in order to keep DCHAN_UP bit
unchanged. libpri will send a PRI_EVENT_DCHAN_DOWN event if it detects
a disconnection of Q.921 layer and this will clear DCHAN_UP if required.

ASTERISK-28615

Change-Id: Ibe27df4971fd4c82cc6850020bce4a8b2692c996
2019-11-19 02:19:10 -05:00
lvl
17c393377e app_senddtmf: Add receive mode to AMI Action PlayDTMF
ASTERISK-28614

Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
2019-11-18 18:09:57 -05:00
Alexei Gradinari
26fc3a3127 serializer: set high/low alert levels on whole pool
The current code sets alert levels starting from index 1.
Need to set on whole pool starting from index 0.

Change-Id: I5decbb43160954fb9a512f04302637fc666b6f5d
2019-11-18 11:06:20 -05:00
George Joseph
ab28da7c9d Merge "func_env: Prevent FILE() from reading garbage at end-of-file" into 13 2019-11-18 09:54:16 -06:00
Friendly Automation
a42f3ff3b7 Merge "res_rtp_asterisk: Always return provided DTLS packet length." into 13 2019-11-18 09:13:10 -06:00
Friendly Automation
803bc786f6 Merge "various files - fix some alerts raised by lgtm code analysis" into 13 2019-11-18 09:12:57 -06:00
Friendly Automation
e82a91ee1c Merge "bridge_softmix: clear hold when joining a softmix bridge" into 13 2019-11-18 09:12:17 -06:00
Martin Tomec
f032b8c158 func_curl.c: Support custom http headers
When user wants to send json data, the default Content-Type header
is incorect (application/x-www-form-urlencoded). This patch allows
to set any custom headers so the Content-Type header can be
overriden. User can set multiple headers by multiple calls of
curlopt(). This approach is not consistent with other parameters,
but is more readable in dialplan than one call with multiple
headers.

ASTERISK-28613

Change-Id: I4dd68c3f4e25362ef941d73a3861f58348dcfbf9
2019-11-15 13:54:52 +00:00
Joshua Colp
eb3b49928e parking: Fix case where we can't get the parker.
ASTERISK-28616

Change-Id: Iabe31ae38d01604284fcc5c2438d44e29a32ea4d
2019-11-15 06:46:37 -04:00
George Joseph
7a236ed20d stasis: Don't hold app_registry and session locks unnecessarily
resource_events:app_handler() was locking the session, then
attempting to determine if the app had debug enabled which
locked the app_registry container.  res_stasis:__stasis_app_register
was locking the app_registry container then calling app_update
which caused app_handler (which locks the session) to run.
The result was a deadlock.

* Updated resource_events:app_handler() to determine if debug was
  set (which locks the app_registry) before obtaining the session lock.

* Updated res_stasis:__stasis_app_register to release the app_registry
  container lock before calling app_update (which locks the sesison).

ASTERISK-28423
Reported by Ross Beer

Change-Id: I58c69d08cb372852a63933608e4d6c3e456247b4
2019-11-14 17:22:58 -06:00
Michael Cargile
9361e32bed app_amd: Fixed timeout issue
ASTERISK_28143 attempted to fix an issue where calls with no audio would never
timeout. It did so by adding AST_FRAME_NULL as a frame type to process in its
calculations. Unfortunately these frames seem to show up at irregular time
intervals. This resulted in app_amd returning prematurely most of the time.

* Removed AST_FRAME_NULL from the calculations
* Added a check to see how much time has actually passed since app_amd began

ASTERISK-28608

Change-Id: I642a21b02d389b17e40ccd5357754b034c3daa42
2019-11-14 11:03:05 -05:00