asterisk/asterisk.git
6 years agochan_gulp: Fix gulp_indicate() handling of AST_CONTROL_PVT_CAUSE_CODE.
Richard Mudgett [Tue, 16 Jul 2013 20:00:25 +0000 (20:00 +0000)]
chan_gulp: Fix gulp_indicate() handling of AST_CONTROL_PVT_CAUSE_CODE.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394489 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPrevent crash from trying to end a session in an invalid way.
Mark Michelson [Tue, 16 Jul 2013 19:13:04 +0000 (19:13 +0000)]
Prevent crash from trying to end a session in an invalid way.

This ensures that code that was only meant to be run on a reinvite failure
only runs on a reinvite failure.

(closes issue ASTERISK-22061)
reported by Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394473 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove some dead code dealing with old bridging method.
Richard Mudgett [Tue, 16 Jul 2013 18:49:26 +0000 (18:49 +0000)]
Remove some dead code dealing with old bridging method.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394471 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoSimplify bridge_simple chan join code.
Richard Mudgett [Tue, 16 Jul 2013 18:48:49 +0000 (18:48 +0000)]
Simplify bridge_simple chan join code.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394470 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRe-order cleanup
Matthew Jordan [Tue, 16 Jul 2013 18:22:07 +0000 (18:22 +0000)]
Re-order cleanup

This patch attempts to fix some possible race conditions in shutdown of the
CDR engine. It:
* Adds a cleanup handler to only unsubscribe and join on stasis messages during
  graceful shutdown. The cleanup handler should execute before the regular atexit
  handler, as we want to unsubscribe for any further messages before dispatching
  the CDRs.
* The CDRs are now locked when we dispatch them on shutdown.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394469 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFixed null dereference when WebSocket protocol is omitted
David M. Lee [Tue, 16 Jul 2013 15:30:09 +0000 (15:30 +0000)]
Fixed null dereference when WebSocket protocol is omitted

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394442 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoReplace chan_agent with app_agent_pool.
Richard Mudgett [Mon, 15 Jul 2013 23:20:55 +0000 (23:20 +0000)]
Replace chan_agent with app_agent_pool.

The ill conceived chan_agent is no more.  It is now replaced by
app_agent_pool.

Agents login using the AgentLogin() application as before.  The
AgentLogin() application no longer does any authentication.
Authentication is now the responsibility of the dialplan.  (Besides, the
authentication done by chan_agent did not match what the voice prompts
asked for.)

Sample extensions.conf
[login]
; Sample agent 1001 login
; Set COLP for in between calls so the agent does not see the last caller COLP.
exten => 1001,1,Set(CONNECTEDLINE(all)="Agent Waiting" <1001>)
; Give the agent DTMF transfer and disconnect features when connected to a caller.
same => n,Set(CHANNEL(dtmf-features)=TX)
same => n,AgentLogin(1001)
same => n,NoOp(AGENT_STATUS is ${AGENT_STATUS})
same => n,Hangup()

[caller]
; Sample caller direct connect to agent 1001
exten => 800,1,AgentRequest(1001)
same => n,NoOp(AGENT_STATUS is ${AGENT_STATUS})
same => n,Hangup()

; Sample caller going through a Queue to agent 1001
exten => 900,1,Queue(agent_q)
same => n,Hangup()

Sample queues.conf
[agent_q]
member => Local/800@caller,,SuperAgent,Agent:1001

Under the hood operation overview:
1) Logged in agents wait for callers in an agents holding bridge.
2) Caller requests an agent using AgentRequest()
3) A basic bridge is created, the agent is notified, and caller joins the
   basic bridge to wait for the agent.
4) The agent is either automatically connected to the caller or must ack
   the call to connect.
5) The agent is moved from the agents holding bridge to the basic bridge.
6) The agent and caller talk.
7) The connection is ended by either party.
8) The agent goes back to the agents holding bridge.

To avoid some locking issues with the agent holding bridge, I needed to
make some changes to the after bridge callback support.  The after bridge
callback is now a list of requested callbacks with the last to be added
the only active callback.  The after bridge callback for failed callbacks
will always happen in the channel thread when the channel leaves the
bridging system or is destroyed.

(closes issue ASTERISK-21554)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/2657/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394417 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove misleading documentation for channel snapshot creation.
Mark Michelson [Mon, 15 Jul 2013 22:05:57 +0000 (22:05 +0000)]
Remove misleading documentation for channel snapshot creation.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394402 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoDocument the ari.conf allowed_origins setting
David M. Lee [Mon, 15 Jul 2013 21:22:12 +0000 (21:22 +0000)]
Document the ari.conf allowed_origins setting

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394397 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove some callbacks and functions which are not needed.
Joshua Colp [Mon, 15 Jul 2013 13:43:37 +0000 (13:43 +0000)]
Remove some callbacks and functions which are not needed.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394370 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoProvide error message for QUEUE_MEMBER when member is not in queue
Matthew Jordan [Sun, 14 Jul 2013 02:41:43 +0000 (02:41 +0000)]
Provide error message for QUEUE_MEMBER when member is not in queue

When QUEUE_MEMBER is used and the member specified is not in the queue,
Asterisk provides an ERROR message that indicates that the option specified
is not valid. This patch now properly displays an ERROR message that the
member is not in the queue if an interface is specified.

(closes issue ASTERISK-21980)
Reported by: Avraam David
........

Merged revisions 394345 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394346 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove redundant code in dns.c
Matthew Jordan [Sun, 14 Jul 2013 02:05:04 +0000 (02:05 +0000)]
Remove redundant code in dns.c

