]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
10 years agortp_engine.c: Fix performance issue with several channel drivers that use RTP. 08/1008/1
Richard Mudgett [Wed, 29 Jul 2015 18:49:47 +0000 (13:49 -0500)] 
rtp_engine.c: Fix performance issue with several channel drivers that use RTP.

ast_rtp_codecs_get_payload() gets called once or twice for every received
RTP frame so it would be nice to not allocate an ao2 object to then have
it destroyed shortly thereafter.  The ao2 object gets allocated only if
the payload type is not set by the channel driver as a negotiated value.
The issue affects chan_skinny, chan_unistim, chan_rtp, and chan_ooh323.

* Made static_RTP_PT[] an array of ao2 objects that
ast_rtp_codecs_get_payload() can return instead of an array of structs
that must be copied into a created ao2 object.

ASTERISK-25296 #close
Reported by: Richard Mudgett

Change-Id: Icb6de5cd90bfae07d44403a1352963db9109dac0

10 years agores_rtp_asterisk.c: Fix off-nominal crash potential. 07/1007/1
Richard Mudgett [Wed, 29 Jul 2015 22:00:05 +0000 (17:00 -0500)] 
res_rtp_asterisk.c: Fix off-nominal crash potential.

ASTERISK-25296
Reported by: Richard Mudgett

Change-Id: I08549fb7c3ab40a559f41a3940f3732a4059b55b

10 years agortp_engine.c: Must protect mime_types_len with mime_types_lock. 06/1006/1
Richard Mudgett [Wed, 29 Jul 2015 18:48:12 +0000 (13:48 -0500)] 
rtp_engine.c: Must protect mime_types_len with mime_types_lock.

Change-Id: I44220dd369cc151ebf5281d5119d84bb9e54d54e

10 years agores_pjsip_sdp_rtp.c: Fixup some whitespace. 05/1005/1
Richard Mudgett [Fri, 24 Jul 2015 23:38:11 +0000 (18:38 -0500)] 
res_pjsip_sdp_rtp.c: Fixup some whitespace.

Change-Id: Ib4eb7ef7dcaf93ddc26538f0a498aaf110d7a973

10 years agores_pjsip_sdp_rtp.c: Fix processing wrong SDP media list. 04/1004/1
Richard Mudgett [Fri, 24 Jul 2015 23:42:29 +0000 (18:42 -0500)] 
res_pjsip_sdp_rtp.c: Fix processing wrong SDP media list.

Change-Id: I7c076826c2d3c6ae8c923ca73b7a71980cca11f2

10 years agortp_engine.h: No sense allowing payload types larger than RFC allows. 03/1003/1
Richard Mudgett [Tue, 28 Jul 2015 00:10:11 +0000 (19:10 -0500)] 
rtp_engine.h: No sense allowing payload types larger than RFC allows.

* Tweaked add_static_payload() to not use magic numbers.

Change-Id: I1719ff0f6d3ce537a91572501eae5bcd912a420b

10 years agortp_engine.c: Minor tweaks. 02/1002/1
Richard Mudgett [Thu, 23 Jul 2015 19:04:16 +0000 (14:04 -0500)] 
rtp_engine.c: Minor tweaks.

* Fix off nominial ref leak of new_type in
ast_rtp_codecs_payloads_set_m_type().

* No need to lock static_RTP_PT_lock in
ast_rtp_codecs_payloads_set_m_type() and
ast_rtp_codecs_payloads_set_rtpmap_type_rate() before the payload type
parameter sanity check.

* No need to create ast_rtp_payload_type ao2 objects with a lock since the
lock is not used.

Change-Id: I64dd1bb4dfabdc7e981e3f61448beac9bb7504d4

10 years agortp_engine.h: Misc comment fixes. 01/1001/1
Richard Mudgett [Thu, 23 Jul 2015 17:41:12 +0000 (12:41 -0500)] 
rtp_engine.h: Misc comment fixes.

Change-Id: If98139264d5d97427b4685ecbdc54518f725bc43

10 years agochan_sip.c: Tweak glue->update_peer() parameter nil value. 00/1000/1
Richard Mudgett [Fri, 17 Jul 2015 21:23:53 +0000 (16:23 -0500)] 
chan_sip.c: Tweak glue->update_peer() parameter nil value.

Change glue->update_peer() parameter from 0 to NULL to better indicate it
is a pointer.

Change-Id: I8ff2e5087f0e19f6998e3488a712a2470cc823bd

10 years agoMerge "Add a test event for inband ringing." into 13
Joshua Colp [Thu, 30 Jul 2015 21:56:00 +0000 (16:56 -0500)] 
Merge "Add a test event for inband ringing." into 13

10 years agores_http_websocket: Properly encode 64 bit payload 90/990/1
Mark Michelson [Wed, 29 Jul 2015 19:35:58 +0000 (14:35 -0500)] 
res_http_websocket: Properly encode 64 bit payload

A test agent was continuously failing all ARI tests when run against
Asterisk 13. As it turns out, the reason for this is that on those test
runs, for some reason we decided to use the super extended 64 bit
payload length for websocket text frames instead of the extended 16 bit
payload length. For 64-bit payloads, the expected byte order over the
network is

7, 6, 5, 4, 3, 2, 1, 0

However, we were sending the payload as

3, 2, 1, 0, 7, 6, 5, 4

This meant that we were saying to expect an absolutely MASSIVE payload
to arrive. Since we did not follow through on this expected payload
size, the client would sit patiently waiting for the rest of the payload
to arrive until the test would time out.

With this change, we use the htobe64() function instead of htonl() so
that a 64-bit byte-swap is performed instead of a 32 bit byte-swap.

Change-Id: Ibcd8552392845fbcdd017a8c8c1043b7fe35964a

10 years agoAdd a test event for inband ringing. 83/983/1
Mark Michelson [Wed, 29 Jul 2015 17:23:43 +0000 (12:23 -0500)] 
Add a test event for inband ringing.

This event is necessary for the bridge_wait_e_options test to be able to
confirm that ringing is being played on the local channel that runs the
BridgeWait() application with the e(r) option.

ASTERISK-25292 #close
Reported by Kevin Harwell

Change-Id: Ifd3d3d2bebc73344d4b5310d0d55c7675359d72e

10 years agoMerge "holding_bridge: ensure moh participants get frames" into 13
Mark Michelson [Tue, 28 Jul 2015 22:05:49 +0000 (17:05 -0500)] 
Merge "holding_bridge: ensure moh participants get frames" into 13

10 years agoholding_bridge: ensure moh participants get frames 20/920/3
Jonathan Rose [Thu, 16 Jul 2015 17:16:25 +0000 (12:16 -0500)] 
holding_bridge: ensure moh participants get frames

