[asterisk-dev] [asterisk-commits] oej: trunk r99644 - in /trunk: channels/ include/asterisk/ main/

Kevin P. Fleming kpfleming at digium.com
Fri Jan 25 16:12:05 CST 2008

SVN commits to the Asterisk project wrote:

> Add a generic function to set the bridged call PVT unique id string
> as a channel variable BRIDGEPVTCALLID

I understand the motivation here, but I suspect that we need to come up
with a more generic solution. What is really needed is the ability to
set a channel variable on a channel you are bridged to; if that was
available, this functionality could be provided by a dialplan macro that
used CHANNEL() to get the Call-ID and then store it on the bridged channel.

> +/*! \brief Deliver SIP call ID for the call */
> +static char *sip_get_callid(struct ast_channel *chan)
> +{
> +	struct sip_pvt *p = chan->tech_pvt;
> +	if (!p)
> +		return "";
> +	return ((char *)p->callid);
>  }

If you make the prototype for this function say that it returns 'const
char *' then you won't have to cast p->callid at all, and it would be
much safer as well. Is there a need to return a *copy* of the callid;
could it change after this function returns and before the caller has
finished working with it (or are there locking concerns)?

> +				/* Set bridged channel variable */
> +				bridgepeer = ast_bridged_channel(p->owner);
> +				if (bridgepeer)
> +					pbx_builtin_setvar_helper(bridgepeer, "SIP_BRIDGED_CALLID", p->callid);

This looks unnecessary, since the data is already available in another
channel variable that is not SIP-specific.

Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)

More information about the asterisk-dev mailing list