[asterisk-commits] tilghman: trunk r96301 - /trunk/main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 3 15:27:57 CST 2008
Author: tilghman
Date: Thu Jan 3 15:27:57 2008
New Revision: 96301
URL: http://svn.digium.com/view/asterisk?view=rev&rev=96301
Log:
Allow the uniqueid to be used for searching for a channel in the list.
Reported and initially patched by: michael-fig
(Closes issue #11340)
Modified:
trunk/main/channel.c
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=96301&r1=96300&r2=96301
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Jan 3 15:27:57 2008
@@ -965,7 +965,7 @@
*/
}
if (name) { /* want match by name */
- if ((!namelen && strcasecmp(c->name, name)) ||
+ if ((!namelen && strcasecmp(c->name, name) && strcmp(c->uniqueid, name)) ||
(namelen && strncasecmp(c->name, name, namelen)))
continue; /* name match failed */
} else if (exten) {
@@ -3534,10 +3534,10 @@
struct ast_cdr *cdr;
int rformat = original->readformat;
int wformat = original->writeformat;
- char newn[100];
- char orig[100];
- char masqn[100];
- char zombn[100];
+ char newn[AST_CHANNEL_NAME];
+ char orig[AST_CHANNEL_NAME];
+ char masqn[AST_CHANNEL_NAME];
+ char zombn[AST_CHANNEL_NAME];
ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n",
clone->name, clone->_state, original->name, original->_state);
@@ -3662,7 +3662,7 @@
ast_channel_unlock(clone);
return -1;
}
-
+
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig);
/* Mangle the name of the clone channel */
ast_string_field_set(clone, name, zombn);
@@ -3672,7 +3672,7 @@
t_pvt = original->monitor;
original->monitor = clone->monitor;
clone->monitor = t_pvt;
-
+
/* Keep the same language. */
ast_string_field_set(original, language, clone->language);
/* Copy the FD's other than the generator fd */
@@ -3706,16 +3706,16 @@
tmpcid = original->cid;
original->cid = clone->cid;
clone->cid = tmpcid;
-
+
/* Restore original timing file descriptor */
ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd);
-
+
/* Our native formats are different now */
original->nativeformats = clone->nativeformats;
-
+
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */
-
+
/* Set the write format */
ast_set_write_format(original, wformat);
@@ -3744,7 +3744,7 @@
/* If an indication is currently playing maintain it on the channel that is taking the place of original */
if (original->visible_indication)
ast_indicate(original, original->visible_indication);
-
+
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
a zombie so nothing tries to touch it. If it's already been marked as a
zombie, then free it now (since it already is considered invalid). */
@@ -3768,7 +3768,7 @@
ast_queue_frame(clone, &ast_null_frame);
ast_channel_unlock(clone);
}
-
+
/* Signal any blocker */
if (ast_test_flag(original, AST_FLAG_BLOCKING))
pthread_kill(original->blocker, SIGURG);
More information about the asterisk-commits
mailing list