Peter J Philipp pointed out that there are two checks that ensure that len is
not less than 0. If len is less than 0, the function returns. Having both of
them is clearly redundant.

This removes the second and attempts to clarify (slightly) the error condition.

(closes issue ASTERISK-21772)
Reported by: Peter J Philipp

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394305 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoClarify documentation for function PASSTHRU
Matthew Jordan [Sun, 14 Jul 2013 02:00:02 +0000 (02:00 +0000)]
Clarify documentation for function PASSTHRU

It is not apparent to the average user that the PASSTHRU function should not
be passed as ${PASSTHRU(string)} but just as PASSTHRU(string) to functions
which take a variable name and not its contents.

This patch clarifies the behavior in the documentation and provides an example.

(closes issue ASTERISK-21717)
Reported by: Richard Miller
patches:
  func_strings.diff uploaded by Richard Miller (license 5685)
........

Merged revisions 394302 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 394303 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394304 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix FRACK message from external redirects; handle outbound channels better
Matthew Jordan [Sat, 13 Jul 2013 23:28:23 +0000 (23:28 +0000)]
Fix FRACK message from external redirects; handle outbound channels better

This patch does the following:
 * It simplifies the Dial handling in CDRs. As a rule, the caller in a dial
   relationship is always the Party A. There was some logic present in the
   handling of the dial message that could, conceivably, pick the caller
   as Party A for the beginning of the dial and the peer as Party A for the
   end of the dial. This shouldn't have happened if the code in the bridging
   framework was doing its job; however, that was broken and it led to the
   FRACK. As it is, this code was overly ocmplex and not needed: the caller,
   if present, should always be Party A. Period.
 * It properly checks to see if a channel will continue on in the dialplan.
   ast_check_hangup - much like cake at the end - is a lie. It will tell
   you that you are hungup when you are not. Do not believe it.

   I would make this function tell the truth, but I'm nervous that we've been
   depending on it sitting on its throne of lies for far too long, and it would
   probably break lots of things. So I'm just checking the "internal" soft
   hangup flags, like everyone else.

(closes issue ASTERISK-22060)
Reported by: Mark Michelson

(issue ASTERISK-21831)
Reported by: Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394290 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPretty up a debug message if the referred-by-uri isn't available
Matthew Jordan [Sat, 13 Jul 2013 22:14:04 +0000 (22:14 +0000)]
Pretty up a debug message if the referred-by-uri isn't available

Instead of formatting a NULL pointer into a "%s" format string (which is
usually not a good thing to do), we instead print "Unknown".

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394278 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a longstanding issue with MFC-R2 configuration that prevented users
Moises Silva [Fri, 12 Jul 2013 22:35:50 +0000 (22:35 +0000)]
Fix a longstanding issue with MFC-R2 configuration that prevented users
from mixing different variants or general MFC-R2 settings within the same E1 line.

Most users do not have a problem with this since MFC-R2 lines are usually fractional E1s, or
the whole E1 has the same country variant and R2 settings.

In Venezuela however is common to have inbound MFC-R2 and outbound DTMF-R2 within the same E1.

This fix now properly parses the chan_dahdi.conf file to generate a new openr2 context every
time a new channel => section is found and the configuration was changed.

(closes issue ASTERISK-21117)
Reported by: Rafael Angulo
Related Elastix issue: http://bugs.elastix.org/view.php?id=1612
........

Merged revisions 394106 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 394173 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394263 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd support to the bridging core for performing COLP updates when channels join a...
Joshua Colp [Fri, 12 Jul 2013 21:42:53 +0000 (21:42 +0000)]
Add support to the bridging core for performing COLP updates when channels join a 2 party bridge.

(closes issue ASTERISK-21829)

Review: https://reviewboard.asterisk.org/r/2636/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394249 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPrevent potential race condition in multiparty basic bridges.
Mark Michelson [Fri, 12 Jul 2013 21:01:51 +0000 (21:01 +0000)]
Prevent potential race condition in multiparty basic bridges.

For more details about the race condition see the linked review
at the bottom of this commit

(closes issue ASTERISK-21882)
Reported by Matt Jordan

Review: https://reviewboard.asterisk.org/r/2663

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394232 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a compiler warning.
Jason Parker [Fri, 12 Jul 2013 19:35:08 +0000 (19:35 +0000)]
Fix a compiler warning.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394216 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFixed intermittent crash when loading test_json.so
David M. Lee [Fri, 12 Jul 2013 18:23:39 +0000 (18:23 +0000)]
Fixed intermittent crash when loading test_json.so

The JSON test attempted an overly clever use of RAII_VAR to run code
at the beginning and end of each test, in order to validate that no
JSON objects were leaked during the test.

The problem is that the validation code would run during the initial
load, when the tests were initialized. This happens during startup,
when other parts of the system might actively be allocating and
freeing JSON objects.

This patch changes the RAII_VAR to use the new
ast_test_register_{init,cleanup} functions to run the validations
properly.

(closes issue ASTERISK-21978)
Review: https://reviewboard.asterisk.org/r/2669/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394203 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoARI: Add support for Cross-Origin Resource Sharing (CORS), origin headers
Jason Parker [Fri, 12 Jul 2013 17:52:52 +0000 (17:52 +0000)]
ARI: Add support for Cross-Origin Resource Sharing (CORS), origin headers

This rejects requests from any unknown origins.

(closes issue ASTERISK-21278)

Review: https://reviewboard.asterisk.org/r/2667/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394189 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix bridge tech write callback parameter name.
Richard Mudgett [Thu, 11 Jul 2013 21:01:09 +0000 (21:01 +0000)]
Fix bridge tech write callback parameter name.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394158 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFixed chan_skinny for systems were pthread_t isn't an int.
David M. Lee [Thu, 11 Jul 2013 20:59:10 +0000 (20:59 +0000)]
Fixed chan_skinny for systems were pthread_t isn't an int.

I'm looking at you, OS X.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394156 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor and cleanup of skinny session handling.
Damien Wedhorn [Thu, 11 Jul 2013 20:17:53 +0000 (20:17 +0000)]
Refactor and cleanup of skinny session handling.

Major changes are to pull all packet reading functions into skinny_session
and move timeout handling to scheduling arrangements. Thread cancelling is
now undertaken directly rather than waiting for the read to timeout
(cleanup is popped on thread cancel). Also added some keepalive timings in
debugging messages.

Keepalive timeout has been increased from 1.1 by keepalive to 3 times
keepalive. This seems to align (after keepalives stabilise) with when
devices reset after not receiving keepalives. Probably needs more work,
especially around the first and/or second keepalives that vary
significantly by device and firmware version.

Review: https://reviewboard.asterisk.org/r/2611/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394147 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoTweak the subscription failure warning message to include endpoint name and context.
Joshua Colp [Thu, 11 Jul 2013 16:23:41 +0000 (16:23 +0000)]
Tweak the subscription failure warning message to include endpoint name and context.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394103 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoCorrect test_cel cleanup.
David M. Lee [Thu, 11 Jul 2013 15:37:51 +0000 (15:37 +0000)]
Correct test_cel cleanup.

When I corrected the CEL test crash in r394037, I didn't quite pay attention
to how the globals and locals were being shuffled around in the cleanup
callback. I removed the nulling of the global variables, which caused them
to be double cleaned.

This patch puts the global nulling code back (since the vars are cleaned up
by RAII_VARs), and removes the explicit ao2_cleanup() (since they were no-ops,
because the variables had just been nulled).

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394089 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoChange ARI user config to use a type field
David M. Lee [Thu, 11 Jul 2013 14:39:55 +0000 (14:39 +0000)]
Change ARI user config to use a type field

When I initially wrote the configuration support for ARI users, I
determined the section type by a category prefix (i.e., [user-admin]).

This is neither idiomatic Asterisk configuration, nor is it really
that user friendly. This patch replaces the category prefix with a
type field in the section, which is much cleaner.

Review: https://reviewboard.asterisk.org/r/2664/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394076 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoApply defaults to ari.conf's general section
David M. Lee [Thu, 11 Jul 2013 13:56:26 +0000 (13:56 +0000)]
Apply defaults to ari.conf's general section

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394065 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agotest_voicemail_api: fix warning found by gcc-4.8
David M. Lee [Thu, 11 Jul 2013 04:34:49 +0000 (04:34 +0000)]
test_voicemail_api: fix warning found by gcc-4.8

The voicemail_api test had code like strncmp(a, b, sizeof(a)), but a was a
char pointer, instead of a literal or char array. This meant that sizeof was
the size of the pointer, not the length of the string.

Since the string is in a stringfield and should be null terminated, I just
changed it to a plain strcmp.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394050 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFixed some CEL test crashes
David M. Lee [Thu, 11 Jul 2013 02:02:48 +0000 (02:02 +0000)]
Fixed some CEL test crashes

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394037 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPSJIP - sip.conf to res_sip.conf script
Kevin Harwell [Wed, 10 Jul 2013 22:26:13 +0000 (22:26 +0000)]
PSJIP - sip.conf to res_sip.conf script

** This script is in no way finished.

Started the initial "cut" at converting a sip.conf file to a res_sip.conf file.
Hopefully the bulk of the framework is in place and only a few minor adjustments
need to be made when an option mapping is added that "doesn't fit".  This script
and supporting files should be executable against python version 2.5.

An OrderedDict class (backported from a newer version of python) is included.
A MultiOrderedDict class is implemented so options, when added, should be able
to be added in order and allowed to have multiple values.

Currently the scripts supports the majority of endpoint options found in
res_sip.conf.  Support has also been added for Aor(s) and the ACL/security
sections.  Inside the sip_to_res_sip.py file one can see a list of options
that still need to be mapped.

Also items that still need to be done: templates, includes, parsing '=>'
delimiter.  Note that some code is hopefully in place already to support
templates (e.g. lookup/retrieving defaults from them).  However, the
parsing of and adding of the section needs to be done.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394024 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoHandle outbound registration failures that do not occur as a result of a real response.
Joshua Colp [Wed, 10 Jul 2013 20:02:59 +0000 (20:02 +0000)]
Handle outbound registration failures that do not occur as a result of a real response.

(closes issue ASTERISK-22064)
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394004 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoDocument the 400 error response for originate
David M. Lee [Wed, 10 Jul 2013 17:13:21 +0000 (17:13 +0000)]
Document the 400 error response for originate

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393987 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoCorrected api-docs for channel variables
David M. Lee [Wed, 10 Jul 2013 13:50:48 +0000 (13:50 +0000)]
Corrected api-docs for channel variables

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393968 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoastobj2-ify the SLA code
Russell Bryant [Wed, 10 Jul 2013 01:56:15 +0000 (01:56 +0000)]
astobj2-ify the SLA code