Currently, if a blank musiconhold.conf is used, musiconhold will fail
to start for a channel going into a holding bridge with an anticipation
of getting music on hold. That being the case, no frames will be written
to the channel and that can pose a problem for blind transfers in PJSIP
which may rely on frames being written to get past the REFER framehook.
This patch makes holding bridges start a silence generator if starting
music on hold fails and makes it so that if no music on hold functions
are installed that the ast_moh_start function will report a failure so
that consumers of that function will be able to respond appropriately.

ASTERISK-25271 #close

Change-Id: I06f066728604943cba0bb0b39fa7cf658a21cd99

10 years agoBump the ARI version to 1.8.0 61/961/1
Matt Jordan [Fri, 24 Jul 2015 17:56:16 +0000 (12:56 -0500)] 
Bump the ARI version to 1.8.0

Due to backwards compatible changes, the ARI version should be bumped to
1.8.0 prior to the release of 13.5.0. Note that a previous patch already
bumped the version of AMI for this release.

Change-Id: I419033bfbbc0d3533a29ccb32b2981f39e0883e7

10 years agopjsip: Add rtp_timeout and rtp_timeout_hold endpoint options. 41/941/3
Joshua Colp [Sat, 18 Jul 2015 16:16:10 +0000 (13:16 -0300)] 
pjsip: Add rtp_timeout and rtp_timeout_hold endpoint options.

This change adds support for the 'rtp_timeout' and 'rtp_timeout_hold'
endpoint options. These allow the channel to be hung up if RTP
is not received from the remote endpoint for a specified number of
seconds.

ASTERISK-25259 #close

Change-Id: I3f39daaa7da2596b5022737b77799d16204175b9

10 years agoMerge "res_pjsip: Add rtp_keepalive to sample config file." into 13
Joshua Colp [Fri, 24 Jul 2015 15:42:56 +0000 (10:42 -0500)] 
Merge "res_pjsip: Add rtp_keepalive to sample config file." into 13

10 years agores_pjsip: Add rtp_keepalive to sample config file. 58/958/1
Mark Michelson [Fri, 24 Jul 2015 14:46:53 +0000 (09:46 -0500)] 
res_pjsip: Add rtp_keepalive to sample config file.

Change-Id: I5f62d0c5684f8b2335f9f8ac2d79ee04fbdafb19

10 years agoLocal channels: Alternate solution to ringback problem. 54/954/3
Mark Michelson [Thu, 23 Jul 2015 18:11:42 +0000 (13:11 -0500)] 
Local channels: Alternate solution to ringback problem.

Commit 54b25c80c8387aea9eb20f9f4f077486cbdf3e5d solved an issue where a
specific scenario involving local channels and a native local RTP bridge
could result in ringback still being heard on a calling channel even
after the call is bridged.

That commit caused many tests in the testsuite to fail with alarming
consequences, such as not sending DialBegin and DialEnd events, and
giving incorrect hangup causes during calls.

This commit reverts the previous commit and implements and alternate
solution. This new solution involves only passing AST_CONTROL_RINGING
frames across local channels if the local channel is in AST_STATE_RING.
Otherwise, the frame does not traverse the local channels. By doing
this, we can ensure that a playtones generator does not get started on
the calling channel but rather is started on the local channel on which
the ringing frame was initially indicated.

ASTERISK-25250 #close
Reported by Etienne Lessard

Change-Id: I3bc87a18a38eb2b68064f732d098edceb5c19f39

10 years agoMerge "audiohook: Use manipulated frame instead of dropping it." into 13
Matt Jordan [Thu, 23 Jul 2015 01:02:26 +0000 (20:02 -0500)] 
Merge "audiohook: Use manipulated frame instead of dropping it." into 13

10 years agoMerge "Local channels: Do not block control -1 payloads." into 13
Joshua Colp [Wed, 22 Jul 2015 18:19:02 +0000 (13:19 -0500)] 
Merge "Local channels: Do not block control -1 payloads." into 13

10 years agoaudiohook: Use manipulated frame instead of dropping it. 52/952/1
Joshua Colp [Wed, 22 Jul 2015 17:24:47 +0000 (14:24 -0300)] 
audiohook: Use manipulated frame instead of dropping it.

Previous changes to sample rate support in audiohooks accidentally
removed code responsible for allowing the manipulate audiohooks
to work. Without this code the manipulated frame would be dropped
and not used. This change restores it.

ASTERISK-25253 #close

Change-Id: I3ff50664cd82faac8941f976fcdcb3918a50fe13

10 years agoLocal channels: Do not block control -1 payloads. 50/950/1
Mark Michelson [Wed, 22 Jul 2015 14:46:29 +0000 (09:46 -0500)] 
Local channels: Do not block control -1 payloads.

Control frames with a -1 payload are used as a special signal to stop
playtones generators on channels. This indication is sent both by
app_dial as well as by ast_answer() when a call is answered in case any
tones were being generated on a calling channel.

This control frame type was made to stop traversing local channel pairs
as an optimization, because it was thought that it was unnecessary to
send these indications, and allowing such unnecessary control frames to
traverse the local channels would cause the local channels to optimize
away less quickly.

As it turns out, through some special magic dialplan code, it is
possible to have a tones being played on a non-local channel, and it is
important for the local channel to convey that the tones should be
stopped. The result of having tones continue to be played on the
non-local channel is that the tones play even once the channel has been
bridged. By not blocking the -1 control frame type, we can ensure that
this situation does not happen.

ASTERISK-25250 #close
Reported by Etienne Lessard

Change-Id: I0bcaac3d70b619afdbd0ca8a8dd708f33fd2f815

10 years agoaudiohook: Read the correct number of samples based on audiohook format. 45/945/1
Joshua Colp [Wed, 22 Jul 2015 10:16:40 +0000 (07:16 -0300)] 
audiohook: Read the correct number of samples based on audiohook format.

Due to changes in audiohooks to support different sample rates the
underlying storage of samples is in the format of the audiohook
itself and not of the format being requested. This means that if a
channel is using G722 the samples stored will be at 16kHz. If
something subsequently reads from the audiohook at a format which
is not the same sample rate as the audiohook the number of samples
needs to be adjusted.

Given the following example:
1. Channel writing into audiohook at 16kHz (as it is using G722).
2. Chanspy reading from audiohook at 8kHz.

The original code would read 160 samples from the audiohook for
each 20ms of audio. This is incorrect. Since the audio in the
audiohook is at 16kHz the actual number needing to be read is 320.
Failure to read this much would cause the audiohook to reset
itself constantly as the buffer became full.

This change adjusts the requested number of samples by determining
the duration of audio requested and then calculating how many
samples that would be in the audiohook format.

ASTERISK-25247 #close

Change-Id: Ia91ce516121882387a315fd8ee116b118b90653d

