mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
Move after bridge callbacks into their own file
One more major refactoring to go. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -43,6 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/bridging.h"
|
||||
#include "asterisk/bridging_internal.h"
|
||||
#include "asterisk/bridging_basic.h"
|
||||
#include "asterisk/bridging_after.h"
|
||||
#include "asterisk/config_options.h"
|
||||
#include "asterisk/features_config.h"
|
||||
#include "asterisk/astobj2.h"
|
||||
@@ -1055,7 +1056,7 @@ static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, stru
|
||||
|
||||
if (!caller_bridge) {
|
||||
/* Reset agent. */
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
return;
|
||||
}
|
||||
res = ast_bridge_move(caller_bridge, bridge_channel->bridge, bridge_channel->chan,
|
||||
@@ -1063,7 +1064,7 @@ static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, stru
|
||||
if (res) {
|
||||
/* Reset agent. */
|
||||
ast_bridge_destroy(caller_bridge);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
return;
|
||||
}
|
||||
ast_bridge_channel_write_control_data(bridge_channel, AST_CONTROL_ANSWER, NULL, 0);
|
||||
@@ -1159,13 +1160,13 @@ static int bridge_agent_hold_heartbeat(struct ast_bridge *bridge, struct ast_bri
|
||||
|
||||
if (deferred_logoff) {
|
||||
ast_debug(1, "Agent %s: Deferred logoff.\n", agent->username);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
} else if (probation_timedout) {
|
||||
ast_debug(1, "Agent %s: Login complete.\n", agent->username);
|
||||
agent_devstate_changed(agent->username);
|
||||
} else if (ack_timedout) {
|
||||
ast_debug(1, "Agent %s: Ack call timeout.\n", agent->username);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
} else if (wrapup_timedout) {
|
||||
ast_debug(1, "Agent %s: Wrapup timeout. Ready for new call.\n", agent->username);
|
||||
agent_devstate_changed(agent->username);
|
||||
@@ -1175,7 +1176,7 @@ static int bridge_agent_hold_heartbeat(struct ast_bridge *bridge, struct ast_bri
|
||||
}
|
||||
|
||||
static void agent_after_bridge_cb(struct ast_channel *chan, void *data);
|
||||
static void agent_after_bridge_cb_failed(enum ast_after_bridge_cb_reason reason, void *data);
|
||||
static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data);
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
@@ -1252,7 +1253,7 @@ static int bridge_agent_hold_push(struct ast_bridge *self, struct ast_bridge_cha
|
||||
}
|
||||
|
||||
if (swap) {
|
||||
res = ast_after_bridge_callback_set(chan, agent_after_bridge_cb,
|
||||
res = ast_bridge_set_after_callback(chan, agent_after_bridge_cb,
|
||||
agent_after_bridge_cb_failed, chan);
|
||||
if (res) {
|
||||
ast_channel_remove_bridge_role(chan, "holding_participant");
|
||||
@@ -1270,7 +1271,7 @@ static int bridge_agent_hold_push(struct ast_bridge *self, struct ast_bridge_cha
|
||||
* agent will have some slightly different behavior in corner
|
||||
* cases.
|
||||
*/
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1620,7 +1621,7 @@ static void agent_after_bridge_cb(struct ast_channel *chan, void *data)
|
||||
ao2_ref(agent, -1);
|
||||
}
|
||||
|
||||
static void agent_after_bridge_cb_failed(enum ast_after_bridge_cb_reason reason, void *data)
|
||||
static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data)
|
||||
{
|
||||
struct ast_channel *chan = data;
|
||||
struct agent_pvt *agent;
|
||||
@@ -1631,7 +1632,7 @@ static void agent_after_bridge_cb_failed(enum ast_after_bridge_cb_reason reason,
|
||||
}
|
||||
ast_log(LOG_WARNING, "Agent %s: Forced logout. Lost control of %s because: %s\n",
|
||||
agent->username, ast_channel_name(chan),
|
||||
ast_after_bridge_cb_reason_string(reason));
|
||||
ast_bridge_after_cb_reason_string(reason));
|
||||
agent_lock(agent);
|
||||
agent_logout(agent);
|
||||
ao2_ref(agent, -1);
|
||||
@@ -1704,7 +1705,7 @@ static void caller_abort_agent(struct agent_pvt *agent)
|
||||
}
|
||||
|
||||
/* Kick the agent out of the holding bridge to reset it. */
|
||||
ast_bridge_channel_leave_bridge_nolock(logged, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge_nolock(logged, BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_unlock(logged);
|
||||
}
|
||||
|
||||
@@ -1714,7 +1715,7 @@ static int caller_safety_timeout(struct ast_bridge *bridge, struct ast_bridge_ch
|
||||
|
||||
if (agent->state == AGENT_STATE_CALL_PRESENT) {
|
||||
ast_verb(3, "Agent '%s' did not respond. Safety timeout.\n", agent->username);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
|
||||
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
|
||||
caller_abort_agent(agent);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/dial.h"
|
||||
#include "asterisk/stasis_channels.h"
|
||||
#include "asterisk/bridging.h"
|
||||
#include "asterisk/bridging_after.h"
|
||||
#include "asterisk/features_config.h"
|
||||
|
||||
/*** DOCUMENTATION
|
||||
@@ -201,7 +202,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
<argument name="exten" required="false" />
|
||||
<argument name="priority" required="true" />
|
||||
<para>If the call is answered, transfer the calling party to
|
||||
the specified <replaceable>priority</replaceable> and the called party to the specified
|
||||
the specified <replaceable>priority</replaceable> and the called party to the specified
|
||||
<replaceable>priority</replaceable> plus one.</para>
|
||||
<note>
|
||||
<para>You cannot use any additional action post answer options in conjunction with this option.</para>
|
||||
@@ -290,7 +291,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
<argument name="arg" multiple="true">
|
||||
<para>Macro arguments</para>
|
||||
</argument>
|
||||
<para>Execute the specified <replaceable>macro</replaceable> for the <emphasis>called</emphasis> channel
|
||||
<para>Execute the specified <replaceable>macro</replaceable> for the <emphasis>called</emphasis> channel
|
||||
before connecting to the calling channel. Arguments can be specified to the Macro
|
||||
using <literal>^</literal> as a delimiter. The macro can set the variable
|
||||
<variable>MACRO_RESULT</variable> to specify the following actions after the macro is
|
||||
@@ -332,7 +333,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
<para>With <replaceable>delete</replaceable> set to <literal>1</literal>, the introduction will
|
||||
always be deleted.</para>
|
||||
</argument>
|
||||
<para>This option is a modifier for the call screening/privacy mode. (See the
|
||||
<para>This option is a modifier for the call screening/privacy mode. (See the
|
||||
<literal>p</literal> and <literal>P</literal> options.) It specifies
|
||||
that no introductions are to be saved in the <directory>priv-callerintros</directory>
|
||||
directory.</para>
|
||||
@@ -353,7 +354,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
<argument name="mode">
|
||||
<para>With <replaceable>mode</replaceable> either not specified or set to <literal>1</literal>,
|
||||
the originator hanging up will cause the phone to ring back immediately.</para>
|
||||
<para>With <replaceable>mode</replaceable> set to <literal>2</literal>, when the operator
|
||||
<para>With <replaceable>mode</replaceable> set to <literal>2</literal>, when the operator
|
||||
flashes the trunk, it will ring their phone back.</para>
|
||||
</argument>
|
||||
<para>Enables <emphasis>operator services</emphasis> mode. This option only
|
||||
@@ -1071,7 +1072,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||
/* If we are calling a single channel, and not providing ringback or music, */
|
||||
/* then, make them compatible for in-band tone purpose */
|
||||
if (ast_channel_make_compatible(outgoing->chan, in) < 0) {
|
||||
/* If these channels can not be made compatible,
|
||||
/* If these channels can not be made compatible,
|
||||
* there is no point in continuing. The bridge
|
||||
* will just fail if it gets that far.
|
||||
*/
|
||||
@@ -1765,7 +1766,7 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
|
||||
|
||||
/*! \page DialPrivacy Dial Privacy scripts
|
||||
* \par priv-callee-options script:
|
||||
* \li Dial 1 if you wish this caller to reach you directly in the future,
|
||||
* \li Dial 1 if you wish this caller to reach you directly in the future,
|
||||
* and immediately connect to their incoming call.
|
||||
* \li Dial 2 if you wish to send this caller to voicemail now and forevermore.
|
||||
* \li Dial 3 to send this caller to the torture menus, now and forevermore.
|
||||
@@ -1891,7 +1892,7 @@ static int setup_privacy_args(struct privacy_args *pa,
|
||||
} else if (ast_test_flag64(opts, OPT_SCREEN_NOCALLERID) && strncmp(pa->privcid, "NOCALLERID", 10) == 0) {
|
||||
ast_verb(3, "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->privdb_val);
|
||||
}
|
||||
|
||||
|
||||
if (pa->privdb_val == AST_PRIVACY_DENY) {
|
||||
ast_verb(3, "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
|
||||
ast_copy_string(pa->status, "NOANSWER", sizeof(pa->status));
|
||||
@@ -2021,14 +2022,14 @@ static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_ch
|
||||
ast_channel_lock(chan);
|
||||
context = ast_strdupa(ast_channel_context(chan));
|
||||
ast_channel_unlock(chan);
|
||||
ast_after_bridge_set_h(peer, context);
|
||||
ast_bridge_set_after_h(peer, context);
|
||||
} else if (ast_test_flag64(opts, OPT_CALLEE_GO_ON)) {
|
||||
ast_channel_lock(chan);
|
||||
context = ast_strdupa(ast_channel_context(chan));
|
||||
extension = ast_strdupa(ast_channel_exten(chan));
|
||||
priority = ast_channel_priority(chan);
|
||||
ast_channel_unlock(chan);
|
||||
ast_after_bridge_set_go_on(peer, context, extension, priority,
|
||||
ast_bridge_set_after_go_on(peer, context, extension, priority,
|
||||
opt_args[OPT_ARG_CALLEE_GO_ON]);
|
||||
}
|
||||
}
|
||||
@@ -2444,7 +2445,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
||||
/* We are on the only destination. */
|
||||
ast_rtp_instance_early_bridge_make_compatible(tc, chan);
|
||||
}
|
||||
|
||||
|
||||
/* Inherit specially named variables from parent channel */
|
||||
ast_channel_inherit_variables(chan, tc);
|
||||
ast_channel_datastore_inherit(chan, tc);
|
||||
@@ -2698,7 +2699,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
||||
/* If appropriate, log that we have a destination channel and set the answer time */
|
||||
if (ast_channel_name(peer))
|
||||
pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", ast_channel_name(peer));
|
||||
|
||||
|
||||
ast_channel_lock(peer);
|
||||
number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
|
||||
if (ast_strlen_zero(number)) {
|
||||
@@ -2967,7 +2968,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
||||
ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
|
||||
}
|
||||
setup_peer_after_bridge_goto(chan, peer, &opts, opt_args);
|
||||
if (ast_after_bridge_goto_setup(peer)
|
||||
if (ast_bridge_setup_after_goto(peer)
|
||||
|| ast_pbx_start(peer)) {
|
||||
ast_autoservice_chan_hangup_peer(chan, peer);
|
||||
}
|
||||
@@ -2997,7 +2998,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
||||
config.end_bridge_callback = end_bridge_callback;
|
||||
config.end_bridge_callback_data = chan;
|
||||
config.end_bridge_callback_data_fixup = end_bridge_callback_data_fixup;
|
||||
|
||||
|
||||
if (moh) {
|
||||
moh = 0;
|
||||
ast_moh_stop(chan);
|
||||
|
||||
@@ -109,6 +109,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/stasis_channels.h"
|
||||
#include "asterisk/stasis_message_router.h"
|
||||
#include "asterisk/bridging.h"
|
||||
#include "asterisk/bridging_after.h"
|
||||
|
||||
/* Define, to debug reference counts on queues, without debugging reference counts on queue members */
|
||||
/* #define REF_DEBUG_ONLY_QUEUES */
|
||||
@@ -5293,7 +5294,7 @@ static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_ch
|
||||
extension = ast_strdupa(ast_channel_exten(chan));
|
||||
priority = ast_channel_priority(chan);
|
||||
ast_channel_unlock(chan);
|
||||
ast_after_bridge_set_go_on(peer, context, extension, priority,
|
||||
ast_bridge_set_after_go_on(peer, context, extension, priority,
|
||||
opt_args[OPT_ARG_CALLEE_GO_ON]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user