The SLA code within app_meetme was written before asotbj2 had been
merged into Asterisk.  Worse, support for reloads did not exist at first
and was added later as a bolt-on feature.  I knew at the time that
reloading was not safe at all while SLA was in use, so the reload would
be queued up to execute when the system was idle.  Unfortunately, this
approach was still prone to errors beyond the fact that this was the
only place in Asterisk where configuration was not reloaded
instantly when requested.

This patch converts various SLA objects to be reference counted objects
using astobj2.  This allows reloads to be processed while the system is
in use.  The code ensures that the objects will not disappear while one
of the other threads is using them.  However, they will be immediately
removed from the global trunk and station containers so no new calls
will use them if removed from configuration.

Review: https://reviewboard.asterisk.org/r/2581/
........

Merged revisions 393928 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 393929 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393930 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake SCOPED_LOCK use RAII_VAR.
Jason Parker [Tue, 9 Jul 2013 21:40:38 +0000 (21:40 +0000)]
Make SCOPED_LOCK use RAII_VAR.

This fixes an issue with requiring SCOPED_LOCK to be the last variable
declaration and removes duplicate code in the process.

Review: https://reviewboard.asterisk.org/r/2665/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393919 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix printf NULL string (null) substituion for NULL config framework default.
Richard Mudgett [Tue, 9 Jul 2013 21:06:21 +0000 (21:06 +0000)]
Fix printf NULL string (null) substituion for NULL config framework default.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393910 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoUse correct function for getting bridged peer when doing direct media checks.
Mark Michelson [Tue, 9 Jul 2013 20:07:21 +0000 (20:07 +0000)]
Use correct function for getting bridged peer when doing direct media checks.

(closes issue ASTERISK-21947)
reported by Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393897 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix some stasis doxygen comments.
Richard Mudgett [Tue, 9 Jul 2013 19:38:00 +0000 (19:38 +0000)]
Fix some stasis doxygen comments.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393896 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoEnsure all pjsip_regc_* access occurs within a pjlib thread.
Joshua Colp [Tue, 9 Jul 2013 11:05:48 +0000 (11:05 +0000)]
Ensure all pjsip_regc_* access occurs within a pjlib thread.

(closes issue ASTERISK-22054)
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393870 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoTweak log message slightly.
Joshua Colp [Mon, 8 Jul 2013 21:27:18 +0000 (21:27 +0000)]
Tweak log message slightly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393858 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoTreat the authentication object as invalid if digest configuration is chosen and...
Joshua Colp [Mon, 8 Jul 2013 21:26:37 +0000 (21:26 +0000)]
Treat the authentication object as invalid if digest configuration is chosen and the digest is not of the correct length.

(closes issue ASTERISK-22003)
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393857 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoOh menuconfig, why do you hate margins?
David M. Lee [Mon, 8 Jul 2013 20:31:41 +0000 (20:31 +0000)]
Oh menuconfig, why do you hate margins?

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393843 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoBetter structure for the WebSocket validation failure message
David M. Lee [Mon, 8 Jul 2013 20:07:58 +0000 (20:07 +0000)]
Better structure for the WebSocket validation failure message

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393834 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoEnsure that a valid bind host is specified for transports.
Joshua Colp [Mon, 8 Jul 2013 19:53:13 +0000 (19:53 +0000)]
Ensure that a valid bind host is specified for transports.

(closes issue ASTERISK-22017)
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393833 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor operations to access the stasis cache instead of objects directly when retri...
Joshua Colp [Mon, 8 Jul 2013 19:19:55 +0000 (19:19 +0000)]
Refactor operations to access the stasis cache instead of objects directly when retrieving information.

(closes issue ASTERISK-21883)

Review: https://reviewboard.asterisk.org/r/2645/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393831 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agores_stasis_http doesn't depend on res_stasis any more
David M. Lee [Mon, 8 Jul 2013 16:04:01 +0000 (16:04 +0000)]
res_stasis_http doesn't depend on res_stasis any more

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393816 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agores_parking: Apply ringing role option on swap with a channel that rings
Jonathan Rose [Mon, 8 Jul 2013 15:59:47 +0000 (15:59 +0000)]
res_parking: Apply ringing role option on swap with a channel that rings

(closes issue ASTERISK-21877)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2656/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393815 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix building.
Joshua Colp [Mon, 8 Jul 2013 15:11:07 +0000 (15:11 +0000)]
Fix building.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393807 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoARI: Add support for getting/setting channel and global variables.
Jason Parker [Mon, 8 Jul 2013 14:46:20 +0000 (14:46 +0000)]
ARI: Add support for getting/setting channel and global variables.

This allows for reading and writing of functions on channels.

(closes issue ASTERISK-21868)

Review: https://reviewboard.asterisk.org/r/2641/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393806 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMove channel driver Registry manager events to core.
Jason Parker [Mon, 8 Jul 2013 14:42:57 +0000 (14:42 +0000)]
Move channel driver Registry manager events to core.

This also shuffles the stasis system topic and related handling.

(closes issue ASTERISK-21488)

Review: https://reviewboard.asterisk.org/r/2631/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393804 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoCreate Local channel messages on the Stasis message bus and produce AMI events
Matthew Jordan [Mon, 8 Jul 2013 14:26:40 +0000 (14:26 +0000)]
Create Local channel messages on the Stasis message bus and produce AMI events

This patch does the following:

* It adds a virtual table of callbacks to core_unreal. These callbacks can be
  supplied by concrete implementations of "unreal" channel drivers, which lets
  the unreal channel driver call specific functionality when it performs some
  action. Currently, this is done to notify implementations when an
  optimization operation has begun, and when an optimization operation has
  succeeded.