10 years agoMerge "Documentation: A couple of trivial fixes in sip.conf.sample and func_cdr.c...
Joshua Colp [Mon, 20 Jul 2015 23:30:40 +0000 (18:30 -0500)] 
Merge "Documentation: A couple of trivial fixes in sip.conf.sample and func_cdr.c" into 13

10 years agoDocumentation: A couple of trivial fixes in sip.conf.sample and func_cdr.c 36/936/1
Rusty Newton [Mon, 20 Jul 2015 17:39:48 +0000 (12:39 -0500)] 
Documentation: A couple of trivial fixes in sip.conf.sample and func_cdr.c

 * In sip.conf.sample fix sentence where we said that WS or WSS are supported
   transports for use in an outbound register definition. They are not
   supported in that case.
 * In func_cdr.c made it clear that the Disable option for CDR_PROP can be used
   to enable CDR on a channel.

ASTERISK-24867 #close
Reported by: Rusty Newton

ASTERISK-24853 #close
Reported by: PSDK

Change-Id: I3d698bc6302b9d00a0a995b5c4ad9a42d69b48ca

10 years agores_pjsip: Add rtp_keepalive endpoint option. 64/864/6
Mark Michelson [Thu, 9 Jul 2015 19:17:53 +0000 (14:17 -0500)] 
res_pjsip: Add rtp_keepalive endpoint option.

This adds an "rtp_keepalive" option for PJSIP endpoints. Similar to the
chan_sip option, this specifies an interval, in seconds, at which we
will send RTP comfort noise frames. This can be useful for keeping RTP
sessions alive as well as keeping NAT associations alive during lulls.

ASTERISK-25242 #close
Reported by Mark Michelson

Change-Id: I06660ba672c0a343814af4cec838e6025cafd54b

10 years agoMerge "chan_pjsip: Don't change formats when frame of unsupported format is received...
Matt Jordan [Mon, 20 Jul 2015 12:31:38 +0000 (07:31 -0500)] 
Merge "chan_pjsip: Don't change formats when frame of unsupported format is received." into 13

10 years agoMerge "res/res_musiconhold: Add a warning when MOH does not exist" into 13
Matt Jordan [Sun, 19 Jul 2015 15:57:50 +0000 (10:57 -0500)] 
Merge "res/res_musiconhold: Add a warning when MOH does not exist" into 13

10 years agoMerge "pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable." into 13
Joshua Colp [Sun, 19 Jul 2015 14:54:38 +0000 (09:54 -0500)] 
Merge "pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable." into 13

10 years agores/res_musiconhold: Add a warning when MOH does not exist 34/934/1
Michael Cargile [Thu, 16 Jul 2015 14:13:10 +0000 (10:13 -0400)] 
res/res_musiconhold: Add a warning when MOH does not exist

Change-Id: Ifdfbd0b97cf31478d29923ec30aabce28d01740b

10 years agores/res_sorcery_config: Prevent crash from misconfigured sorcery.conf 31/931/1
Matt Jordan [Sun, 19 Jul 2015 14:11:18 +0000 (09:11 -0500)] 
res/res_sorcery_config: Prevent crash from misconfigured sorcery.conf

Misconfiguring sorcery.conf with a 'config' wizard with no extra data
will currently crash Asterisk on startup, as the wizard requires a comma
delineated list to parse. This patch updates res_sorcery_config to check
for the presence of the data before it starts manipulating it.

Change-Id: I4c97512e8258bc82abe190627a9206c28f5d3847

10 years agoMerge "sig_pri.h: force_restart_unavailable_chans in wrong scope" into 13
Mark Michelson [Fri, 17 Jul 2015 17:44:00 +0000 (12:44 -0500)] 
Merge "sig_pri.h: force_restart_unavailable_chans in wrong scope" into 13

10 years agochan_pjsip: Don't change formats when frame of unsupported format is received. 03/903/3
Joshua Colp [Thu, 16 Jul 2015 14:46:14 +0000 (11:46 -0300)] 
chan_pjsip: Don't change formats when frame of unsupported format is received.

Receipt of an RTP packet currently causes the formats on an PJSIP channel to
change to the format of the RTP packet. In some off-nominal cases it's possible
for this to be a format that has not been configured or negotiated. This change
makes it so only formats explicitly configured on the endpoint are allowed.

ASTERISK-25258 #close

Change-Id: If93d641fb6418a285928839300d7854cab8c1020

10 years agosig_pri.h: force_restart_unavailable_chans in wrong scope 24/924/2
Patric Marschall [Fri, 17 Jul 2015 09:59:19 +0000 (11:59 +0200)] 
sig_pri.h: force_restart_unavailable_chans in wrong scope

In channels/sig_pri.h, struct sig_pri_span, the field
force_restart_unavailable_chans is only defined if

#if defined(HAVE_PRI_MCID) is true.

All other occurences of force_restart_unavailable_chans are outside of the

#if defined(HAVE_PRI_MCID)
endif

scope.

ASTERISK-25257 #close
Reported by: Patric Marschall

Change-Id: I071de89cc2cd0d85927a013036e235851f672549

10 years agopbx.c: Post AMI VarSet event if delete a non-empty dialplan variable. 27/927/1
Richard Mudgett [Tue, 14 Jul 2015 21:55:46 +0000 (16:55 -0500)] 
pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable.

ASTERISK-25256 #close
Reported by: Richard Mudgett

Change-Id: I0b6be720b66fa956f6a798cd22ef8934eb0c0ff3

10 years agoMerge "ARI: Add support for push configuration of dynamic object" into 13
Matt Jordan [Fri, 17 Jul 2015 14:23:44 +0000 (09:23 -0500)] 
Merge "ARI: Add support for push configuration of dynamic object" into 13

10 years agoMerge "strings.h: Fix issues with escape string functions." into 13
Matt Jordan [Fri, 17 Jul 2015 13:50:30 +0000 (08:50 -0500)] 
Merge "strings.h: Fix issues with escape string functions." into 13

10 years agoARI: Add support for push configuration of dynamic object 53/853/4
Matt Jordan [Wed, 8 Jul 2015 21:39:35 +0000 (16:39 -0500)] 
ARI: Add support for push configuration of dynamic object

This patch adds support for push configuration of dynamic, i.e.,
sorcery, objects in Asterisk. It adds three new REST API calls to the
'asterisk' resource:
 * GET /asterisk/{configClass}/{objectType}/{id}: retrieve the current
   object given its ID. This returns back a list of ConfigTuples, which
   define the fields and their present values that make up the object.
 * PUT /asterisk/{configClass}/{objectType}/{id}: create or update an
   object. A body may be passed with the request that contains fields to
   populate in the object. The same format as what is retrieved using
   the GET operation is used for the body, save that we specify that the
   list of fields to update are contained in the "fields" attribute.
 * DELETE /asterisk/{configClass}/{objectType}/{id}: remove a dynamic
   object from its backing storage.

