📄 pjsua.h
字号:
* Log decoration.
*/
unsigned decor;
/**
* Optional log filename.
*/
pj_str_t log_filename;
/**
* Optional callback function to be called to write log to
* application specific device. This function will be called for
* log messages on input verbosity level.
*
* \par Sample Python Syntax:
* \code
# level: integer
# data: string
# len: integer
def cb(level, data, len):
print data,
* \endcode
*/
void (*cb)(int level, const char *data, pj_size_t len);
} pjsua_logging_config;
/**
* Use this function to initialize logging config.
*
* @param cfg The logging config to be initialized.
*
* \par Python Syntax:
* The Python function instantiates and initialize the logging config:
* \code
logging_cfg = py_pjsua.logging_config_default()
* \endcode
*/
PJ_INLINE(void) pjsua_logging_config_default(pjsua_logging_config *cfg)
{
pj_bzero(cfg, sizeof(*cfg));
cfg->msg_logging = PJ_TRUE;
cfg->level = 5;
cfg->console_level = 4;
cfg->decor = PJ_LOG_HAS_SENDER | PJ_LOG_HAS_TIME |
PJ_LOG_HAS_MICRO_SEC | PJ_LOG_HAS_NEWLINE;
}
/**
* Use this function to duplicate logging config.
*
* @param pool Pool to use.
* @param dst Destination config.
* @param src Source config.
*
* \par Python Syntax:
* Not available (for now). Ideally we should be able to just assign
* one config to another, but this has not been tested.
*/
PJ_INLINE(void) pjsua_logging_config_dup(pj_pool_t *pool,
pjsua_logging_config *dst,
const pjsua_logging_config *src)
{
pj_memcpy(dst, src, sizeof(*src));
pj_strdup_with_null(pool, &dst->log_filename, &src->log_filename);
}
/**
* This structure describes application callback to receive various event
* notification from PJSUA-API. All of these callbacks are OPTIONAL,
* although definitely application would want to implement some of
* the important callbacks (such as \a on_incoming_call).
*
* \par Python Syntax:
* This callback structure is embedded on pjsua_config structure.
*/
typedef struct pjsua_callback
{
/**
* Notify application when invite state has changed.
* Application may then query the call info to get the
* detail call states by calling pjsua_call_get_info() function.
*
* @param call_id The call index.
* @param e Event which causes the call state to change.
*
* \par Python Syntax:
* \code
# call_id: integer
# e: an opaque object
def on_call_state(call_id, e):
return
* \endcode
*/
void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e);
/**
* Notify application on incoming call.
*
* @param acc_id The account which match the incoming call.
* @param call_id The call id that has just been created for
* the call.
* @param rdata The incoming INVITE request.
*
* \par Python Syntax:
* \code
# acc_id: integer
# call_id: integer
# rdata: an opaque object
def on_incoming_call(acc_id, call_id, rdata):
return
* \endcode
*/
void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata);
/**
* Notify application when media state in the call has changed.
* Normal application would need to implement this callback, e.g.
* to connect the call's media to sound device.
*
* @param call_id The call index.
*
* \par Python Syntax:
* \code
# call_id: integer
def on_call_media_state(call_id):
return
* \endcode
*/
void (*on_call_media_state)(pjsua_call_id call_id);
/**
* Notify application upon incoming DTMF digits.
*
* @param call_id The call index.
* @param digit DTMF ASCII digit.
*
* \par Python Syntax:
* \code
# call_id: integer
# digit: integer
def on_dtmf_digit(call_id, digit):
return
* \endcode
*/
void (*on_dtmf_digit)(pjsua_call_id call_id, int digit);
/**
* Notify application on call being transfered (i.e. REFER is received).
* Application can decide to accept/reject transfer request
* by setting the code (default is 200). When this callback
* is not defined, the default behavior is to accept the
* transfer.
*
* @param call_id The call index.
* @param dst The destination where the call will be
* transfered to.
* @param code Status code to be returned for the call transfer
* request. On input, it contains status code 200.
*
* \par Python Syntax:
* \code
# call_id: integer
# dst: string
# code: integer
def on_call_transfer_request(call_id, dst, code):
return code
* \endcode
*/
void (*on_call_transfer_request)(pjsua_call_id call_id,
const pj_str_t *dst,
pjsip_status_code *code);
/**
* Notify application of the status of previously sent call
* transfer request. Application can monitor the status of the
* call transfer request, for example to decide whether to
* terminate existing call.
*
* @param call_id Call ID.
* @param st_code Status progress of the transfer request.
* @param st_text Status progress text.
* @param final If non-zero, no further notification will
* be reported. The st_code specified in
* this callback is the final status.
* @param p_cont Initially will be set to non-zero, application
* can set this to FALSE if it no longer wants
* to receie further notification (for example,
* after it hangs up the call).
*
* \par Python Syntax:
* \code
# call_id: integer
# st_code: integer
# st_text: string
# final: integer
# cont: integer
# return: cont
def on_call_transfer_status(call_id, st_code, st_text, final, cont):
return cont
* \endcode
*/
void (*on_call_transfer_status)(pjsua_call_id call_id,
int st_code,
const pj_str_t *st_text,
pj_bool_t final,
pj_bool_t *p_cont);
/**
* Notify application about incoming INVITE with Replaces header.
* Application may reject the request by setting non-2xx code.
*
* @param call_id The call ID to be replaced.
* @param rdata The incoming INVITE request to replace the call.
* @param st_code Status code to be set by application. Application
* should only return a final status (200-699).
* @param st_text Optional status text to be set by application.
*
* \par Python Syntax:
* \code
# call_id: integer
# rdata: an opaque object
# st_code: integer
# st_text: string
# return: (st_code, st_text) tuple
def on_call_replace_request(call_id, rdata, st_code, st_text):
return st_code, st_text
* \endcode
*/
void (*on_call_replace_request)(pjsua_call_id call_id,
pjsip_rx_data *rdata,
int *st_code,
pj_str_t *st_text);
/**
* Notify application that an existing call has been replaced with
* a new call. This happens when PJSUA-API receives incoming INVITE
* request with Replaces header.
*
* After this callback is called, normally PJSUA-API will disconnect
* \a old_call_id and establish \a new_call_id.
*
* @param old_call_id Existing call which to be replaced with the
* new call.
* @param new_call_id The new call.
* @param rdata The incoming INVITE with Replaces request.
*
* \par Python Syntax:
* \code
# old_call_id: integer
# new_call_id: integer
def on_call_replaced(old_call_id, new_call_id):
return
* \endcode
*/
void (*on_call_replaced)(pjsua_call_id old_call_id,
pjsua_call_id new_call_id);
/**
* Notify application when registration status has changed.
* Application may then query the account info to get the
* registration details.
*
* @param acc_id Account ID.
*
* \par Python Syntax:
* \code
# acc_id: account ID (integer)
def on_reg_state(acc_id):
return
* \endcode
*/
void (*on_reg_state)(pjsua_acc_id acc_id);
/**
* Notify application when the buddy state has changed.
* Application may then query the buddy into to get the details.
*
* @param buddy_id The buddy id.
*
* \par Python Syntax:
* \code
# buddy_id: integer
def on_buddy_state(buddy_id):
return
* \endcode
*/
void (*on_buddy_state)(pjsua_buddy_id buddy_id);
/**
* Notify application on incoming pager (i.e. MESSAGE request).
* Argument call_id will be -1 if MESSAGE request is not related to an
* existing call.
*
* See also \a on_pager2() callback for the version with \a pjsip_rx_data
* passed as one of the argument.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param mime_type MIME type of the message.
* @param body The message content.
*
* \par Python Syntax:
* \code
# call_id: integer
# from: string
# to: string
# contact: string
# mime_type: string
# body: string
def on_pager(call_id, from, to, contact, mime_type, body):
return
* \endcode
*/
void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body);
/**
* This is the alternative version of the \a on_pager() callback with
* \a pjsip_rx_data argument.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param mime_type MIME type of the message.
* @param body The message content.
* @param rdata The incoming MESSAGE request.
*/
void (*on_pager2)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body,
pjsip_rx_data *rdata);
/**
* Notify application about the delivery status of outgoing pager
* request.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param to Destination URI.
* @param body Message body.
* @param user_data Arbitrary data that was specified when sending
* IM message.
* @param status Delivery status.
* @param reason Delivery status reason.
*
* \par Python Syntax
* \code
# call_id: integer
# to: string
# body: string
# user_data: string
# status: integer
# reason: string
def on_pager_status(call_id, to, body, user_data, status, reason):
return
* \endcode
*/
void (*on_pager_status)(pjsua_call_id call_id,
const pj_str_t *to,
const pj_str_t *body,
void *user_data,
pjsip_status_code status,
const pj_str_t *reason);
/**
* Notify application about typing indication.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param is_typing Non-zero if peer is typing, or zero if peer
* has stopped typing a message.
*
* \par Python Syntax
* \code
# call_id: string
# from: string
# to: string
# contact: string
# is_typing: integer
def on_typing(call_id, from, to, contact, is_typing):
return
* \endcode
*/
void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
pj_bool_t is_typing);
} pjsua_callback;
/**
* This structure describes the settings to control the API and
* user agent behavior, and can be specified when calling #pjsua_init().
* Before setting the values, application must call #pjsua_config_default()
* to initialize this structure with the default values.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -