[asterisk-commits] bmd: branch group/newcdr r117326 - /team/group/newcdr/funcs/func_channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 20 15:00:06 CDT 2008


Author: bmd
Date: Tue May 20 15:00:06 2008
New Revision: 117326

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117326
Log:
return uniqueid if linkedid is not set

Modified:
    team/group/newcdr/funcs/func_channel.c

Modified: team/group/newcdr/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/funcs/func_channel.c?view=diff&rev=117326&r1=117325&r2=117326
==============================================================================
--- team/group/newcdr/funcs/func_channel.c (original)
+++ team/group/newcdr/funcs/func_channel.c Tue May 20 15:00:06 2008
@@ -94,8 +94,17 @@
 		locked_copy_string(chan, buf, chan->accountcode, len);
 	else if (!strcasecmp(data, "peeraccount"))
 		locked_copy_string(chan, buf, chan->peeraccount, len);
-	else if (!strcasecmp(data, "linkedid"))
-		locked_copy_string(chan, buf, chan->linkedid, len);
+	else if (!strcasecmp(data, "linkedid")) {
+		ast_channel_lock(chan);
+		if (ast_strlen_zero(chan->linkedid)) {
+			/* fall back on the channel's uniqueid if linkedid is unset */
+			ast_copy_string(buf, chan->uniqueid, len);
+		}
+		else {
+			ast_copy_string(buf, chan->linkedid, len);
+		}
+		ast_channel_unlock(chan);
+	}
 	else if (!strcasecmp(data, "transfercapability"))
 		locked_copy_string(chan, buf, transfercapability_table[chan->transfercapability & 0x1f], len);
 	else if (!strcasecmp(data, "callgroup")) {




More information about the asterisk-commits mailing list