提交 53706b9f authored 作者: Brian West's avatar Brian West

dox and add a func to logger

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1124 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 1bb893ef
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* @file switch_caller.h * @file switch_caller.h
* @brief Caller Identification * @brief Caller Identification
* @see caller * @see caller
*/ */
/** /**
* @defgroup caller Caller Identity / Dialplan * @defgroup caller Caller Identity / Dialplan
* @ingroup FREESWITCH * @ingroup FREESWITCH
...@@ -56,120 +56,123 @@ ...@@ -56,120 +56,123 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef _FORMATBUG
}
#endif
#include <switch.h> #include <switch.h>
/*! \brief Call Specific Data /*! \brief Call Specific Data
*/ */
struct switch_caller_profile { struct switch_caller_profile {
/*! The name of the dialplan */ /*! The name of the dialplan */
char *dialplan; char *dialplan;
/*! Caller ID Name */ /*! Caller ID Name */
char *caller_id_name; char *caller_id_name;
/*! Caller ID Number */ /*! Caller ID Number */
char *caller_id_number; char *caller_id_number;
/*! Caller Network Address (when applicable) */ /*! Caller Network Address (when applicable) */
char *network_addr; char *network_addr;
/*! ANI (when applicable) */ /*! ANI (when applicable) */
char *ani; char *ani;
/*! ANI II (when applicable) */ /*! ANI II (when applicable) */
char *ani2; char *ani2;
/*! Destination Number */ /*! Destination Number */
char *destination_number; char *destination_number;
/*! channel name */ /*! channel name */
char *chan_name; char *chan_name;
/*! unique id */ /*! unique id */
char *uuid; char *uuid;
}; };
/*! \brief An Abstract Representation of a dialplan Application */ /*! \brief An Abstract Representation of a dialplan Application */
struct switch_caller_application { struct switch_caller_application {
/*! The name of the registered application to call */ /*! The name of the registered application to call */
char *application_name; char *application_name;
/*! An optional argument string to pass to the application */ /*! An optional argument string to pass to the application */
char *application_data; char *application_data;
/*! A function pointer to the application */ /*! A function pointer to the application */
switch_application_function application_function; switch_application_function application_function;
struct switch_caller_application *next; struct switch_caller_application *next;
}; };
/*! \brief An Abstract Representation of a dialplan extension */ /*! \brief An Abstract Representation of a dialplan extension */
struct switch_caller_extension { struct switch_caller_extension {
/*! The name of the extension */ /*! The name of the extension */
char *extension_name; char *extension_name;
/*! The number of the extension */ /*! The number of the extension */
char *extension_number; char *extension_number;
/*! Pointer to the current application for this extension */ /*! Pointer to the current application for this extension */
struct switch_caller_application *current_application; struct switch_caller_application *current_application;
/*! Pointer to the last application for this extension */ /*! Pointer to the last application for this extension */
struct switch_caller_application *last_application; struct switch_caller_application *last_application;
/*! Pointer to the entire stack of applications for this extension */ /*! Pointer to the entire stack of applications for this extension */
struct switch_caller_application *applications; struct switch_caller_application *applications;
}; };
/*! /*!
\brief Create a new extension with desired parameters \brief Create a new extension with desired parameters
\param session session associated with the extension (bound by scope) \param session session associated with the extension (bound by scope)
\param extension_name extension name \param extension_name extension name
\param extension_number extension number \param extension_number extension number
\return a new extension object allocated from the session's memory pool \return a new extension object allocated from the session's memory pool
*/ */
SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_core_session *session, SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_core_session *session,
char *extension_name, char *extension_name,
char *extension_number char *extension_number
); );
/*! /*!
\brief Add an application (instruction) to the given extension \brief Add an application (instruction) to the given extension
\param session session associated with the extension (bound by scope) \param session session associated with the extension (bound by scope)
\param caller_extension extension to add the application to \param caller_extension extension to add the application to
\param application_name the name of the application \param application_name the name of the application
\param extra_data optional argument to the application \param extra_data optional argument to the application
*/ */
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session *session, SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session *session,
switch_caller_extension *caller_extension, switch_caller_extension *caller_extension,
char *application_name, char *application_name,
char *extra_data); char *extra_data);
/*! /*!
\brief Create a new caller profile object \brief Create a new caller profile object
\param pool memory pool to use \param pool memory pool to use
\param dialplan name of the dialplan module in use \param dialplan name of the dialplan module in use
\param caller_id_name caller ID name \param caller_id_name caller ID name
\param caller_id_number caller ID number \param caller_id_number caller ID number
\param network_addr network address \param network_addr network address
\param ani ANI information \param ani ANI information
\param ani2 ANI II information \param ani2 ANI II information
\param destination_number destination number \param destination_number destination number
\return a new profile object allocated from the session's memory pool \return a new profile object allocated from the session's memory pool
*/ */
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool *pool, SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool *pool,
char *dialplan, char *dialplan,
char *caller_id_name, char *caller_id_name,
char *caller_id_number, char *caller_id_number,
char *network_addr, char *network_addr,
char *ani, char *ani,
char *ani2, char *ani2,
char *destination_number); char *destination_number);
/*! /*!
\brief Clone an existing caller profile object \brief Clone an existing caller profile object
\param session session associated with the profile (bound by scope) \param session session associated with the profile (bound by scope)
\param tocopy the existing profile \param tocopy the existing profile
*/ */
SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_session *session, SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_session *session,
switch_caller_profile *tocopy); switch_caller_profile *tocopy);
/*! /*!
\brief Add headers to an existing event in regards to a specific profile \brief Add headers to an existing event in regards to a specific profile
\param caller_profile the desired profile \param caller_profile the desired profile
\param prefix a prefix string to all of the field names (for uniqueness) \param prefix a prefix string to all of the field names (for uniqueness)
\param event the event to add the information to \param event the event to add the information to
*/ */
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event); SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -47,25 +47,32 @@ extern "C" { ...@@ -47,25 +47,32 @@ extern "C" {
#include <switch.h> #include <switch.h>
///\defgroup log Logger Routines
///\ingroup core1
///\{
/*! \brief Log Data
*/
typedef struct { typedef struct {
/*! The complete log message */
char *data; char *data;
/*! The file where the message originated */
char *file; char *file;
char *func; /*! The line number where the message originated */
char *content;
uint32_t line; uint32_t line;
/*! The function where the message originated */
char *func;
/*! The log level of the message */
switch_log_level level; switch_log_level level;
/*! The time when the log line was sent */
switch_time_t timestamp; switch_time_t timestamp;
/*! A pointer to where the actual content of the message starts (skipping past the preformatted portion) */
char *content;
} switch_log_node; } switch_log_node;
typedef switch_status (*switch_log_function)(const switch_log_node *node, switch_log_level level); typedef switch_status (*switch_log_function)(const switch_log_node *node, switch_log_level level);
/*!
\brief A method akin to printf that allows you to redirect output to a specific log
*/
///\defgroup log Logger Routines
///\ingroup core1
///\{
/*! /*!
\brief Initilize the logging engine \brief Initilize the logging engine
...@@ -100,6 +107,13 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel channel, char *file, ...@@ -100,6 +107,13 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel channel, char *file,
*/ */
SWITCH_DECLARE(switch_status) switch_log_bind_logger(switch_log_function function, switch_log_level level); SWITCH_DECLARE(switch_status) switch_log_bind_logger(switch_log_function function, switch_log_level level);
/*!
\brief Return the name of the specified log level
\param level the level
\return the name of the log level
*/
SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level level);
///\} ///\}
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论