Commit Graph

27580 Commits

Author SHA1 Message Date
zuul
95285c6d23 Merge "res_pjsip_outbound_registration: generate correct Contact URI for TLS" into 13 2016-05-12 15:05:42 -05:00
Sebastian Damm
a94a12bbf7 res_pjsip_outbound_registration: generate correct Contact URI for TLS
There are two types of SIP URIs indicating a secure transport:
* sips:user@example.org
* sip:user@example.org;transport=tls

When using a sips URI, Asterisk checks incoming INVITEs and answers from
the other side for sips URIs, and rejects the packet if there are only
sip URIs. So Asterisk should only generate a sips Contact URI if the
other side supports it.

This patch makes Asterisk generate either a sip or sips Contact URI
depending on the format of the server URI.

If you want a sip URI, use:
server_uri=sip:example.org\;transport=tls

If you want a sips URI, use:
server_uri=sips:example.org

ASTERISK-25990 #close
Reported-by: Sebastian Damm

Change-Id: I5ae57d6531ce940b5fc64d5cd2673e60db0f9ba2
2016-05-12 05:34:24 -05:00
Matt Jordan
37214b0bdf configure: Fix errors with AST_UNDEFINED_SANITIZER/AST_LEAK_SANITIZER
When running on a system that does not support or use AST_UNDEFINED_SANITIZER
or AST_LEAK_SANITIZER, the configure script would incorrectly set those
constants to a blank value, e.g., 'AST_UNDEFINED_SANITIZER='. This would
cause menuselect to error out, complaining that a blank value is not a
valid option. This patch corrects the issue by setting the value to 0 if
the options that those constants enable/disable is not found.

Change-Id: Ib39814aaf940f308d500c1e026edb3d70de47fba
2016-05-11 14:07:17 -05:00
zuul
a01ce2b889 Merge "res_pjsip: improve realtime performance" into 13 2016-05-11 12:22:10 -05:00
zuul
81773ceb9c Merge "res_fax/t38_gateway: Peer V.21 session is created on wrong channel" into 13 2016-05-11 10:19:50 -05:00
Joshua Colp
2d4c818ac1 Merge "app_confbridge: Add a regcontext option for confbridge bridge profiles." into 13 2016-05-10 04:48:44 -05:00
zuul
577d65b701 Merge "res_pjsip_authenticator_digest: Don't use source port in nonce verification" into 13 2016-05-09 22:34:39 -05:00
Joshua Colp
7561ffa64a Merge "pjproject_bundled: Check for python-dev and TEST_FRAMEWORK" into 13 2016-05-09 20:11:30 -05:00
Kevin Harwell
4d063814ba res_pjsip_authenticator_digest: Don't use source port in nonce verification
From the issue reporter:
"res_pjsip_outbound_authenticator_digest builds a nonce that is a hash of
the timestamp, the source address, the source port, a server UUID that is
calculated at startup, and the authentication realm.

Rather than caching nonces that we create, we instead attempt to re-calculate
the nonce when receiving an incoming request with authentication. We then
compare the re-calculated nonce to the incoming nonce, and if they don't match,
then authentication has failed early.

The problem is that it is possible, especially when using TCP, to receive two
requests from the same endpoint but have differing source ports for those
requests. Asterisk itself commonly will use different source ports for
outbound TCP requests."

This patch removes the source port dependency when building the nonce.

ASTERISK-25978 #close

Change-Id: I871b5f4adce102df1c4988066283095ec509dffe
2016-05-09 14:15:26 -05:00
zuul
0f54a5ee98 Merge "res_pjsip: module load priority" into 13 2016-05-09 11:03:14 -05:00
zuul
5261151286 Merge "file: Ensure nativeformats remains valid for lifetime of use." into 13 2016-05-09 08:27:51 -05:00
Jaco Kroon
2db17a793c app_confbridge: Add a regcontext option for confbridge bridge profiles.
This patch allows for having app_confbridge register the name of the
conference as an extension into a specific context, similar to
regcontext for chan_sip.  This variant is not quite as involved as the
one in chan_sip and doesn't allow for multiple contexts or custom
extensions, you can only specify the context and the conference name
will always be used as the extension to register.

ASTERISK-25989 #close

Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f
2016-05-09 08:17:59 -05:00
zuul
60cc53ecb3 Merge "stasis_endpoints: Add new Status and Headers to ContactStatus" into 13 2016-05-09 06:46:16 -05:00
George Joseph
2a7130b8b0 pjproject_bundled: Check for python-dev and TEST_FRAMEWORK
The pjsua and pjsystest apps are now built only if TEST_FRAMEWORK is set.
The python bindings are now built only if TEST_FRAMEWORK is set and a
python development package is installed.

