asterisk/asterisk.git
5 years agopjsip_distributor: Add missing newline to NOTICE
George Joseph [Thu, 12 May 2016 14:13:55 +0000 (08:13 -0600)]
pjsip_distributor:  Add missing newline to NOTICE

There was a newline missing from the end of the "no matching endpoint" notice.

Change-Id: Idc11fe5bc0354072291663dbffe648c471e39181

5 years agoMerge "res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches"
Joshua Colp [Wed, 11 May 2016 17:57:34 +0000 (12:57 -0500)]
Merge "res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches"

5 years agoMerge "res_pjsip_outbound_publishing: After unloading the library won't load again"
Joshua Colp [Wed, 11 May 2016 17:57:24 +0000 (12:57 -0500)]
Merge "res_pjsip_outbound_publishing: After unloading the library won't load again"

5 years agoMerge "res_pjsip_outbound_publish: Won't unload if condition wait times out"
Joshua Colp [Wed, 11 May 2016 17:57:13 +0000 (12:57 -0500)]
Merge "res_pjsip_outbound_publish: Won't unload if condition wait times out"

5 years agoMerge "res_pjsip_outbound_publish: Ref leak in off nominal callback paths"
Joshua Colp [Wed, 11 May 2016 17:57:04 +0000 (12:57 -0500)]
Merge "res_pjsip_outbound_publish: Ref leak in off nominal callback paths"

5 years agoMerge "res_pjsip_outbound_publish: Potential crash due to off nominal path"
Joshua Colp [Wed, 11 May 2016 17:56:52 +0000 (12:56 -0500)]
Merge "res_pjsip_outbound_publish: Potential crash due to off nominal path"

5 years agoMerge "res_pjsip: improve realtime performance"
Joshua Colp [Wed, 11 May 2016 15:58:54 +0000 (10:58 -0500)]
Merge "res_pjsip: improve realtime performance"

5 years agoMerge "res_fax/t38_gateway: Peer V.21 session is created on wrong channel"
zuul [Wed, 11 May 2016 15:36:34 +0000 (10:36 -0500)]
Merge "res_fax/t38_gateway: Peer V.21 session is created on wrong channel"

5 years agoMerge "app_confbridge: Add a regcontext option for confbridge bridge profiles."
Joshua Colp [Tue, 10 May 2016 09:48:35 +0000 (04:48 -0500)]
Merge "app_confbridge: Add a regcontext option for confbridge bridge profiles."

5 years agoMerge "res_pjsip_authenticator_digest: Don't use source port in nonce verification"
zuul [Tue, 10 May 2016 03:56:53 +0000 (22:56 -0500)]
Merge "res_pjsip_authenticator_digest: Don't use source port in nonce verification"

5 years agoMerge "pjproject_bundled: Check for python-dev and TEST_FRAMEWORK"
Joshua Colp [Mon, 9 May 2016 23:49:42 +0000 (18:49 -0500)]
Merge "pjproject_bundled:  Check for python-dev and TEST_FRAMEWORK"

5 years agoMerge "res_pjsip_pubsub: Use common datastores container API."
Joshua Colp [Mon, 9 May 2016 23:27:35 +0000 (18:27 -0500)]
Merge "res_pjsip_pubsub: Use common datastores container API."

5 years agoMerge "datastore: Add common container based datastores API."
zuul [Mon, 9 May 2016 23:23:44 +0000 (18:23 -0500)]
Merge "datastore: Add common container based datastores API."

5 years agores_pjsip_authenticator_digest: Don't use source port in nonce verification
Kevin Harwell [Thu, 5 May 2016 16:37:37 +0000 (11:37 -0500)]
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

5 years agoMerge "res_pjsip: module load priority"
Joshua Colp [Mon, 9 May 2016 15:06:10 +0000 (10:06 -0500)]
Merge "res_pjsip: module load priority"

5 years agores_pjsip_pubsub: Use common datastores container API.
Joshua Colp [Thu, 5 May 2016 14:14:00 +0000 (11:14 -0300)]
res_pjsip_pubsub: Use common datastores container API.

This migrates res_pjsip_pubsub over to using the newly
introduce common datastores management API instead of using
its own implementations for both subscriptions and
publications.

As well the extension state data now provides a generic
datastores container instead of a subscription. This allows
the dialog-info+xml body generator to work for both
subscriptions and publications.

ASTERISK-25999 #close

Change-Id: I773f9e4f35092da0f653566736a8647e8cfebef1