* It adds Stasis-Core messages for Local channel bridging and Local channel
  optimization. Local channel optimization is now two events: a Begin and an
  End. Some consumers of Stasis-Core may want to know when an operation is
  beginning so that they can 'prepare' their information; others will be more
  concerned about when the operation has completed, so that they can 'fix up'
  information. Stasis-Core allows for both, as does AMI.

Review: https://reviewboard.asterisk.org/r/2552

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393801 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix some broken logic in sending outbound caller ID.
Mark Michelson [Mon, 8 Jul 2013 13:57:28 +0000 (13:57 +0000)]
Fix some broken logic in sending outbound caller ID.

* trust_id_outbound was required even when the caller ID was not marked
private. This is against intentions and documentation.
* We now check both name and number privacy instead of checking name privacy
twice.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393793 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoIn a channel destructor dispose of items that raise Stasis message properly
Matthew Jordan [Sun, 7 Jul 2013 21:29:40 +0000 (21:29 +0000)]
In a channel destructor dispose of items that raise Stasis message properly

This patch reorders certain actions that may raise Stasis messages in the
channel destructor such that they occur before the Stasis cache is cleared.
Once the Stasis cache is cleared, its rather a bad idea to be trying to
publish information about a channel.

(closes issue ASTERISK-22001)
Reported by: Jonathan Rose

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393785 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoHandle hangup logic in the Stasis message bus and consumers of Stasis messages
Matthew Jordan [Sun, 7 Jul 2013 20:34:38 +0000 (20:34 +0000)]
Handle hangup logic in the Stasis message bus and consumers of Stasis messages

This patch does the following:
* It adds a new soft hangup flag AST_SOFTHANGUP_HANGUP_EXEC that is set when a
  channel is executing dialplan hangup logic, i.e., the 'h' extension or a
  hangup handler. Stasis messages now also convey the soft hangup flag so
  consumers of the messages can know when a channel is executing said
  hangup logic.
* It adds a new channel flag, AST_FLAG_DEAD, which is set when a channel is
  well and truly dead. Not just a zombie, but dead, Jim. Manager, CEL, CDRs,
  and other consumers of Stasis have been updated to look for this flag to
  know when the channel should by lying six feet under.
* The CDR engine has been updated to better handle a channel entering and
  leaving a bridge. Previously, a new CDR was automatically created when a
  channel left a bridge and put into the 'Pending' state; however, this
  way of handling CDRs made it difficult for the 'endbeforehexten' logic to
  work correctly - there was always a new CDR waiting in the hangup logic
  and, even if 'ended', wouldn't be the CDR people wanted to inspect in the
  hangup routine. This patch completely removes the Pending state and instead
  defers creation of the new CDR until it gets a new message that requires
  a new CDR.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393777 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoARI: return a 503 if Asterisk isn't fully booted
David M. Lee [Fri, 5 Jul 2013 22:08:27 +0000 (22:08 +0000)]
ARI: return a 503 if Asterisk isn't fully booted

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393768 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPrint error details when set nonblock fails
David M. Lee [Fri, 5 Jul 2013 19:56:50 +0000 (19:56 +0000)]
Print error details when set nonblock fails

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393757 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoDocument MissingParams error message for /ari/events
David M. Lee [Fri, 5 Jul 2013 19:15:27 +0000 (19:15 +0000)]
Document MissingParams error message for /ari/events

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393749 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor RTCP events over to Stasis; associate with channels
Matthew Jordan [Fri, 5 Jul 2013 17:33:33 +0000 (17:33 +0000)]
Refactor RTCP events over to Stasis; associate with channels

This patch does the following:

* It merges Jaco Kroon's patch from ASTERISK-20754, which provides channel
  information in the RTCP events. Because Stasis provides a cache, Jaco's
  patch was modified to pass the channel uniqueid to the RTP layer as
  opposed to a pointer to the channel. This has the following benefits:
  (1) It keeps the RTP engine 'clean' of references back to channels
  (2) It prevents circular dependencies and other potential ref counting issues
* The RTP engine now allows any RTP implementation to raise RTCP messages.
  Potentially, other implementations (such as res_rtp_multicast) could also
  raise RTCP information. The engine provides structs to represent RTCP headers
  and RTCP SR/RR reports.
* Some general refactoring in res_rtp_asterisk was done to try and tame the
  RTCP code. It isn't perfect - that's *way* beyond the scope of this work -
  but it does feel marginally better.
* A few random bugs were fixed in the RTCP statistics. (Example: performing an
  assignment of a = a is probably not correct)
* We now raise RTCP events for each SR/RR sent/received. Previously we wouldn't
  raise an event when we sent a RR report.

Note that this work will be of use to others who want to monitor call quality
or build modules that report call quality statistics. Since the events are now
moving across the Stasis message bus, this is far easier to accomplish. It is
also a first step (though by no means the last step) towards getting Olle's
pinefrog work incorporated.

Again: note that the patch by Jaco Kroon was modified slightly for this work;
however, he did all of the hard work in finding the right places to set the
channel in the RTP engine across the channel drivers. Much thanks goes to Jaco
for his hard work here.

Review: https://reviewboard.asterisk.org/r/2603/

(closes issue ASTERISK-20574)
Reported by: Jaco Kroon
patches:
  asterisk-rtcp-channel.patch uploaded by jkroon (License 5671)

