]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agoaudiohook.c: Simplify variable usage in audiohook_read_frame_both(). 87/1087/2
Richard Mudgett [Thu, 13 Aug 2015 17:30:00 +0000 (12:30 -0500)] 
audiohook.c: Simplify variable usage in audiohook_read_frame_both().

Change-Id: I58bed58631a94295b267991c5b61a3a93c167f0c

9 years agoaudiohook.c: Fix MixMonitor crash when using the r() or t() options. 86/1086/2
Richard Mudgett [Thu, 13 Aug 2015 17:22:14 +0000 (12:22 -0500)] 
audiohook.c: Fix MixMonitor crash when using the r() or t() options.

The built frame format in audiohook_read_frame_both() is now set to a
signed linear format before the rx and tx frames are duplicated instead of
only for the mixed audio frame duplication.

ASTERISK-25322 #close
Reported by Sean Pimental

Change-Id: I86f85b5c48c49e4e2d3b770797b9d484250a1538

9 years agoMerge "chan_sip.c: wrong peer searched in sip_report_security_event" into 13
Mark Michelson [Thu, 13 Aug 2015 21:12:23 +0000 (16:12 -0500)] 
Merge "chan_sip.c: wrong peer searched in sip_report_security_event" into 13

9 years agochan_sip.c: wrong peer searched in sip_report_security_event 82/1082/2
Kevin Harwell [Wed, 12 Aug 2015 17:59:53 +0000 (12:59 -0500)] 
chan_sip.c: wrong peer searched in sip_report_security_event

In chan_sip, after handling an incoming invite a security event is raised
describing authorization (success, failure, etc...). However, it was doing
a lookup of the peer by extension. This is fine for register messages, but
in the case of an invite it may search and find the wrong peer, or a non
existent one (for instance, in the case of call pickup). Also, if the peers
are configured through realtime this may cause an unnecessary database lookup
when caching is enabled.

This patch makes it so that sip_report_security_event searches by IP address
when looking for a peer instead of by extension after an invite is processed.

ASTERISK-25320 #close

Change-Id: I9b3f11549efb475b6561c64f0e6da1a481d98bc4

9 years agores_http_websocket: When shutting down a session don't close closed socket 78/1078/2
Joshua Colp [Thu, 13 Aug 2015 10:26:51 +0000 (07:26 -0300)] 
res_http_websocket: When shutting down a session don't close closed socket

Due to the use of ast_websocket_close in session termination it is
possible for the underlying socket to already be closed when the
session is terminated. This occurs when the close frame is attempted
to be written out but fails.

Change-Id: I7572583529a42a7dc911ea77a974d8307d5c0c8b

9 years agoMerge "res_http_websocket: Forcefully terminate on write errors." into 13
Joshua Colp [Wed, 12 Aug 2015 18:42:59 +0000 (13:42 -0500)] 
Merge "res_http_websocket: Forcefully terminate on write errors." into 13

9 years agoMerge topic 'ASTERISK-25315' into 13
Mark Michelson [Wed, 12 Aug 2015 18:37:38 +0000 (13:37 -0500)] 
Merge topic 'ASTERISK-25315' into 13

* changes:
  chan_dahdi.c: Flush the DAHDI write buffer after starting DTMF.
  chan_dahdi.c: Lock private struct for ast_write().

9 years agoMerge "chan_sip: Fix negotiation of iLBC 30." into 13
Joshua Colp [Wed, 12 Aug 2015 18:36:01 +0000 (13:36 -0500)] 
Merge "chan_sip: Fix negotiation of iLBC 30." into 13

9 years agores_http_websocket: Forcefully terminate on write errors. 73/1073/1
Joshua Colp [Tue, 11 Aug 2015 10:24:30 +0000 (07:24 -0300)] 
res_http_websocket: Forcefully terminate on write errors.

The res_http_websocket module will currently attempt to close
the WebSocket connection if fatal cases occur, such as when
attempting to write out data and being unable to. When the
fatal cases occur the code attempts to write a WebSocket close
frame out to have the remote side close the connection. If
writing this fails then the connection is not terminated.

This change forcefully terminates the connection if the
WebSocket is to be closed but is unable to send the close frame.

