[asterisk-dev] [asterisk-commits] qwell: trunk r270260 - /trunk/channels/chan_agent.c

Russell Bryant russell at digium.com
Tue Jun 15 17:29:16 CDT 2010


On 06/14/2010 02:41 PM, SVN commits to the Asterisk project wrote:
> Author: qwell
> Date: Mon Jun 14 14:41:43 2010
> New Revision: 270260
>
> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270260
> Log:
> Add option to get untruncated channel name from AGENT function.
>
> The "channel" option would chop the channel name at the last '-', which made
> it useless for something like a channel transfer from the dialplan.  The
> "fullchannel" option will return the channel name as-is.
>
> ABE-2218
>
> Modified:
>      trunk/channels/chan_agent.c
>
> Modified: trunk/channels/chan_agent.c
> URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_agent.c?view=diff&rev=270260&r1=270259&r2=270260
> ==============================================================================
> --- trunk/channels/chan_agent.c (original)
> +++ trunk/channels/chan_agent.c Mon Jun 14 14:41:43 2010
> @@ -159,6 +159,9 @@
>   					<enum name="channel">
>   						<para>The name of the active channel for the Agent (AgentLogin)</para>
>   					</enum>
> +					<enum name="fullchannel">
> +						<para>The untruncated name of the active channel for the Agent (AgentLogin)</para>
> +					</enum>
>   				</enumlist>
>   			</parameter>
>   		</syntax>
> @@ -2291,6 +2294,10 @@
>   			if (tmp)
>   				*tmp = '\0';
>   		}
> +	} else if (!strcasecmp(args.item, "fullchannel")) {
> +		if (agent->chan) {
> +			ast_copy_string(buf, agent->chan->name, len);
> +		}
>   	} else if (!strcasecmp(args.item, "exten")) {
>   		buf[0] = '\0';
>   	}

This change is actually not thread-safe.  agent->chan needs to be locked 
before you can read the name off of it.

-- 
Russell Bryant
Digium, Inc.  |  Engineering Manager, Open Source Software
445 Jan Davis Drive NW   -    Huntsville, AL 35806  -  USA
jabber: rbryant at digium.com    -=-    skype: russell-bryant
www.digium.com -=- www.asterisk.org -=- blogs.asterisk.org



More information about the asterisk-dev mailing list