libresample was also disabled.

ASTERISK-25993 #close
Reported-by: Joshua Colp

Change-Id: If4e91c503a02f113d5b71bc8b972081fa3ff6f03
2016-05-08 19:32:23 -06:00
Alexei Gradinari
72eb7c8301 res_pjsip: module load priority
The res_pjsip_authenticator_digest, res_pjsip_endpoint_identifier_*
and res_pjsip_registrar modules should load ASAP
to avoid "No matching endpoint found" for legitimate endpoint.

ASTERISK-25994

Change-Id: Iac95d95ad031e0be104189d29e923a2ad7c24a1b
2016-05-06 09:27:39 -04:00
Chris Trobridge
dd00c71aae config_options.c: Expand #ifdef to contain whole if statement.
ASTERISK-25956 #close

Change-Id: If6961ec54be276d5ab4f012ee7e7b420cb45de38
2016-05-06 04:28:58 -05:00
Alexei Gradinari
e6eb17efd9 stasis_endpoints: Add new Status and Headers to ContactStatus
ASTERISK-25903 added a new headers to AMI Event ContactStatusDetail.
ASTERISK-25904 added a new Status to AMI Event ContactStatusDetail.
These additions should be also in stasis_endpoints
to include in command "manager show event ContactStatus"

Change-Id: I7610ad02a998e1f26c20caa27aa50279d0164f6a
2016-05-05 16:30:44 -04:00
zuul
3fd8113386 Merge "pjsip: Added "reg_server" to contacts (fixed alembic)" into 13 2016-05-05 13:15:16 -05:00
Joshua Colp
fa11f4c920 file: Ensure nativeformats remains valid for lifetime of use.
It is possible for the nativeformats of a channel to change
throughout its lifetime. As a result a user of it needs to either
ensure the channel is locked when accessing the formats or keep
a reference to the nativeformats themselves.

This change fixes the file playback support so it keeps a
reference to the nativeformats when accessing things.

ASTERISK-25998 #close

Change-Id: Ie45b65475e1481ddf05b874ee48f63e39fff8915
2016-05-05 13:01:12 -03:00
Alexei Gradinari
9c2032240e res_pjsip: improve realtime performance
This patch modified pjsip_options to retrieve only
permament contacts for aor if the qualify_frequency is > 0
and persisted contacts if the qualify_frequency is > 0.

This patch also fixed a bug in res_sorcery_astdb.
res_sorcery_astdb doesn't save object data retrived from astdb.

ASTERISK-25826

Change-Id: I1831fa46c4578eae5a3e574ee3362fddf08a1f05
2016-05-05 10:45:28 -05:00
zuul
168a7b3dd8 Merge "res_fax: add FAXMODE variable" into 13 2016-05-05 09:18:34 -05:00
Alexei Gradinari
fe38d21c2a pjsip: Added "reg_server" to contacts (fixed alembic)
ASTERISK-25931

Change-Id: Icc4321a88f5c93ff809da3f372eebbf69c6a8549
2016-05-04 17:11:17 -04:00
zuul
8aef2c4156 Merge "res_pjsip/AMI: add contact.updated event" into 13 2016-05-03 21:42:12 -05:00
Joshua Colp
3fa70be0f5 Merge "app_voicemail: always copy dynamic struct to avoid race condition" into 13 2016-05-03 19:14:31 -05:00
zuul
2970f72dff Merge "pjproject_bundled: Various fixes discovered during testing of OSes" into 13 2016-05-03 19:11:12 -05:00
Alexei Gradinari
7a14e669f0 res_pjsip/AMI: add contact.updated event
With the old SIP module AMI sends PeerStatus event on every
successfully REGISTER requests, ie, on start registration,
update registration and stop registration.

With PJSIP AMI sends ContactStatus only when status is changed.
Regarding registration:
on start registration - Created
on stop registration - Removed
but on update registration nothing

This patch added contact.updated event.

ASTERISK-25904

Change-Id: I8fad8aae9305481469c38d2146e1ba3a56d3108f
2016-05-03 17:35:27 -04:00
Alexei Gradinari
06d4ac0355 res_fax: add FAXMODE variable
The app_fax set FAXMODE variable, but res_fax missing this feature.
This patch add FAXMODE variable which is set to either "audio" or "T38".

ASTERISK-25980