ASTERISK-25312 #close

Change-Id: I10973086671cc192a76424060d9ec8e688602845

9 years agochan_dahdi.c: Flush the DAHDI write buffer after starting DTMF. 65/1065/1
Richard Mudgett [Mon, 10 Aug 2015 18:43:19 +0000 (13:43 -0500)] 
chan_dahdi.c: Flush the DAHDI write buffer after starting DTMF.

Pressing DTMF digits on a phone to go out on a DAHDI channel can result in
the digit not being recognized or even heard by the peer.

Phone -> Asterisk -> DAHDI/channel

Turns out the DAHDI behavior with DTMF generation (and any other generated
tones) is exposed by the "buffers=" setting in chan_dahdi.conf.  When
Asterisk requests to start sending DTMF then DAHDI waits until its write
buffer is empty before generating any samples for the DTMF tones.  When
Asterisk subsequently requests DAHDI to stop sending DTMF then DAHDI
immediately stops generating the DTMF samples.  As a result, the more
samples there are in the DAHDI write buffer the shorter the time DTMF
actually gets sent on the wire.  If there are more samples in the write
buffer than the time DTMF is supposed to be sent then no DTMF gets sent on
the wire.  With the "buffers=12,half" setting and each buffer representing
20 ms of samples then the DAHDI write buffer is going to contain around
120 ms of samples.  For DTMF to be recognized by the peer the actual sent
DTMF duration needs to be a minimum of 40 ms.  Therefore, the intended
duration needs to be a minimum of 160 ms for the peer to receive the
minimum DTMF digit duration to recognize it.

A simple and effective solution to work around the DAHDI behavior is for
Asterisk to flush the DAHDI write buffer when sending DTMF so the full
duration of DTMF is actually sent on the wire.  When someone is going to
send DTMF they are not likely to be talking before sending the tones so
the flushed write samples are expected to just contain silence.

* Made dahdi_digit_begin() flush the DAHDI write buffer after requesting
to send a DTMF digit.

ASTERISK-25315 #close
Reported by John Hardin

Change-Id: Ib56262c708cb7858082156bfc70ebd0a220efa6a

9 years agochan_dahdi.c: Lock private struct for ast_write(). 64/1064/1
Richard Mudgett [Wed, 5 Aug 2015 19:21:50 +0000 (14:21 -0500)] 
chan_dahdi.c: Lock private struct for ast_write().

There is a window of opportunity for DTMF to not go out if an audio frame
is in the process of being written to DAHDI while another thread starts
sending DTMF.  The thread sending the audio frame could be past the
currently dialing check before being preempted by another thread starting
a DTMF generation request.  When the thread sending the audio frame
resumes it will then cause DAHDI to stop the DTMF tone generation.  The
result is no DTMF goes out.

* Made dahdi_write() lock the private struct before writing to the DAHDI
file descriptor.

ASTERISK-25315
Reported by John Hardin

Change-Id: Ib4e0264cf63305ed5da701188447668e72ec9abb

9 years agores_pjsip.c: Fix crash from corrupt saved SUBSCRIBE message. 63/1063/1
Richard Mudgett [Mon, 10 Aug 2015 23:23:02 +0000 (18:23 -0500)] 
res_pjsip.c: Fix crash from corrupt saved SUBSCRIBE message.

If the saved SUBSCRIBE message is not parseable for whatever reason then
Asterisk could crash when libpjsip tries to parse the message and adds an
error message to the parse error list.

* Made ast_sip_create_rdata() initialize the parse error rdata list.  The
list is checked after parsing to see that it remains empty for the
function to return successful.

ASTERISK-25306
Reported by Mark Michelson

Change-Id: Ie0677f69f707503b1a37df18723bd59418085256

9 years agoMerge "res/res_format_attr_silk: Expose format attributes to other modules" into 13
Matt Jordan [Tue, 11 Aug 2015 16:59:44 +0000 (11:59 -0500)] 
Merge "res/res_format_attr_silk: Expose format attributes to other modules" into 13

9 years agoMerge "main/format: Add an API call for retrieving format attributes" into 13
Matt Jordan [Tue, 11 Aug 2015 16:59:39 +0000 (11:59 -0500)] 
Merge "main/format: Add an API call for retrieving format attributes" into 13