(closes issue ASTERISK-21471)
Reported by: Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393740 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoOneTouchRecord: Add function defined earlier: ast_bridge_features_do()
Richard Mudgett [Fri, 5 Jul 2013 14:54:27 +0000 (14:54 +0000)]
OneTouchRecord: Add function defined earlier: ast_bridge_features_do()

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393729 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove parkinglot from the channel snapshot
Matthew Jordan [Fri, 5 Jul 2013 03:08:58 +0000 (03:08 +0000)]
Remove parkinglot from the channel snapshot

Legacy channel drivers often include the ability to set a default parking lot
on an endpoint basis; when channels are created for that endpoint, they inherit
the parkinglot option. Parking used to use this option more frequently; while
it is still supported, other options (such as using channel variables or
creation of a custom parkinglot) are supported. More importantly, conveying the
parkinglot information through a channel snapshot isn't terribly useful - it
is rarely (if ever) changed on a channel and some consumers of channel
snapshots, such as ARI, will never use the information.

(closes issue ASTERISK-21968)
Reported by: Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393716 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agores_parking: Replace Parker snapshots with ParkerDialString
Jonathan Rose [Thu, 4 Jul 2013 18:46:56 +0000 (18:46 +0000)]
res_parking: Replace Parker snapshots with ParkerDialString

