[asterisk-commits] mmichelson: branch mmichelson/queue_bugbug r394461 - /team/mmichelson/queue_b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 16 12:18:36 CDT 2013


Author: mmichelson
Date: Tue Jul 16 12:18:34 2013
New Revision: 394461

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394461
Log:
Remove the old transfer datastore madness.

We have a new way of detecting transfers and hangups in town,
and there ain't room for the both of yas.


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=394461&r1=394460&r2=394461
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Tue Jul 16 12:18:34 2013
@@ -1588,10 +1588,6 @@
 static struct member *interface_exists(struct call_queue *q, const char *interface);
 static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
 
-#if 0	// BUGBUG
-static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
-#endif	// BUGBUG
-
 static struct member *find_member_by_queuename_and_interface(const char *queuename, const char *interface);
 /*! \brief sets the QUEUESTATUS channel variable */
 static void set_queue_result(struct ast_channel *chan, enum queue_result res)
@@ -5152,115 +5148,6 @@
 			queue_agent_complete_type(), blob);
 }
 
-#if 0	// BUGBUG
-struct queue_transfer_ds {
-	struct queue_ent *qe;
-	struct member *member;
-	time_t starttime;
-	int callcompletedinsl;
-};
-#endif	// BUGBUG
-
-#if 0	// BUGBUG
-static void queue_transfer_destroy(void *data)
-{
-	struct queue_transfer_ds *qtds = data;
-	ast_free(qtds);
-}
-#endif	// BUGBUG
-
-#if 0	// BUGBUG
-/*! \brief a datastore used to help correctly log attended transfers of queue callers
- */
-static const struct ast_datastore_info queue_transfer_info = {
-	.type = "queue_transfer",
-	.chan_fixup = queue_transfer_fixup,
-	.destroy = queue_transfer_destroy,
-};
-#endif	// BUGBUG
-
-#if 0	// BUGBUG
-/*! \brief Log an attended transfer when a queue caller channel is masqueraded
- *
- * When a caller is masqueraded, we want to log a transfer. Fixup time is the closest we can come to when
- * the actual transfer occurs. This happens during the masquerade after datastores are moved from old_chan
- * to new_chan. This is why new_chan is referenced for exten, context, and datastore information.
- *
- * At the end of this, we want to remove the datastore so that this fixup function is not called on any
- * future masquerades of the caller during the current call.
- */
-static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
-{
-	struct queue_transfer_ds *qtds = data;
-	struct queue_ent *qe = qtds->qe;
-	struct member *member = qtds->member;
-	time_t callstart = qtds->starttime;
-	int callcompletedinsl = qtds->callcompletedinsl;
-	struct ast_datastore *datastore;
-
-	ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
-				ast_channel_exten(new_chan), ast_channel_context(new_chan), (long) (callstart - qe->start),
-				(long) (time(NULL) - callstart), qe->opos);
-
-	update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
-
-	/* No need to lock the channels because they are already locked in ast_do_masquerade */
-	if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
-		ast_channel_datastore_remove(old_chan, datastore);
-	} else {
-		ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
-	}
-}
-#endif	// BUGBUG
-
-#if 0	// BUGBUG
-/*! \brief mechanism to tell if a queue caller was atxferred by a queue member.
- *
- * When a caller is atxferred, then the queue_transfer_info datastore
- * is removed from the channel. If it's still there after the bridge is
- * broken, then the caller was not atxferred.
- *
- * \note Only call this with chan locked
- */
-static int attended_transfer_occurred(struct ast_channel *chan)
-{
-	return ast_channel_datastore_find(chan, &queue_transfer_info, NULL) ? 0 : 1;
-}
-#endif	// BUGBUG
-
-#if 0	// BUGBUG
-/*! \brief create a datastore for storing relevant info to log attended transfers in the queue_log
- */
-static struct ast_datastore *setup_transfer_datastore(struct queue_ent *qe, struct member *member, time_t starttime, int callcompletedinsl)
-{
-	struct ast_datastore *ds;
-	struct queue_transfer_ds *qtds = ast_calloc(1, sizeof(*qtds));
-
-	if (!qtds) {
-		ast_log(LOG_WARNING, "Memory allocation error!\n");
-		return NULL;
-	}
-
-	ast_channel_lock(qe->chan);
-	if (!(ds = ast_datastore_alloc(&queue_transfer_info, NULL))) {
-		ast_channel_unlock(qe->chan);
-		ast_free(qtds);
-		ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n");
-		return NULL;
-	}
-
-	qtds->qe = qe;
-	/* This member is refcounted in try_calling, so no need to add it here, too */
-	qtds->member = member;
-	qtds->starttime = starttime;
-	qtds->callcompletedinsl = callcompletedinsl;
-	ds->data = qtds;
-	ast_channel_datastore_add(qe->chan, ds);
-	ast_channel_unlock(qe->chan);
-	return ds;
-}
-#endif	// BUGBUG
-
 struct queue_stasis_data {
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(caller_uniqueid);
@@ -5557,9 +5444,6 @@
 	int callcompletedinsl;
 	struct ao2_iterator memi;
 	struct ast_datastore *datastore;
-#if 0	// BUGBUG
-	struct ast_datastore *transfer_ds;
-#endif	// BUGBUG
 	struct queue_end_bridge *queue_end_bridge = NULL;
 
 	ast_channel_lock(qe->chan);
@@ -6179,53 +6063,8 @@
 		}
 
 		time(&callstart);
-#if 0	// BUGBUG
-		transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
-#endif	// BUGBUG
 		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. */
-#if 0	// BUGBUG
-		/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
-		 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary, except for
-		 * the AgentComplete manager event
-		 */
-		ast_channel_lock(qe->chan);
-		if (!attended_transfer_occurred(qe->chan)) {
-			struct ast_datastore *tds;
-
-			/* detect a blind transfer */
-			if (!(ast_channel_softhangup_internal_flag(qe->chan) | ast_channel_softhangup_internal_flag(peer)) && (strcasecmp(oldcontext, ast_channel_context(qe->chan)) || strcasecmp(oldexten, ast_channel_exten(qe->chan)))) {
-				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
-					ast_channel_exten(qe->chan), ast_channel_context(qe->chan), (long) (callstart - qe->start),
-					(long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
-			} else if (ast_check_hangup(qe->chan) && !ast_check_hangup(peer)) {
-				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "COMPLETECALLER", "%ld|%ld|%d",
-					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
-			} else {
-				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
-					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
-			}
-			if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
-				ast_channel_datastore_remove(qe->chan, tds);
-			}
-			ast_channel_unlock(qe->chan);
-			update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
-		} else {
-			ast_channel_unlock(qe->chan);
-
-			/* We already logged the TRANSFER on the queue_log, but we still need to send the AgentComplete event */
-			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
-		}
-
-		if (transfer_ds) {
-			ast_datastore_free(transfer_ds);
-		}
-#endif	// BUGBUG
 
 		res = bridge ? bridge : 1;
 		ao2_ref(member, -1);




More information about the asterisk-commits mailing list