[asterisk-commits] mmichelson: branch mmichelson/queue-log-atxfer r121958 - /team/mmichelson/que...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 11 17:09:57 CDT 2008
Author: mmichelson
Date: Wed Jun 11 17:09:56 2008
New Revision: 121958
URL: http://svn.digium.com/view/asterisk?view=rev&rev=121958
Log:
Now the datastore is removed on the first transfer (really the first masquerade)
so a second transfer of the caller won't cause a segfault.
Modified:
team/mmichelson/queue-log-atxfer/apps/app_queue.c
Modified: team/mmichelson/queue-log-atxfer/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-log-atxfer/apps/app_queue.c?view=diff&rev=121958&r1=121957&r2=121958
==============================================================================
--- team/mmichelson/queue-log-atxfer/apps/app_queue.c (original)
+++ team/mmichelson/queue-log-atxfer/apps/app_queue.c Wed Jun 11 17:09:56 2008
@@ -529,6 +529,7 @@
static void update_realtime_members(struct call_queue *q);
static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
+static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
/*! \brief sets the QUEUESTATUS channel variable */
static void set_queue_result(struct ast_channel *chan, enum queue_result res)
{
@@ -3053,25 +3054,32 @@
/*stub*/
}
+static const struct ast_datastore_info queue_transfer_info = {
+ .type = "queue_transfer",
+ .destroy = queue_transfer_destroy,
+ .chan_fixup = queue_transfer_fixup,
+};
+
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;
int callstart = qtds->starttime;
+ struct ast_datastore *datastore;
ast_log(LOG_NOTICE, "This would be where we would log a transfer!\n");
ast_log(LOG_NOTICE, "old_chan is %s(%p) and new_chan is %s(%p)\n", old_chan->name, old_chan, new_chan->name, new_chan);
ast_log(LOG_NOTICE, "old_chan has exten %s and context %s. new_chan has exten %s and context %s\n", old_chan->exten, old_chan->context, new_chan->exten, new_chan->context);
ast_queue_log(qe->parent->name, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
new_chan->exten, new_chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart));
-}
-
-static const struct ast_datastore_info queue_transfer_info = {
- .type = "queue_transfer",
- .destroy = queue_transfer_destroy,
- .chan_fixup = queue_transfer_fixup,
-};
+ if (!(datastore = ast_channel_datastore_find(new_chan, &queue_transfer_info, NULL))) {
+ ast_log(LOG_WARNING, "Can't find the datastore. WTF?\n");
+ return;
+ }
+
+ ast_channel_datastore_remove(new_chan, datastore);
+}
static void setup_transfer_datastore(struct queue_ent *qe, struct member *member, int starttime)
{
More information about the asterisk-commits
mailing list