This process also involved a large amount of rework regarding how to redial
the Parker when a channel leaves a parking lot due to timeout. An attended
transfer channel variable has been added to attended transfers to extensions
that will eventually park (but haven't at the time of transfer) as well.
This resolves one of the two BUGBUG comments remaining in res_parking.

(issues ASTERISK-21877)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2638/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393704 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix int width problem for 32-bit... again
David M. Lee [Thu, 4 Jul 2013 13:37:57 +0000 (13:37 +0000)]
Fix int width problem for 32-bit... again

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393687 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix int width problem for 32-bit
David M. Lee [Thu, 4 Jul 2013 13:18:45 +0000 (13:18 +0000)]
Fix int width problem for 32-bit

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393679 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix utils directory breakage.
David M. Lee [Thu, 4 Jul 2013 13:06:15 +0000 (13:06 +0000)]
Fix utils directory breakage.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393675 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd BUGBUG note for ASTERISK-22009
Richard Mudgett [Wed, 3 Jul 2013 23:59:17 +0000 (23:59 +0000)]
Add BUGBUG note for ASTERISK-22009

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393633 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRevert accidental overcommit.
Richard Mudgett [Wed, 3 Jul 2013 23:57:37 +0000 (23:57 +0000)]
Revert accidental overcommit.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393632 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd BUGBUG note for ASTERISK-22009
Richard Mudgett [Wed, 3 Jul 2013 23:55:53 +0000 (23:55 +0000)]
Add BUGBUG note for ASTERISK-22009

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393631 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agochan_dahdi: Fix segfault reloading chan_dahdi when round robin is used.
Richard Mudgett [Wed, 3 Jul 2013 23:34:19 +0000 (23:34 +0000)]
chan_dahdi: Fix segfault reloading chan_dahdi when round robin is used.

* Clear round_robin[] in dahdi_restart().

(closes issue ASTERISK-21847)
Reported by: Ivo Andonov
Patches:
      jira_asterisk_21847_v1.8.patch (license #5621) patch uploaded by rmudgett
........

Merged revisions 393627 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 393628 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393629 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoOneTouchRecord: Make so Monitor/MixMonitor can be toggled/started/stopped.
Richard Mudgett [Wed, 3 Jul 2013 22:36:38 +0000 (22:36 +0000)]
OneTouchRecord: Make so Monitor/MixMonitor can be toggled/started/stopped.

The OneTouchRecord feature has historically been a toggle.  This patch
adds the ability to make the OneTouchRecord hook optionally start/stop
recording only.  If OneTouchRecord is already doing what is requested then
only the invoker hears the courtesy tone and/or start/stop recording
message.

The new feature is written so we could easily add explicit start/stop
recording DTMF hooks for Monitor and MixMonitor.

The majority of the changes in bridge_builtin_features.c is a refactoring
of the OneTouchRecord code (Monitor and MixMonitor versions) so it is easy
to direct the toggle/start/stop functionality.

Review: https://reviewboard.asterisk.org/r/2655/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393612 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMove when bridge channel enter is published so it does not interrupt the thought...
Richard Mudgett [Wed, 3 Jul 2013 22:07:25 +0000 (22:07 +0000)]
Move when bridge channel enter is published so it does not interrupt the thought of some lines of code.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393601 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix some indentation in stasis_config.c.
Richard Mudgett [Wed, 3 Jul 2013 22:05:54 +0000 (22:05 +0000)]
Fix some indentation in stasis_config.c.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393600 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix some bugs in CDRs; add some CLI commands to help debugging
Matthew Jordan [Wed, 3 Jul 2013 22:04:08 +0000 (22:04 +0000)]
Fix some bugs in CDRs; add some CLI commands to help debugging

This patch fixes a few minor bugs and one major one: the CDR by bridge
container was less than helpful. The mechanism previously used to try
and find all of the CDRs in a particular bridge ended up missing CDRs,
resulting in incorrect records.

When looking up CDRs in a bridge, we now just bite the bullet and do
a selection across all existing CDRs.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393599 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoLet Stasis load itself with default values
Matthew Jordan [Wed, 3 Jul 2013 21:14:03 +0000 (21:14 +0000)]
Let Stasis load itself with default values

While a Stasis configuration file is nice, it shouldn't be mandatory.
We can carry on with default values.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393589 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPublish a bridge enter before pulling on a push-and-swap operation.
Mark Michelson [Wed, 3 Jul 2013 20:41:00 +0000 (20:41 +0000)]
Publish a bridge enter before pulling on a push-and-swap operation.

Prior to this patch, the order of procedures on a bridge push was

* Add new bridge channel to bridge's array.
* Pull the swap channel out of the bridge
* Publish a bridge enter event.

The problem is that when the swap channel was pulled from the bridge,
a bridge leave event would be published. The bridge snapshot
published during the bridge leave showed the new channel that had
been added to the bridge, but there had been no bridge enter event
for that channel.

The fix provided here was to change the order a bit

* Add new bridge channel to bridge's array.
* Publish bridge enter event.
* Pull the swap channel out of the bridge.

This makes it so that the bridge snapshots during the stasis
events are accurate.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393586 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix load errors related to the new ari_model_validators.
David M. Lee [Wed, 3 Jul 2013 19:46:50 +0000 (19:46 +0000)]
Fix load errors related to the new ari_model_validators.

The Asterisk strategy of loading modules with RTLD_LAZY to extract metadata
from the module works well enough, until you try to take the address of a
function.

If a module takes the address of a function, that function needs to be
resolved at load time. That kinda defeats RTLD_LAZY.

This patch adds some ari_validator_{id}_fn() wrapper functions for safely
getting the function pointer from a different module.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393576 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoViolating the margins to make menuconfig happy
David M. Lee [Wed, 3 Jul 2013 18:24:45 +0000 (18:24 +0000)]
Violating the margins to make menuconfig happy

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393561 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoARI - channel recording support
David M. Lee [Wed, 3 Jul 2013 17:58:45 +0000 (17:58 +0000)]
ARI - channel recording support

This patch is the first step in adding recording support to the
Asterisk REST Interface.

Recordings are stored in /var/spool/recording. Since recordings may be
destructive (overwriting existing files), the API rejects attempts to
escape the recording directory (avoiding issues if someone attempts to
record to ../../lib/sounds/greeting, for example).

(closes issue ASTERISK-21594)
(closes issue ASTERISK-21581)
Review: https://reviewboard.asterisk.org/r/2612/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393550 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoConfiguration for Stasis threadpool
David M. Lee [Wed, 3 Jul 2013 17:20:43 +0000 (17:20 +0000)]
Configuration for Stasis threadpool

The appropriate settings for the Stasis threadpool is very system
specific, depending upon both workload and system configuration.

This patch adds a stasis.conf file which can be used to configure the
key attributes of the threadpool for the Stasis message bus.

(closes issue ASTERISK-21280)
Review: https://reviewboard.asterisk.org/r/2651/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393542 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoARI authentication.
David M. Lee [Wed, 3 Jul 2013 16:33:13 +0000 (16:33 +0000)]
ARI authentication.

This patch adds authentication support to ARI.

Two authentication methods are supported. The first is HTTP Basic
authentication, as specified in RFC 2617[1]. The second is by simply
passing the username and password as an ?api_key query parameter
(which allows swagger-ui[2] to authenticate more easily).

ARI usernames and passwords are configured in the ari.conf file
(formerly known as stasis_http.conf). The user may be set to
`read_only`, which will prohibit the user from issuing POST, DELETE,
etc. Also, the user's password may be specified in either plaintext,
or encrypted using the crypt() function.

Several other notes about the patch.

 * A few command line commands for seeing ARI config and status were
   also added.
 * The configuration parsing grew big enough that I extracted it to
   its own file.

 [1]: http://www.ietf.org/rfc/rfc2617.txt [2]:
 https://github.com/wordnik/swagger-ui

(closes issue ASTERISK-21277)
Review: https://reviewboard.asterisk.org/r/2649/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393530 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoUpdate events to use Swagger 1.3 subtyping, and related aftermath
David M. Lee [Wed, 3 Jul 2013 16:32:41 +0000 (16:32 +0000)]
Update events to use Swagger 1.3 subtyping, and related aftermath

This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:

    { "stasis_start": { "args": [], "channel": { ... } } }

The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.

This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.

 [1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ

In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.

The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.

Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.

The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.

 * The model for a channel snapshot was trimmed down to match the
   information sent via AMI. Many of the field being sent were not
   useful in the general case.
 * The model for a bridge snapshot was updated to be more consistent
   with the other ARI models.

Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.

Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.

(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoShuffle RESTful URL's around.
David M. Lee [Wed, 3 Jul 2013 16:32:00 +0000 (16:32 +0000)]
Shuffle RESTful URL's around.

This patch moves the RESTful URL's around to more appropriate
locations for release.

The /stasis URL's are moved to /ari, since Asterisk REST Interface was
a more appropriate name than Stasis-HTTP. (Most of the code still has
stasis_http references, but they will be cleaned up after there are no
more outstanding branches that would have merge conflicts with such a
change).

A larger change was moving the ARI events WebSocket off of the shared
/ws URL to its permanent home on /ari/events. The Swagger code
generator was extended to handle "upgrade: websocket" and
"websocketProtocol:" attributes on an operation.

The WebSocket module was modified to better handle WebSocket servers
that have a single registered protocol handler. If a client
connections does not specify the Sec-WebSocket-Protocol header, and
the server has a single protocol handler registered, the WebSocket
server will go ahead and accept the client for that subprotocol.

(closes issue ASTERISK-21857)
Review: https://reviewboard.asterisk.org/r/2621/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393528 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd a SystemName field to all AMI events.
Jason Parker [Tue, 2 Jul 2013 22:01:23 +0000 (22:01 +0000)]
Add a SystemName field to all AMI events.

This only gets sent out if configured in asterisk.conf

(closes issue ASTERISK-21494)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393508 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Minor code cleanup.
Richard Mudgett [Tue, 2 Jul 2013 21:19:21 +0000 (21:19 +0000)]
MixMonitor: Minor code cleanup.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393500 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Make start_mixmonitor_callback() options parameter NULL tolerant.
Richard Mudgett [Tue, 2 Jul 2013 21:16:25 +0000 (21:16 +0000)]
MixMonitor: Make start_mixmonitor_callback() options parameter NULL tolerant.

* Removed some unnecessary code in start_mixmonitor_callback().

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393496 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Don't use ast_strdupa() in a loop.
Richard Mudgett [Tue, 2 Jul 2013 21:13:56 +0000 (21:13 +0000)]
MixMonitor: Don't use ast_strdupa() in a loop.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393494 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Update XML documentation and CLI "mixmonitor {start|stop|list}" help.
Richard Mudgett [Tue, 2 Jul 2013 21:12:26 +0000 (21:12 +0000)]
MixMonitor: Update XML documentation and CLI "mixmonitor {start|stop|list}" help.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393493 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Fix refleak in manager_stop_mixmonitor() if could not stop monitoring.
Richard Mudgett [Tue, 2 Jul 2013 21:01:23 +0000 (21:01 +0000)]
MixMonitor: Fix refleak in manager_stop_mixmonitor() if could not stop monitoring.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393490 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMixMonitor: Remove some unnecessary channel locking.
Richard Mudgett [Tue, 2 Jul 2013 20:56:13 +0000 (20:56 +0000)]
MixMonitor: Remove some unnecessary channel locking.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393489 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix MixMonitor b option.
Richard Mudgett [Tue, 2 Jul 2013 20:45:47 +0000 (20:45 +0000)]
Fix MixMonitor b option.

The option had not been converted to use the replacement for
ast_bridged_channel().  One touch mixmonitor now records files again.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393487 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix chan_gtalk.c compile error.
Richard Mudgett [Tue, 2 Jul 2013 20:43:10 +0000 (20:43 +0000)]
Fix chan_gtalk.c compile error.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393485 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd pjproject dependency to res_sip_notify
David M. Lee [Tue, 2 Jul 2013 20:34:42 +0000 (20:34 +0000)]
Add pjproject dependency to res_sip_notify

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393484 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove unused blind transfer publication structure.
Mark Michelson [Tue, 2 Jul 2013 18:28:16 +0000 (18:28 +0000)]
Remove unused blind transfer publication structure.

I ended up using a bridge blob, so this structure was
unused. Keeping it in the header would just cause confusion.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393463 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoStasis - Refactor AOC Events
Kevin Harwell [Tue, 2 Jul 2013 17:20:20 +0000 (17:20 +0000)]
Stasis - Refactor AOC Events

Refactored the AMI events in AOC onto Stasis-Core.  The ast_aoc_manager_event
function now publishes a channel snapshot, along with a JSON blob describing
the advice of charge.  A "to_ami" handler has also been added that converts
the channel snapshot and AOC event data back into the appropriate data structure
for use with AMI.

(closes issue ASTERISK-21472)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2643/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393449 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoNew SIP Channel driver: Always Auth Reject
Kevin Harwell [Tue, 2 Jul 2013 17:06:06 +0000 (17:06 +0000)]
New SIP Channel driver: Always Auth Reject

If no matching endpoint is found for the incoming request Asterisk will respond
with a 401 Unauthorized (rejecting the request), but will first challenge if
no authorization creditials are given.

Changes also included moving ACL options into a new global 'security'
configuration section in res_sip.conf.

(closes issue ASTERISK-21433)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2554/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393442 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix transfer AMI event parameter naming
Kinsey Moore [Tue, 2 Jul 2013 16:11:32 +0000 (16:11 +0000)]
Fix transfer AMI event parameter naming

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393429 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd CEL unit tests and do some cleanup
Kinsey Moore [Tue, 2 Jul 2013 14:01:53 +0000 (14:01 +0000)]
Add CEL unit tests and do some cleanup

This adds several unit tests for CEL functionality and provides the
requisite framework for creating additional unit tests.

This also cleans up some reference leaks that were occurring in
Stasis-Core message callback code.

Review: https://reviewboard.asterisk.org/r/2646/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393410 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix issue with inability to cancell call transfer made by on-sceen menus.
Igor Goncharovskiy [Tue, 2 Jul 2013 10:16:27 +0000 (10:16 +0000)]
Fix issue with inability to cancell call transfer made by on-sceen menus.

Reported by: Igor Olhovskiy
........

Merged revisions 393395 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393396 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoast_tls_cert: don't recreate generated files
Tzafrir Cohen [Tue, 2 Jul 2013 08:23:16 +0000 (08:23 +0000)]
ast_tls_cert: don't recreate generated files

Don't regenrate cat.cfg, ca.crt and ca.key if they were already created
on a previous run.

(closes issue ASTERISK-21932)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393383 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoNew SIP Channel Driver - Add CLI/AMI initiated NOTIFY requests
Kevin Harwell [Mon, 1 Jul 2013 21:28:32 +0000 (21:28 +0000)]
New SIP Channel Driver - Add CLI/AMI initiated NOTIFY requests

Added the ability to send unsolicited NOTIFY requests to a particular endpoint
with a configured payload.  Added both CLI and AMI support.  For a given
endpoint, this module will iterate over all its contacts sending the appropriate
NOTIFY request to each.

(closes issue ASTERISK-21436)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2623/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393364 65c4cc65-6c06-0410-ace0-fbb531ad65f3