[asterisk-commits] mmichelson: branch mmichelson/queue_bugbug r394398 - /team/mmichelson/queue_b...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 15 16:38:07 CDT 2013
Author: mmichelson
Date: Mon Jul 15 16:38:05 2013
New Revision: 394398
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394398
Log:
Log blind transfers appropriately.
Modified:
team/mmichelson/queue_bugbug/apps/app_queue.c
Modified: team/mmichelson/queue_bugbug/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/apps/app_queue.c?view=diff&rev=394398&r1=394397&r2=394398
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Mon Jul 15 16:38:05 2013
@@ -5118,13 +5118,10 @@
TRANSFER
};
-#if 0 // BUGBUG
/*! \brief Send out AMI message with member call completion status information */
-static void send_agent_complete(struct stasis_topic *topic, const char *queuename,
- const struct ast_channel_snapshot *caller,
- const struct ast_channel_snapshot *peer,
- const struct member *member, time_t holdstart, time_t callstart,
- enum agent_complete_reason rsn)
+static void send_agent_complete(const char *queuename, struct ast_channel_snapshot *caller,
+ struct ast_channel_snapshot *peer, const struct member *member, time_t holdstart,
+ time_t callstart, enum agent_complete_reason rsn)
{
const char *reason = NULL; /* silence dumb compilers */
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
@@ -5145,12 +5142,16 @@
"Queue", queuename,
"Interface", member->interface,
"MemberName", member->membername,
- "HoldTime", (long)(callstart - holdstart)
- "TalkTime", (long)(time(NULL) - callstart)
+ "HoldTime", (long)(callstart - holdstart),
+ "TalkTime", (long)(time(NULL) - callstart),
"Reason", reason);
- queue_publish_multi_channel_snapshot_blob(topic, chan, peer, queue_agent_complete_type(), blob);
-}
-#endif // BUGBUG
+
+ /* XXX Topic is currently BS. Just filler for the moment until a queue
+ * topic is created
+ */
+ queue_publish_multi_channel_snapshot_blob(ast_bridge_topic_all(), caller, peer,
+ queue_agent_complete_type(), blob);
+}
#if 0 // BUGBUG
struct queue_transfer_ds {
@@ -5264,11 +5265,15 @@
struct queue_stasis_data {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(caller_uniqueid);
+ AST_STRING_FIELD(agent_uniqueid);
AST_STRING_FIELD(bridge_uniqueid);
AST_STRING_FIELD(queue);
);
+ struct member *member;
struct stasis_topic *caller_topic;
+ time_t holdstart;
time_t starttime;
+ int caller_pos;
int callcompletedinsl;
};
@@ -5276,11 +5281,13 @@
{
struct queue_stasis_data *queue_data = obj;
+ ao2_cleanup(queue_data->member);
ast_string_field_free_memory(queue_data);
}
static struct queue_stasis_data *queue_stasis_data_alloc(struct queue_ent *qe,
- struct member *mem, time_t starttime, int callcompletedinsl)
+ struct ast_channel *peer, struct member *mem, time_t holdstart,
+ time_t starttime, int callcompletedinsl)
{
struct queue_stasis_data *queue_data;
@@ -5290,9 +5297,14 @@
}
ast_string_field_set(queue_data, caller_uniqueid, ast_channel_uniqueid(qe->chan));
+ ast_string_field_set(queue_data, agent_uniqueid, ast_channel_uniqueid(peer));
ast_string_field_set(queue_data, queue, qe->parent->name);
queue_data->starttime = starttime;
+ queue_data->holdstart = holdstart;
queue_data->callcompletedinsl = callcompletedinsl;
+ queue_data->caller_pos = qe->opos;
+ ao2_ref(mem, +1);
+ queue_data->member = mem;
return queue_data;
}
@@ -5317,13 +5329,26 @@
}
} else if (ast_blind_transfer_type() == stasis_message_type(msg)) {
struct ast_bridge_blob *blind_blob = stasis_message_data(msg);
+ struct ast_channel_snapshot *caller;
+ struct ast_channel_snapshot *agent;
if (ast_strlen_zero(queue_data->bridge_uniqueid) ||
strcmp(queue_data->bridge_uniqueid, blind_blob->bridge->uniqueid)) {
return;
}
+ caller = ast_channel_snapshot_get_latest(queue_data->caller_uniqueid);
+ agent = ast_channel_snapshot_get_latest(queue_data->agent_uniqueid);
+
ast_log(LOG_NOTICE, "Detected blind transfer in queue %s\n", queue_data->queue);
+ ast_queue_log(queue_data->queue, caller->uniqueid, queue_data->member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
+ ast_json_string_get(ast_json_object_get(blind_blob->blob, "exten")),
+ ast_json_string_get(ast_json_object_get(blind_blob->blob, "context")),
+ (long) queue_data->starttime - queue_data->holdstart,
+ (long) time(NULL) - queue_data->starttime, queue_data->caller_pos);
+
+ send_agent_complete(queue_data->queue, caller, agent, queue_data->member,
+ queue_data->holdstart, queue_data->starttime, TRANSFER);
stasis_unsubscribe(sub);
} else if (ast_attended_transfer_type() == stasis_message_type(msg)) {
struct ast_attended_transfer_message *atxfer_msg = stasis_message_data(msg);
@@ -5341,10 +5366,10 @@
}
}
-static int setup_stasis_subs(struct queue_ent *qe, struct member *mem, time_t starttime,
- int callcompletedinsl)
-{
- struct queue_stasis_data *queue_data = queue_stasis_data_alloc(qe, mem, starttime, callcompletedinsl);
+static int setup_stasis_subs(struct queue_ent *qe, struct ast_channel *peer, struct member *mem,
+ time_t holdstart, time_t starttime, int callcompletedinsl)
+{
+ struct queue_stasis_data *queue_data = queue_stasis_data_alloc(qe, peer, mem, holdstart, starttime, callcompletedinsl);
if (!queue_data) {
return -1;
@@ -6101,7 +6126,7 @@
#if 0 // BUGBUG
transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
#endif // BUGBUG
- setup_stasis_subs(qe, member, callstart, callcompletedinsl);
+ setup_stasis_subs(qe, peer, member, qe->start, callstart, callcompletedinsl);
bridge = ast_bridge_call(qe->chan, peer, &bridge_config);
/* BUGBUG need to do this queue logging a different way because we cannot reference peer anymore. Likely needs to be made a subscriber of stasis transfer events. */
More information about the asterisk-commits
mailing list