[asterisk-commits] oej: trunk r99644 - in /trunk: channels/ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 22 14:35:11 CST 2008
Author: oej
Date: Tue Jan 22 14:35:10 2008
New Revision: 99644
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99644
Log:
Add a generic function to set the bridged call PVT unique id string
as a channel variable BRIDGEPVTCALLID
This is important for call tracing in log files and CDRs, so that
the SIP callID can be traced along servers.
The CHANNEL dialplan function won't work here, since the outbound
channel is gone when we need the Call-ID.
Other channel drivers may now implement the same function :-),
but this patch only supports chan_sip.so.
Inspired by (issue #11816)
Reported by: ctooley
Patch by oej
Modified:
trunk/channels/chan_sip.c
trunk/include/asterisk/channel.h
trunk/main/channel.c
Change Statistics:
0 files changed
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=99644&r1=99643&r2=99644
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jan 22 14:35:10 2008
@@ -1676,6 +1676,7 @@
static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int sip_senddigit_begin(struct ast_channel *ast, char digit);
static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
+static char *sip_get_callid(struct ast_channel *chan);
static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin);
static int sip_standard_port(struct sip_socket s);
@@ -2036,6 +2037,7 @@
.early_bridge = ast_rtp_early_bridge,
.send_text = sip_sendtext, /* called with chan locked */
.func_channel_read = acf_channel_read,
+ .get_pvt_uniqueid = sip_get_callid,
};
/*! \brief This version of the sip channel tech has no send_digit_begin
@@ -3236,6 +3238,15 @@
}
return 0;
+}
+
+/*! \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);
}
/*! \brief Send SIP MESSAGE text within a call
@@ -14381,6 +14392,10 @@
manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
"Channel: %s\r\nChanneltype: %s\r\nUniqueid: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",
p->owner->name, p->owner->uniqueid, "SIP", p->callid, p->fullcontact, p->peername);
+ /* Set bridged channel variable */
+ bridgepeer = ast_bridged_channel(p->owner);
+ if (bridgepeer)
+ pbx_builtin_setvar_helper(bridgepeer, "SIP_BRIDGED_CALLID", p->callid);
} else { /* RE-invite */
ast_queue_frame(p->owner, &ast_null_frame);
}
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=99644&r1=99643&r2=99644
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Jan 22 14:35:10 2008
@@ -335,6 +335,9 @@
/*! \brief Set base channel (agent and local) */
int (* set_base_channel)(struct ast_channel *chan, struct ast_channel *base);
+
+ /*! \brief Get the unique identifier for the PVT, i.e. SIP call-ID for SIP */
+ char * (* get_pvt_uniqueid)(struct ast_channel *chan);
};
struct ast_epoll_data;
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=99644&r1=99643&r2=99644
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Jan 22 14:35:10 2008
@@ -4222,6 +4222,10 @@
pbx_builtin_setvar_helper(c0, "BRIDGEPEER", c1->name);
if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER")))
pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0->name);
+ if (c0->tech->get_pvt_uniqueid)
+ pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0->tech->get_pvt_uniqueid(c0));
+ if (c1->tech->get_pvt_uniqueid)
+ pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1->tech->get_pvt_uniqueid(c1));
if (c0->tech->bridge &&
(config->timelimit == 0) &&
More information about the asterisk-commits
mailing list