5 years agodatastore: Add common container based datastores API.
Joshua Colp [Thu, 5 May 2016 14:12:59 +0000 (11:12 -0300)]
datastore: Add common container based datastores API.

This change introduces a common container based datastores
management API. This has been done in a few places across
the tree but this consolidates all of the logic into one
place in a generic fashion.

ASTERISK-25999

Change-Id: I72eb15941dcdbc2a37bb00a33ce00f8755bd336a

5 years agoMerge "file: Ensure nativeformats remains valid for lifetime of use."
Joshua Colp [Mon, 9 May 2016 13:28:16 +0000 (08:28 -0500)]
Merge "file: Ensure nativeformats remains valid for lifetime of use."

5 years agoapp_confbridge: Add a regcontext option for confbridge bridge profiles.
Jaco Kroon [Wed, 4 May 2016 07:40:55 +0000 (09:40 +0200)]
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

5 years agopjproject_bundled: Check for python-dev and TEST_FRAMEWORK
George Joseph [Mon, 9 May 2016 01:19:50 +0000 (19:19 -0600)]
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

5 years agores_pjsip: module load priority
Alexei Gradinari [Fri, 6 May 2016 16:54:17 +0000 (12:54 -0400)]
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

5 years agostasis_endpoints: Add new Status and Headers to ContactStatus
Alexei Gradinari [Thu, 5 May 2016 20:16:16 +0000 (16:16 -0400)]
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

5 years agoMerge "config_options.c: Expand #ifdef to contain whole if statement."
zuul [Fri, 6 May 2016 11:14:40 +0000 (06:14 -0500)]
Merge "config_options.c: Expand #ifdef to contain whole if statement."

5 years agores_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches
Kevin Harwell [Tue, 3 May 2016 20:43:16 +0000 (15:43 -0500)]
res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches

When reloading, or fetching realtime data, if the "apply" failed for any
numerous reasons the current state object would not be maintained. This
potentially resulted in publishes being stopped for some states/clients when
they should not have been.

This patch makes it so the current state object is kept upon any type of reload/
fetch failures.

Change-Id: Iab6020c116d628ed2ae81183e987e2eaa3c90b30

5 years agores_pjsip_outbound_publishing: After unloading the library won't load again
Kevin Harwell [Tue, 3 May 2016 20:35:24 +0000 (15:35 -0500)]
res_pjsip_outbound_publishing: After unloading the library won't load again

The same thing was happening in res_pjsip_publish_asterisk. When the library
was unloaded it did not unregister the object type from sorcery. Subsequent
loads resulted in a failed load due to the sorcery type already existing.

Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9

5 years agores_pjsip_outbound_publish: Won't unload if condition wait times out
Kevin Harwell [Tue, 3 May 2016 20:39:32 +0000 (15:39 -0500)]
res_pjsip_outbound_publish: Won't unload if condition wait times out

When res_pjsip_outbound_publish unloads it has to wait for all current
publishing objects to get done. However if the wait condition times out
then it does not fail the unload. This sometimes results in an infinite
loop check while unloading. This patch now fails the unload operation if
the condition times out.

Change-Id: Id57b8cbed9d61222690fcba1e4f18e259df4c7ec

5 years agores_pjsip_outbound_publish: Ref leak in off nominal callback paths
Kevin Harwell [Tue, 3 May 2016 19:59:06 +0000 (14:59 -0500)]
res_pjsip_outbound_publish: Ref leak in off nominal callback paths

There were a few spots where the client object's reference was being leaked in
sip_outbound_publish_callback. This patch cleans up those leaks.

Change-Id: I485d0bc9335090f373026f77c548042e258461df

5 years agores_pjsip_outbound_publish: Potential crash due to off nominal path
Kevin Harwell [Tue, 3 May 2016 20:31:19 +0000 (15:31 -0500)]
res_pjsip_outbound_publish: Potential crash due to off nominal path

It was possible for the explicit publish destroy function to be called without
the pjsip client ever being initialized. This fix checks to make sure there is
a client to destroy before attempting.

Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c

5 years agofile: Ensure nativeformats remains valid for lifetime of use.
Joshua Colp [Thu, 5 May 2016 10:07:50 +0000 (07:07 -0300)]
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

5 years agores_pjsip: improve realtime performance
Alexei Gradinari [Fri, 15 Apr 2016 14:32:12 +0000 (10:32 -0400)]
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

5 years agores_fax/t38_gateway: Peer V.21 session is created on wrong channel
Alexei Gradinari [Mon, 2 May 2016 21:52:16 +0000 (17:52 -0400)]
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