Change-Id: Ie3dcbfb72cc681e9e267a60202f7fb8723a51b6b
2016-05-03 17:20:18 -04:00
Alexei Gradinari
2d17fe06c5 res_fax/t38_gateway: Peer V.21 session is created on wrong channel
The channel and peer V.21 sessions are created on the same channel now.
The peer V.21 session should be created only on peer channel
when one of channel can handle T.38.

Also this patch enable debug for T.38 gateway session
if global fax debug enabled.

ASTERISK-25982

Change-Id: I78387156ea521a77eb0faf170179ddd37a50430e
2016-05-03 16:43:09 -04:00
Joshua Colp
3677409116 Merge "pjsip: Added "reg_server" to contacts." into 13 2016-05-03 12:41:23 -05:00
Diederik de Groot
a2f19d82a8 configs/basic-pbx/asterisk.conf: contains incorrect path separator
Note: When packagers use these files (as an example) the paths are never
really used when they are split using '='.

Note: Thirdparty applications will also have trouble parsing the file when
expecting '=>'.

Change-Id: I0ada647f588e81f023fb1333ca15a1a333fd6004
2016-05-03 11:56:44 -05:00
George Joseph
f39089f17c pjproject_bundled: Various fixes discovered during testing of OSes
For all OSes:
* Disabled third-party codecs in pjproject and added
  '--disable-speex-codec --disable-speex-aec --disable-gsm-codec' to the
  configure options since we don't use the pjsip codec capability.

FreeBSD:
* Added FreeBSD support to install_prereq.
* Changed pjproject/configure.m4 to use $GNU_MAKE instead of hardcoding "make".
* Added __progname and environ to asterisk.exports.in.
* Reverted the use of ldconfig to create shared library symlinks to ln.
* Only enable epoll in pjproject if `uname -s` is Linux.
* Added a patch to pjproject to take the name of the 'make' command from
  an environment variable if supplied.  This is needed for the python bindings.
  (merged by Teluu into pjproject trunk 5/3/2016)
FreeBSD support isn't complete.  Still some general issues regarding
make/gmake having nothing to do with pjproject.  With some handholding it DOES
build successfully.

CentOS:
Added 'patch' and 'bzip2' to install_prereq PACKAGES_RH.
CentOS 6/7 32/64 build and run the pjsip testsuite successfully.

Ubuntu:
No changes required.
Ubuntu 15/16 32/64 build and run the pjsip testsuite successfully.

Debian:
No changes required.
Debian 6/7/8 32/64 build and run the pjsip testsuite successfully.

There will utimately be a follow-up patch to create an install_prereq for
the testsuite as I've discovered a few missing requirements.

ASTERISK-25968 #close

Change-Id: I5756a07facfc63798115a5e73a8709382fe9259c
2016-05-03 06:54:29 -06:00
Andrew Nagy
8028fc7585 app_voicemail: always copy dynamic struct to avoid race condition
Voicemail email addresses can be corrupt or voicemail
emails can end up being sent to the wrong email address if asterisk is
reading voicemail.conf during a reload and processing an email at the
same time. This patch always copies the struct that would otherwise only
be copied once.

ASTERISK-24463 #close
Reported by: John Campbell
Tested by: Etienne Lessard
Tested by: Andrew Nagy
Change-Id: I3a0643813116da84e2617291903d0d489b7425fb
2016-05-03 07:24:21 -03:00
Alexei Gradinari
3cb8934de0 pjsip: Added "reg_server" to contacts.
If the Asterisk system name is set in asterisk.conf, it will be stored
into the "reg_server" field in the ps_contacts table to facilitate
multi-server setups.

ASTERISK-25931