Note that the success/failure of these operations is somewhat
configuration dependent, i.e., you must be using a sorcery wizard that
supports the operation in question. If a sorcery wizard does not support
the create or delete mechanisms, then the REST API call will fail with a
403 forbidden.

ASTERISK-25238 #close

Change-Id: I28cd5c7bf6f67f8e9e437ff097f8fd171d30ff5c

10 years agoMerge "res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer()."...
Matt Jordan [Fri, 17 Jul 2015 01:33:38 +0000 (20:33 -0500)] 
Merge "res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer()." into 13

10 years agoMerge "res_pjsip_session.c: Add some helpful comments and minor tweaks." into 13
Matt Jordan [Fri, 17 Jul 2015 01:33:34 +0000 (20:33 -0500)] 
Merge "res_pjsip_session.c: Add some helpful comments and minor tweaks." into 13

10 years agoMerge "res_pjsip_session.c: Fix off nominal crash potential in debug message." into 13
Matt Jordan [Fri, 17 Jul 2015 01:33:30 +0000 (20:33 -0500)] 
Merge "res_pjsip_session.c: Fix off nominal crash potential in debug message." into 13

10 years agostrings.h: Fix issues with escape string functions. 14/914/1
Richard Mudgett [Wed, 15 Jul 2015 20:40:32 +0000 (15:40 -0500)] 
strings.h: Fix issues with escape string functions.

Fixes for issues with the ASTERISK-24934 patch.

* Fixed ast_escape_alloc() and ast_escape_c_alloc() if the s parameter is
an empty string.  If it were an empty string the functions returned NULL
as if there were a memory allocation failure.  This failure caused the AMI
VarSet event to not get posted if the new value was an empty string.

* Fixed dest buffer overwrite potential in ast_escape() and
ast_escape_c().  If the dest buffer size is smaller than the space needed
by the escaped s parameter string then the dest buffer would be written
beyond the end by the nul string terminator.  The num parameter was really
the dest buffer size parameter so I renamed it to size.

* Made nul terminate the dest buffer if the source string parameter s was
an empty string in ast_escape() and ast_escape_c().

* Updated ast_escape() and ast_escape_c() doxygen function description
comments to reflect reality.

* Added some more unit test cases to /main/strings/escape to cover the
empty source string issues.

ASTERISK-25255 #close
Reported by: Richard Mudgett

Change-Id: Id77fc704600ebcce81615c1200296f74de254104

10 years agoparking_applications.c: Fix ast_verb() line terminator. 13/913/1
Richard Mudgett [Tue, 14 Jul 2015 19:29:07 +0000 (14:29 -0500)] 
parking_applications.c: Fix ast_verb() line terminator.

Change-Id: I8797238c71563e243c48c6145b4f1ae58f91f775

10 years agores_parking: Fix crash if ATTENDEDTRANSFER set empty before Park. 12/912/1
Richard Mudgett [Tue, 14 Jul 2015 19:36:42 +0000 (14:36 -0500)] 
res_parking: Fix crash if ATTENDEDTRANSFER set empty before Park.

setup_park_common_datastore() was assuming that a non-NULL string returned
for the ATTENDEDTRANSFER and BLINDTRANSFER channel variables are not empty
strings.  Things got crashy as a result.

* Made setup_park_common_datastore() treat the channel variable values the
same whether they are NULL or empty for ATTENDEDTRANSFER and
BLINDTRANSFER.

ASTERISK-25254 #close
Reported by: Richard Mudgett

Change-Id: I9a9c174b33f354f35f82cc6b7cea8303adbaf9c2

10 years agores_pjsip_session.c: Extract sip_session_defer_termination_stop_timer(). 08/908/1
Richard Mudgett [Fri, 10 Jul 2015 23:01:43 +0000 (18:01 -0500)] 
res_pjsip_session.c: Extract sip_session_defer_termination_stop_timer().

Change-Id: I9e115dee74bd72e06081d0ee73ecdeb886caa5fb

10 years agores_pjsip_session.c: Add some helpful comments and minor tweaks. 07/907/1
Richard Mudgett [Fri, 10 Jul 2015 15:42:13 +0000 (10:42 -0500)] 
res_pjsip_session.c: Add some helpful comments and minor tweaks.

Change-Id: I742aeeaf5f760593f323a00fb691affe22e35743

10 years agores_pjsip_session.c: Fix off nominal crash potential in debug message. 06/906/1
Richard Mudgett [Fri, 10 Jul 2015 15:43:40 +0000 (10:43 -0500)] 
res_pjsip_session.c: Fix off nominal crash potential in debug message.

Change-Id: I09928297927ee85f7655289acee3a586816466bc

10 years agoMerge "apps/app_dictate: Fix typo in attribution" into 13
Joshua Colp [Wed, 15 Jul 2015 15:48:40 +0000 (10:48 -0500)] 
Merge "apps/app_dictate: Fix typo in attribution" into 13

10 years agoMerge "ARI: Fixed unload mode for unload module." into 13
Mark Michelson [Wed, 15 Jul 2015 15:44:08 +0000 (10:44 -0500)] 
Merge "ARI: Fixed unload mode for unload module." into 13

10 years agoapps/app_dictate: Fix typo in attribution 95/895/1
Matt Jordan [Wed, 15 Jul 2015 15:31:51 +0000 (10:31 -0500)] 
apps/app_dictate: Fix typo in attribution

Last time I checked, it's "Sangoma", not "Samgoma". Thanks to Brian
(GameGamer43) for pointing that out.

Change-Id: I43d7b196f6d7a2b2517b84915e3a8dfbc2894106

10 years agoARI: Fixed unload mode for unload module. 92/892/1
Benjamin Ford [Wed, 15 Jul 2015 15:28:00 +0000 (10:28 -0500)] 
ARI: Fixed unload mode for unload module.

Changed the unload mode to AST_FORCE_SOFT from AST_FORCE_FIRM,
which would unload a module even if it was in use.

* Changed unload mode to proper mode

ASTERISK-25173

Change-Id: If2402487b5bce05d9770f25f65f5c8e292ad5533

10 years agoMerge "res_pjsip_session.c: Fix crash on call disconnect." into 13
Matt Jordan [Wed, 15 Jul 2015 03:17:45 +0000 (22:17 -0500)] 
Merge "res_pjsip_session.c: Fix crash on call disconnect." into 13

10 years agores/res_sorcery_astdb: Add a debugging message for when retrieval by ID fails 52/852/3
Matt Jordan [Wed, 8 Jul 2015 21:38:24 +0000 (16:38 -0500)] 
res/res_sorcery_astdb: Add a debugging message for when retrieval by ID fails