5 years agopjsip: Added "reg_server" to contacts (fixed alembic)
Alexei Gradinari [Wed, 4 May 2016 21:11:17 +0000 (17:11 -0400)]
pjsip: Added "reg_server" to contacts (fixed alembic)

ASTERISK-25931

Change-Id: Icc4321a88f5c93ff809da3f372eebbf69c6a8549

5 years agoconfig_options.c: Expand #ifdef to contain whole if statement.
Chris Trobridge [Wed, 4 May 2016 08:17:26 +0000 (09:17 +0100)]
config_options.c: Expand #ifdef to contain whole if statement.

ASTERISK-25956 #close

Change-Id: If6961ec54be276d5ab4f012ee7e7b420cb45de38

5 years agores_fax: add FAXMODE variable
Alexei Gradinari [Mon, 2 May 2016 21:08:06 +0000 (17:08 -0400)]
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

5 years agoMerge "app_chanspy: fix audiohook options in non read-only mode"
Joshua Colp [Wed, 4 May 2016 09:49:29 +0000 (04:49 -0500)]
Merge "app_chanspy: fix audiohook options in non read-only mode"

5 years agoMerge "app_voicemail: always copy dynamic struct to avoid race condition"
Joshua Colp [Wed, 4 May 2016 09:49:19 +0000 (04:49 -0500)]
Merge "app_voicemail: always copy dynamic struct to avoid race condition"

5 years agoMerge "res_pjsip/AMI: add contact.updated event"
zuul [Wed, 4 May 2016 03:06:34 +0000 (22:06 -0500)]
Merge "res_pjsip/AMI: add contact.updated event"

5 years agoMerge "pjproject_bundled: Various fixes discovered during testing of OSes"
zuul [Wed, 4 May 2016 00:11:18 +0000 (19:11 -0500)]
Merge "pjproject_bundled:  Various fixes discovered during testing of OSes"

5 years agoapp_chanspy: fix audiohook options in non read-only mode
Jean Aunis [Mon, 2 May 2016 10:56:24 +0000 (12:56 +0200)]
app_chanspy: fix audiohook options in non read-only mode

When option 'o' was not set, ChanSpy created its audiohook with the flag
AST_AUDIOHOOK_MUTE_WRITE, which caused ChanSpy to listen audio from one
direction only.

ASTERISK-25866 #close

Change-Id: I5c745855eea29a3fbc4e4aed0b0c0f53580535e0

5 years agores_pjsip/AMI: add contact.updated event
Alexei Gradinari [Thu, 7 Apr 2016 21:33:49 +0000 (17:33 -0400)]
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

5 years agoMerge "pjsip: Added "reg_server" to contacts."
zuul [Tue, 3 May 2016 19:05:45 +0000 (14:05 -0500)]
Merge "pjsip: Added "reg_server" to contacts."

5 years agoMerge "configs/basic-pbx/asterisk.conf: contains incorrect path separator"
Joshua Colp [Tue, 3 May 2016 17:11:21 +0000 (12:11 -0500)]
Merge "configs/basic-pbx/asterisk.conf: contains incorrect path separator"

5 years agopjproject_bundled: Various fixes discovered during testing of OSes
George Joseph [Sat, 30 Apr 2016 22:52:47 +0000 (16:52 -0600)]
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

5 years agoMerge "res_pjsip_exten_state: Create PUBLISH messages."
zuul [Tue, 3 May 2016 11:10:52 +0000 (06:10 -0500)]
Merge "res_pjsip_exten_state: Create PUBLISH messages."

5 years agoapp_voicemail: always copy dynamic struct to avoid race condition
Andrew Nagy [Thu, 17 Mar 2016 19:29:38 +0000 (12:29 -0700)]
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

5 years agopjsip: Added "reg_server" to contacts.
Alexei Gradinari [Fri, 15 Apr 2016 19:26:15 +0000 (15:26 -0400)]
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

5 years agoconfigs/basic-pbx/asterisk.conf: contains incorrect path separator
Diederik de Groot [Sun, 1 May 2016 07:21:33 +0000 (09:21 +0200)]
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

5 years agoMerge "pjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE"
Joshua Colp [Fri, 29 Apr 2016 19:57:19 +0000 (14:57 -0500)]
Merge "pjproject_bundled:  Disable PJSIP_UNESCAPE_IN_PLACE"

5 years agores_pjsip_exten_state: Create PUBLISH messages.
Richard Mudgett [Wed, 27 Apr 2016 22:19:53 +0000 (17:19 -0500)]
res_pjsip_exten_state: Create PUBLISH messages.

