summaryrefslogtreecommitdiff
path: root/main/channel_internal_api.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2012-05-17 16:28:20 +0000
committerJonathan Rose <jrose@digium.com>2012-05-17 16:28:20 +0000
commitcd37bec058f821f2777407eb9e99cc561bafdef5 (patch)
tree308553e9e2806f90a4087bea76745bbd03761a02 /main/channel_internal_api.c
parente240b2159acc159a531fc8398e67a1755084eae0 (diff)
logger: Adds additional support for call id logging and chan_sip specific stuff
This patch improves the handling of call id logging significantly with regard to transfers and adding APIs to better handle specific aspects of logging. Also, changes have been made to chan_sip in order to better handle the creation of callids and to enable the monitor thread to bind itself to a particular call id when a dialog is determined to be related to a callid. It then unbinds itself before returning to normal monitoring. review: https://reviewboard.asterisk.org/r/1886/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel_internal_api.c')
-rw-r--r--main/channel_internal_api.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 4f89ca788..5125c6f59 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -82,6 +82,7 @@ struct ast_channel {
struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
* in the CHANNEL dialplan function */
struct ast_channel_monitor *monitor; /*!< Channel monitoring */
+ struct ast_callid *callid; /*!< Bound call identifier pointer */
#ifdef HAVE_EPOLL
struct ast_epoll_data *epfd_data[AST_MAX_FDS];
#endif
@@ -829,6 +830,31 @@ enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
return chan->state;
}
+struct ast_callid *ast_channel_callid(const struct ast_channel *chan)
+{
+ if (chan->callid) {
+ ast_callid_ref(chan->callid);
+ return chan->callid;
+ }
+ return NULL;
+}
+void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
+{
+ if (chan->callid) {
+
+ if ((option_debug >= 3) || (ast_opt_dbg_module && ast_debug_get_by_module(AST_MODULE) >= 3)) {
+ char call_identifier_from[13];
+ char call_identifier_to[13];
+ ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
+ ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
+ ast_log(LOG_DEBUG, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
+ }
+
+ /* unbind if already set */
+ ast_callid_unref(chan->callid);
+ }
+ chan->callid = ast_callid_ref(callid);
+}
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
chan->state = value;
@@ -956,6 +982,13 @@ void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int va
chan ->softhangup &= ~value;
}
+void ast_channel_callid_cleanup(struct ast_channel *chan)
+{
+ if (chan->callid) {
+ chan->callid = ast_callid_unref(chan->callid);
+ }
+}
+
/* Typedef accessors */
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
{