diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/bridging.h | 6 | ||||
-rw-r--r-- | include/asterisk/logger.h | 68 |
2 files changed, 73 insertions, 1 deletions
diff --git a/include/asterisk/bridging.h b/include/asterisk/bridging.h index 3c117b7cd..831f340c8 100644 --- a/include/asterisk/bridging.h +++ b/include/asterisk/bridging.h @@ -165,6 +165,8 @@ struct ast_bridge_channel { struct ast_bridge_tech_optimizations tech_args; /*! Queue of DTMF digits used for DTMF streaming */ char dtmf_stream_q[8]; + /*! Call ID associated with bridge channel */ + struct ast_callid *callid; /*! Linked list information */ AST_LIST_ENTRY(ast_bridge_channel) entry; }; @@ -243,9 +245,11 @@ struct ast_bridge { size_t array_num; /*! Number of channels the array can handle */ size_t array_size; + /*! Call ID associated with the bridge */ + struct ast_callid *callid; /*! Linked list of channels participating in the bridge */ AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) channels; -}; + }; /*! \brief Create a new bridge * diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h index c7f260c49..a49544963 100644 --- a/include/asterisk/logger.h +++ b/include/asterisk/logger.h @@ -60,6 +60,24 @@ extern "C" { void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf, 5, 6))); +/* XXX needs documentation */ +struct ast_callid; + +/*! \brief Used for sending a log message with a known call_id + This is a modified logger function which is functionally identical to the above logger function, + it just include a call_id argument as well. If NULL is specified here, no attempt will be made to + join the log message with a call_id. + + \param level Type of log event + \param file Will be provided by the AST_LOG_* macro + \param line Will be provided by the AST_LOG_* macro + \param function Will be provided by the AST_LOG_* macro + \param callid This is the ast_callid that is associated with the log message. May be NULL. + \param fmt This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-) +*/ +void ast_log_callid(int level, const char *file, int line, const char *function, struct ast_callid *callid, const char *fmt, ...) + __attribute__((format(printf, 6, 7))); + void ast_backtrace(void); /*! \brief Reload logger without rotating log files */ @@ -216,6 +234,56 @@ int ast_logger_register_level(const char *name); void ast_logger_unregister_level(const char *name); /*! + * \brief factory function to create a new uniquely identifying callid. + * + * \retval ast_callid struct pointer containing the call id + * + * \note The newly created callid will be referenced upon creation and this function should be + * paired with a call to ast_callid_unref() + */ +struct ast_callid *ast_create_callid(void); + +/*! + * \brief extracts the callerid from the thread + * + * \retval ast_callid reference to call_id related to the thread + * \retval NULL if no call_id is present in the thread + * + * This reference must be unreffed before it loses scope to prevent memory leaks. + */ +struct ast_callid *ast_read_threadstorage_callid(void); + +/*! + * \brief Increase callid reference count + * + * \param c the ast_callid + * + * \retval c always + */ +#define ast_callid_ref(c) ({ ao2_ref(c, +1); (c); }) + +/*! + * \brief Decrease callid reference count + * + * \param c the ast_callid + * + * \retval NULL always + */ +#define ast_callid_unref(c) ({ ao2_ref(c, -1); (NULL); }) + +/*! + * \brief Adds a known callid to thread storage of the calling thread + * + * \retval 0 - success + * \retval non-zero - failure + */ +int ast_callid_threadassoc_add(struct ast_callid *callid); + +/* + * May need a function to clean the threadstorage if we want to repurpose a thread. + */ + +/*! * \brief Send a log message to a dynamically registered log level * \param level The log level to send the message to * |