Create PUBLISH messages to update a third party when an extension state
changes because of either a device or presence state change.

A configuration example:

[exten-state-publisher]
type=outbound-publish
server_uri=sip:instance1@172.16.10.2
event=presence
; Optional regex for context filtering, if specified only extension state
; for contexts matching the regex will cause a PUBLISH to be sent.
@context=^users
; Optional regex for extension filtering, if specified only extension
; state for extensions matching the regex will cause a PUBLISH to be sent.
@exten=^[0-9]*
; Required body type for the PUBLISH message.
;
; Supported values are:
; application/pidf+xml
; application/xpidf+xml
; application/cpim-pidf+xml
; application/dialog-info+xml (Planned support but not yet)
@body=application/pidf+xml

The '@' extended variables are used because the implementation can't
extend the outbound publish type as it is provided by the outbound publish
module.  That means you either have to use extended variables, or
implement some sort of custom extended variable thing in the outbound
publish module.  Another option would be to refactor that stuff to have an
option which specifies the use of an alternate implementation's
configuration and then have that passed to the implementation.  JColp
opted for the extended variables method originally.

ASTERISK-25972 #close

Change-Id: Ic0dab4022f5cf59302129483ed38398764ee3cca

5 years agoMerge "res_pjsip_exten_state: Check if body generator is available."
Joshua Colp [Fri, 29 Apr 2016 19:33:01 +0000 (14:33 -0500)]
Merge "res_pjsip_exten_state: Check if body generator is available."

5 years agoMerge "res_pjsip_pubsub.c: Fix body generator registration race."
Joshua Colp [Fri, 29 Apr 2016 18:33:43 +0000 (13:33 -0500)]
Merge "res_pjsip_pubsub.c: Fix body generator registration race."

5 years agoMerge "res_pjsip: Start body generator users after suppliers."
zuul [Fri, 29 Apr 2016 18:01:06 +0000 (13:01 -0500)]
Merge "res_pjsip: Start body generator users after suppliers."

5 years agoMerge "chan_sip: Make autocreated peers send PeerStatus events"
Joshua Colp [Fri, 29 Apr 2016 16:44:11 +0000 (11:44 -0500)]
Merge "chan_sip: Make autocreated peers send PeerStatus events"

5 years agoMerge "res_pjsip_pubsub.c: Add useful information to some messages."
zuul [Fri, 29 Apr 2016 03:55:04 +0000 (22:55 -0500)]
Merge "res_pjsip_pubsub.c: Add useful information to some messages."

5 years agoMerge "res_pjsip_pubsub.h: Fix doxygen association."
zuul [Fri, 29 Apr 2016 03:43:29 +0000 (22:43 -0500)]
Merge "res_pjsip_pubsub.h: Fix doxygen association."

5 years agoMerge "res_pjsip_outbound_publish.c: Remove redundant flag check."
zuul [Fri, 29 Apr 2016 02:02:05 +0000 (21:02 -0500)]
Merge "res_pjsip_outbound_publish.c: Remove redundant flag check."

5 years agoMerge "res_pjsip: Add ability to identify by Authorization username"
zuul [Thu, 28 Apr 2016 23:02:41 +0000 (18:02 -0500)]
Merge "res_pjsip:  Add ability to identify by Authorization username"

5 years agoMerge "app_chanspy: reduce audio loss on the spying channel."
zuul [Thu, 28 Apr 2016 22:45:57 +0000 (17:45 -0500)]
Merge "app_chanspy: reduce audio loss on the spying channel."

5 years agores_pjsip_exten_state: Check if body generator is available.
Richard Mudgett [Tue, 26 Apr 2016 21:10:26 +0000 (16:10 -0500)]
res_pjsip_exten_state: Check if body generator is available.

When starting the extension state publishers, check if the requested
message body generator is available.  If not available give error message
and skip starting that publisher.

* res_pjsip_pubsub.c: Create new API if type/subtype generator
registered.

* res_pjsip_exten_state.c: Use new body generator API for validation.

ASTERISK-25922

Change-Id: I4ad69200666e3cc909d4619e3c81042d7f9db25c

5 years agores_pjsip: Start body generator users after suppliers.
Richard Mudgett [Thu, 28 Apr 2016 16:35:44 +0000 (11:35 -0500)]
res_pjsip: Start body generator users after suppliers.

Change-Id: I8f0b57841feaab56c8a4e821b5ccb4e05e5fbadb

