mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
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
This commit is contained in:
@@ -55,6 +55,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
</syntax>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="AgentLogin">
|
||||
<managerEventInstance class="EVENT_FLAG_AGENT">
|
||||
<synopsis>Raised when an Agent has logged in.</synopsis>
|
||||
<syntax>
|
||||
<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
|
||||
<parameter name="Agent">
|
||||
<para>Agent ID of the agent.</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<see-also>
|
||||
<ref type="application">AgentLogin</ref>
|
||||
<ref type="managerEvent">AgentLogoff</ref>
|
||||
</see-also>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="AgentLogoff">
|
||||
<managerEventInstance class="EVENT_FLAG_AGENT">
|
||||
<synopsis>Raised when an Agent has logged off.</synopsis>
|
||||
<syntax>
|
||||
<xi:include xpointer="xpointer(/docs/managerEvent[@name='AgentLogin']/managerEventInstance/syntax/parameter)" />
|
||||
<parameter name="Logintime">
|
||||
<para>The number of seconds the agent was logged in.</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<see-also>
|
||||
<ref type="managerEvent">AgentLogin</ref>
|
||||
</see-also>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
***/
|
||||
|
||||
#define NUM_MULTI_CHANNEL_BLOB_BUCKETS 7
|
||||
@@ -627,6 +656,44 @@ static struct ast_manager_event_blob *varset_to_ami(struct stasis_message *msg)
|
||||
ast_str_buffer(channel_event_string), variable, value);
|
||||
}
|
||||
|
||||
static struct ast_manager_event_blob *agent_login_to_ami(struct stasis_message *msg)
|
||||
{
|
||||
RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
|
||||
RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
|
||||
struct ast_channel_blob *obj = stasis_message_data(msg);
|
||||
const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
|
||||
|
||||
channel_string = ast_manager_build_channel_state_string(obj->snapshot);
|
||||
if (!channel_string) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ast_manager_event_blob_create(EVENT_FLAG_AGENT, "AgentLogin",
|
||||
"%s"
|
||||
"Agent: %s\r\n",
|
||||
ast_str_buffer(channel_string), agent);
|
||||
}
|
||||
|
||||
static struct ast_manager_event_blob *agent_logoff_to_ami(struct stasis_message *msg)
|
||||
{
|
||||
RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
|
||||
RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
|
||||
struct ast_channel_blob *obj = stasis_message_data(msg);
|
||||
const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
|
||||
long logintime = ast_json_integer_get(ast_json_object_get(obj->blob, "logintime"));
|
||||
|
||||
channel_string = ast_manager_build_channel_state_string(obj->snapshot);
|
||||
if (!channel_string) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ast_manager_event_blob_create(EVENT_FLAG_AGENT, "AgentLogoff",
|
||||
"%s"
|
||||
"Agent: %s\r\n"
|
||||
"Logintime: %ld\r\n",
|
||||
ast_str_buffer(channel_string), agent, logintime);
|
||||
}
|
||||
|
||||
void ast_publish_channel_state(struct ast_channel *chan)
|
||||
{
|
||||
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
|
||||
@@ -827,6 +894,12 @@ STASIS_MESSAGE_TYPE_DEFN(ast_channel_moh_start_type);
|
||||
STASIS_MESSAGE_TYPE_DEFN(ast_channel_moh_stop_type);
|
||||
STASIS_MESSAGE_TYPE_DEFN(ast_channel_monitor_start_type);
|
||||
STASIS_MESSAGE_TYPE_DEFN(ast_channel_monitor_stop_type);
|
||||
STASIS_MESSAGE_TYPE_DEFN(ast_channel_agent_login_type,
|
||||
.to_ami = agent_login_to_ami,
|
||||
);
|
||||
STASIS_MESSAGE_TYPE_DEFN(ast_channel_agent_logoff_type,
|
||||
.to_ami = agent_logoff_to_ami,
|
||||
);
|
||||
|
||||
/*! @} */
|
||||
|
||||
@@ -853,6 +926,8 @@ static void stasis_channels_cleanup(void)
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_moh_stop_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_monitor_start_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_monitor_stop_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_agent_login_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_agent_logoff_type);
|
||||
}
|
||||
|
||||
void ast_stasis_channels_init(void)
|
||||
@@ -876,6 +951,8 @@ void ast_stasis_channels_init(void)
|
||||
STASIS_MESSAGE_TYPE_INIT(ast_channel_moh_stop_type);
|
||||
STASIS_MESSAGE_TYPE_INIT(ast_channel_monitor_start_type);
|
||||
STASIS_MESSAGE_TYPE_INIT(ast_channel_monitor_stop_type);
|
||||
STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_login_type);
|
||||
STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_logoff_type);
|
||||
|
||||
channel_topic_all = stasis_topic_create("ast_channel_topic_all");
|
||||
channel_topic_all_cached = stasis_caching_topic_create(channel_topic_all, channel_snapshot_get_id);
|
||||
|
Reference in New Issue
Block a user