9 years agochan_sip: Fix negotiation of iLBC 30. 57/1057/2
Alexander Traud [Mon, 10 Aug 2015 12:40:02 +0000 (14:40 +0200)] 
chan_sip: Fix negotiation of iLBC 30.

iLBC 20 was advertised in a SIP/SDP negotiation. However, only iLBC 30 is
supported. Removes "a=fmtp:x mode=y" from SDP. Because of RFC 3952 section 5,
only iLBC 30 is negotiated now.

ASTERISK-25309 #close

Change-Id: I92d724600a183eec3114da0ac607b994b1a793da

9 years agoMerge "Replace htobe64 with htonll" into 13
Joshua Colp [Mon, 10 Aug 2015 16:39:05 +0000 (11:39 -0500)] 
Merge "Replace htobe64 with htonll" into 13

9 years agoMerge "res_pjsip_pubsub: More accurately persist packet." into 13
Joshua Colp [Mon, 10 Aug 2015 14:03:18 +0000 (09:03 -0500)] 
Merge "res_pjsip_pubsub: More accurately persist packet." into 13

9 years agores/res_format_attr_silk: Expose format attributes to other modules 54/1054/1
Matt Jordan [Sun, 9 Aug 2015 23:42:00 +0000 (18:42 -0500)] 
res/res_format_attr_silk: Expose format attributes to other modules

This patch adds the .get callback to the format attribute module, such
that the Asterisk core or other third party modules can query for the
negotiated format attributes.

Change-Id: Ia24f55cf9b661d651ce89b4f4b023d921380f19c

9 years agomain/format: Add an API call for retrieving format attributes 53/1053/1
Matt Jordan [Sun, 9 Aug 2015 22:56:48 +0000 (17:56 -0500)] 
main/format: Add an API call for retrieving format attributes

Some codecs that may be a third party library to Asterisk need to have
knowledge of the format attributes that were negotiated. Unfortunately,
when the great format migration of Asterisk 13 occurred, that ability
was lost.

This patch adds an API call, ast_format_attribute_get, to the core
format API, along with updates to the unit test to check the new API
call. A new callback is also now available for format attribute modules,
such that they can provide the format attribute values they manage.

Note that the API returns a void *. This is done as the format attribute
modules themselves may store format attributes in any particular manner
they like. Care should be taken by consumers of the API to check the
return value before casting and dereferencing. Consumers will obviously
need to have a priori knowledge of the type of the format attribute as
well.

Change-Id: Ieec76883dfb46ecd7aff3dc81a52c81f4dc1b9e3

9 years agoMerge "rtp_engine.c: Fix performance issue with several channel drivers that use...
Matt Jordan [Sat, 8 Aug 2015 13:07:18 +0000 (08:07 -0500)] 
Merge "rtp_engine.c: Fix performance issue with several channel drivers that use RTP." into 13

10 years agoReplace htobe64 with htonll 51/1051/1
David M. Lee [Sat, 8 Aug 2015 03:11:03 +0000 (22:11 -0500)] 
Replace htobe64 with htonll

We don't have a compatability function to fill in a missing htobe64; but
we already have one for the identical htonll.

Change-Id: Ic0a95db1c5b0041e14e6b127432fb533b97e4cac

10 years agoARI: Retrieve existing log channels 86/986/14
Scott Emidy [Fri, 7 Aug 2015 19:20:29 +0000 (14:20 -0500)] 
ARI: Retrieve existing log channels

An http request can be sent to get the existing Asterisk logs.

The command "curl -v -u user:pass -X GET 'http://localhost:8088
/ari/asterisk/logging'" can be run in the terminal to access the
newly implemented functionality.

* Retrieve all existing log channels

ASTERISK-25252

Change-Id: I7bb08b93e3b938c991f3f56cc5d188654768a808

10 years agoARI: Creating log channels 42/1042/5
Scott Emidy [Fri, 7 Aug 2015 16:14:06 +0000 (11:14 -0500)] 
ARI: Creating log channels

An http request can be sent to create a log channel
in Asterisk.