5 years agores_pjsip_pubsub.c: Add useful information to some messages.
Richard Mudgett [Thu, 28 Apr 2016 21:06:57 +0000 (16:06 -0500)]
res_pjsip_pubsub.c: Add useful information to some messages.

Change-Id: Ia0b2e15773894c599e5c5748bbc70e99f434192a

5 years agores_pjsip_pubsub.c: Fix body generator registration race.
Richard Mudgett [Tue, 26 Apr 2016 20:58:06 +0000 (15:58 -0500)]
res_pjsip_pubsub.c: Fix body generator registration race.

Change-Id: Id8752073ef06472a2fd96080f4009fac42843e67

5 years agopjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE
George Joseph [Thu, 28 Apr 2016 21:54:07 +0000 (15:54 -0600)]
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

5 years agores_pjsip_pubsub.h: Fix doxygen association.
Richard Mudgett [Tue, 26 Apr 2016 20:13:50 +0000 (15:13 -0500)]
res_pjsip_pubsub.h: Fix doxygen association.

Change-Id: I110d3e3572598289fcd4215d966cf0c858f98632

5 years agores_pjsip_outbound_publish.c: Remove redundant flag check.
Richard Mudgett [Mon, 25 Apr 2016 21:00:30 +0000 (16:00 -0500)]
res_pjsip_outbound_publish.c: Remove redundant flag check.

Change-Id: I0da80a3c3e0eae0c52ff27e7412ba027d6f52353

5 years agoMerge "res_pjsip_exten_state: Add config support for exten state publishers."
zuul [Thu, 28 Apr 2016 20:35:08 +0000 (15:35 -0500)]
Merge "res_pjsip_exten_state: Add config support for exten state publishers."

5 years agoMerge "func_odbc: Check connection status before executing queries."
zuul [Thu, 28 Apr 2016 11:53:01 +0000 (06:53 -0500)]
Merge "func_odbc: Check connection status before executing queries."

5 years agores_pjsip: Add ability to identify by Authorization username
George Joseph [Tue, 8 Mar 2016 00:34:31 +0000 (17:34 -0700)]
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

5 years agoMerge "config: Fix ast_config_text_file_save2 writability check for missing files"
Joshua Colp [Wed, 27 Apr 2016 19:55:55 +0000 (14:55 -0500)]
Merge "config:  Fix ast_config_text_file_save2 writability check for missing files"

5 years agofunc_odbc: Check connection status before executing queries.
Mark Michelson [Wed, 27 Apr 2016 18:23:37 +0000 (13:23 -0500)]
func_odbc: Check connection status before executing queries.

A recent change to func_odbc made it so that a single connection was
maintained per DSN. The problem was that the code was optimistic about
the health of the connection after initially opening it and did nothing
to re-connect in case the connection had died.

This change adds a check before executing a query to ensure that the
connection to the database is still up and running.

ASTERISK-25963 #close
Reported by Ross Beer

Change-Id: Id33c86eb04ff48ca088bb2e3086c27b3b683491d

5 years agoMerge "res_pjsip: disable multi domain to improve realtime performace"
Joshua Colp [Wed, 27 Apr 2016 17:45:11 +0000 (12:45 -0500)]
Merge "res_pjsip: disable multi domain to improve realtime performace"

5 years agoMerge "res_pjsip: Add serialized scheduler (res_pjsip/pjsip_scheduler.c)"
zuul [Wed, 27 Apr 2016 16:14:11 +0000 (11:14 -0500)]
Merge "res_pjsip:  Add serialized scheduler (res_pjsip/pjsip_scheduler.c)"

5 years agores_pjsip: disable multi domain to improve realtime performace
Alexei Gradinari [Fri, 15 Apr 2016 16:59:42 +0000 (12:59 -0400)]
res_pjsip: disable multi domain to improve realtime performace

This patch added new global pjsip option 'disable_multi_domain'.
Disabling Multi Domain can improve Realtime performance by reducing
number of database requests.

ASTERISK-25930 #close

Change-Id: I2e7160f3aae68475d52742107949a799aa2c7dc7

5 years agoapp_chanspy: reduce audio loss on the spying channel.
Jean Aunis [Fri, 1 Apr 2016 12:50:30 +0000 (14:50 +0200)]
app_chanspy: reduce audio loss on the spying channel.

ChanSpy was creating its audiohook with the flags AST_AUDIOHOOK_TRIGGER_SYNC
and AST_AUDIOHOOK_SMALL_QUEUE, which caused audio frames to be lost when
queues grow too large or when read and write queues go out of sync.
Now these flags are set conditionally:
- AST_AUDIOHOOK_TRIGGER_SYNC is not set if the option "o" is set
- a new option "l" is created: if set, AST_AUDIOHOOK_SMALL_QUEUE will not
be set on the audiohook

