diff options
author | Olle Johansson <oej@edvina.net> | 2008-01-22 20:35:10 +0000 |
---|---|---|
committer | Olle Johansson <oej@edvina.net> | 2008-01-22 20:35:10 +0000 |
commit | b8aa3248ec9deecf45f535893a34c693b38e508c (patch) | |
tree | e31993095f4b8bfb76a913e5b7732d1fc79e16c8 /channels | |
parent | d1ba37f1c97b5c8e722c947e553f221bd1ec65e7 (diff) |
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
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 507ac276e..6c7c15884 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1676,6 +1676,7 @@ static int sip_transfer(struct ast_channel *ast, const char *dest); 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 @@ static const struct ast_channel_tech sip_tech = { .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 @@ -3238,6 +3240,15 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data 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 Called from PBX core sendtext() application */ static int sip_sendtext(struct ast_channel *ast, const char *text) @@ -14381,6 +14392,10 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru 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); } |