Having a debug message tell us that we attempted to look up an item but
failed is nice in circumstances when it isn't clear if the wizard was
queried correctly or not.

Change-Id: I2600c3bbea87f252196358f62e73f4c7da8632f7

10 years agores/res_pjsip_outbound_registration: Fix WARNING message 51/851/3
Matt Jordan [Wed, 8 Jul 2015 21:37:56 +0000 (16:37 -0500)] 
res/res_pjsip_outbound_registration: Fix WARNING message

Newlines are nice.

Change-Id: Icf0d915db02882e47cd9077ed9009f5d44140d42

10 years agores_pjsip/configuration: Fix a variety of default value problems 50/850/3
Matt Jordan [Wed, 8 Jul 2015 21:35:36 +0000 (16:35 -0500)] 
res_pjsip/configuration: Fix a variety of default value problems

This patch fixes some bad default value handling in the following
settings:

* The 'message_context' and 'accountcode' settings are not mandatory. As
  such, we can allow their stringfield values to be empty.
* The 'media_encryption' setting applies a default value of 'none' to
  the setting, which it then can't parse or understand. Since the value
  is documented to be 'no', this will now apply that as the default
  value.

Change-Id: Ib9be7f97a7a5b9bc7aee868edf5acf38774cff83

10 years agomain/sorcery: Provide log messages when a wizard does not support an operation 49/849/3
Matt Jordan [Wed, 8 Jul 2015 21:32:25 +0000 (16:32 -0500)] 
main/sorcery: Provide log messages when a wizard does not support an operation

If a sorcery wizard does not support one of the 'optional' CRUD
operations (namely the CUD), log a WARNING message so we are aware of
why the operation failed. This also removes an assert in this case, as
the CUD operation may have been triggered by an external system, in
which case it is not a programming error but a configuration error.

Change-Id: Ifecd9df946d9deaa86235257b49c6e5e24423b53

10 years agores_pjsip_session.c: Fix crash on call disconnect. 89/889/1
Richard Mudgett [Fri, 10 Jul 2015 23:17:52 +0000 (18:17 -0500)] 
res_pjsip_session.c: Fix crash on call disconnect.

The crash fix for ASTERISK-25183 backported some code from master to try
to make sure that a BYE response is processed by the same serializer used
by the BYE request.  The identified race condition causing that backport
was the BYE request code had not finished processing after sending the BYE
before the BYE response came in for processing under a different thread.
Unfortunately, there is still a race condition.  Now the race condition is
between destroying the call session's serializer in
ast_taskprocessor_unreference() and using ast_taskprocessor_get() to get a
reference to the serializer for a BYE response.  Even worse, the new race
condition is a design limitation of the taskprocessor implementation that
didn't matter in versions before v12.  Back then, taskprocessors were only
destroyed when a module unloaded.  Now res_pjsip can destroy them when a
call ends.

However, as noted on the ASTERISK-25183 commit,
session_inv_on_state_changed() is disassociating the dialog from the
session when the invite dialog state becomes PJSIP_INV_STATE_DISCONNECTED.
This is a tad too soon because our BYE request transaction has not
completed yet.

* Split session_end() that is called by session_inv_on_state_changed() to
hold off session destruction until the BYE transaction timeout occurs or a
failed initial INVITE transaction timeout occurs in
session_inv_on_tsx_state_changed().

ASTERISK-25201 #close
Reported by: Matt Jordan

Change-Id: Iaf8dc8485fd8392a2a3ee4ad3b7f7f04a0dcc961

10 years agoARI: Added new functionality to reload a single module. 58/858/3
Benjamin Ford [Tue, 14 Jul 2015 18:12:32 +0000 (13:12 -0500)] 
ARI: Added new functionality to reload a single module.

An http request can be sent to reload an Asterisk module. If the
module can not be reloaded or is not already loaded, an error
response will be returned.

The command "curl -v -u user:pass -X PUT 'http://localhost:8088
/ari/asterisk/modules/{moduleName}'" (or something similar, based
on configuration) can be run in the terminal to access this new
functionality.

For more information, see:
https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource

* Added new ARI functionality
* Asterisk modules can be reloaded through http requests

ASTERISK-25173

Change-Id: I289188bcae182b2083bdbd9ebfffd50b62f58ae1

10 years agoARI: Added new functionality to unload a single module. 08/808/5
Benjamin Ford [Tue, 14 Jul 2015 13:55:14 +0000 (08:55 -0500)] 
ARI: Added new functionality to unload a single module.

An http request can be sent to unload an Asterisk module. If the
module can not be unloaded or is already unloaded, an error response
will be returned.

The command "curl -v -u user:pass -X DELETE 'http://localhost:8088
/ari/asterisk/modules/{moduleName}'" (or something similar, depending
on configuration) can be run in the terminal to access this new
functionality.

For more information, see:
https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource

* Added new ARI functionality
* Asterisk modules can be unloaded through http requests

ASTERISK-25173

Change-Id: I535a95f5676deb02651522761ecbdc0b00b5ac57

10 years agoARI: Added new functionality to load a single module. 07/807/8
Benjamin Ford [Mon, 13 Jul 2015 21:00:19 +0000 (16:00 -0500)] 
ARI: Added new functionality to load a single module.

An http request can be sent to load an Asterisk module. If the
module can not be loaded or is loaded already, an error response
will be returned.

The command curl -v -u user:pass -X POST 'http://localhost:8088/ari
/asterisk/modules/{moduleName}'" (or something similar, depending on
configuration) can be run in the terminal to access this new
functionality.

For more information, see:
https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource

* Added new ARI functionality
* Asterisk modules can be loaded through http requests

ASTERISK-25173

Change-Id: I9e05d5b8c5c666ecfef341504f9edc1aa84fda33

10 years agoMerge "ARI: Added new functionality to get information on a single module." into 13
Mark Michelson [Mon, 13 Jul 2015 20:15:44 +0000 (15:15 -0500)] 
Merge "ARI: Added new functionality to get information on a single module." into 13

10 years agoMerge "bridge.c: Fixed race condition during attended transfer" into 13
Mark Michelson [Mon, 13 Jul 2015 19:51:22 +0000 (14:51 -0500)] 
Merge "bridge.c: Fixed race condition during attended transfer" into 13

10 years agoARI: Added new functionality to get information on a single module. 90/790/10
Benjamin Ford [Mon, 13 Jul 2015 15:54:51 +0000 (10:54 -0500)] 
ARI: Added new functionality to get information on a single module.

An http request can be sent to retrieve information on a single
module, including the resource name, description, use count, status,
and support level.

The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari
/asterisk/modules/{moduleName}'" (or something similar, depending on
configuration) can be run in the terminal to access this new
functionality.

For more information, see:
https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource

* Added new ARI functionality
* Information on a single module can now be retrieved

ASTERISK-25173

Change-Id: Ibce5a94e70ecdf4e90329cf0ba66c33a62d37463

10 years agobridge.c: Fixed race condition during attended transfer 39/839/5
Kevin Harwell [Wed, 8 Jul 2015 19:56:10 +0000 (14:56 -0500)] 
bridge.c: Fixed race condition during attended transfer

During an attended transfer a thread is started that handles imparting the
bridge channel. From the start of the thread to when the bridge channel is
ready exists a gap that can potentially cause problems (for instance, the
channel being swapped is hung up before the replacement channel enters the
bridge thus stopping the transfer). This patch adds a condition that waits
for the impart thread to get to a point of acceptable readiness before
allowing the initiating thread to continue.

ASTERISK-24782
Reported by: John Bigelow

Change-Id: I08fe33a2560da924e676df55b181e46fca604577

10 years agoMerge "main/format_cap: Parse capabilities generated by ast_format_cap_get_names...
Matt Jordan [Mon, 13 Jul 2015 17:53:54 +0000 (12:53 -0500)] 
Merge "main/format_cap: Parse capabilities generated by ast_format_cap_get_names" into 13

10 years agomain/sorcery: Don't fail object set creation from JSON if field fails 48/848/3
Matt Jordan [Wed, 8 Jul 2015 21:28:13 +0000 (16:28 -0500)] 
main/sorcery: Don't fail object set creation from JSON if field fails

Some individual fields may fail their conversion due to their default
values being invalid for their custom handlers. In particular,
configuration values that depend on others being enabled (and thus have
an empty default value) are notorious for tripping this routine up. An
example of this are any of the DTLS options for endpoints. Any of the
DTLS options will fail to be applied (as DTLS is not enabled), causing
the entire object set to be aborted.

This patch makes it so that we log a debug message when skipping a
field, and rumble on anyway.

ASTERISK-25238

Change-Id: I0bea13de79f66bf9f9ae6ece0e94a2dc1c026a76

10 years agomain/format_cap: Parse capabilities generated by ast_format_cap_get_names 47/847/2
Matt Jordan [Wed, 8 Jul 2015 21:21:09 +0000 (16:21 -0500)] 
main/format_cap: Parse capabilities generated by ast_format_cap_get_names

We have a strange relationship between the parsing of format
capabilities from a string and their representation as a string. We
expect the format capabilities to be expressed as a string in the
following format:

allow = !all,ulaw,alaw
disallow = g722

While we would generate the string representation of those formats as:

allow = (ulaw|alaw)
disallow = (ulaw|alaw|g729...)

When the configuration framework needs to store values as a string, it
generates the format capabilities using the second representation; this
representation however cannot be parsed when the entry is rehydrated.
This patch fixes that by updating
ast_format_cap_update_by_allow_disallow to parse an entry as if it were
in the generated format if it has a leading '(' and a trailing ')'.

ASTERISK-25238

Change-Id: I904d43caf4cf45af06f6aee0c9e58556eb91d6ca

10 years agoMerge "tests/test_devicestate: Add additional tests for the device state API" into 13
Matt Jordan [Sat, 11 Jul 2015 16:44:13 +0000 (11:44 -0500)] 
Merge "tests/test_devicestate: Add additional tests for the device state API" into 13

10 years agoMerge "res/res_sorcery_memory_cache: Fix test registration issues" into 13
Matt Jordan [Sat, 11 Jul 2015 16:31:28 +0000 (11:31 -0500)] 
Merge "res/res_sorcery_memory_cache: Fix test registration issues" into 13

10 years agoMerge "tests/test_sorcery_memory_cache_thrash: Fix test loading problems" into 13
Matt Jordan [Sat, 11 Jul 2015 16:31:23 +0000 (11:31 -0500)] 
Merge "tests/test_sorcery_memory_cache_thrash: Fix test loading problems" into 13

10 years agotests/test_devicestate: Add additional tests for the device state API 70/870/1
Matt Jordan [Sat, 27 Jun 2015 22:53:37 +0000 (17:53 -0500)] 
tests/test_devicestate: Add additional tests for the device state API

This patch adds more tests that exercise the device state API. This includes:

* Tests that cover adding a device state provider, as well as deleting a
  device state provider. This also verifies that you cannot add an
  already added device state provider, and cannot delete an already
  deleted device state provider.
* A test that covers changing device state and receiving said updates
  from a device state subscriber. This also covers hitting both the
  device state cache as well as a custom device state provider.
* A test that covers converting device state to channel state and device
  state values to a string representation and back.
* A test that covers obtaining device state from an active channel and a
  channel driver that provides its own device state.

Change-Id: I2adca67ffb405cd8625a5d6df1e3f9b3d945c08d

10 years agomain/devicestate: Prevent duplicate registration of device state providers 84/784/2
Matt Jordan [Sat, 27 Jun 2015 22:51:43 +0000 (17:51 -0500)] 
main/devicestate: Prevent duplicate registration of device state providers

Currently, the device state provider API will allow you to register a
device state provider with the same case insensitive name more than
once. This could cause strange issues, as the duplicate device state
providers will not be queried when a device's state has to be polled.
This patch updates the API such that a device state provider with the
same name as one that has already registered will be rejected.

Change-Id: I4a418a12280b7b6e4960bd44f302e27cd036ceb2

10 years agores/res_sorcery_memory_cache: Fix test registration issues 69/869/1
Matt Jordan [Sat, 11 Jul 2015 03:25:00 +0000 (22:25 -0500)] 
res/res_sorcery_memory_cache: Fix test registration issues

Again, tests now need to not end with a newline. This patch makes it so
the tests can register again, unit tests will actually pass, and we can
stop wasting time trying to figure out why builds are failing when they
really aren't failing.

Change-Id: Ide519fbeba89f413c733446c5ff7b224fc4ce840

10 years agoMerge "ARI: Added new functionality to get all module information." into 13
Matt Jordan [Sat, 11 Jul 2015 02:46:38 +0000 (21:46 -0500)] 
Merge "ARI: Added new functionality to get all module information." into 13

10 years agotests/test_sorcery_memory_cache_thrash: Fix test loading problems 68/868/1
Matt Jordan [Sat, 11 Jul 2015 02:42:58 +0000 (21:42 -0500)] 
tests/test_sorcery_memory_cache_thrash: Fix test loading problems

Because unit tests now want descriptions to not end with a newline, the
sorcery memory cache thrash tests failed to register. This patch
corrects their descriptions.

Change-Id: Id004b1becfdeed8ee3c846f49beab76a5c0f68b6

10 years agoARI: Added new functionality to get all module information. 32/732/11
Benjamin Ford [Fri, 26 Jun 2015 15:57:15 +0000 (10:57 -0500)] 
ARI: Added new functionality to get all module information.