ASTERISK-25866

Change-Id: I9c7652f41d9fa72c8691e4e70ec4fd16b047a4dd

5 years agores_pjsip_exten_state: Add config support for exten state publishers.
Joshua Colp [Thu, 14 Apr 2016 12:03:24 +0000 (09:03 -0300)]
res_pjsip_exten_state: Add config support for exten state publishers.

This change adds the ability to configure outbound publishing of
extension state. Right now stuff is merely set up to store the
configuration and to register a global extension state callback. The
act of constructing the body and sending is not yet complete.

Configurable elements right now are a regex for filtering the context,
a regex for filtering the extension, and the body type to publish.

ASTERISK-25922 #close

Change-Id: Ia7e630136dfc355073c1cadff8ad394a08523d78

5 years agochan_sip: Give more time for TCP/TLS threads to stop.
Joshua Colp [Tue, 26 Apr 2016 16:13:14 +0000 (13:13 -0300)]
chan_sip: Give more time for TCP/TLS threads to stop.

The unload process currently tells each TCP/TLS to terminate but
does not wait for them to do so. This introduces a race condition
where the container holding the threads may be destroyed before
the threads are able to remove themselves from it. When they
finally do the container is invalid and can't be used causing a
crash.

A previous change existed which waited a bit to wait for any
stranglers to finish. This change extends this and waits longer.

ASTERISK-25961 #close

Change-Id: Idc6262b670ca49ede32061159e323b7b63c6f3c6

5 years agoapp_queue: Fix crash when unloading module.
Joshua Colp [Tue, 26 Apr 2016 10:48:40 +0000 (07:48 -0300)]
app_queue: Fix crash when unloading module.

When unloading the app_queue module the members in each queue are
destroyed and as part of this they are removed from the pending
members container. Unfortunately a crash would occur as the container
was destroyed before the members were removed.

This change tweaks ordering so the container destruction occurs
after the members are destroyed.

ASTERISK-16115

Change-Id: I48c728668c55aee3d05b751a5d450fb57e87f44b

5 years agoMerge changes from topic 'system_stress_patches'
Joshua Colp [Tue, 26 Apr 2016 09:57:36 +0000 (04:57 -0500)]
Merge changes from topic 'system_stress_patches'

* changes:
  test_message.c: Wait longer in case dialplan also processes the test message.
  Manager: Short circuit AMI message processing.
  manager.c: Eliminate most RAII_VAR usage.

5 years agoMerge "manager_channels.c: Fix allocation failure crash."
zuul [Tue, 26 Apr 2016 03:00:51 +0000 (22:00 -0500)]
Merge "manager_channels.c: Fix allocation failure crash."

5 years agoMerge "Bridge system: Fix memory leaks and double frees on impart failure."
zuul [Tue, 26 Apr 2016 02:08:16 +0000 (21:08 -0500)]
Merge "Bridge system: Fix memory leaks and double frees on impart failure."

5 years agoMerge "bridge_softmix.c: Fix crash if channel fails to join mixing tech."
zuul [Tue, 26 Apr 2016 02:08:15 +0000 (21:08 -0500)]
Merge "bridge_softmix.c: Fix crash if channel fails to join mixing tech."

5 years agoMerge "app_queue: queue members can receive multiple calls"
Joshua Colp [Tue, 26 Apr 2016 00:34:09 +0000 (19:34 -0500)]
Merge "app_queue: queue members can receive multiple calls"

5 years agoconfig: Fix ast_config_text_file_save2 writability check for missing files
George Joseph [Mon, 25 Apr 2016 03:51:16 +0000 (21:51 -0600)]
config:  Fix ast_config_text_file_save2 writability check for missing files

A patch I did back in 2014 modified ast_config_text_file_save2 to check the
writability of the main file and include files before truncating and re-writing
them.  An unintended side-effect of this was that if a file doesn't exist,
the check fails and the write is aborted.

This patch causes ast_config_text_file_save2 to check the writability of the
parent directory of missing files instead of checking the file itself.  This
allows missing files to be created again.  A unit test was also added to
test_config to test saving of config files.

The regression was discovered when app_voicemail's passwordlocation=spooldir
feature stopped working.

ASTERISK-25917 #close
Reported-by: Jonathan Rose