The command "curl -v -u user:pass -X POST
'http://localhost:088/ari/asterisk/logging/mylog?
configuration=notice,warning'" can be run in the terminal
to access the newly implemented functionality for ARI.

* Ability to create log channels using ARI

ASTERISK-25252

Change-Id: I9a20e5c75716dfbb6b62fd3474faf55be20bd782

10 years agoMerge "ARI: Deleting log channels" into 13
Joshua Colp [Fri, 7 Aug 2015 15:41:22 +0000 (10:41 -0500)] 
Merge "ARI: Deleting log channels" into 13

10 years agoMerge "res_pjsip: Ensure sanitized XML is NULL terminated." into 13
Joshua Colp [Fri, 7 Aug 2015 15:23:40 +0000 (10:23 -0500)] 
Merge "res_pjsip: Ensure sanitized XML is NULL terminated." into 13

10 years agoARI: Deleting log channels 48/1048/4
Scott Emidy [Thu, 6 Aug 2015 20:18:04 +0000 (15:18 -0500)] 
ARI: Deleting log channels

An http request can be sent to delete a log channel
in Asterisk.

The command "curl -v -u user:pass -X DELETE 'http://localhost:8088
/ari/asterisk/logging/mylog'" can be run in the terminal
to access the newly implemented functionally for ARI.

* Able to delete log channels using ARI

ASTERISK-25252

Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6

10 years agores_pjsip_pubsub: More accurately persist packet. 44/1044/2
Mark Michelson [Thu, 6 Aug 2015 17:48:07 +0000 (12:48 -0500)] 
res_pjsip_pubsub: More accurately persist packet.

The pjsip_rx_data structure has a pkt_info.packet field on it that is
the packet that was read from the transport. For datagram transports,
the packet read from the transport will correspond to the SIP message
that arrived. For streamed transports, however, it is possible to read
multiple SIP messages in one packet.

In a recent case, Asterisk crashed on a system where TCP was being used.
This is because at some point, a read from the TCP socket resulted in a
200 OK response as well as an incoming SUBSCRIBE request being stored in
rdata->pkt_info.packet. When the SUBSCRIBE was processed, the
combination 200 OK and SUBSCRIBE was saved in persistent storage. Later,
a restart of Asterisk resulted in the crash because the persistent
subscription recreation code ended up building the 200 OK response
instead of a SUBSCRIBE request, and we attempted to access
request-specific data.

The fix here is to use the pjsip_msg_print() function in order to
persist SUBSCRIBE requests. This way, rather than using the raw socket
data, we use the parsed SIP message that PJSIP has given us. If we
receive multiple SIP messages from a single read, we will be sure only
to save off the relevant SIP message. There also is a safeguard put in
place to make sure that if we do end up reconstructing a SIP response,
it will not cause a crash.

ASTERISK-25306 #close
Reported by Mark Michelson

Change-Id: I4bf16f7b76a2541d10b55de82bcd14c6e542afb2

10 years agoMerge "res_rtp_asterisk.c: Fix off-nominal crash potential." into 13
Joshua Colp [Thu, 6 Aug 2015 17:05:07 +0000 (12:05 -0500)] 
Merge "res_rtp_asterisk.c: Fix off-nominal crash potential." into 13

10 years agoMerge topic 'misc_rtp_tweaks' into 13
Joshua Colp [Thu, 6 Aug 2015 16:50:25 +0000 (11:50 -0500)] 
Merge topic 'misc_rtp_tweaks' into 13

* changes:
  rtp_engine.c: Must protect mime_types_len with mime_types_lock.
  res_pjsip_sdp_rtp.c: Fixup some whitespace.

10 years agores_pjsip: Ensure sanitized XML is NULL terminated. 38/1038/2
Joshua Colp [Tue, 4 Aug 2015 21:12:59 +0000 (18:12 -0300)] 
res_pjsip: Ensure sanitized XML is NULL terminated.

The ast_sip_sanitize_xml function is used to sanitize
a string for placement into XML. This is done by examining
an input string and then appending values to an output
buffer. The function used by its implementation, strncat,
has specific behavior that was not taken into account.
If the size of the input string exceeded the available
output buffer size it was possible for the sanitization
function to write past the output buffer itself causing
a crash. The crash would either occur because it was
writing into memory it shouldn't be or because the resulting
string was not NULL terminated.