An http request can be sent to retrieve a list of all existing modules,
including the resource name, description, use count, status, and
support level.

The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari/
asterisk/modules" (or something similar, depending on configuration)
can be run in the terminal to access this new functionality.

For more information, see:
https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource

* Added new ARI functionality
* Information on modules can now be retrieved

Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0

10 years agoMerge "bridge_native_rtp.c: Don't start native RTP bridging after attended transfer...
Matt Jordan [Fri, 10 Jul 2015 14:29:29 +0000 (09:29 -0500)] 
Merge "bridge_native_rtp.c: Don't start native RTP bridging after attended transfer." into 13

10 years agobridge_native_rtp.c: Don't start native RTP bridging after attended transfer. 55/855/2
Joshua Colp [Thu, 9 Jul 2015 14:18:11 +0000 (11:18 -0300)] 
bridge_native_rtp.c: Don't start native RTP bridging after attended transfer.

The bridge_native_rtp module adds a frame hook to channels which are in
a native RTP bridge. This frame hook is used to intercept when a hold
or unhold frame traverses the bridge so native RTP can be stopped or
started as appropriate. This is expected but exposes a specific bug
when attended transfers are involved.

Upon completion of an attended transfer an unhold frame is queued up
to take one of the channels involved off hold. After this is done
the channel is moved between bridges.

When the frame hook is involved in this case for the unhold it
releases the channel lock and acquires the bridge lock. This
allows the bridge core to step in and move the channel
(potentially changing the bridging techology) from another thread.
Once completed the bridge lock is released by the bridge core.
The frame hook is then able to acquire the bridge lock and
wrongfully starts native RTP again, despite the channel no longer
being in the bridge or needing to start native RTP. In fact at
this point the frame hook is no longer attached to the channel.

This change makes it so the native RTP bridge data is available to
the frame hook when it is invoked. Whether the frame hook has
been detached or not is stored on the native RTP bridge data and
is checked by the frame hook before starting or stopping native
RTP bridging. If the frame hook has been detached it does nothing.

ASTERISK-25240 #close

Change-Id: I13a73186a05f4e5a764f81e5cd0ccec1ed1891d2

10 years agores_sorcery_memory_cache: Backport to 13 54/854/1
Joshua Colp [Sat, 16 May 2015 22:02:50 +0000 (19:02 -0300)] 
res_sorcery_memory_cache: Backport to 13

Gerrit is complaining of conflicts when trying to create a patch series
of all of the cherry-picked master commits, so I have instead squashed
it all into one commit.

ASTERISK-25067 #close
Reported by: Matt Jordan

Change-Id: I6dda90343fae24a75dc5beec84980024e8d61eb9

10 years agores_rtp_asterisk: Ensure DTLS timeout timer is -1 if DTLS is not used. 10/810/1
Joshua Colp [Wed, 8 Jul 2015 09:21:16 +0000 (06:21 -0300)] 
res_rtp_asterisk: Ensure DTLS timeout timer is -1 if DTLS is not used.

This change fixes a bug where the DTLS timeout timer would be
initialized to 0 if DTLS was not used for an RTP session.

ASTERISK-25103

Change-Id: If8d26bb054f1d300838850da5b8db9044c2fe2ac

10 years agoMerge "res_pjsip_mwi.c: Use safer loop coding in mwi_subscription_mailboxes_str(...
Matt Jordan [Wed, 8 Jul 2015 01:38:42 +0000 (20:38 -0500)] 
Merge "res_pjsip_mwi.c: Use safer loop coding in mwi_subscription_mailboxes_str()." into 13

10 years agoMerge "res_pjsip_mwi.c: Fix MWI subscription memory corruption crash." into 13
Matt Jordan [Wed, 8 Jul 2015 01:38:12 +0000 (20:38 -0500)] 
Merge "res_pjsip_mwi.c: Fix MWI subscription memory corruption crash." into 13

10 years agoMerge "PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error." into 13
Joshua Colp [Tue, 7 Jul 2015 22:38:59 +0000 (17:38 -0500)] 
Merge "PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error." into 13

10 years agoMerge topic 'res_pjsip_mwi_cleanups' into 13
Joshua Colp [Tue, 7 Jul 2015 22:24:36 +0000 (17:24 -0500)] 
Merge topic 'res_pjsip_mwi_cleanups' into 13

* changes:
  res_pjsip_mwi.c: Eliminate a simple RAII_VAR.
  res_pjsip_mwi.c: Fix mid-line log message line breaks.

10 years agoMerge "PJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences...
Joshua Colp [Tue, 7 Jul 2015 22:20:46 +0000 (17:20 -0500)] 
Merge "PJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences." into 13

10 years agoMerge "res_pjsip_t38.c: Fix always false if test." into 13
Joshua Colp [Tue, 7 Jul 2015 22:12:18 +0000 (17:12 -0500)] 
Merge "res_pjsip_t38.c: Fix always false if test." into 13

10 years agoMerge "res_pjsip: Need to use the same serializer for a pjproject SIP transaction...
Joshua Colp [Tue, 7 Jul 2015 22:11:26 +0000 (17:11 -0500)] 
Merge "res_pjsip: Need to use the same serializer for a pjproject SIP transaction." into 13

10 years agoMerge "res/res_http_websocket: Don't send HTTP response fragmented." into 13
Joshua Colp [Tue, 7 Jul 2015 22:01:24 +0000 (17:01 -0500)] 
Merge "res/res_http_websocket: Don't send HTTP response fragmented." into 13

10 years agores_rtp_asterisk: Prevent simultaneous access to DTLS SSL context. 87/787/5
Joshua Colp [Wed, 1 Jul 2015 12:55:47 +0000 (09:55 -0300)] 
res_rtp_asterisk: Prevent simultaneous access to DTLS SSL context.

This change moves logic for setting up the DTLS SSL contexts to
when the SDP is done being processed instead of when ICE negotiation
completes. It also stops handshakes from being initiated when we
are acting as a server.

Manipulating the SSL context when ICE negotiation has completed
is problematic as the SSL context is not protected and if acting
as a client the remote side may have started DTLS negotiation
already.

The retransmission timeout timer code has also been split up
and simplified some. Both RTP and RTCP now have their own timers
and the points at which the timer is stopped and started is now
more specific. When a packet is sent the timer is started. When
a response is received but before it is processed the timer is
stopped. This provides a guarantee that the timeout is not
occurring while the response is processed.

ASTERISK-22805 #close
ASTERISK-24550 #close
ASTERISK-24651 #close
ASTERISK-24832 #close
ASTERISK-25103 #close
ASTERISK-25127 #close

Change-Id: Ib75ea2546f29d6efc3d2d37c58df6986c7bd9b91