Change-Id: Ic4dbe58c277a47b674679e49daed5fc6de349f80

5 years agoFix case sensitive actions in AMI QueueSummary and QueueStatus
DarkS [Mon, 25 Apr 2016 13:11:31 +0000 (15:11 +0200)]
Fix case sensitive actions in AMI QueueSummary and QueueStatus

ASTERISK-25954 #close
Reported by: Javier Acosta

Change-Id: I00be83d45cc7e8385de2523012bd196aafeeb256
(cherry picked from commit c0688a6398f27296ff849848a2e416e036d794e3)

5 years agoapp_queue: queue members can receive multiple calls
Kevin Harwell [Thu, 21 Apr 2016 19:23:21 +0000 (14:23 -0500)]
app_queue: queue members can receive multiple calls

It was possible for a queue member that is a member of at least 2 or more
queues to receive mulitiple calls at the same time. This happened because
of a race between when a member was being rung and when the device state
notified the other queue(s) member object of the state change.

This patch makes it so when a queue member is being rung it gets added to
a global pool of queue members. If that same member is tried again, e.g.
from another queue, and it is found to already exist in the pending member
container then it will not ring that member.

ASTERISK-16115 #close

Change-Id: I546dd474776d158c2b6be44205353dee5bac7e48

5 years agores_agi: Prevent run_agi from eating frames it shouldn't
George Joseph [Fri, 22 Apr 2016 22:53:23 +0000 (16:53 -0600)]
res_agi:  Prevent run_agi from eating frames it shouldn't

The run_agi function is eating control frames when it shouldn't be. This is
causing issues when an AGI is run from CONNECTED_LINE_SEND_SUB in a blond
transfer.

Alice calls Bob. Bob attended transfers to Charlie but hangs up before Charlie
answers.

Alice gets the COLP UPDATE indicating Charlie but Charlie never gets an UPDATE
and is left thinking he's connected to Bob.

In this case, when CONNECTED_LINE_SEND_SUB runs on Alice's channel and it calls
an AGI, the extra eaten frames prevent CONNECTED_LINE_SEND_SUB from running on
Charlie's channel.

The fix was to accumulate deferrable frames in the "forever" loop instead of
dropping them, and re-queue them just before running the actual agi command
or exiting.

ASTERISK-25951 #close

Change-Id: I0f4bbfd72fc1126c2aaba41da3233a33d0433645

5 years agoMerge "func_odbc: Use one connection per DSN."
Joshua Colp [Mon, 25 Apr 2016 10:14:17 +0000 (05:14 -0500)]
Merge "func_odbc: Use one connection per DSN."

5 years agoMerge "Remove reference to non-existent sip.conf option"
zuul [Fri, 22 Apr 2016 23:55:45 +0000 (18:55 -0500)]
Merge "Remove reference to non-existent sip.conf option"

5 years agoMerge "res_stasis: Handle re-enter stasis bridge with swap channel."
zuul [Fri, 22 Apr 2016 22:08:06 +0000 (17:08 -0500)]
Merge "res_stasis: Handle re-enter stasis bridge with swap channel."

5 years agoMerge "bridge: Hold off more than one imparting channel at a time."
zuul [Fri, 22 Apr 2016 22:08:04 +0000 (17:08 -0500)]
Merge "bridge: Hold off more than one imparting channel at a time."

5 years agotest_message.c: Wait longer in case dialplan also processes the test message.
Richard Mudgett [Fri, 22 Apr 2016 20:25:29 +0000 (15:25 -0500)]
test_message.c: Wait longer in case dialplan also processes the test message.

Bumped the wait from 1 second to 5 seconds.  The test message was hitting my
default call handler and failing the test because it took longer.

Change-Id: I3a03737f25e92983de00548fcc7bbc50dd7544ba

5 years agochan_sip: Make autocreated peers send PeerStatus events
kkm [Fri, 22 Apr 2016 04:53:46 +0000 (21:53 -0700)]
chan_sip: Make autocreated peers send PeerStatus events

Since Stasis has been introduced, an attempt to send AMI messages by an
autocreated peer caused a crash, and all events from autocreated peers were
semi-inadvertently disabled altogether in 0b83761. This change restores the
disabled functionality.

ASTERISK-25950

Change-Id: Iecc350f23db603fadb2f302064643ebe9664e974

5 years agomanager_channels.c: Fix allocation failure crash.
Richard Mudgett [Wed, 13 Apr 2016 22:09:53 +0000 (17:09 -0500)]
manager_channels.c: Fix allocation failure crash.