Change-Id: Ia8f6bd2267809c78753b52bcf21835b9b59f4cb8
2016-05-02 09:59:08 -03:00
zuul
69ced86c6c Merge "pjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE" into 13 2016-04-29 15:08:33 -05:00
Joshua Colp
d65023b5a5 Merge "res_pjsip: Start body generator users after suppliers." into 13 2016-04-29 13:11:37 -05:00
zuul
3e5666eadc Merge "res_pjsip_pubsub.c: Fix body generator registration race." into 13 2016-04-29 13:06:27 -05:00
zuul
72ee8c1bf9 Merge "chan_sip: Make autocreated peers send PeerStatus events" into 13 2016-04-29 12:13:57 -05:00
Joshua Colp
1ce30f1fb5 Merge "res_pjsip_outbound_publish.c: Remove redundant flag check." into 13 2016-04-29 04:57:32 -05:00
zuul
cc8a50631e Merge "res_pjsip_pubsub.c: Add useful information to some messages." into 13 2016-04-28 23:01:59 -05:00
zuul
2ae097f144 Merge "res_pjsip_pubsub.h: Fix doxygen association." into 13 2016-04-28 22:43:32 -05:00
zuul
28e6978e82 Merge "res_pjsip: Add ability to identify by Authorization username" into 13 2016-04-28 17:49:56 -05:00
Richard Mudgett
7992923c70 res_pjsip: Start body generator users after suppliers.
Change-Id: I8f0b57841feaab56c8a4e821b5ccb4e05e5fbadb
2016-04-28 17:12:36 -05:00
Richard Mudgett
5dc0e082b2 res_pjsip_pubsub.c: Add useful information to some messages.
Change-Id: Ia0b2e15773894c599e5c5748bbc70e99f434192a
2016-04-28 17:06:01 -05:00
Richard Mudgett
f9e416f053 res_pjsip_pubsub.c: Fix body generator registration race.
Change-Id: Id8752073ef06472a2fd96080f4009fac42843e67
2016-04-28 17:03:07 -05:00
Richard Mudgett
b1b2019046 res_pjsip_pubsub.h: Fix doxygen association.
Change-Id: I110d3e3572598289fcd4215d966cf0c858f98632
2016-04-28 17:00:46 -05:00
Richard Mudgett
b7f07fdff5 res_pjsip_outbound_publish.c: Remove redundant flag check.
Change-Id: I0da80a3c3e0eae0c52ff27e7412ba027d6f52353
2016-04-28 16:58:54 -05:00
George Joseph
719ece5659 pjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE
When pjsip_parse_uri is called with PJSIP_UNESCAPE_IN_PLACE enabled,
the input uri string will become corrupted if it contains escape sequences.
It's not possible to automatically strdup or strdupa the input string because
the output uri pj_str_t's will have pointers to chunks of the input string.
Getting around this would require more memory management code and wouldn't
be worth the savings of doing the unescape in place.

ASTERISK-25970 #close
Reported-by: Dmitriy Serov

Change-Id: I28dc0e599b5108f7959b9c46dc8278371b372f88
2016-04-28 15:54:07 -06:00
Joshua Colp
86fb803257 Merge "func_odbc: Check connection status before executing queries." into 13 2016-04-28 06:50:55 -05:00
George Joseph
38bed4515d res_pjsip: Add ability to identify by Authorization username
A feature of chan_sip that service providers relied upon was the ability to
identify by the Authorization username.  This is most often used when customers
have a PBX that needs to register rather than identify by IP address.  From my
own experiance, this is pretty common with small businesses who otherwise
don't need a static IP.

In this scenario, a register from the customer's PBX may succeed because From
will usually contain the PBXs account id but an INVITE will contain the caller
id.  With nothing recognizable in From, the service provider's Asterisk can
never match to an endpoint and the INVITE just stays unauthorized.

The fixes:

A new value "auth_username" has been added to endpoint/identify_by that
will use the username and digest fields in the Authorization header
instead of username and domain in the the From header to match an endpoint,
or the To header to match an aor.  This code as added to
res_pjsip_endpoint_identifier_user rather than creating a new module.

Although identify_by was always a comma-separated list, there was only
1 choice so order wasn't preserved.  So to keep the order, a vector was added
to the end of ast_sip_endpoint.  This is only used by res_pjsip_registrar
to find the aor.  The res_pjsip_endpoint_identifier_* modules are called in
globals/endpoint_identifier_order.

Along the way, the logic in res_pjsip_registrar was corrected to match
most-specific to least-specific as res_pjsip_endpoint_identifier_user does.

The order is:

username@domain
username@domain_alias
username

Auth by username does present 1 problem however, the first INVITE won't have
an Authorization header so the distributor, not finding a match on anything,
sends a securty_alert.  It still sends a 401 with a challenge so the next
INVITE will have the Authorization header and presumably succeed.  As a result
though, that first security alert is actually a false alarm.

To address this, a new feature has been added to pjsip_distributor that keeps
track of unidentified requests and only sends the security alert if a
configurable number of unidentified requests come from the same IP in a
configurable amout of time.  Those configuration options have been added to
the global config object.  This feature is only used when auth_username
is enabled.

Finally, default_realm was added to the globals object to replace the hard
coded "asterisk" used when an endpoint is not yet identified.

The testsuite tests all pass but new tests are forthcoming for this new
feature.

ASTERISK-25835 #close
Reported-by: Ross Beer

Change-Id: I30ba62d208e6f63439600916fcd1c08a365ed69d
2016-04-27 15:22:29 -06:00
Joshua Colp
a16aa467f5 Merge "config: Fix ast_config_text_file_save2 writability check for missing files" into 13 2016-04-27 16:20:31 -05:00