manager: Restore Originate failure behavior from Asterisk 11

In Asterisk 11, if the 'Originate' AMI command failed to connect the provided
Channel while in extension mode, a 'failed' extension would be looked up and
run. This was, I believe, unintentionally removed in 51b6c49. This patch
restores that behavior.

This also adds an enum for the various 'synchronous' modes in an attempt to
make them meaningful.

ASTERISK-26115 #close
Reported by: Nasir Iqbal

Change-Id: I8afbd06725e99610e02adb529137d4800c05345d
This commit is contained in:
Sean Bright
2017-02-09 11:01:22 -05:00
parent 648d181d2f
commit 0910773077
7 changed files with 53 additions and 25 deletions

View File

@@ -1144,6 +1144,12 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
*/
int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
enum ast_pbx_outgoing_sync {
AST_OUTGOING_NO_WAIT = 0, /*!< Don't wait for originated call to answer */
AST_OUTGOING_WAIT = 1, /*!< Wait for originated call to answer */
AST_OUTGOING_WAIT_COMPLETE = 2, /*!< Wait for originated call to answer and hangup */
};
/*!
* \brief Synchronously or asynchronously make an outbound call and send it to a
* particular extension
@@ -1157,11 +1163,15 @@ int ast_async_goto_by_name(const char *chan, const char *context, const char *ex
* \param priority The destination priority for the outbound channel
* \param reason Optional. If provided, the dialed status of the outgoing channel.
* Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero.
* \param synchronous If zero then don't wait for anything.
* If one then block until the outbound channel answers or the call fails.
* If greater than one then wait for the call to complete or if the call doesn't
* answer and failed@context exists then run a channel named OutgoingSpoolFailed
* at failed@context.
* \param synchronous defined by the ast_pbx_outgoing_sync enum.
* If \c AST_OUTGOING_NO_WAIT then don't wait for anything.
* If \c AST_OUTGOING_WAIT then block until the outbound channel answers or
* the call fails.
* If \c AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or
* fail.
* If \c AST_OUTGOING_WAIT or \c AST_OUTGOING_WAIT_COMPLETE is specified,
* the call doesn't answer, and \c failed@context exists then run a channel
* named \c OutgoingSpoolFailed at \c failed@context.
* \param cid_num The caller ID number to set on the outbound channel
* \param cid_name The caller ID name to set on the outbound channel
* \param vars Variables to set on the outbound channel
@@ -1201,9 +1211,12 @@ int ast_pbx_outgoing_exten_predial(const char *type, struct ast_format_cap *cap,
* \param appdata Data to pass to the application
* \param reason Optional. If provided, the dialed status of the outgoing channel.
* Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero.
* \param synchronous If zero then don't wait for anything.
* If one then block until the outbound channel answers or the call fails.
* If greater than one then wait for the call to complete.
* \param synchronous defined by the ast_pbx_outgoing_sync enum.
* If \c AST_OUTGOING_NO_WAIT then don't wait for anything.
* If \c AST_OUTGOING_WAIT then block until the outbound channel answers or
* the call fails.
* If \c AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or
* fail.
* \param cid_num The caller ID number to set on the outbound channel
* \param cid_name The caller ID name to set on the outbound channel
* \param vars Variables to set on the outbound channel