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
This commit is contained in:
Jonathan Rose
2012-05-17 16:28:20 +00:00
parent e240b2159a
commit cd37bec058
11 changed files with 317 additions and 33 deletions

View File

@@ -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)
{