An earlier allocation failure failed to create a channel snapshot for the
AMI HangupRequest/SoftHangupRequest event which resulted in a crash in
channel_hangup_request_cb().  Where the stasis message gets generated
cannot tell if the NULL snapshot returned was because of an allocation
failure or the channel was a dummy channel.

* Made channel_hangup_request_cb() check if the channel blob has a
snapshot and exit if it doesn't.

* Eliminated the RAII_VAR usage in channel_hangup_request_cb().

Change-Id: I0b6a1c4e95cbb7d80b2a7054c6eadecc169dfd24

5 years agoBridge system: Fix memory leaks and double frees on impart failure.
Richard Mudgett [Wed, 13 Apr 2016 18:50:04 +0000 (13:50 -0500)]
Bridge system: Fix memory leaks and double frees on impart failure.

You cannot reference the passed in features struct after calling
ast_bridge_impart().  Even if the call fails.

Change-Id: I902b88ba0d5d39520e670fb635078a367268ea21

5 years agobridge_softmix.c: Fix crash if channel fails to join mixing tech.
Richard Mudgett [Wed, 13 Apr 2016 18:20:23 +0000 (13:20 -0500)]
bridge_softmix.c: Fix crash if channel fails to join mixing tech.

softmix_bridge_join() failed because of an allocation failure.  To address
this, the softmix bridge technology now checks if the channel failed to
join softmix successfully.  In addition, the bridge now begins the process
of kicking the channel out of the bridge so we don't have channels
partially in the bridge for very long.

* Fix the test_channel_feature_hooks.c unit tests.  The test channel must
have a valid codec to join the simple_bridge technology.  This patch makes
joining a bridge more strict by not allowing partially joined channels to
remain in the bridge.

Change-Id: I97e2ade6a2bcd1214f24fb839fda948825b61a2b

5 years agoManager: Short circuit AMI message processing.
Richard Mudgett [Tue, 12 Apr 2016 20:29:52 +0000 (15:29 -0500)]
Manager: Short circuit AMI message processing.

Improve AMI message processing performance if there are no consumers
listening for the messages.  We now skip creating the AMI event message
text strings.

Change-Id: I7b22fc5ec4e500d00635c1a467aa8ea68a1bb2b3

5 years agomanager.c: Eliminate most RAII_VAR usage.
Richard Mudgett [Wed, 13 Apr 2016 22:54:26 +0000 (17:54 -0500)]
manager.c: Eliminate most RAII_VAR usage.

* Made ast_manager_event_blob_create() not allocate the ao2 event object
with a lock as it is not needed.

Change-Id: I8e11bfedd22c21316012e0b9dd79f5918f644b7c

5 years agofunc_odbc: Use one connection per DSN.
Mark Michelson [Fri, 22 Apr 2016 18:49:50 +0000 (13:49 -0500)]
func_odbc: Use one connection per DSN.

res_odbc was changed in Asterisk 13.8.0 to remove connection management,
opting instead to let unixodbc maintain open connections and return
those to Asterisk as requested.

This was a boon for realtime, since it meant that multiple threads could
potentially run parallel queries since they could each be using their
own database connections.

However, on the user-facing side, func_odbc, there were some inherent
behaviors being relied on that no longer hold true after the change.
One such reported behavior was that MySQL's LAST_INSERTED_ID() works
per-connection. This means that if Asterisk uses separate connections
for every database operation, whereas before it used one connection for
everything, we have broken expectations and functionality.

The fix provided in this patch is to make func_odbc use a single
database connection per DSN. This way, user-facing database usage will
have the same behavior as it did pre-13.8.0. However, realtime, which is
the real workhorse of database interaction, will continue to let
unixodbc manage connections.

ASTERISK-25938 #close
Reported by Edwin Vandamme

Change-Id: Iac961fe79154c6211569afcdfec843c0c24c46dc

5 years agoRemove reference to non-existent sip.conf option
Leif Madsen [Fri, 22 Apr 2016 18:02:53 +0000 (14:02 -0400)]
Remove reference to non-existent sip.conf option

Option was removed in commit 7f883ef495b57ae9182e47213d01d5e8009dbf3f

ASTERISK-25927 #close

Change-Id: I92f9b0196d9fc41d1d58354c07340c465ef1fcf8

5 years agoMerge "res_pjsip_callerid: Clear out display name if id->name is not valid"
Joshua Colp [Thu, 21 Apr 2016 19:02:09 +0000 (14:02 -0500)]
Merge "res_pjsip_callerid:  Clear out display name if id->name is not valid"