This change keeps count of how much remaining space is
available in the output buffer for text and only allows
strncat to use that amount.

Since this was exposed by the res_pjsip_pidf_digium_body_supplement
module attempting to send a large message the maximum allowed
message size has also been increased in it.

A unit test has also been added which confirms that the
ast_sip_sanitize_xml function is providing NULL terminated
output even when the input length exceeds the output
buffer size.

ASTERISK-25304 #close

Change-Id: I743dd9809d3e13d722df1b0509dfe34621398302

10 years agoMerge "res_pjsip_sdp_rtp.c: Fix processing wrong SDP media list." into 13
Joshua Colp [Thu, 6 Aug 2015 09:52:31 +0000 (04:52 -0500)] 
Merge "res_pjsip_sdp_rtp.c: Fix processing wrong SDP media list." into 13

10 years agoMerge "res_rtp_asterisk: Don't leak temporary key when enabling PFS." into 13
Mark Michelson [Wed, 5 Aug 2015 17:45:09 +0000 (12:45 -0500)] 
Merge "res_rtp_asterisk: Don't leak temporary key when enabling PFS." into 13

10 years agores_rtp_asterisk: Don't leak temporary key when enabling PFS. 36/1036/2
Joshua Colp [Wed, 5 Aug 2015 10:23:21 +0000 (07:23 -0300)] 
res_rtp_asterisk: Don't leak temporary key when enabling PFS.

A change recently went in which enabled perfect forward secrecy for
DTLS in res_rtp_asterisk. This was accomplished two different ways
depending on the availability of a feature in OpenSSL. The fallback
method created a temporary instance of a key but did not free it.
This change fixes that.

ASTERISK-25265

Change-Id: Iadc031b67a91410bbefb17ffb4218d615d051396

10 years agores_http_websocket: Debug write lengths. 33/1033/1
Mark Michelson [Tue, 4 Aug 2015 14:47:34 +0000 (09:47 -0500)] 
res_http_websocket: Debug write lengths.

Commit 39cc28f6ea2140ad6d561fd4c9e9a66f065cecee attempted to fix a
test failure observed on 32 bit test agents by ensuring that a cast from
a 32 bit unsigned integer to a 64 bit unsigned integer was happening in
a predictable place. As it turns out, this did not cause test runs to
succeed.

This commit adds several redundant debug messages that print the payload
lengths of websocket frames. The idea here is that this commit will not
cause tests to succeed for the faulty test agent, but we might deduce
where the fault lies more easily this way by observing at what point the
expected value (537) changes to some ungangly huge number.

If you are wondering why something like this is being committed to the
branch, keep in mind that in commit
39cc28f6ea2140ad6d561fd4c9e9a66f065cecee I noted that the observed test
failures only happen when automated tests are run. Attempts to run the
tests by hand manually on the test agent result in the tests passing.

Change-Id: I14a65c19d8af40dadcdbd52348de3b0016e1ae8d

10 years agoMerge "res_http_websocket: Avoid passing strlen() to ast_websocket_write()." into 13
Matt Jordan [Mon, 3 Aug 2015 16:51:56 +0000 (11:51 -0500)] 
Merge "res_http_websocket: Avoid passing strlen() to ast_websocket_write()." into 13

10 years agores_http_websocket: Avoid passing strlen() to ast_websocket_write(). 31/1031/1
Mark Michelson [Mon, 3 Aug 2015 16:06:07 +0000 (11:06 -0500)] 
res_http_websocket: Avoid passing strlen() to ast_websocket_write().

We have seen a rash of test failures on a 32-bit build agent. Commit
48698a5e21d7307f61b5fb2bd39fd593bc1423ca solved an obvious problem where
we were not encoding a 64-bit value correctly over the wire. This
commit, however, did not solve the test failures.

In the failing tests, ARI is attempting to send a 537 byte text frame
over a websocket. When sending a frame this small, 16 bits are all that
is required in order to encode the payload length on the websocket
frame. However, ast_websocket_write() thinks that the payload length is
greater than 65535 and therefore writes out a 64 bit payload length.
Inspecting this payload length, the lower 32 bits are exactly what we
would expect it to be, 537 in hex. The upper 32 bits, are junk values
that are not expected to be there.