10 years agores_pjsip_t38.c: Fix always false if test. 93/793/1
Richard Mudgett [Fri, 26 Jun 2015 21:10:26 +0000 (16:10 -0500)] 
res_pjsip_t38.c: Fix always false if test.

Calling t38_change_state() sets the t38 state so it makes little sense to
then check the state right after the call for something else.

* Made the code in t38_interpret_parameters() reject or exit T.38 mode as
intended but not implemented.

Change-Id: Ib281263a6ed44da9448132c4e6df1e183b8a3df2

10 years agores_pjsip_mwi.c: Use safer loop coding in mwi_subscription_mailboxes_str(). 97/797/1
Richard Mudgett [Tue, 30 Jun 2015 16:17:25 +0000 (11:17 -0500)] 
res_pjsip_mwi.c: Use safer loop coding in mwi_subscription_mailboxes_str().

Change-Id: I6f39d809a6d1b47b35bb32b298f5a12f35d6f907

10 years agores_pjsip_mwi.c: Eliminate a simple RAII_VAR. 96/796/1
Richard Mudgett [Tue, 30 Jun 2015 16:14:57 +0000 (11:14 -0500)] 
res_pjsip_mwi.c: Eliminate a simple RAII_VAR.

Change-Id: Ib1843f81e826a6c760c424c88eb70c350d9d61da

10 years agores_pjsip_mwi.c: Fix mid-line log message line breaks. 95/795/1
Richard Mudgett [Tue, 30 Jun 2015 16:11:19 +0000 (11:11 -0500)] 
res_pjsip_mwi.c: Fix mid-line log message line breaks.

* Add create_mwi_subscriptions_for_endpoint() doxygen comment.

Change-Id: I3c3f921f4ec749fb65b62d2f6fa0d4d1888b94e2

10 years agores_pjsip_mwi.c: Fix MWI subscription memory corruption crash. 03/803/1
Richard Mudgett [Fri, 26 Jun 2015 23:48:35 +0000 (18:48 -0500)] 
res_pjsip_mwi.c: Fix MWI subscription memory corruption crash.

MWI subscriptions can crash or corrupt memory when using the subscription
datastore to access the MWI subscription object because the datastore is
not holding a reference to the object.

* Give the subscription datastore a ref to the MWI subscription object.
It is unfortunate that the ref causes a circular ref chain that must be
explicitly broken to allow the memory to get released.  The loop is broken
when the subscription is shutdown and if the subscription setup fails.

ASTERISK-25168 #close
Reported by: Carl Fortin

Change-Id: Ice4fa823f138ff10a6c74d280699c41a82836d4f

10 years agoPJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error. 02/802/1
Richard Mudgett [Thu, 2 Jul 2015 19:51:29 +0000 (14:51 -0500)] 
PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error.

When res_pjsip body generator modules were generating XML or XPIDF
response bodies, there was a chance that the generated body would be the
exact size of the supplied buffer.  Adding the nul string terminator would
then write beyond the end of the buffer and potentially corrupt memory.

* Fix MALLOC_DEBUG high fence violations caused by adding a nul string
terminator on the end of a buffer for XML or XPIDF response bodies.

* Made calls to pj_xml_print() safer if the XML prolog is requested.  Due
to a bug in pjproject, the return value could be -1 _or_
AST_PJSIP_XML_PROLOG_LEN if the supplied buffer is not large enough.

* Updated the doxygen comment of AST_PJSIP_XML_PROLOG_LEN to describe the
return value of pj_xml_print() when the supplied buffer is not large
enough.

ASTERISK-25168
Reported by: Carl Fortin

Change-Id: Id70e1d373a6a2b2bd9e678b5cbc5e55b308981de

10 years agoPJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences. 01/801/1
Richard Mudgett [Fri, 26 Jun 2015 15:36:19 +0000 (10:36 -0500)] 
PJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences.

When a caller calls a FAX number and then hangs up right after the call is
answered then the T.38 re-INVITE automatic reject timer may still be
running after the channel goes away.

* Added session NULL channel checks on the code paths that get executed by
t38_automatic_reject() to prevent a crash when the T.38 re-INVITE
automatic reject timer expires.

ASTERISK-25168
Reported by: Carl Fortin

Change-Id: I07b6cd23815aedce5044f8f32543779e2f7a2403

10 years agores_pjsip: Need to use the same serializer for a pjproject SIP transaction. 92/792/1
Richard Mudgett [Fri, 5 Jun 2015 20:37:33 +0000 (15:37 -0500)] 
res_pjsip: Need to use the same serializer for a pjproject SIP transaction.

All send/receive processing for a SIP transaction needs to be done under
the same threadpool serializer to prevent reentrancy problems inside
pjproject and res_pjsip.

* Add threadpool API call to get the current serializer associated with
the worker thread.

* Pick a serializer from a pool of default serializers if the caller of
res_pjsip.c:ast_sip_push_task() does not provide one.

This is a simple way to ensure that all outgoing SIP request messages are
processed under a serializer.  Otherwise, any place where a pushed task is
done that would result in an outgoing out-of-dialog request would need to
be modified to supply a serializer.  Serializers from the default
serializer pool are picked in a round robin sequence for simplicity.

A side effect is that the default serializer pool will limit the growth of
the thread pool from random tasks.  This is not necessarily a bad thing.

* Made pjsip_distributor.c save the thread's serializer name on the
outgoing request tdata struct so the response can be processed under the
same serializer.

This is a cherry-pick from master.

**** ASTERISK-25115 Change-Id: Iea71c16ce1132017b5791635e198b8c27973f40a

NOTE: session_inv_on_state_changed() is disassociating the dialog from the
session when the invite dialog becomes PJSIP_INV_STATE_DISCONNECTED.
Unfortunately this is a tad too soon because our BYE request transaction
has not completed yet.

ASTERISK-25183 #close
Reported by: Matt Jordan

Change-Id: I8bad0ae1daf18d75b8c9e55874244b7962df2d0a

10 years agoMerge "chan_sip: Fix early call pickup channel leak." into 13
Joshua Colp [Sun, 5 Jul 2015 00:09:51 +0000 (19:09 -0500)] 
Merge "chan_sip: Fix early call pickup channel leak." into 13

10 years agores/res_http_websocket: Don't send HTTP response fragmented. 79/779/1
Joshua Colp [Sat, 4 Jul 2015 23:22:01 +0000 (20:22 -0300)] 
res/res_http_websocket: Don't send HTTP response fragmented.

This change makes it so that when accepting a WebSocket
connection the HTTP response is sent as one packet instead of
fragmented. Browsers don't like it when you send it fragmented.

ASTERISK-25103

Change-Id: I9b82c4ec2949b0bce692ad0bf6f7cea9709e7f69