In the failure, we are passing the result of strlen() to a function that
expects a uint64_t parameter to be passed in. strlen() returns a size_t,
which on this 32-bit machine is 32 bits wide. Normally, passing a 32-bit
unsigned value to somewhere where a 64-bit unsigned value is expected
would cause no problems. In fact, in manual runs of failing tests, this
works just fine. However, ast_websocket_write() uses the Asterisk
optional API, which means that rather than a simple function call, there
are a series of macros that are used for its declaration and
implementation. These macros may be causing some sort of error to occur
when converting from a 32 bit quantity to a 64 bit quantity.

This commit changes the logic by making existing ast_websocket_write()
calls use ast_websocket_write_string() instead. Within
ast_websocket_write_string(), the 64-bit converted strlen is saved in a
local variable, and that variable is passed to ast_websocket_write()
instead.

Note that this commit message is full of speculation rather than
certainty. This is because the observed test failures, while always
present in automated test runs, never occur when tests are manually
attempted on the same test agent. The idea behind this commit is to fix
a theoretical issue by performing changes that should, at the least,
cause no harm. If it turns out that this change does not fix the failing
tests, then this commit should be reverted.

Change-Id: I4458dd87d785ca322b89c152b223a540a3d23e67

10 years agores/res_rtp_asterisk: Add ECDH support 30/1030/1
Mark Duncan [Tue, 28 Jul 2015 10:33:39 +0000 (19:33 +0900)] 
res/res_rtp_asterisk: Add ECDH support

This will add ECDH support to Asterisk. It will
detect auto ECDH support in OpenSSL
(1.0.2b and above) during ./configure. If this is
available, it will use it,
otherwise it will fall back to prime256v1 (this
behavior is consistent with
other projects such as Apache and nginx).

This fixes WebRTC being broken in Firefox 38+ due
to Firefox now only supporting
ciphers with perfect forward secrecy.

ASTERISK-25265 #close

Change-Id: I8c13b33a2a79c0bde2e69e4ba6afa5ab9351465b

10 years agoMerge topic 'misc_rtp_tweaks' into 13
Joshua Colp [Mon, 3 Aug 2015 13:43:50 +0000 (08:43 -0500)] 
Merge topic 'misc_rtp_tweaks' into 13

* changes:
  rtp_engine.h: No sense allowing payload types larger than RFC allows.
  rtp_engine.c: Minor tweaks.
  rtp_engine.h: Misc comment fixes.
  chan_sip.c: Tweak glue->update_peer() parameter nil value.

10 years agoMerge "ARI: Rotate log channels." into 13
Mark Michelson [Fri, 31 Jul 2015 16:57:39 +0000 (11:57 -0500)] 
Merge "ARI: Rotate log channels." into 13

10 years agoARI: Rotate log channels. 88/988/5
Benjamin Ford [Wed, 29 Jul 2015 19:17:09 +0000 (14:17 -0500)] 
ARI: Rotate log channels.

An http request can be sent to rotate a specified log channel.
If the channel does not exist, an error response will be
returned.

The command "curl -v -u user:pass -X PUT 'http://localhost:8088
/ari/asterisk/logging/logChannelName/rotate'" can be run in the
terminal to access this new functionality.

* Added the ability to rotate log files through ARI

ASTERISK-25252

Change-Id: Iaefa21cbbc1b29effb33004ee3d89c977e76ab01

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: 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 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 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 agores_pjsip_session.c: Fix crashes seen when call cancelled. 95/995/1
Richard Mudgett [Thu, 30 Jul 2015 22:05:57 +0000 (17:05 -0500)] 
res_pjsip_session.c: Fix crashes seen when call cancelled.

Two testsuite tests crashed in the same place as a result of an INVITE
being CANCELed.

tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified
tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp

The session pointer is no longer in the inv->mod_data[session_module.id]
location because the INVITE transaction has reached the terminated state.

ASTERISK-25297 #close
Reported by: Richard Mudgett

Change-Id: Idb75fdca0321f5447d5dac737a632a5f03614427

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