conference.h   conference.h 
/* $Id: conference.h 2506 2009-03-12 18:11:37Z bennylp $ */ /* $Id: conference.h 2728 2009-06-01 13:56:09Z nanang $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 232 skipping to change at line 232
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_conf_add_port( pjmedia_conf *conf, PJ_DECL(pj_status_t) pjmedia_conf_add_port( pjmedia_conf *conf,
pj_pool_t *pool, pj_pool_t *pool,
pjmedia_port *strm_port, pjmedia_port *strm_port,
const pj_str_t *name, const pj_str_t *name,
unsigned *p_slot ); unsigned *p_slot );
/** /**
* <i><b>Warning:</b> This API has been deprecated since 1.3 and will be
* removed in the future release, use #PJMEDIA_SPLITCOMB instead.</i>
*
* Create and add a passive media port to the conference bridge. Unlike * Create and add a passive media port to the conference bridge. Unlike
* "normal" media port that is added with #pjmedia_conf_add_port(), media * "normal" media port that is added with #pjmedia_conf_add_port(), media
* port created with this function will not have its get_frame() and * port created with this function will not have its get_frame() and
* put_frame() called by the bridge; instead, application MUST continuosly * put_frame() called by the bridge; instead, application MUST continuosly
* call these functions to the port, to allow media to flow from/to the * call these functions to the port, to allow media to flow from/to the
* port. * port.
* *
* Upon return of this function, application will be given two objects: * Upon return of this function, application will be given two objects:
* the slot number of the port in the bridge, and pointer to the media * the slot number of the port in the bridge, and pointer to the media
* port where application MUST start calling get_frame() and put_frame() * port where application MUST start calling get_frame() and put_frame()
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 ice_session.h   ice_session.h 
/* $Id: ice_session.h 2642 2009-04-22 17:20:24Z bennylp $ */ /* $Id: ice_session.h 2724 2009-05-29 13:04:03Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 176 skipping to change at line 176
/** /**
* This structure describes ICE component. * This structure describes ICE component.
* A media stream may require multiple components, each of which has * A media stream may require multiple components, each of which has
* to work for the media stream as a whole to work. For media streams * to work for the media stream as a whole to work. For media streams
* based on RTP, there are two components per media stream - one for RTP, * based on RTP, there are two components per media stream - one for RTP,
* and one for RTCP. * and one for RTCP.
*/ */
typedef struct pj_ice_sess_comp typedef struct pj_ice_sess_comp
{ {
/** /**
* The pointer to ICE check which was nominated for this component. * Pointer to ICE check with highest priority which connectivity check
* The value will be NULL if a nominated check has not been found * has been successful. The value will be NULL if a no successful check
* for this component. * has not been found for this component.
*/ */
pj_ice_sess_check *valid_check; pj_ice_sess_check *valid_check;
/** /**
* Pointer to ICE check with highest priority which connectivity check
* has been successful and it has been nominated. The value may be NULL
* if there is no such check yet.
*/
pj_ice_sess_check *nominated_check;
/**
* The STUN session to be used to send and receive STUN messages for th is * The STUN session to be used to send and receive STUN messages for th is
* component. * component.
*/ */
pj_stun_session *stun_sess; pj_stun_session *stun_sess;
} pj_ice_sess_comp; } pj_ice_sess_comp;
/** /**
* Data structure to be attached to internal message processing. * Data structure to be attached to internal message processing.
*/ */
skipping to change at line 543 skipping to change at line 550
pj_sockaddr src_addr; /**< Source address of reque st */ pj_sockaddr src_addr; /**< Source address of reque st */
unsigned src_addr_len; /**< Length of src address. */ unsigned src_addr_len; /**< Length of src address. */
pj_bool_t use_candidate; /**< USE-CANDIDATE is present? */ pj_bool_t use_candidate; /**< USE-CANDIDATE is present? */
pj_uint32_t priority; /**< PRIORITY value in the r eq. */ pj_uint32_t priority; /**< PRIORITY value in the r eq. */
pj_stun_uint64_attr *role_attr; /**< ICE-CONTROLLING/CONTROLLED */ pj_stun_uint64_attr *role_attr; /**< ICE-CONTROLLING/CONTROLLED */
} pj_ice_rx_check; } pj_ice_rx_check;
/** /**
* This structure describes various ICE session options. Application
* configure the ICE session with these options by calling
* #pj_ice_sess_set_options().
*/
typedef struct pj_ice_sess_options
{
/**
* Specify whether to use aggressive nomination.
*/
pj_bool_t aggressive;
/**
* For controlling agent if it uses regular nomination, specify the del
ay
* to perform nominated check (connectivity check with USE-CANDIDATE
* attribute) after all components have a valid pair.
*
* Default value is PJ_ICE_NOMINATED_CHECK_DELAY.
*/
unsigned nominated_check_delay;
/**
* For a controlled agent, specify how long it wants to wait (in
* milliseconds) for the controlling agent to complete sending
* connectivity check with nominated flag set to true for all component
s
* after the controlled agent has found that all connectivity checks in
* its checklist have been completed and there is at least one successf
ul
* (but not nominated) check for every component.
*
* Default value for this option is
* ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT. Specify -1 to disable
* this timer.
*/
int controlled_agent_want_nom_timeout;
} pj_ice_sess_options;
/**
* This structure describes the ICE session. For this version of PJNATH, * This structure describes the ICE session. For this version of PJNATH,
* an ICE session corresponds to a single media stream (unlike the ICE * an ICE session corresponds to a single media stream (unlike the ICE
* session described in the ICE standard where an ICE session covers the * session described in the ICE standard where an ICE session covers the
* whole media and may consist of multiple media streams). The decision * whole media and may consist of multiple media streams). The decision
* to support only a single media session was chosen for simplicity, * to support only a single media session was chosen for simplicity,
* while still allowing application to utilize multiple media streams by * while still allowing application to utilize multiple media streams by
* creating multiple ICE sessions, one for each media stream. * creating multiple ICE sessions, one for each media stream.
*/ */
struct pj_ice_sess struct pj_ice_sess
{ {
char obj_name[PJ_MAX_OBJ_NAME]; /**< Object name. */ char obj_name[PJ_MAX_OBJ_NAME]; /**< Object name. */
pj_pool_t *pool; /**< Pool instance. */ pj_pool_t *pool; /**< Pool instance. */
void *user_data; /**< App. data. */ void *user_data; /**< App. data. */
pj_mutex_t *mutex; /**< Mutex. */ pj_mutex_t *mutex; /**< Mutex. */
pj_ice_sess_role role; /**< ICE role. */ pj_ice_sess_role role; /**< ICE role. */
pj_ice_sess_options opt; /**< Options */
pj_timestamp tie_breaker; /**< Tie breaker value */ pj_timestamp tie_breaker; /**< Tie breaker value */
pj_uint8_t *prefs; /**< Type preference. */ pj_uint8_t *prefs; /**< Type preference. */
pj_bool_t is_nominating; /**< Nominating stage */
pj_bool_t is_complete; /**< Complete? */ pj_bool_t is_complete; /**< Complete? */
pj_status_t ice_status; /**< Error statu s. */ pj_status_t ice_status; /**< Error statu s. */
pj_timer_entry completion_timer; /**< To call callback. */ pj_timer_entry timer; /**< ICE timer. */
pj_ice_sess_cb cb; /**< Callback. */ pj_ice_sess_cb cb; /**< Callback. */
pj_stun_config stun_cfg; /**< STUN settings. */ pj_stun_config stun_cfg; /**< STUN settings. */
/* STUN credentials */ /* STUN credentials */
pj_str_t tx_ufrag; /**< Remote ufrag. */ pj_str_t tx_ufrag; /**< Remote ufrag. */
pj_str_t tx_uname; /**< Uname for TX. */ pj_str_t tx_uname; /**< Uname for TX. */
pj_str_t tx_pass; /**< Remote password. */ pj_str_t tx_pass; /**< Remote password. */
pj_str_t rx_ufrag; /**< Local ufrag. */ pj_str_t rx_ufrag; /**< Local ufrag. */
pj_str_t rx_uname; /**< Uname for RX */ pj_str_t rx_uname; /**< Uname for RX */
pj_str_t rx_pass; /**< Local password. */ pj_str_t rx_pass; /**< Local password. */
/* Components */ /* Components */
unsigned comp_cnt; /**< # of components. */ unsigned comp_cnt; /**< # of components. */
pj_ice_sess_comp comp[PJ_ICE_MAX_COMP]; /**< Component array */ pj_ice_sess_comp comp[PJ_ICE_MAX_COMP]; /**< Component array */
unsigned comp_ka; /**< Next comp for KA */
/* Local candidates */ /* Local candidates */
unsigned lcand_cnt; /**< # of local cand. */ unsigned lcand_cnt; /**< # of local cand. */
pj_ice_sess_cand lcand[PJ_ICE_MAX_CAND]; /**< Array of cand. */ pj_ice_sess_cand lcand[PJ_ICE_MAX_CAND]; /**< Array of cand. */
/* Remote candidates */ /* Remote candidates */
unsigned rcand_cnt; /**< # of remote cand. */ unsigned rcand_cnt; /**< # of remote cand. */
pj_ice_sess_cand rcand[PJ_ICE_MAX_CAND]; /**< Array of cand. */ pj_ice_sess_cand rcand[PJ_ICE_MAX_CAND]; /**< Array of cand. */
/** Array of transport datas */ /** Array of transport datas */
skipping to change at line 642 skipping to change at line 689
* @param foundation Pointer to receive the foundation string. * @param foundation Pointer to receive the foundation string.
* @param type Candidate type. * @param type Candidate type.
* @param base_addr Base address of the candidate. * @param base_addr Base address of the candidate.
*/ */
PJ_DECL(void) pj_ice_calc_foundation(pj_pool_t *pool, PJ_DECL(void) pj_ice_calc_foundation(pj_pool_t *pool,
pj_str_t *foundation, pj_str_t *foundation,
pj_ice_cand_type type, pj_ice_cand_type type,
const pj_sockaddr *base_addr); const pj_sockaddr *base_addr);
/** /**
* Initialize ICE session options with library default values.
*
* @param opt ICE session options.
*/
PJ_DECL(void) pj_ice_sess_options_default(pj_ice_sess_options *opt);
/**
* Create ICE session with the specified role and number of components. * Create ICE session with the specified role and number of components.
* Application would typically need to create an ICE session before * Application would typically need to create an ICE session before
* sending an offer or upon receiving one. After the session is created, * sending an offer or upon receiving one. After the session is created,
* application can register candidates to the ICE session by calling * application can register candidates to the ICE session by calling
* #pj_ice_sess_add_cand() function. * #pj_ice_sess_add_cand() function.
* *
* @param stun_cfg The STUN configuration settings, containing among * @param stun_cfg The STUN configuration settings, containing among
* other things the timer heap instance to be used * other things the timer heap instance to be used
* by the ICE session. * by the ICE session.
* @param name Optional name to identify this ICE instance in * @param name Optional name to identify this ICE instance in
skipping to change at line 675 skipping to change at line 729
PJ_DECL(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg, PJ_DECL(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg,
const char *name, const char *name,
pj_ice_sess_role role, pj_ice_sess_role role,
unsigned comp_cnt, unsigned comp_cnt,
const pj_ice_sess_cb *cb, const pj_ice_sess_cb *cb,
const pj_str_t *local_ufrag, const pj_str_t *local_ufrag,
const pj_str_t *local_passwd, const pj_str_t *local_passwd,
pj_ice_sess **p_ice); pj_ice_sess **p_ice);
/** /**
* Get the value of various options of the ICE session.
*
* @param ice The ICE session.
* @param opt The options to be initialized with the values
* from the ICE session.
*
* @return PJ_SUCCESS on success, or the appropriate error.
*/
PJ_DECL(pj_status_t) pj_ice_sess_get_options(pj_ice_sess *ice,
pj_ice_sess_options *opt);
/**
* Specify various options for this ICE session. Application MUST only
* call this function after the ICE session has been created but before
* any connectivity check is started.
*
* Application should call #pj_ice_sess_get_options() to initialize the
* options with their default values.
*
* @param ice The ICE session.
* @param opt Options to be applied to the ICE session.
*
* @return PJ_SUCCESS on success, or the appropriate error.
*/
PJ_DECL(pj_status_t) pj_ice_sess_set_options(pj_ice_sess *ice,
const pj_ice_sess_options *opt)
;
/**
* Destroy ICE session. This will cancel any connectivity checks currently * Destroy ICE session. This will cancel any connectivity checks currently
* running, if any, and any other events scheduled by this session, as well * running, if any, and any other events scheduled by this session, as well
* as all memory resources. * as all memory resources.
* *
* @param ice ICE session instance. * @param ice ICE session instance.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pj_ice_sess_destroy(pj_ice_sess *ice); PJ_DECL(pj_status_t) pj_ice_sess_destroy(pj_ice_sess *ice);
 End of changes. 10 change blocks. 
5 lines changed or deleted 91 lines changed or added


 ice_strans.h   ice_strans.h 
/* $Id: ice_strans.h 2642 2009-04-22 17:20:24Z bennylp $ */ /* $Id: ice_strans.h 2724 2009-05-29 13:04:03Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 196 skipping to change at line 196
/** /**
* DNS resolver to be used to resolve servers. If DNS SRV * DNS resolver to be used to resolve servers. If DNS SRV
* resolution is required, the resolver must be set. * resolution is required, the resolver must be set.
* *
* The default value is NULL. * The default value is NULL.
*/ */
pj_dns_resolver *resolver; pj_dns_resolver *resolver;
/** /**
* This contains various STUN session options. Once the ICE stream
* transport is created, application may also change the options
* with #pj_ice_strans_set_options().
*/
pj_ice_sess_options opt;
/**
* STUN and local transport settings. This specifies the * STUN and local transport settings. This specifies the
* settings for local UDP socket, which will be resolved * settings for local UDP socket, which will be resolved
* to get the STUN mapped address. * to get the STUN mapped address.
*/ */
struct { struct {
/** /**
* Optional configuration for STUN transport. The default * Optional configuration for STUN transport. The default
* value will be initialized with #pj_stun_sock_cfg_default(). * value will be initialized with #pj_stun_sock_cfg_default().
*/ */
pj_stun_sock_cfg cfg; pj_stun_sock_cfg cfg;
/** /**
* Disable host candidates. When this option is set, no * Maximum number of host candidates to be added. If the
* host candidates will be added. * value is zero, no host candidates will be added.
* *
* Default: PJ_FALSE * Default: 64
*/ */
pj_bool_t no_host_cands; unsigned max_host_cands;
/** /**
* Include loopback addresses in the host candidates. * Include loopback addresses in the host candidates.
* *
* Default: PJ_FALSE * Default: PJ_FALSE
*/ */
pj_bool_t loop_addr; pj_bool_t loop_addr;
/** /**
* Specify the STUN server domain or hostname or IP address. * Specify the STUN server domain or hostname or IP address.
skipping to change at line 380 skipping to change at line 387
/** /**
* Get the user data associated with the ICE stream transport. * Get the user data associated with the ICE stream transport.
* *
* @param ice_st The ICE stream transport. * @param ice_st The ICE stream transport.
* *
* @return The user data. * @return The user data.
*/ */
PJ_DECL(void*) pj_ice_strans_get_user_data(pj_ice_strans *ice_st); PJ_DECL(void*) pj_ice_strans_get_user_data(pj_ice_strans *ice_st);
/** /**
* Get the value of various options of the ICE stream transport.
*
* @param ice_st The ICE stream transport.
* @param opt The options to be initialized with the values
* from the ICE stream transport.
*
* @return PJ_SUCCESS on success, or the appropriate error.
*/
PJ_DECL(pj_status_t) pj_ice_strans_get_options(pj_ice_strans *ice_st,
pj_ice_sess_options *opt);
/**
* Specify various options for this ICE stream transport. Application
* should call #pj_ice_strans_get_options() to initialize the options
* with their default values.
*
* @param ice_st The ICE stream transport.
* @param opt Options to be applied to this ICE stream transport.
*
* @return PJ_SUCCESS on success, or the appropriate error.
*/
PJ_DECL(pj_status_t) pj_ice_strans_set_options(pj_ice_strans *ice_st,
const pj_ice_sess_options *op
t);
/**
* Initialize the ICE session in the ICE stream transport. * Initialize the ICE session in the ICE stream transport.
* When application is about to send an offer containing ICE capability, * When application is about to send an offer containing ICE capability,
* or when it receives an offer containing ICE capability, it must * or when it receives an offer containing ICE capability, it must
* call this function to initialize the internal ICE session. This would * call this function to initialize the internal ICE session. This would
* register all transport address aliases for each component to the ICE * register all transport address aliases for each component to the ICE
* session as candidates. Then application can enumerate all local * session as candidates. Then application can enumerate all local
* candidates by calling #pj_ice_strans_enum_cands(), and encode these * candidates by calling #pj_ice_strans_enum_cands(), and encode these
* candidates in the SDP to be sent to remote agent. * candidates in the SDP to be sent to remote agent.
* *
* @param ice_st The ICE stream transport. * @param ice_st The ICE stream transport.
 End of changes. 6 change blocks. 
5 lines changed or deleted 38 lines changed or added


 pjsua.h   pjsua.h 
/* $Id: pjsua.h 2686 2009-05-07 16:56:04Z bennylp $ */ /* $Id: pjsua.h 2762 2009-06-15 16:03:40Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 55 skipping to change at line 55
/* Include all PJLIB-UTIL headers. */ /* Include all PJLIB-UTIL headers. */
#include <pjlib-util.h> #include <pjlib-util.h>
/* Include all PJLIB headers. */ /* Include all PJLIB headers. */
#include <pjlib.h> #include <pjlib.h>
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* @defgroup PJSUA_LIB PJSUA API - High Level Softphone API for C/C++ and P ython * @defgroup PJSUA_LIB PJSUA API - High Level Softphone API
* @brief Very high level API for constructing SIP UA applications. * @brief Very high level API for constructing SIP UA applications.
* @{ * @{
* *
* @section pjsua_api_intro A SIP User Agent API for C/C++ and Python * @section pjsua_api_intro A SIP User Agent API for C/C++
* *
* PJSUA API is very high level API, available for C/C++ and Python languag * PJSUA API is very high level API for constructing SIP multimedia user ag
e, ent
* for constructing SIP multimedia user agent
* applications. It wraps together the signaling and media functionalities * applications. It wraps together the signaling and media functionalities
* into an easy to use call API, provides account management, buddy * into an easy to use call API, provides account management, buddy
* management, presence, instant messaging, along with multimedia * management, presence, instant messaging, along with multimedia
* features such as conferencing, file streaming, local playback, * features such as conferencing, file streaming, local playback,
* voice recording, and so on. * voice recording, and so on.
* *
* @subsection pjsua_for_c_cpp C/C++ Binding * @subsection pjsua_for_c_cpp C/C++ Binding
* Application must link with <b>pjsua-lib</b> to use this API. In addition , * Application must link with <b>pjsua-lib</b> to use this API. In addition ,
* this library depends on the following libraries: * this library depends on the following libraries:
* - <b>pjsip-ua</b>, * - <b>pjsip-ua</b>,
skipping to change at line 85 skipping to change at line 84
* - <b>pjmedia</b>, * - <b>pjmedia</b>,
* - <b>pjmedia-codec</b>, * - <b>pjmedia-codec</b>,
* - <b>pjlib-util</b>, and * - <b>pjlib-util</b>, and
* - <b>pjlib</b>, * - <b>pjlib</b>,
* *
* so application must also link with these libraries as well. For more * so application must also link with these libraries as well. For more
* information, please refer to * information, please refer to
* <A HREF="http://www.pjsip.org/using.htm">Getting Started with PJSIP</A> * <A HREF="http://www.pjsip.org/using.htm">Getting Started with PJSIP</A>
* page. * page.
* *
* @subsection pjsua_for_python Python Binding
*
* The Python binding for PJSUA-API is implemented by <b>py_pjsua</b>
* module, in <tt>pjsip-apps/py_pjsua</tt> directory. This module is
* built by building <tt>py_pjsua</tt> project in <tt>pjsip_apps</tt>
* Visual Studio workspace, or by invoking the usual <tt>setup.py</tt>
* Python installer script.
*
* The Python script then can import the PJSUA-API Python module by
* using <b>import py_pjsua</b> construct as usual.
*
*
* @section pjsua_samples * @section pjsua_samples
* *
* Few samples are provided both in C and Python. * Few samples are provided:
* *
- @ref page_pjsip_sample_simple_pjsuaua_c\n - @ref page_pjsip_sample_simple_pjsuaua_c\n
Very simple SIP User Agent with registration, call, and media, using Very simple SIP User Agent with registration, call, and media, using
PJSUA-API, all in under 200 lines of code. PJSUA-API, all in under 200 lines of code.
- @ref page_pjsip_samples_pjsua\n - @ref page_pjsip_samples_pjsua\n
This is the reference implementation for PJSIP and PJMEDIA. This is the reference implementation for PJSIP and PJMEDIA.
PJSUA is a console based application, designed to be simple enough PJSUA is a console based application, designed to be simple enough
to be readble, but powerful enough to demonstrate all features to be readble, but powerful enough to demonstrate all features
available in PJSIP and PJMEDIA.\n available in PJSIP and PJMEDIA.\n
- Python sample\n
For a real simple Python sample application, have a look at
<A HREF="http://www.pjsip.org/trac/browser/pjproject/trunk/pjsip-apps/s
rc/py_pjsua/pjsua_app.py">
<tt>pjsip-apps/src/py_pjsua/pjsua_app.py</tt></A> file.
* @section root_using_pjsua_lib Using PJSUA API * @section root_using_pjsua_lib Using PJSUA API
* *
* Please refer to @ref PJSUA_LIB_BASE on how to create and initialize the API. * Please refer to @ref PJSUA_LIB_BASE on how to create and initialize the API.
* And then see the Modules on the bottom of this page for more information * And then see the Modules on the bottom of this page for more information
* about specific subject. * about specific subject.
*/ */
/************************************************************************** *** /************************************************************************** ***
* BASE API * BASE API
*/ */
skipping to change at line 140 skipping to change at line 122
* @brief Basic application creation/initialization, logging configuration, etc. * @brief Basic application creation/initialization, logging configuration, etc.
* @{ * @{
* *
* The base PJSUA API controls PJSUA creation, initialization, and startup, and * The base PJSUA API controls PJSUA creation, initialization, and startup, and
* also provides various auxiliary functions. * also provides various auxiliary functions.
* *
* @section using_pjsua_lib Using PJSUA Library * @section using_pjsua_lib Using PJSUA Library
* *
* @subsection creating_pjsua_lib Creating PJSUA * @subsection creating_pjsua_lib Creating PJSUA
* *
* Before anything else, application must create PJSUA by calling #pjsua_cr * Before anything else, application must create PJSUA by calling
eate() * #pjsua_create().
* (or <tt>py_pjsua.create()</tt> from Python).
* This, among other things, will initialize PJLIB, which is crucial before * This, among other things, will initialize PJLIB, which is crucial before
* any PJLIB functions can be called, PJLIB-UTIL, and create a SIP endpoint . * any PJLIB functions can be called, PJLIB-UTIL, and create a SIP endpoint .
* *
* After this function is called, application can create a memory pool (wit h * After this function is called, application can create a memory pool (wit h
* #pjsua_pool_create()) and read configurations from command line or file to * #pjsua_pool_create()) and read configurations from command line or file to
* build the settings to initialize PJSUA below. * build the settings to initialize PJSUA below.
* *
* @subsection init_pjsua_lib Initializing PJSUA * @subsection init_pjsua_lib Initializing PJSUA
* *
* After PJSUA is created, application can initialize PJSUA by calling * After PJSUA is created, application can initialize PJSUA by calling
skipping to change at line 204 skipping to change at line 186
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error initializing pjsua", status); pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
return status; return status;
} }
. .
... ...
} }
\endcode \endcode
* *
* *
* @subsubsection init_pjsua_lib_python PJSUA-LIB Initialization (in Python
)
* Sample code to initialize PJSUA in Python code:
\code
import py_pjsua
#
# Initialize pjsua.
#
def app_init():
# Create pjsua before anything else
status = py_pjsua.create()
if status != 0:
err_exit("pjsua create() error", status)
# We use default logging config for this sample
log_cfg = py_pjsua.logging_config_default()
# Create and initialize pjsua config
# Note: for this Python module, thread_cnt must be 0 since Python
# doesn't like to be called from alien thread (pjsua's thread
# in this case)
ua_cfg = py_pjsua.config_default()
ua_cfg.thread_cnt = 0
ua_cfg.user_agent = "PJSUA/Python 0.1"
# Override callbacks. At the very least application would want to
# override the call callbacks in pjsua_config
ua_cfg.cb.on_incoming_call = ...
ua_cfg.cb.on_call_state = ...
# Use default media config for this cample
med_cfg = py_pjsua.media_config_default()
#
# Initialize pjsua!!
#
status = py_pjsua.init(ua_cfg, log_cfg, med_cfg)
if status != 0:
err_exit("pjsua init() error", status)
# Utility: display PJ error and exit
#
def err_exit(title, rc):
py_pjsua.perror(THIS_FILE, title, rc)
exit(1)
\endcode
* @subsection other_init_pjsua_lib Other Initialization * @subsection other_init_pjsua_lib Other Initialization
* *
* After PJSUA is initialized with #pjsua_init(), application will normally * After PJSUA is initialized with #pjsua_init(), application will normally
* need/want to perform the following tasks: * need/want to perform the following tasks:
* *
* - create SIP transport with #pjsua_transport_create(). Application woul d * - create SIP transport with #pjsua_transport_create(). Application woul d
* to call #pjsua_transport_create() for each transport types that it * to call #pjsua_transport_create() for each transport types that it
* wants to support (for example, UDP, TCP, and TLS). Please see * wants to support (for example, UDP, TCP, and TLS). Please see
* @ref PJSUA_LIB_TRANSPORT section for more info. * @ref PJSUA_LIB_TRANSPORT section for more info.
skipping to change at line 309 skipping to change at line 242
while (1) { while (1) {
char choice[10]; char choice[10];
printf("Select menu: "); printf("Select menu: ");
fgets(choice, sizeof(choice), stdin); fgets(choice, sizeof(choice), stdin);
... ...
} }
} }
\endcode \endcode
* @subsubsection starting_pjsua_lib_python Python Example for starting PJS
UA
* For Python, starting PJSUA-LIB takes one more step, that is to initializ
e
* Python worker thread to poll PJSUA-LIB. This step is necessary because
* Python doesn't like it when it is called by an "alien" thread (that is,
* thread that is not created using Python API).
*
* Because of this, we cannot use a worker thread in PJSUA-LIB, because the
n
* the Python callback will be called by an "alien" thread and this would
* crash Python (or raise assert() probably).
*
* So because worker thread is disabled, we need to create a worker thread
* in Python. Note that this may not be necessary if we're creating a
* GUI application, because then we can attach, for example, a GUI timer
* object to poll the PJSUA-LIB. But because we're creating a console
* application which will block at <tt>sys.stdin.readline()</tt>, we need
* to have a worker thread to poll PJSUA-LIB.
\code
import thread
C_QUIT = 0
def app_start():
# Done with initialization, start pjsua!!
#
status = py_pjsua.start()
if status != 0:
py_pjsua.destroy()
err_exit("Error starting pjsua!", status)
# Start worker thread
thr = thread.start_new(worker_thread_main, (0,))
print "PJSUA Started!!"
#
# Worker thread function.
# Python doesn't like it when it's called from an alien thread
# (pjsua's worker thread, in this case), so for Python we must
# disable worker thread in pjsua and poll pjsua from Python instead.
#
def worker_thread_main(arg):
global C_QUIT
thread_desc = 0
status = py_pjsua.thread_register("python worker", thread_desc)
if status != 0:
py_pjsua.perror(THIS_FILE, "Error registering thread", statu
s)
else:
while C_QUIT == 0:
py_pjsua.handle_events(50)
print "Worker thread quitting.."
C_QUIT = 2
\endcode
*/ */
/** Constant to identify invalid ID for all sorts of IDs. */ /** Constant to identify invalid ID for all sorts of IDs. */
#define PJSUA_INVALID_ID (-1) #define PJSUA_INVALID_ID (-1)
/** Call identification */ /** Call identification */
typedef int pjsua_call_id; typedef int pjsua_call_id;
/** Account identification */ /** Account identification */
typedef int pjsua_acc_id; typedef int pjsua_acc_id;
skipping to change at line 427 skipping to change at line 305
#ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING #ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
#define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 1 #define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 1
#endif #endif
#endif #endif
/** /**
* Logging configuration, which can be (optionally) specified when calling * Logging configuration, which can be (optionally) specified when calling
* #pjsua_init(). Application must call #pjsua_logging_config_default() to * #pjsua_init(). Application must call #pjsua_logging_config_default() to
* initialize this structure with the default values. * initialize this structure with the default values.
*
* \par Sample Python Syntax:
* \code
# Python type: py_pjsua.Logging_Config
log_cfg = py_pjsua.logging_config_default()
log_cfg.level = 4
* \endcode
*/ */
typedef struct pjsua_logging_config typedef struct pjsua_logging_config
{ {
/** /**
* Log incoming and outgoing SIP message? Yes! * Log incoming and outgoing SIP message? Yes!
*/ */
pj_bool_t msg_logging; pj_bool_t msg_logging;
/** /**
* Input verbosity level. Value 5 is reasonable. * Input verbosity level. Value 5 is reasonable.
skipping to change at line 477 skipping to change at line 347
* file instead of overwriting it. * file instead of overwriting it.
* *
* Default is 0. * Default is 0.
*/ */
unsigned log_file_flags; unsigned log_file_flags;
/** /**
* Optional callback function to be called to write log to * Optional callback function to be called to write log to
* application specific device. This function will be called for * application specific device. This function will be called for
* log messages on input verbosity level. * 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, int len); void (*cb)(int level, const char *data, int len);
} pjsua_logging_config; } pjsua_logging_config;
/** /**
* Use this function to initialize logging config. * Use this function to initialize logging config.
* *
* @param cfg The logging config to be initialized. * @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_DECL(void) pjsua_logging_config_default(pjsua_logging_config *cfg); PJ_DECL(void) pjsua_logging_config_default(pjsua_logging_config *cfg);
/** /**
* Use this function to duplicate logging config. * Use this function to duplicate logging config.
* *
* @param pool Pool to use. * @param pool Pool to use.
* @param dst Destination config. * @param dst Destination config.
* @param src Source 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_DECL(void) pjsua_logging_config_dup(pj_pool_t *pool, PJ_DECL(void) pjsua_logging_config_dup(pj_pool_t *pool,
pjsua_logging_config *dst, pjsua_logging_config *dst,
const pjsua_logging_config *src); const pjsua_logging_config *src);
/** /**
* This structure describes application callback to receive various event * This structure describes application callback to receive various event
* notification from PJSUA-API. All of these callbacks are OPTIONAL, * notification from PJSUA-API. All of these callbacks are OPTIONAL,
* although definitely application would want to implement some of * although definitely application would want to implement some of
* the important callbacks (such as \a on_incoming_call). * 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 typedef struct pjsua_callback
{ {
/** /**
* Notify application when invite state has changed. * Notify application when invite state has changed.
* Application may then query the call info to get the * Application may then query the call info to get the
* detail call states by calling pjsua_call_get_info() function. * detail call states by calling pjsua_call_get_info() function.
* *
* @param call_id The call index. * @param call_id The call index.
* @param e Event which causes the call state to change. * @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); void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e);
/** /**
* Notify application on incoming call. * Notify application on incoming call.
* *
* @param acc_id The account which match the incoming call. * @param acc_id The account which match the incoming call.
* @param call_id The call id that has just been created for * @param call_id The call id that has just been created for
* the call. * the call.
* @param rdata The incoming INVITE request. * @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, void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata); pjsip_rx_data *rdata);
/** /**
* This is a general notification callback which is called whenever * This is a general notification callback which is called whenever
* a transaction within the call has changed state. Application can * a transaction within the call has changed state. Application can
* implement this callback for example to monitor the state of * implement this callback for example to monitor the state of
* outgoing requests, or to answer unhandled incoming requests * outgoing requests, or to answer unhandled incoming requests
* (such as INFO) with a final response. * (such as INFO) with a final response.
skipping to change at line 594 skipping to change at line 422
pjsip_event *e); pjsip_event *e);
/** /**
* Notify application when media state in the call has changed. * Notify application when media state in the call has changed.
* Normal application would need to implement this callback, e.g. * Normal application would need to implement this callback, e.g.
* to connect the call's media to sound device. When ICE is used, * to connect the call's media to sound device. When ICE is used,
* this callback will also be called to report ICE negotiation * this callback will also be called to report ICE negotiation
* failure. * failure.
* *
* @param call_id The call index. * @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); void (*on_call_media_state)(pjsua_call_id call_id);
/** /**
* Notify application when media session is created and before it is * Notify application when media session is created and before it is
* registered to the conference bridge. Application may return differen t * registered to the conference bridge. Application may return differen t
* media port if it has added media processing port to the stream. This * media port if it has added media processing port to the stream. This
* media port then will be added to the conference bridge instead. * media port then will be added to the conference bridge instead.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param sess Media session for the call. * @param sess Media session for the call.
* @param stream_idx Stream index in the media session. * @param stream_idx Stream index in the media session.
* @param p_port On input, it specifies the media port of the * @param p_port On input, it specifies the media port of the
* stream. Application may modify this pointer to * stream. Application may modify this pointer to
* point to different media port to be registered * point to different media port to be registered
* to the conference bridge. * to the conference bridge.
*
* \par Python:
* Not applicable.
*/ */
void (*on_stream_created)(pjsua_call_id call_id, void (*on_stream_created)(pjsua_call_id call_id,
pjmedia_session *sess, pjmedia_session *sess,
unsigned stream_idx, unsigned stream_idx,
pjmedia_port **p_port); pjmedia_port **p_port);
/** /**
* Notify application when media session has been unregistered from the * Notify application when media session has been unregistered from the
* conference bridge and about to be destroyed. * conference bridge and about to be destroyed.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param sess Media session for the call. * @param sess Media session for the call.
* @param stream_idx Stream index in the media session. * @param stream_idx Stream index in the media session.
*
* \par Python:
* Not applicable.
*/ */
void (*on_stream_destroyed)(pjsua_call_id call_id, void (*on_stream_destroyed)(pjsua_call_id call_id,
pjmedia_session *sess, pjmedia_session *sess,
unsigned stream_idx); unsigned stream_idx);
/** /**
* Notify application upon incoming DTMF digits. * Notify application upon incoming DTMF digits.
* *
* @param call_id The call index. * @param call_id The call index.
* @param digit DTMF ASCII digit. * @param digit DTMF ASCII digit.
*
* \par Python Syntax:
* \code
# call_id: integer
# digit: digit string
def on_dtmf_digit(call_id, digit):
return
* \endcode
*/ */
void (*on_dtmf_digit)(pjsua_call_id call_id, int digit); void (*on_dtmf_digit)(pjsua_call_id call_id, int digit);
/** /**
* Notify application on call being transfered (i.e. REFER is received) . * Notify application on call being transfered (i.e. REFER is received) .
* Application can decide to accept/reject transfer request * Application can decide to accept/reject transfer request
* by setting the code (default is 202). When this callback * by setting the code (default is 202). When this callback
* is not defined, the default behavior is to accept the * is not defined, the default behavior is to accept the
* transfer. * transfer.
* *
* @param call_id The call index. * @param call_id The call index.
* @param dst The destination where the call will be * @param dst The destination where the call will be
* transfered to. * transfered to.
* @param code Status code to be returned for the call transfer * @param code Status code to be returned for the call transfer
* request. On input, it contains status code 200. * 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, void (*on_call_transfer_request)(pjsua_call_id call_id,
const pj_str_t *dst, const pj_str_t *dst,
pjsip_status_code *code); pjsip_status_code *code);
/** /**
* Notify application of the status of previously sent call * Notify application of the status of previously sent call
* transfer request. Application can monitor the status of the * transfer request. Application can monitor the status of the
* call transfer request, for example to decide whether to * call transfer request, for example to decide whether to
* terminate existing call. * terminate existing call.
skipping to change at line 703 skipping to change at line 497
* @param call_id Call ID. * @param call_id Call ID.
* @param st_code Status progress of the transfer request. * @param st_code Status progress of the transfer request.
* @param st_text Status progress text. * @param st_text Status progress text.
* @param final If non-zero, no further notification will * @param final If non-zero, no further notification will
* be reported. The st_code specified in * be reported. The st_code specified in
* this callback is the final status. * this callback is the final status.
* @param p_cont Initially will be set to non-zero, application * @param p_cont Initially will be set to non-zero, application
* can set this to FALSE if it no longer wants * can set this to FALSE if it no longer wants
* to receie further notification (for example, * to receie further notification (for example,
* after it hangs up the call). * 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, void (*on_call_transfer_status)(pjsua_call_id call_id,
int st_code, int st_code,
const pj_str_t *st_text, const pj_str_t *st_text,
pj_bool_t final, pj_bool_t final,
pj_bool_t *p_cont); pj_bool_t *p_cont);
/** /**
* Notify application about incoming INVITE with Replaces header. * Notify application about incoming INVITE with Replaces header.
* Application may reject the request by setting non-2xx code. * Application may reject the request by setting non-2xx code.
* *
* @param call_id The call ID to be replaced. * @param call_id The call ID to be replaced.
* @param rdata The incoming INVITE request to replace the call. * @param rdata The incoming INVITE request to replace the call.
* @param st_code Status code to be set by application. Applicatio n * @param st_code Status code to be set by application. Applicatio n
* should only return a final status (200-699). * should only return a final status (200-699).
* @param st_text Optional status text to be set by application. * @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, void (*on_call_replace_request)(pjsua_call_id call_id,
pjsip_rx_data *rdata, pjsip_rx_data *rdata,
int *st_code, int *st_code,
pj_str_t *st_text); pj_str_t *st_text);
/** /**
* Notify application that an existing call has been replaced with * Notify application that an existing call has been replaced with
* a new call. This happens when PJSUA-API receives incoming INVITE * a new call. This happens when PJSUA-API receives incoming INVITE
* request with Replaces header. * request with Replaces header.
* *
* After this callback is called, normally PJSUA-API will disconnect * After this callback is called, normally PJSUA-API will disconnect
* \a old_call_id and establish \a new_call_id. * \a old_call_id and establish \a new_call_id.
* *
* @param old_call_id Existing call which to be replaced with the * @param old_call_id Existing call which to be replaced with the
* new call. * new call.
* @param new_call_id The new call. * @param new_call_id The new call.
* @param rdata The incoming INVITE with Replaces request. * @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, void (*on_call_replaced)(pjsua_call_id old_call_id,
pjsua_call_id new_call_id); pjsua_call_id new_call_id);
/** /**
* Notify application when registration status has changed. * Notify application when registration status has changed.
* Application may then query the account info to get the * Application may then query the account info to get the
* registration details. * registration details.
* *
* @param acc_id Account ID. * @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); void (*on_reg_state)(pjsua_acc_id acc_id);
/** /**
* Notification when incoming SUBSCRIBE request is received. Applicatio n * Notification when incoming SUBSCRIBE request is received. Applicatio n
* may use this callback to authorize the incoming subscribe request * may use this callback to authorize the incoming subscribe request
* (e.g. ask user permission if the request should be granted). * (e.g. ask user permission if the request should be granted).
* *
* If this callback is not implemented, all incoming presence subscript ion * If this callback is not implemented, all incoming presence subscript ion
* requests will be accepted. * requests will be accepted.
skipping to change at line 872 skipping to change at line 622
pjsua_srv_pres *srv_pres, pjsua_srv_pres *srv_pres,
const pj_str_t *remote_uri, const pj_str_t *remote_uri,
pjsip_evsub_state state, pjsip_evsub_state state,
pjsip_event *event); pjsip_event *event);
/** /**
* Notify application when the buddy state has changed. * Notify application when the buddy state has changed.
* Application may then query the buddy into to get the details. * Application may then query the buddy into to get the details.
* *
* @param buddy_id The buddy id. * @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); void (*on_buddy_state)(pjsua_buddy_id buddy_id);
/** /**
* Notify application on incoming pager (i.e. MESSAGE request). * Notify application on incoming pager (i.e. MESSAGE request).
* Argument call_id will be -1 if MESSAGE request is not related to an * Argument call_id will be -1 if MESSAGE request is not related to an
* existing call. * existing call.
* *
* See also \a on_pager2() callback for the version with \a pjsip_rx_da ta * See also \a on_pager2() callback for the version with \a pjsip_rx_da ta
* passed as one of the argument. * passed as one of the argument.
* *
* @param call_id Containts the ID of the call where the IM was * @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent * sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context. * outside call context.
* @param from URI of the sender. * @param from URI of the sender.
* @param to URI of the destination message. * @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present. * @param contact The Contact URI of the sender, if present.
* @param mime_type MIME type of the message. * @param mime_type MIME type of the message.
* @param body The message content. * @param body The message content.
*
* \par Python Syntax:
* \code
# call_id: integer
# from: string
# to: string
# contact: string
# mime_type: string
# body: string
# acc_id: integer
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, 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 *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body); const pj_str_t *mime_type, const pj_str_t *body);
/** /**
* This is the alternative version of the \a on_pager() callback with * This is the alternative version of the \a on_pager() callback with
* \a pjsip_rx_data argument. * \a pjsip_rx_data argument.
* *
* @param call_id Containts the ID of the call where the IM was * @param call_id Containts the ID of the call where the IM was
skipping to change at line 952 skipping to change at line 680
* *
* @param call_id Containts the ID of the call where the IM was * @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent * sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context. * outside call context.
* @param to Destination URI. * @param to Destination URI.
* @param body Message body. * @param body Message body.
* @param user_data Arbitrary data that was specified when s ending * @param user_data Arbitrary data that was specified when s ending
* IM message. * IM message.
* @param status Delivery status. * @param status Delivery status.
* @param reason Delivery status reason. * @param reason Delivery status reason.
*
* \par Python Syntax
* \code
# call_id: integer
# to: string
# body: string
# user_data: string
# status: integer
# reason: string
# acc_id: integer
def on_pager_status(call_id, to, body, user_data, status, reason):
return
* \endcode
*/ */
void (*on_pager_status)(pjsua_call_id call_id, void (*on_pager_status)(pjsua_call_id call_id,
const pj_str_t *to, const pj_str_t *to,
const pj_str_t *body, const pj_str_t *body,
void *user_data, void *user_data,
pjsip_status_code status, pjsip_status_code status,
const pj_str_t *reason); const pj_str_t *reason);
/** /**
* Notify application about the delivery status of outgoing pager * Notify application about the delivery status of outgoing pager
skipping to change at line 1015 skipping to change at line 729
* Notify application about typing indication. * Notify application about typing indication.
* *
* @param call_id Containts the ID of the call where the IM was * @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent * sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context. * outside call context.
* @param from URI of the sender. * @param from URI of the sender.
* @param to URI of the destination message. * @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present. * @param contact The Contact URI of the sender, if present.
* @param is_typing Non-zero if peer is typing, or zero if p eer * @param is_typing Non-zero if peer is typing, or zero if p eer
* has stopped typing a message. * 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, void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact, const pj_str_t *to, const pj_str_t *contact,
pj_bool_t is_typing); pj_bool_t is_typing);
/** /**
* Notify application about typing indication. * Notify application about typing indication.
* *
* @param call_id Containts the ID of the call where the IM was * @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent * sent, or PJSUA_INVALID_ID if the IM was sent
skipping to change at line 1116 skipping to change at line 818
const pjsip_uri *target, const pjsip_uri *target,
const pjsip_event *e); const pjsip_event *e);
} pjsua_callback; } pjsua_callback;
/** /**
* This structure describes the settings to control the API and * This structure describes the settings to control the API and
* user agent behavior, and can be specified when calling #pjsua_init(). * user agent behavior, and can be specified when calling #pjsua_init().
* Before setting the values, application must call #pjsua_config_default() * Before setting the values, application must call #pjsua_config_default()
* to initialize this structure with the default values. * to initialize this structure with the default values.
*
* \par Python Sample Syntax:
* The pjsua_config type in Python is <tt>py_pjsua.Config</tt>. Application
* creates the instance by calling <tt>py_pjsua.config_default()</tt>:
* \code
cfg = py_pjsua.config_default()
* \endcode
*/ */
typedef struct pjsua_config typedef struct pjsua_config
{ {
/** /**
* Maximum calls to support (default: 4). The value specified here * Maximum calls to support (default: 4). The value specified here
* must be smaller than the compile time maximum settings * must be smaller than the compile time maximum settings
* PJSUA_MAX_CALLS, which by default is 32. To increase this * PJSUA_MAX_CALLS, which by default is 32. To increase this
* limit, the library must be recompiled with new PJSUA_MAX_CALLS * limit, the library must be recompiled with new PJSUA_MAX_CALLS
* value. * value.
skipping to change at line 1294 skipping to change at line 989
* Default: PJ_TRUE (only disable this setting for testing purposes). * Default: PJ_TRUE (only disable this setting for testing purposes).
*/ */
pj_bool_t hangup_forked_call; pj_bool_t hangup_forked_call;
} pjsua_config; } pjsua_config;
/** /**
* Use this function to initialize pjsua config. * Use this function to initialize pjsua config.
* *
* @param cfg pjsua config to be initialized. * @param cfg pjsua config to be initialized.
*
* \par Python Sample Syntax:
* The corresponding Python function creates an instance of the config and
* initializes it to the default settings:
* \code
cfg = py_pjsua.config_default()
* \endcode
*/ */
PJ_DECL(void) pjsua_config_default(pjsua_config *cfg); PJ_DECL(void) pjsua_config_default(pjsua_config *cfg);
/** The implementation has been moved to sip_auth.h */ /** The implementation has been moved to sip_auth.h */
#define pjsip_cred_dup pjsip_cred_info_dup #define pjsip_cred_dup pjsip_cred_info_dup
/** /**
* Duplicate pjsua_config. * Duplicate pjsua_config.
* *
* @param pool The pool to get memory from. * @param pool The pool to get memory from.
skipping to change at line 1327 skipping to change at line 1014
const pjsua_config *src); const pjsua_config *src);
/** /**
* This structure describes additional information to be sent with * This structure describes additional information to be sent with
* outgoing SIP message. It can (optionally) be specified for example * outgoing SIP message. It can (optionally) be specified for example
* with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup() , * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup() ,
* #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more. * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more.
* *
* Application MUST call #pjsua_msg_data_init() to initialize this * Application MUST call #pjsua_msg_data_init() to initialize this
* structure before setting its values. * structure before setting its values.
*
* \par Python Syntax
* The data type in Python is <tt>py_pjsua.Msg_Data</tt>. Application is
* recommended to instantiate the structure by using this construct:
* \code
msg_data = py_pjsua.msg_data_init()
* \endcode
*/ */
struct pjsua_msg_data struct pjsua_msg_data
{ {
/** /**
* Additional message headers as linked list. Application can add * Additional message headers as linked list. Application can add
* headers to the list by creating the header, either from the heap/poo l * headers to the list by creating the header, either from the heap/poo l
* or from temporary local variable, and add the header using * or from temporary local variable, and add the header using
* linked list operation. See pjsip_apps.c for some sample codes. * linked list operation. See pjsip_apps.c for some sample codes.
*
* \par Python:
* This field is implemented as string linked-list in Python, where eac
h
* string describes the header. For example:
\code
msg_data = py_pjsua.Msg_Data()
msg_data.hdr_list = ["Subject: Hello py_pjsua!", "Priority: very low
"]
\endcode
*/ */
pjsip_hdr hdr_list; pjsip_hdr hdr_list;
/** /**
* MIME type of optional message body. * MIME type of optional message body.
*/ */
pj_str_t content_type; pj_str_t content_type;
/** /**
* Optional message body. * Optional message body.
*/ */
pj_str_t msg_body; pj_str_t msg_body;
}; };
/** /**
* Initialize message data. * Initialize message data.
* *
* @param msg_data Message data to be initialized. * @param msg_data Message data to be initialized.
*
* \par Python
* The corresponding Python function creates and initializes the structure:
* \code
msg_data = py_pjsua.msg_data_init()
* \endcode
*/ */
PJ_DECL(void) pjsua_msg_data_init(pjsua_msg_data *msg_data); PJ_DECL(void) pjsua_msg_data_init(pjsua_msg_data *msg_data);
/** /**
* Instantiate pjsua application. Application must call this function befor e * Instantiate pjsua application. Application must call this function befor e
* calling any other functions, to make sure that the underlying libraries * calling any other functions, to make sure that the underlying libraries
* are properly initialized. Once this function has returned success, * are properly initialized. Once this function has returned success,
* application must call pjsua_destroy() before quitting. * application must call pjsua_destroy() before quitting.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.create()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_create(void); PJ_DECL(pj_status_t) pjsua_create(void);
/** Forward declaration */ /** Forward declaration */
typedef struct pjsua_media_config pjsua_media_config; typedef struct pjsua_media_config pjsua_media_config;
/** /**
* Initialize pjsua with the specified settings. All the settings are * Initialize pjsua with the specified settings. All the settings are
* optional, and the default values will be used when the config is not * optional, and the default values will be used when the config is not
* specified. * specified.
* *
* Note that #pjsua_create() MUST be called before calling this function. * Note that #pjsua_create() MUST be called before calling this function.
* *
* @param ua_cfg User agent configuration. * @param ua_cfg User agent configuration.
* @param log_cfg Optional logging configuration. * @param log_cfg Optional logging configuration.
* @param media_cfg Optional media configuration. * @param media_cfg Optional media configuration.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function is similar in Python:
* \code
status = py_pjsua.init(ua_cfg, log_cfg, media_cfg)
* \endcode
* Note that \a ua_cfg, \a log_cfg, and \a media_cfg are optional, and
* the Python script may pass None if it doesn't want to configure the
* setting.
*/ */
PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg, PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg,
const pjsua_logging_config *log_cfg, const pjsua_logging_config *log_cfg,
const pjsua_media_config *media_cfg); const pjsua_media_config *media_cfg);
/** /**
* Application is recommended to call this function after all initializatio n * Application is recommended to call this function after all initializatio n
* is done, so that the library can do additional checking set up * is done, so that the library can do additional checking set up
* additional * additional
* *
* Application may call this function anytime after #pjsua_init(). * Application may call this function anytime after #pjsua_init().
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function is similar in Python:
* \code
status = py_pjsua.start()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_start(void); PJ_DECL(pj_status_t) pjsua_start(void);
/** /**
* Destroy pjsua. Application is recommended to perform graceful shutdown * Destroy pjsua. Application is recommended to perform graceful shutdown
* before calling this function (such as unregister the account from the SI P * before calling this function (such as unregister the account from the SI P
* server, terminate presense subscription, and hangup active calls), howev er, * server, terminate presense subscription, and hangup active calls), howev er,
* this function will do all of these if it finds there are active sessions * this function will do all of these if it finds there are active sessions
* that need to be terminated. This function will approximately block for * that need to be terminated. This function will approximately block for
* one second to wait for replies from remote. * one second to wait for replies from remote.
* *
* Application.may safely call this function more than once if it doesn't * Application.may safely call this function more than once if it doesn't
* keep track of it's state. * keep track of it's state.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function is similar in Python:
* \code
status = py_pjsua.destroy()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_destroy(void); PJ_DECL(pj_status_t) pjsua_destroy(void);
/** /**
* Poll pjsua for events, and if necessary block the caller thread for * Poll pjsua for events, and if necessary block the caller thread for
* the specified maximum interval (in miliseconds). * the specified maximum interval (in miliseconds).
* *
* Application doesn't normally need to call this function if it has * Application doesn't normally need to call this function if it has
* configured worker thread (\a thread_cnt field) in pjsua_config structure , * configured worker thread (\a thread_cnt field) in pjsua_config structure ,
* because polling then will be done by these worker threads instead. * because polling then will be done by these worker threads instead.
* *
* @param msec_timeout Maximum time to wait, in miliseconds. * @param msec_timeout Maximum time to wait, in miliseconds.
* *
* @return The number of events that have been handled during the * @return The number of events that have been handled during the
* poll. Negative value indicates error, and application * poll. Negative value indicates error, and application
* can retrieve the error as (status = -return_value). * can retrieve the error as (status = -return_value).
*
* \par Python:
* The function is similar in Python:
* \code
n = py_pjsua.handle_events(msec_timeout)
* \endcode
*/ */
PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout); PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout);
/** /**
* Create memory pool to be used by the application. Once application * Create memory pool to be used by the application. Once application
* finished using the pool, it must be released with pj_pool_release(). * finished using the pool, it must be released with pj_pool_release().
* *
* @param name Optional pool name. * @param name Optional pool name.
* @param init_size Initial size of the pool. * @param init_size Initial size of the pool.
* @param increment Increment size. * @param increment Increment size.
* *
* @return The pool, or NULL when there's no memory. * @return The pool, or NULL when there's no memory.
*
* \par Python:
* Python script may also create a pool object from the script:
* \code
pool = py_pjsua.pool_create(name, init_size, increment)
* \endcode
*/ */
PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size , PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size ,
pj_size_t increment); pj_size_t increment);
/** /**
* Application can call this function at any time (after pjsua_create(), of * Application can call this function at any time (after pjsua_create(), of
* course) to change logging settings. * course) to change logging settings.
* *
* @param c Logging configuration. * @param c Logging configuration.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function is similar in Python:
* \code
status = py_pjsua.reconfigure_logging(log_cfg)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config * c); PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config * c);
/** /**
* Internal function to get SIP endpoint instance of pjsua, which is * Internal function to get SIP endpoint instance of pjsua, which is
* needed for example to register module, create transports, etc. * needed for example to register module, create transports, etc.
* Only valid after #pjsua_init() is called. * Only valid after #pjsua_init() is called.
* *
* @return SIP endpoint instance. * @return SIP endpoint instance.
*
* \par Python:
* Application may retrieve the SIP endpoint instance:
* \code
endpt = py_pjsua.get_pjsip_endpt()
* \endcode
* However currently the object is just an opaque object and does not have
* any use for Python scripts.
*/ */
PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void); PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void);
/** /**
* Internal function to get media endpoint instance. * Internal function to get media endpoint instance.
* Only valid after #pjsua_init() is called. * Only valid after #pjsua_init() is called.
* *
* @return Media endpoint instance. * @return Media endpoint instance.
*
* \par Python:
* Application may retrieve the media endpoint instance:
* \code
endpt = py_pjsua.get_pjmedia_endpt()
* \endcode
* However currently the object is just an opaque object and does not have
* any use for Python scripts.
*/ */
PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void); PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
/** /**
* Internal function to get PJSUA pool factory. * Internal function to get PJSUA pool factory.
* Only valid after #pjsua_create() is called. * Only valid after #pjsua_create() is called.
* *
* @return Pool factory currently used by PJSUA. * @return Pool factory currently used by PJSUA.
*
* \par Python:
* Application may retrieve the pool factory instance:
* \code
endpt = py_pjsua.get_pool_factory()
* \endcode
* However currently the object is just an opaque object and does not have
* any use for Python scripts.
*/ */
PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void); PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void);
/************************************************************************** *** /************************************************************************** ***
* Utilities. * Utilities.
* *
*/ */
/** /**
* This is a utility function to detect NAT type in front of this * This is a utility function to detect NAT type in front of this
skipping to change at line 1614 skipping to change at line 1212
*/ */
PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type); PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type);
/** /**
* This is a utility function to verify that valid SIP url is given. If the * This is a utility function to verify that valid SIP url is given. If the
* URL is valid, PJ_SUCCESS will be returned. * URL is valid, PJ_SUCCESS will be returned.
* *
* @param url The URL, as NULL terminated string. * @param url The URL, as NULL terminated string.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.verify_sip_url(url)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url); PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url);
/** /**
* This is a utility function to display error message for the specified * This is a utility function to display error message for the specified
* error code. The error message will be sent to the log. * error code. The error message will be sent to the log.
* *
* @param sender The log sender field. * @param sender The log sender field.
* @param title Message title for the error. * @param title Message title for the error.
* @param status Status code. * @param status Status code.
*
* \par Python:
* \code
py_pjsua.perror(sender, title, status)
* \endcode
*/ */
PJ_DECL(void) pjsua_perror(const char *sender, const char *title, PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
pj_status_t status); pj_status_t status);
/** /**
* This is a utility function to dump the stack states to log, using * This is a utility function to dump the stack states to log, using
* verbosity level 3. * verbosity level 3.
* *
* @param detail Will print detailed output (such as list of * @param detail Will print detailed output (such as list of
* SIP transactions) when non-zero. * SIP transactions) when non-zero.
skipping to change at line 1675 skipping to change at line 1263
/** SIP transport identification. /** SIP transport identification.
*/ */
typedef int pjsua_transport_id; typedef int pjsua_transport_id;
/** /**
* Transport configuration for creating transports for both SIP * Transport configuration for creating transports for both SIP
* and media. Before setting some values to this structure, application * and media. Before setting some values to this structure, application
* MUST call #pjsua_transport_config_default() to initialize its * MUST call #pjsua_transport_config_default() to initialize its
* values with default settings. * values with default settings.
*
* \par Python:
* The data type in Python is <tt>py_pjsua.Transport_Config</tt>,
* although application can just do this to create the instance:
* \code
transport_cfg = py_pjsua.transport_config_default()
* \endcode
*/ */
typedef struct pjsua_transport_config typedef struct pjsua_transport_config
{ {
/** /**
* UDP port number to bind locally. This setting MUST be specified * UDP port number to bind locally. This setting MUST be specified
* even when default port is desired. If the value is zero, the * even when default port is desired. If the value is zero, the
* transport will be bound to any available port, and application * transport will be bound to any available port, and application
* can query the port by querying the transport info. * can query the port by querying the transport info.
*/ */
unsigned port; unsigned port;
skipping to change at line 1730 skipping to change at line 1311
* transport. * transport.
*/ */
pjsip_tls_setting tls_setting; pjsip_tls_setting tls_setting;
} pjsua_transport_config; } pjsua_transport_config;
/** /**
* Call this function to initialize UDP config with default values. * Call this function to initialize UDP config with default values.
* *
* @param cfg The UDP config to be initialized. * @param cfg The UDP config to be initialized.
*
* \par Python:
* The corresponding Python function is rather different:
* \code
transport_cfg = py_pjsua.transport_config_default()
* \endcode
*/ */
PJ_DECL(void) pjsua_transport_config_default(pjsua_transport_config *cfg); PJ_DECL(void) pjsua_transport_config_default(pjsua_transport_config *cfg);
/** /**
* Duplicate transport config. * Duplicate transport config.
* *
* @param pool The pool. * @param pool The pool.
* @param dst The destination config. * @param dst The destination config.
* @param src The source config. * @param src The source config.
*
* \par Python:
* Not applicable. One should be able to just copy one variable instance
* to another in Python.
*/ */
PJ_DECL(void) pjsua_transport_config_dup(pj_pool_t *pool, PJ_DECL(void) pjsua_transport_config_dup(pj_pool_t *pool,
pjsua_transport_config *dst, pjsua_transport_config *dst,
const pjsua_transport_config *src); const pjsua_transport_config *src);
/** /**
* This structure describes transport information returned by * This structure describes transport information returned by
* #pjsua_transport_get_info() function. * #pjsua_transport_get_info() function.
*
* \par Python:
* The corresponding data type in Python is <tt>py_pjsua.Transport_Info</tt
>.
*/ */
typedef struct pjsua_transport_info typedef struct pjsua_transport_info
{ {
/** /**
* PJSUA transport identification. * PJSUA transport identification.
*/ */
pjsua_transport_id id; pjsua_transport_id id;
/** /**
* Transport type. * Transport type.
skipping to change at line 1819 skipping to change at line 1387
/** /**
* Create and start a new SIP transport according to the specified * Create and start a new SIP transport according to the specified
* settings. * settings.
* *
* @param type Transport type. * @param type Transport type.
* @param cfg Transport configuration. * @param cfg Transport configuration.
* @param p_id Optional pointer to receive transport ID. * @param p_id Optional pointer to receive transport ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The corresponding Python function returns (status,id) tuple:
* \code
status, transport_id = py_pjsua.transport_create(type, cfg)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type, PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type,
const pjsua_transport_config *cf g, const pjsua_transport_config *cf g,
pjsua_transport_id *p_id); pjsua_transport_id *p_id);
/** /**
* Register transport that has been created by application. This function * Register transport that has been created by application. This function
* is useful if application wants to implement custom SIP transport and use * is useful if application wants to implement custom SIP transport and use
* it with pjsua. * it with pjsua.
* *
* @param tp Transport instance. * @param tp Transport instance.
* @param p_id Optional pointer to receive transport ID. * @param p_id Optional pointer to receive transport ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not applicable (for now), because one cannot create a custom transport
* from Python script.
*/ */
PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp, PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp,
pjsua_transport_id *p_id); pjsua_transport_id *p_id);
/** /**
* Enumerate all transports currently created in the system. This function * Enumerate all transports currently created in the system. This function
* will return all transport IDs, and application may then call * will return all transport IDs, and application may then call
* #pjsua_transport_get_info() function to retrieve detailed information * #pjsua_transport_get_info() function to retrieve detailed information
* about the transport. * about the transport.
* *
* @param id Array to receive transport ids. * @param id Array to receive transport ids.
* @param count In input, specifies the maximum number of el ements. * @param count In input, specifies the maximum number of el ements.
* On return, it contains the actual number of elements . * On return, it contains the actual number of elements .
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function returns list of integers representing transport ids:
* \code
[int] = py_pjsua.enum_transports()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[], PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[],
unsigned *count ); unsigned *count );
/** /**
* Get information about transports. * Get information about transports.
* *
* @param id Transport ID. * @param id Transport ID.
* @param info Pointer to receive transport info. * @param info Pointer to receive transport info.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
transport_info = py_pjsua.transport_get_info(id)
* \endcode
* The Python function returns None on error.
*/ */
PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id, PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id,
pjsua_transport_info *info); pjsua_transport_info *info);
/** /**
* Disable a transport or re-enable it. By default transport is always * Disable a transport or re-enable it. By default transport is always
* enabled after it is created. Disabling a transport does not necessarily * enabled after it is created. Disabling a transport does not necessarily
* close the socket, it will only discard incoming messages and prevent * close the socket, it will only discard incoming messages and prevent
* the transport from being used to send outgoing messages. * the transport from being used to send outgoing messages.
* *
* @param id Transport ID. * @param id Transport ID.
* @param enabled Non-zero to enable, zero to disable. * @param enabled Non-zero to enable, zero to disable.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.transport_set_enable(id, enabled)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id, PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id,
pj_bool_t enabled); pj_bool_t enabled);
/** /**
* Close the transport. If transport is forcefully closed, it will be * Close the transport. If transport is forcefully closed, it will be
* immediately closed, and any pending transactions that are using the * immediately closed, and any pending transactions that are using the
* transport may not terminate properly (it may even crash). Otherwise, * transport may not terminate properly (it may even crash). Otherwise,
* the system will wait until all transactions are closed while preventing * the system will wait until all transactions are closed while preventing
* new users from using the transport, and will close the transport when * new users from using the transport, and will close the transport when
* it is safe to do so. * it is safe to do so.
* *
* @param id Transport ID. * @param id Transport ID.
* @param force Non-zero to immediately close the transport. This * @param force Non-zero to immediately close the transport. This
* is not recommended! * is not recommended!
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.transport_close(id, force)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id, PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
pj_bool_t force ); pj_bool_t force );
/** /**
* @} * @}
*/ */
/************************************************************************** *** /************************************************************************** ***
* ACCOUNT API * ACCOUNT API
skipping to change at line 2014 skipping to change at line 1550
* either "sip" or "sips". * either "sip" or "sips".
*/ */
#ifndef PJSUA_SECURE_SCHEME #ifndef PJSUA_SECURE_SCHEME
# define PJSUA_SECURE_SCHEME "sip" # define PJSUA_SECURE_SCHEME "sip"
#endif #endif
/** /**
* This structure describes account configuration to be specified when * This structure describes account configuration to be specified when
* adding a new account with #pjsua_acc_add(). Application MUST initialize * adding a new account with #pjsua_acc_add(). Application MUST initialize
* this structure first by calling #pjsua_acc_config_default(). * this structure first by calling #pjsua_acc_config_default().
*
* \par Python:
* The data type in Python is <tt>py_pjsua.Acc_Config</tt>, but normally
* application can just use the snippet below to create and initialize
* the account config:
* \code
acc_cfg = py_pjsua.acc_config_default()
* \endcode
*/ */
typedef struct pjsua_acc_config typedef struct pjsua_acc_config
{ {
/** /**
* Arbitrary user data to be associated with the newly created account. * Arbitrary user data to be associated with the newly created account.
* Application may set this later with #pjsua_acc_set_user_data() and * Application may set this later with #pjsua_acc_set_user_data() and
* retrieve it with #pjsua_acc_get_user_data(). * retrieve it with #pjsua_acc_get_user_data().
*/ */
void *user_data; void *user_data;
skipping to change at line 2104 skipping to change at line 1632
/** /**
* Specify whether support for reliable provisional response (100rel an d * Specify whether support for reliable provisional response (100rel an d
* PRACK) should be required for all sessions of this account. * PRACK) should be required for all sessions of this account.
* *
* Default: PJ_FALSE * Default: PJ_FALSE
*/ */
pj_bool_t require_100rel; pj_bool_t require_100rel;
/** /**
* Number of proxies in the proxy array below. * Number of proxies in the proxy array below.
*
* \par Python:
* Not applicable, as \a proxy is implemented as list of strings.
*/ */
unsigned proxy_cnt; unsigned proxy_cnt;
/** /**
* Optional URI of the proxies to be visited for all outgoing requests * Optional URI of the proxies to be visited for all outgoing requests
* that are using this account (REGISTER, INVITE, etc). Application nee d * that are using this account (REGISTER, INVITE, etc). Application nee d
* to specify these proxies if the service provider requires that reque sts * to specify these proxies if the service provider requires that reque sts
* destined towards its network should go through certain proxies first * destined towards its network should go through certain proxies first
* (for example, border controllers). * (for example, border controllers).
* *
* These proxies will be put in the route set for this account, with * These proxies will be put in the route set for this account, with
* maintaining the orders (the first proxy in the array will be visited * maintaining the orders (the first proxy in the array will be visited
* first). If global outbound proxies are configured in pjsua_config, * first). If global outbound proxies are configured in pjsua_config,
* then these account proxies will be placed after the global outbound * then these account proxies will be placed after the global outbound
* proxies in the routeset. * proxies in the routeset.
*
* \par Python:
* This will be list of strings.
*/ */
pj_str_t proxy[PJSUA_ACC_MAX_PROXIES]; pj_str_t proxy[PJSUA_ACC_MAX_PROXIES];
/** /**
* Optional interval for registration, in seconds. If the value is zero , * Optional interval for registration, in seconds. If the value is zero ,
* default interval will be used (PJSUA_REG_INTERVAL, 300 seconds). * default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
*/ */
unsigned reg_timeout; unsigned reg_timeout;
/** /**
* Number of credentials in the credential array. * Number of credentials in the credential array.
*
* \par Python:
* Not applicable, since \a cred_info is a list of credentials.
*/ */
unsigned cred_count; unsigned cred_count;
/** /**
* Array of credentials. If registration is desired, normally there sho uld * Array of credentials. If registration is desired, normally there sho uld
* be at least one credential specified, to successfully authenticate * be at least one credential specified, to successfully authenticate
* against the service provider. More credentials can be specified, for * against the service provider. More credentials can be specified, for
* example when the requests are expected to be challenged by the * example when the requests are expected to be challenged by the
* proxies in the route set. * proxies in the route set.
*
* \par Python:
* This field is a list of credentials.
*/ */
pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
/** /**
* Optionally bind this account to specific transport. This normally is * Optionally bind this account to specific transport. This normally is
* not a good idea, as account should be able to send requests using * not a good idea, as account should be able to send requests using
* any available transports according to the destination. But some * any available transports according to the destination. But some
* application may want to have explicit control over the transport to * application may want to have explicit control over the transport to
* use, so in that case it can set this field. * use, so in that case it can set this field.
* *
skipping to change at line 2228 skipping to change at line 1744
*/ */
int srtp_secure_signaling; int srtp_secure_signaling;
#endif #endif
} pjsua_acc_config; } pjsua_acc_config;
/** /**
* Call this function to initialize account config with default values. * Call this function to initialize account config with default values.
* *
* @param cfg The account config to be initialized. * @param cfg The account config to be initialized.
*
* \par Python:
* In Python, this function both creates and initializes the account
* config:
* \code
acc_cfg = py_pjsua.acc_config_default()
* \endcode
*/ */
PJ_DECL(void) pjsua_acc_config_default(pjsua_acc_config *cfg); PJ_DECL(void) pjsua_acc_config_default(pjsua_acc_config *cfg);
/** /**
* Duplicate account config. * Duplicate account config.
* *
* @param pool Pool to be used for duplicating the config. * @param pool Pool to be used for duplicating the config.
* @param dst Destination configuration. * @param dst Destination configuration.
* @param src Source configuration. * @param src Source configuration.
*/ */
PJ_DECL(void) pjsua_acc_config_dup(pj_pool_t *pool, PJ_DECL(void) pjsua_acc_config_dup(pj_pool_t *pool,
pjsua_acc_config *dst, pjsua_acc_config *dst,
const pjsua_acc_config *src); const pjsua_acc_config *src);
/** /**
* Account info. Application can query account info by calling * Account info. Application can query account info by calling
* #pjsua_acc_get_info(). * #pjsua_acc_get_info().
*
* \par Python:
* The data type in Python is <tt>py_pjsua.Acc_Info</tt>.
*/ */
typedef struct pjsua_acc_info typedef struct pjsua_acc_info
{ {
/** /**
* The account ID. * The account ID.
*/ */
pjsua_acc_id id; pjsua_acc_id id;
/** /**
* Flag to indicate whether this is the default account. * Flag to indicate whether this is the default account.
skipping to change at line 2322 skipping to change at line 1828
* Buffer that is used internally to store the status text. * Buffer that is used internally to store the status text.
*/ */
char buf_[PJ_ERR_MSG_SIZE]; char buf_[PJ_ERR_MSG_SIZE];
} pjsua_acc_info; } pjsua_acc_info;
/** /**
* Get number of current accounts. * Get number of current accounts.
* *
* @return Current number of accounts. * @return Current number of accounts.
*
* \par Python:
* \code
count = py_pjsua.acc_get_count()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_acc_get_count(void); PJ_DECL(unsigned) pjsua_acc_get_count(void);
/** /**
* Check if the specified account ID is valid. * Check if the specified account ID is valid.
* *
* @param acc_id Account ID to check. * @param acc_id Account ID to check.
* *
* @return Non-zero if account ID is valid. * @return Non-zero if account ID is valid.
*
* \par Python:
* \code
is_valid = py_pjsua.acc_is_valid(acc_id)
* \endcode
*/ */
PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id); PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id);
/** /**
* Set default account to be used when incoming and outgoing * Set default account to be used when incoming and outgoing
* requests doesn't match any accounts. * requests doesn't match any accounts.
* *
* @param acc_id The account ID to be used as default. * @param acc_id The account ID to be used as default.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* \code
status = py_pjsua.acc_set_default(acc_id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_set_default(pjsua_acc_id acc_id); PJ_DECL(pj_status_t) pjsua_acc_set_default(pjsua_acc_id acc_id);
/** /**
* Get default account to be used when receiving incoming requests (calls), * Get default account to be used when receiving incoming requests (calls),
* when the destination of the incoming call doesn't match any other * when the destination of the incoming call doesn't match any other
* accounts. * accounts.
* *
* @return The default account ID, or PJSUA_INVALID_ID if no * @return The default account ID, or PJSUA_INVALID_ID if no
* default account is configured. * default account is configured.
*
* \par Python:
* \code
acc_id = py_pjsua.acc_get_default()
* \endcode
*/ */
PJ_DECL(pjsua_acc_id) pjsua_acc_get_default(void); PJ_DECL(pjsua_acc_id) pjsua_acc_get_default(void);
/** /**
* Add a new account to pjsua. PJSUA must have been initialized (with * Add a new account to pjsua. PJSUA must have been initialized (with
* #pjsua_init()) before calling this function. If registration is configur ed * #pjsua_init()) before calling this function. If registration is configur ed
* for this account, this function would also start the SIP registration * for this account, this function would also start the SIP registration
* session with the SIP registrar server. This SIP registration session * session with the SIP registrar server. This SIP registration session
* will be maintained internally by the library, and application doesn't * will be maintained internally by the library, and application doesn't
* need to do anything to maintain the registration session. * need to do anything to maintain the registration session.
skipping to change at line 2393 skipping to change at line 1879
* @param acc_cfg Account configuration. * @param acc_cfg Account configuration.
* @param is_default If non-zero, this account will be set as the default * @param is_default If non-zero, this account will be set as the default
* account. The default account will be used when sendi ng * account. The default account will be used when sendi ng
* outgoing requests (e.g. making call) when no account is * outgoing requests (e.g. making call) when no account is
* specified, and when receiving incoming requests when the * specified, and when receiving incoming requests when the
* request does not match any accounts. It is recommend ed * request does not match any accounts. It is recommend ed
* that default account is set to local/LAN account. * that default account is set to local/LAN account.
* @param p_acc_id Pointer to receive account ID of the new account. * @param p_acc_id Pointer to receive account ID of the new account.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function returns (status, account_id) tuple:
* \code
status, account_id = py_pjsua.acc_add(acc_cfg, is_default)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *acc_cfg, PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *acc_cfg,
pj_bool_t is_default, pj_bool_t is_default,
pjsua_acc_id *p_acc_id); pjsua_acc_id *p_acc_id);
/** /**
* Add a local account. A local account is used to identify local endpoint * Add a local account. A local account is used to identify local endpoint
* instead of a specific user, and for this reason, a transport ID is neede d * instead of a specific user, and for this reason, a transport ID is neede d
* to obtain the local address information. * to obtain the local address information.
* *
* @param tid Transport ID to generate account address. * @param tid Transport ID to generate account address.
* @param is_default If non-zero, this account will be set as the default * @param is_default If non-zero, this account will be set as the default
* account. The default account will be used when sendi ng * account. The default account will be used when sendi ng
* outgoing requests (e.g. making call) when no account is * outgoing requests (e.g. making call) when no account is
* specified, and when receiving incoming requests when the * specified, and when receiving incoming requests when the
* request does not match any accounts. It is recommend ed * request does not match any accounts. It is recommend ed
* that default account is set to local/LAN account. * that default account is set to local/LAN account.
* @param p_acc_id Pointer to receive account ID of the new account. * @param p_acc_id Pointer to receive account ID of the new account.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function returns (status, account_id) tuple:
* \code
status, account_id = py_pjsua.acc_add_local(tid, is_default)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid, PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid,
pj_bool_t is_default, pj_bool_t is_default,
pjsua_acc_id *p_acc_id); pjsua_acc_id *p_acc_id);
/** /**
* Set arbitrary data to be associated with the account. * Set arbitrary data to be associated with the account.
* *
* @param acc_id The account ID. * @param acc_id The account ID.
* @param user_data User/application data. * @param user_data User/application data.
skipping to change at line 2459 skipping to change at line 1933
PJ_DECL(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id); PJ_DECL(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id);
/** /**
* Delete an account. This will unregister the account from the SIP server, * Delete an account. This will unregister the account from the SIP server,
* if necessary, and terminate server side presence subscriptions associate d * if necessary, and terminate server side presence subscriptions associate d
* with this account. * with this account.
* *
* @param acc_id Id of the account to be deleted. * @param acc_id Id of the account to be deleted.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.acc_del(acc_id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id); PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id);
/** /**
* Modify account information. * Modify account information.
* *
* @param acc_id Id of the account to be modified. * @param acc_id Id of the account to be modified.
* @param acc_cfg New account configuration. * @param acc_cfg New account configuration.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.acc_modify(acc_id, acc_cfg)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
const pjsua_acc_config *acc_cfg); const pjsua_acc_config *acc_cfg);
/** /**
* Modify account's presence status to be advertised to remote/presence * Modify account's presence status to be advertised to remote/presence
* subscribers. This would trigger the sending of outgoing NOTIFY request * subscribers. This would trigger the sending of outgoing NOTIFY request
* if there are server side presence subscription for this account, and/or * if there are server side presence subscription for this account, and/or
* outgoing PUBLISH if presence publication is enabled for this account. * outgoing PUBLISH if presence publication is enabled for this account.
* *
* @see pjsua_acc_set_online_status2() * @see pjsua_acc_set_online_status2()
* *
* @param acc_id The account ID. * @param acc_id The account ID.
* @param is_online True of false. * @param is_online True of false.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.acc_set_online_status(acc_id, is_online)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
pj_bool_t is_online); pj_bool_t is_online);
/** /**
* Modify account's presence status to be advertised to remote/presence * Modify account's presence status to be advertised to remote/presence
* subscribers. This would trigger the sending of outgoing NOTIFY request * subscribers. This would trigger the sending of outgoing NOTIFY request
* if there are server side presence subscription for this account, and/or * if there are server side presence subscription for this account, and/or
* outgoing PUBLISH if presence publication is enabled for this account. * outgoing PUBLISH if presence publication is enabled for this account.
* *
skipping to change at line 2535 skipping to change at line 1994
* configured for this account, then initial SIP REGISTER will be sent * configured for this account, then initial SIP REGISTER will be sent
* when the account is added with #pjsua_acc_add(). Application normally * when the account is added with #pjsua_acc_add(). Application normally
* only need to call this function if it wants to manually update the * only need to call this function if it wants to manually update the
* registration or to unregister from the server. * registration or to unregister from the server.
* *
* @param acc_id The account ID. * @param acc_id The account ID.
* @param renew If renew argument is zero, this will start * @param renew If renew argument is zero, this will start
* unregistration process. * unregistration process.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.acc_set_registration(acc_id, renew)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id,
pj_bool_t renew); pj_bool_t renew);
/** /**
* Get information about the specified account. * Get information about the specified account.
* *
* @param acc_id Account identification. * @param acc_id Account identification.
* @param info Pointer to receive account information. * @param info Pointer to receive account information.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
acc_info = py_pjsua.acc_get_info(acc_id)
* \endcode
* The function returns None if account ID is not valid.
*/ */
PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id,
pjsua_acc_info *info); pjsua_acc_info *info);
/** /**
* Enumerate all account currently active in the library. This will fill * Enumerate all account currently active in the library. This will fill
* the array with the account Ids, and application can then query the * the array with the account Ids, and application can then query the
* account information for each id with #pjsua_acc_get_info(). * account information for each id with #pjsua_acc_get_info().
* *
* @see pjsua_acc_enum_info(). * @see pjsua_acc_enum_info().
* *
* @param ids Array of account IDs to be initialized. * @param ids Array of account IDs to be initialized.
* @param count In input, specifies the maximum number of el ements. * @param count In input, specifies the maximum number of el ements.
* On return, it contains the actual number of elements . * On return, it contains the actual number of elements .
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function takes no argument and returns list of account Ids:
* \code
[acc_ids] = py_pjsua.enum_accs()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[], PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[],
unsigned *count ); unsigned *count );
/** /**
* Enumerate account informations. * Enumerate account informations.
* *
* @param info Array of account infos to be initialized. * @param info Array of account infos to be initialized.
* @param count In input, specifies the maximum number of el ements. * @param count In input, specifies the maximum number of el ements.
* On return, it contains the actual number of elements . * On return, it contains the actual number of elements .
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function takes no argument and returns list of account infos:
* \code
[acc_info] = py_pjsua.acc_enum_info()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[], PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[],
unsigned *count ); unsigned *count );
/** /**
* This is an internal function to find the most appropriate account to * This is an internal function to find the most appropriate account to
* used to reach to the specified URL. * used to reach to the specified URL.
* *
* @param url The remote URL to reach. * @param url The remote URL to reach.
* *
* @return Account id. * @return Account id.
*
* \par Python:
* \code
acc_id = py_pjsua.acc_find_for_outgoing(url)
* \endcode
*/ */
PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url); PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_outgoing(const pj_str_t *url);
/** /**
* This is an internal function to find the most appropriate account to be * This is an internal function to find the most appropriate account to be
* used to handle incoming calls. * used to handle incoming calls.
* *
* @param rdata The incoming request message. * @param rdata The incoming request message.
* *
* @return Account id. * @return Account id.
*
* \par Python:
* \code
acc_id = py_pjsua.acc_find_for_outgoing(url)
* \endcode
*/ */
PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata); PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata);
/** /**
* Create arbitrary requests using the account. Application should only use * Create arbitrary requests using the account. Application should only use
* this function to create auxiliary requests outside dialog, such as * this function to create auxiliary requests outside dialog, such as
* OPTIONS, and use the call or presence API to create dialog related * OPTIONS, and use the call or presence API to create dialog related
* requests. * requests.
* *
* @param acc_id The account ID. * @param acc_id The account ID.
skipping to change at line 2659 skipping to change at line 2085
/** /**
* Create a suitable URI to be put as Contact based on the specified * Create a suitable URI to be put as Contact based on the specified
* target URI for the specified account. * target URI for the specified account.
* *
* @param pool Pool to allocate memory for the string. * @param pool Pool to allocate memory for the string.
* @param contact The string where the Contact URI will be stored. * @param contact The string where the Contact URI will be stored.
* @param acc_id Account ID. * @param acc_id Account ID.
* @param uri Destination URI of the request. * @param uri Destination URI of the request.
* *
* @return PJ_SUCCESS on success, other on error. * @return PJ_SUCCESS on success, other on error.
*
* \par Python:
* This function is still experimental in Python:
* \code
uri = py_pjsua.acc_create_uac_contact(pool, acc_id, uri)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool, PJ_DECL(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
pj_str_t *contact, pj_str_t *contact,
pjsua_acc_id acc_id, pjsua_acc_id acc_id,
const pj_str_t *uri); const pj_str_t *uri);
/** /**
* Create a suitable URI to be put as Contact based on the information * Create a suitable URI to be put as Contact based on the information
* in the incoming request. * in the incoming request.
* *
* @param pool Pool to allocate memory for the string. * @param pool Pool to allocate memory for the string.
* @param contact The string where the Contact URI will be stored. * @param contact The string where the Contact URI will be stored.
* @param acc_id Account ID. * @param acc_id Account ID.
* @param rdata Incoming request. * @param rdata Incoming request.
* *
* @return PJ_SUCCESS on success, other on error. * @return PJ_SUCCESS on success, other on error.
*
* \par Python:
* This function is still experimental in Python:
* \code
uri = py_pjsua.acc_create_uas_contact(pool, acc_id, rdata)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool, PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
pj_str_t *contact, pj_str_t *contact,
pjsua_acc_id acc_id, pjsua_acc_id acc_id,
pjsip_rx_data *rdata ); pjsip_rx_data *rdata );
/** /**
* Lock/bind this account to a specific transport/listener. Normally * Lock/bind this account to a specific transport/listener. Normally
* application shouldn't need to do this, as transports will be selected * application shouldn't need to do this, as transports will be selected
* automatically by the stack according to the destination. * automatically by the stack according to the destination.
skipping to change at line 2709 skipping to change at line 2123
* requests from this account will use the specified transport (this * requests from this account will use the specified transport (this
* includes SIP registration, dialog (call and event subscription), and * includes SIP registration, dialog (call and event subscription), and
* out-of-dialog requests such as MESSAGE). * out-of-dialog requests such as MESSAGE).
* *
* Note that transport_id may be specified in pjsua_acc_config too. * Note that transport_id may be specified in pjsua_acc_config too.
* *
* @param acc_id The account ID. * @param acc_id The account ID.
* @param tp_id The transport ID. * @param tp_id The transport ID.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* Not yet implemented.
*/ */
PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id,
pjsua_transport_id tp_id); pjsua_transport_id tp_id);
/** /**
* @} * @}
*/ */
/************************************************************************** *** /************************************************************************** ***
* CALLS API * CALLS API
skipping to change at line 2763 skipping to change at line 2174
/** The media is currently put on hold by remote endpoint */ /** The media is currently put on hold by remote endpoint */
PJSUA_CALL_MEDIA_REMOTE_HOLD, PJSUA_CALL_MEDIA_REMOTE_HOLD,
/** The media has reported error (e.g. ICE negotiation) */ /** The media has reported error (e.g. ICE negotiation) */
PJSUA_CALL_MEDIA_ERROR PJSUA_CALL_MEDIA_ERROR
} pjsua_call_media_status; } pjsua_call_media_status;
/** /**
* This structure describes the information and current status of a call. * This structure describes the information and current status of a call.
*
* \par Python:
* The type name is <tt>py_pjsua.Call_Info</tt>.
*/ */
typedef struct pjsua_call_info typedef struct pjsua_call_info
{ {
/** Call identification. */ /** Call identification. */
pjsua_call_id id; pjsua_call_id id;
/** Initial call role (UAC == caller) */ /** Initial call role (UAC == caller) */
pjsip_role_e role; pjsip_role_e role;
/** The account ID where this call belongs. */ /** The account ID where this call belongs. */
skipping to change at line 2838 skipping to change at line 2246
char call_id[128]; char call_id[128];
char last_status_text[128]; char last_status_text[128];
} buf_; } buf_;
} pjsua_call_info; } pjsua_call_info;
/** /**
* Get maximum number of calls configured in pjsua. * Get maximum number of calls configured in pjsua.
* *
* @return Maximum number of calls configured. * @return Maximum number of calls configured.
*
* \par Python:
* \code
count = py_pjsua.call_get_max_count()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_call_get_max_count(void); PJ_DECL(unsigned) pjsua_call_get_max_count(void);
/** /**
* Get number of currently active calls. * Get number of currently active calls.
* *
* @return Number of currently active calls. * @return Number of currently active calls.
*
* \par Python:
* \code
count = py_pjsua.call_get_count()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_call_get_count(void); PJ_DECL(unsigned) pjsua_call_get_count(void);
/** /**
* Enumerate all active calls. Application may then query the information a nd * Enumerate all active calls. Application may then query the information a nd
* state of each call by calling #pjsua_call_get_info(). * state of each call by calling #pjsua_call_get_info().
* *
* @param ids Array of account IDs to be initialized. * @param ids Array of account IDs to be initialized.
* @param count In input, specifies the maximum number of el ements. * @param count In input, specifies the maximum number of el ements.
* On return, it contains the actual number of elements . * On return, it contains the actual number of elements .
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* This function takes no argument and return list of call Ids.
* \code
[call_ids] = py_pjsua.enum_calls()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[], PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[],
unsigned *count); unsigned *count);
/** /**
* Make outgoing call to the specified URI using the specified account. * Make outgoing call to the specified URI using the specified account.
* *
* @param acc_id The account to be used. * @param acc_id The account to be used.
* @param dst_uri URI to be put in the To header (normally is the same * @param dst_uri URI to be put in the To header (normally is the same
* as the target URI). * as the target URI).
* @param options Options (must be zero at the moment). * @param options Options (must be zero at the moment).
* @param user_data Arbitrary user data to be attached to the call, and * @param user_data Arbitrary user data to be attached to the call, and
* can be retrieved later. * can be retrieved later.
* @param msg_data Optional headers etc to be added to outgoing INVITE * @param msg_data Optional headers etc to be added to outgoing INVITE
* request, or NULL if no custom header is desired. * request, or NULL if no custom header is desired.
* @param p_call_id Pointer to receive call identification. * @param p_call_id Pointer to receive call identification.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The Python function returns (status, call_id) tuple:
* \code
status, call_id = py_pjsua.call_make_call(acc_id, dst_uri, options,
user_data, msg_data)
* \endcode
* Note: the \a user_data in Python function is an integer, and the
* \a msg_data can be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
const pj_str_t *dst_uri, const pj_str_t *dst_uri,
unsigned options, unsigned options,
void *user_data, void *user_data,
const pjsua_msg_data *msg_data, const pjsua_msg_data *msg_data,
pjsua_call_id *p_call_id); pjsua_call_id *p_call_id);
/** /**
* Check if the specified call has active INVITE session and the INVITE * Check if the specified call has active INVITE session and the INVITE
* session has not been disconnected. * session has not been disconnected.
* *
* @param call_id Call identification. * @param call_id Call identification.
* *
* @return Non-zero if call is active. * @return Non-zero if call is active.
*
* \par Python:
* \code
bool = py_pjsua.call_is_active(call_id)
* \endcode
*/ */
PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id); PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id);
/** /**
* Check if call has an active media session. * Check if call has an active media session.
* *
* @param call_id Call identification. * @param call_id Call identification.
* *
* @return Non-zero if yes. * @return Non-zero if yes.
*
* \par Python:
* \code
bool = py_pjsua.call_has_media(call_id)
* \endcode
*/ */
PJ_DECL(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id); PJ_DECL(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id);
/** /**
* Retrieve the media session associated with this call. Note that the medi a * Retrieve the media session associated with this call. Note that the medi a
* session may not be available depending on the current call's media statu s * session may not be available depending on the current call's media statu s
* (the pjsua_call_media_status information in pjsua_call_info). Applicatio n * (the pjsua_call_media_status information in pjsua_call_info). Applicatio n
* may use the media session to retrieve more detailed information about th e * may use the media session to retrieve more detailed information about th e
* call's media. * call's media.
* *
skipping to change at line 2968 skipping to change at line 2341
*/ */
PJ_DECL(pjmedia_transport*) pjsua_call_get_media_transport(pjsua_call_id ci d); PJ_DECL(pjmedia_transport*) pjsua_call_get_media_transport(pjsua_call_id ci d);
/** /**
* Get the conference port identification associated with the call. * Get the conference port identification associated with the call.
* *
* @param call_id Call identification. * @param call_id Call identification.
* *
* @return Conference port ID, or PJSUA_INVALID_ID when the * @return Conference port ID, or PJSUA_INVALID_ID when the
* media has not been established or is not active. * media has not been established or is not active.
*
* \par Python:
* \code
slot = py_pjsua.call_get_conf_port(call_id)
* \endcode
*/ */
PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id) ; PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id) ;
/** /**
* Obtain detail information about the specified call. * Obtain detail information about the specified call.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param info Call info to be initialized. * @param info Call info to be initialized.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
call_info = py_pjsua.call_get_info(call_id)
* \endcode
* \a call_info return value will be set to None if call_id is not valid.
*/ */
PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id,
pjsua_call_info *info); pjsua_call_info *info);
/** /**
* Attach application specific data to the call. Application can then * Attach application specific data to the call. Application can then
* inspect this data by calling #pjsua_call_get_user_data(). * inspect this data by calling #pjsua_call_get_user_data().
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param user_data Arbitrary data to be attached to the call. * @param user_data Arbitrary data to be attached to the call.
* *
* @return The user data. * @return The user data.
*
* \par Python:
* \code
status = py_pjsua.call_set_user_data(call_id, user_data)
* \endcode
* The \a user_data is an integer in the Python function.
*/ */
PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id,
void *user_data); void *user_data);
/** /**
* Get user data attached to the call, which has been previously set with * Get user data attached to the call, which has been previously set with
* #pjsua_call_set_user_data(). * #pjsua_call_set_user_data().
* *
* @param call_id Call identification. * @param call_id Call identification.
* *
* @return The user data. * @return The user data.
*
* \par Python:
* \code
user_data = py_pjsua.call_get_user_data(call_id)
* \endcode
* The \a user_data is an integer.
*/ */
PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id); PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id);
/** /**
* Get the NAT type of remote's endpoint. This is a proprietary feature * Get the NAT type of remote's endpoint. This is a proprietary feature
* of PJSUA-LIB which sends its NAT type in the SDP when \a nat_type_in_sdp * of PJSUA-LIB which sends its NAT type in the SDP when \a nat_type_in_sdp
* is set in #pjsua_config. * is set in #pjsua_config.
* *
* This function can only be called after SDP has been received from remote , * This function can only be called after SDP has been received from remote ,
* which means for incoming call, this function can be called as soon as * which means for incoming call, this function can be called as soon as
skipping to change at line 3064 skipping to change at line 2414
* response, establish the call, or terminate the call. * response, establish the call, or terminate the call.
* *
* @param call_id Incoming call identification. * @param call_id Incoming call identification.
* @param code Status code, (100-699). * @param code Status code, (100-699).
* @param reason Optional reason phrase. If NULL, default text * @param reason Optional reason phrase. If NULL, default text
* will be used. * will be used.
* @param msg_data Optional list of headers etc to be added to outgoing * @param msg_data Optional list of headers etc to be added to outgoing
* response message. * response message.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_answer(call_id, code, reason, msg_data)
* \endcode
* Arguments \a reason and \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id,
unsigned code, unsigned code,
const pj_str_t *reason, const pj_str_t *reason,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Hangup call by using method that is appropriate according to the * Hangup call by using method that is appropriate according to the
* call state. This function is different than answering the call with * call state. This function is different than answering the call with
* 3xx-6xx response (with #pjsua_call_answer()), in that this function * 3xx-6xx response (with #pjsua_call_answer()), in that this function
skipping to change at line 3094 skipping to change at line 2438
* @param call_id Call identification. * @param call_id Call identification.
* @param code Optional status code to be sent when we're rejecting * @param code Optional status code to be sent when we're rejecting
* incoming call. If the value is zero, "603/Decline" * incoming call. If the value is zero, "603/Decline"
* will be sent. * will be sent.
* @param reason Optional reason phrase to be sent when we're rejecti ng * @param reason Optional reason phrase to be sent when we're rejecti ng
* incoming call. If NULL, default text will be used. * incoming call. If NULL, default text will be used.
* @param msg_data Optional list of headers etc to be added to outgoing * @param msg_data Optional list of headers etc to be added to outgoing
* request/response message. * request/response message.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_hangup(call_id, code, reason, msg_data)
* \endcode
* Arguments \a reason and \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id,
unsigned code, unsigned code,
const pj_str_t *reason, const pj_str_t *reason,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Accept or reject redirection response. Application MUST call this functi on * Accept or reject redirection response. Application MUST call this functi on
* after it signaled PJSIP_REDIRECT_PENDING in the \a on_call_redirected() * after it signaled PJSIP_REDIRECT_PENDING in the \a on_call_redirected()
* callback, to notify the call whether to accept or reject the redirection * callback, to notify the call whether to accept or reject the redirection
skipping to change at line 3145 skipping to change at line 2483
* appropriate SDP to inform remote that the call is being put on hold. * appropriate SDP to inform remote that the call is being put on hold.
* The final status of the request itself will be reported on the * The final status of the request itself will be reported on the
* \a on_call_media_state() callback, which inform the application that * \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed. * the media state of the call has changed.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param msg_data Optional message components to be sent with * @param msg_data Optional message components to be sent with
* the request. * the request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_set_hold(call_id, msg_data)
* \endcode
* Argument \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Send re-INVITE to release hold. * Send re-INVITE to release hold.
* The final status of the request itself will be reported on the * The final status of the request itself will be reported on the
* \a on_call_media_state() callback, which inform the application that * \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed. * the media state of the call has changed.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param unhold If this argument is non-zero and the call is locally * @param unhold If this argument is non-zero and the call is locally
* held, this will release the local hold. * held, this will release the local hold.
* @param msg_data Optional message components to be sent with * @param msg_data Optional message components to be sent with
* the request. * the request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_reinvite(call_id, unhold, msg_data)
* \endcode
* Argument \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
pj_bool_t unhold, pj_bool_t unhold,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Send UPDATE request. * Send UPDATE request.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param options Must be zero for now. * @param options Must be zero for now.
skipping to change at line 3209 skipping to change at line 2535
* the progress of the transfer request, it can implement * the progress of the transfer request, it can implement
* \a on_call_transfer_status() callback which will report the progress * \a on_call_transfer_status() callback which will report the progress
* of the call transfer request. * of the call transfer request.
* *
* @param call_id The call id to be transfered. * @param call_id The call id to be transfered.
* @param dest Address of new target to be contacted. * @param dest Address of new target to be contacted.
* @param msg_data Optional message components to be sent with * @param msg_data Optional message components to be sent with
* the request. * the request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_xfer(call_id, dest, msg_data)
* \endcode
* Argument \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id,
const pj_str_t *dest, const pj_str_t *dest,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Flag to indicate that "Require: replaces" should not be put in the * Flag to indicate that "Require: replaces" should not be put in the
* outgoing INVITE request caused by REFER request created by * outgoing INVITE request caused by REFER request created by
* #pjsua_call_xfer_replaces(). * #pjsua_call_xfer_replaces().
*/ */
skipping to change at line 3243 skipping to change at line 2563
* @param call_id The call id to be transfered. * @param call_id The call id to be transfered.
* @param dest_call_id The call id to be replaced. * @param dest_call_id The call id to be replaced.
* @param options Application may specify PJSUA_XFER_NO_REQUIRE_REPLAC ES * @param options Application may specify PJSUA_XFER_NO_REQUIRE_REPLAC ES
* to suppress the inclusion of "Require: replaces" in * to suppress the inclusion of "Require: replaces" in
* the outgoing INVITE request created by the REFER * the outgoing INVITE request created by the REFER
* request. * request.
* @param msg_data Optional message components to be sent with * @param msg_data Optional message components to be sent with
* the request. * the request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_xfer_replaces(call_id, dest_call_id, options, ms
g_data)
* \endcode
* Argument \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id,
pjsua_call_id dest_call_id, pjsua_call_id dest_call_id,
unsigned options, unsigned options,
const pjsua_msg_data *msg_data ); const pjsua_msg_data *msg_data );
/** /**
* Send DTMF digits to remote using RFC 2833 payload formats. * Send DTMF digits to remote using RFC 2833 payload formats.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param digits DTMF string digits to be sent. * @param digits DTMF string digits to be sent.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_dial_dtmf(call_id, digits)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id,
const pj_str_t *digits); const pj_str_t *digits);
/** /**
* Send instant messaging inside INVITE session. * Send instant messaging inside INVITE session.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param mime_type Optional MIME type. If NULL, then "text/plain" is * @param mime_type Optional MIME type. If NULL, then "text/plain" is
* assumed. * assumed.
* @param content The message content. * @param content The message content.
* @param msg_data Optional list of headers etc to be included in outgo ing * @param msg_data Optional list of headers etc to be included in outgo ing
* request. The body descriptor in the msg_data is * request. The body descriptor in the msg_data is
* ignored. * ignored.
* @param user_data Optional user data, which will be given back when * @param user_data Optional user data, which will be given back when
* the IM callback is called. * the IM callback is called.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_send_im(call_id, mime_type, content, msg_data, u
ser_data)
* \endcode
* Note that the \a user_data argument is an integer in Python.
*/ */
PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id,
const pj_str_t *mime_type, const pj_str_t *mime_type,
const pj_str_t *content, const pj_str_t *content,
const pjsua_msg_data *msg_data, const pjsua_msg_data *msg_data,
void *user_data); void *user_data);
/** /**
* Send IM typing indication inside INVITE session. * Send IM typing indication inside INVITE session.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param is_typing Non-zero to indicate to remote that local person is * @param is_typing Non-zero to indicate to remote that local person is
* currently typing an IM. * currently typing an IM.
* @param msg_data Optional list of headers etc to be included in outgo ing * @param msg_data Optional list of headers etc to be included in outgo ing
* request. * request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.call_send_typing_ind(call_id, is_typing, msg_data)
* \endcode
* Argument \a msg_data may be set to None if not required.
*/ */
PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id,
pj_bool_t is_typing, pj_bool_t is_typing,
const pjsua_msg_data*msg_dat a); const pjsua_msg_data*msg_dat a);
/** /**
* Send arbitrary request with the call. This is useful for example to send * Send arbitrary request with the call. This is useful for example to send
* INFO request. Note that application should not use this function to send * INFO request. Note that application should not use this function to send
* requests which would change the invite session's state, such as re-INVIT E, * requests which would change the invite session's state, such as re-INVIT E,
* UPDATE, PRACK, and BYE. * UPDATE, PRACK, and BYE.
skipping to change at line 3339 skipping to change at line 2636
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*/ */
PJ_DECL(pj_status_t) pjsua_call_send_request(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_send_request(pjsua_call_id call_id,
const pj_str_t *method, const pj_str_t *method,
const pjsua_msg_data *msg_data) ; const pjsua_msg_data *msg_data) ;
/** /**
* Terminate all calls. This will initiate #pjsua_call_hangup() for all * Terminate all calls. This will initiate #pjsua_call_hangup() for all
* currently active calls. * currently active calls.
*
* \par Python:
* \code
py_pjsua.call_hangup_all()
* \endcode
*/ */
PJ_DECL(void) pjsua_call_hangup_all(void); PJ_DECL(void) pjsua_call_hangup_all(void);
/** /**
* Dump call and media statistics to string. * Dump call and media statistics to string.
* *
* @param call_id Call identification. * @param call_id Call identification.
* @param with_media Non-zero to include media information too. * @param with_media Non-zero to include media information too.
* @param buffer Buffer where the statistics are to be written to. * @param buffer Buffer where the statistics are to be written to.
* @param maxlen Maximum length of buffer. * @param maxlen Maximum length of buffer.
* @param indent Spaces for left indentation. * @param indent Spaces for left indentation.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* \code
string = py_pjsua.call_dump(call_id, with_media, max_len, indent)
* \endcode
* The \a max_len argument is the desired maximum length to be allocated.
*/ */
PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id, PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id,
pj_bool_t with_media, pj_bool_t with_media,
char *buffer, char *buffer,
unsigned maxlen, unsigned maxlen,
const char *indent); const char *indent);
/** /**
* @} * @}
*/ */
skipping to change at line 3411 skipping to change at line 2697
*/ */
#ifndef PJSUA_PRES_TIMER #ifndef PJSUA_PRES_TIMER
# define PJSUA_PRES_TIMER 300 # define PJSUA_PRES_TIMER 300
#endif #endif
/** /**
* This structure describes buddy configuration when adding a buddy to * This structure describes buddy configuration when adding a buddy to
* the buddy list with #pjsua_buddy_add(). Application MUST initialize * the buddy list with #pjsua_buddy_add(). Application MUST initialize
* the structure with #pjsua_buddy_config_default() to initialize this * the structure with #pjsua_buddy_config_default() to initialize this
* structure with default configuration. * structure with default configuration.
*
* \par Python:
* In Python this structure is <tt>py_pjsua.Buddy_Config</tt>. However
* it is recommended that application instantiates the buddy config
* by calling:
* \code
buddy_cfg = py_pjsua.buddy_config_default()
* \endcode
*/ */
typedef struct pjsua_buddy_config typedef struct pjsua_buddy_config
{ {
/** /**
* Buddy URL or name address. * Buddy URL or name address.
*/ */
pj_str_t uri; pj_str_t uri;
/** /**
* Specify whether presence subscription should start immediately. * Specify whether presence subscription should start immediately.
skipping to change at line 3466 skipping to change at line 2744
/** /**
* Buddy is offline. * Buddy is offline.
*/ */
PJSUA_BUDDY_STATUS_OFFLINE, PJSUA_BUDDY_STATUS_OFFLINE,
} pjsua_buddy_status; } pjsua_buddy_status;
/** /**
* This structure describes buddy info, which can be retrieved by calling * This structure describes buddy info, which can be retrieved by calling
* #pjsua_buddy_get_info(). * #pjsua_buddy_get_info().
*
* \par Python:
* This structure in Python is <tt>py_pjsua.Buddy_Info</tt>.
*/ */
typedef struct pjsua_buddy_info typedef struct pjsua_buddy_info
{ {
/** /**
* The buddy ID. * The buddy ID.
*/ */
pjsua_buddy_id id; pjsua_buddy_id id;
/** /**
* The full URI of the buddy, as specified in the configuration. * The full URI of the buddy, as specified in the configuration.
skipping to change at line 3526 skipping to change at line 2801
* presence subscription is currently active, the value will be empty. * presence subscription is currently active, the value will be empty.
*/ */
pj_str_t sub_term_reason; pj_str_t sub_term_reason;
/** /**
* Extended RPID information about the person. * Extended RPID information about the person.
*/ */
pjrpid_element rpid; pjrpid_element rpid;
/** /**
* Extended presence info.
*/
pjsip_pres_status pres_status;
/**
* Internal buffer. * Internal buffer.
*/ */
char buf_[512]; char buf_[512];
} pjsua_buddy_info; } pjsua_buddy_info;
/** /**
* Set default values to the buddy config. * Set default values to the buddy config.
*
* \par Python:
* \code
buddy_cfg = py_pjsua.buddy_config_default()
* \endcode
*/ */
PJ_DECL(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg); PJ_DECL(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg);
/** /**
* Get total number of buddies. * Get total number of buddies.
* *
* @return Number of buddies. * @return Number of buddies.
*
* \par Python:
* \code
buddy_count = py_pjsua.get_buddy_count()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_get_buddy_count(void); PJ_DECL(unsigned) pjsua_get_buddy_count(void);
/** /**
* Check if buddy ID is valid. * Check if buddy ID is valid.
* *
* @param buddy_id Buddy ID to check. * @param buddy_id Buddy ID to check.
* *
* @return Non-zero if buddy ID is valid. * @return Non-zero if buddy ID is valid.
*
* \par Python:
* \code
is_valid = py_pjsua.buddy_is_valid(buddy_id)
* \endcode
*/ */
PJ_DECL(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id); PJ_DECL(pj_bool_t) pjsua_buddy_is_valid(pjsua_buddy_id buddy_id);
/** /**
* Enumerate all buddy IDs in the buddy list. Application then can use * Enumerate all buddy IDs in the buddy list. Application then can use
* #pjsua_buddy_get_info() to get the detail information for each buddy * #pjsua_buddy_get_info() to get the detail information for each buddy
* id. * id.
* *
* @param ids Array of ids to be initialized. * @param ids Array of ids to be initialized.
* @param count On input, specifies max elements in the arra y. * @param count On input, specifies max elements in the arra y.
* On return, it contains actual number of elements * On return, it contains actual number of elements
* that have been initialized. * that have been initialized.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The Python function takes no argument and returns list of buddy IDs:
* \code
[buddy_ids] = py_pjsua.enum_buddies()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[], PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[],
unsigned *count); unsigned *count);
/** /**
* Find the buddy ID with the specified URI. * Find the buddy ID with the specified URI.
* *
* @param uri The buddy URI. * @param uri The buddy URI.
* *
* @return The buddy ID, or PJSUA_INVALID_ID if not found. * @return The buddy ID, or PJSUA_INVALID_ID if not found.
*/ */
PJ_DECL(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri); PJ_DECL(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri);
/** /**
* Get detailed buddy info. * Get detailed buddy info.
* *
* @param buddy_id The buddy identification. * @param buddy_id The buddy identification.
* @param info Pointer to receive information about buddy. * @param info Pointer to receive information about buddy.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
buddy_info = py_pjsua.buddy_get_info(buddy_id)
* \endcode
* The function returns None if buddy_id is not valid.
*/ */
PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id, PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id,
pjsua_buddy_info *info); pjsua_buddy_info *info);
/** /**
* Set the user data associated with the buddy object. * Set the user data associated with the buddy object.
* *
* @param buddy_id The buddy identification. * @param buddy_id The buddy identification.
* @param user_data Arbitrary application data to be associated with * @param user_data Arbitrary application data to be associated with
* the buddy object. * the buddy object.
skipping to change at line 3645 skipping to change at line 2898
/** /**
* Add new buddy to the buddy list. If presence subscription is enabled * Add new buddy to the buddy list. If presence subscription is enabled
* for this buddy, this function will also start the presence subscription * for this buddy, this function will also start the presence subscription
* session immediately. * session immediately.
* *
* @param buddy_cfg Buddy configuration. * @param buddy_cfg Buddy configuration.
* @param p_buddy_id Pointer to receive buddy ID. * @param p_buddy_id Pointer to receive buddy ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function returns (status, buddy_id) tuple:
* \code
status, buddy_id = py_pjsua.buddy_add(buddy_cfg)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg, PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg,
pjsua_buddy_id *p_buddy_id); pjsua_buddy_id *p_buddy_id);
/** /**
* Delete the specified buddy from the buddy list. Any presence subscriptio n * Delete the specified buddy from the buddy list. Any presence subscriptio n
* to this buddy will be terminated. * to this buddy will be terminated.
* *
* @param buddy_id Buddy identification. * @param buddy_id Buddy identification.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.buddy_del(buddy_id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id); PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id);
/** /**
* Enable/disable buddy's presence monitoring. Once buddy's presence is * Enable/disable buddy's presence monitoring. Once buddy's presence is
* subscribed, application will be informed about buddy's presence status * subscribed, application will be informed about buddy's presence status
* changed via \a on_buddy_state() callback. * changed via \a on_buddy_state() callback.
* *
* @param buddy_id Buddy identification. * @param buddy_id Buddy identification.
* @param subscribe Specify non-zero to activate presence subscription t o * @param subscribe Specify non-zero to activate presence subscription t o
* the specified buddy. * the specified buddy.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.buddy_subscribe_pres(buddy_id, subscribe)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id, PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id,
pj_bool_t subscribe); pj_bool_t subscribe);
/** /**
* Update the presence information for the buddy. Although the library * Update the presence information for the buddy. Although the library
* periodically refreshes the presence subscription for all buddies, some * periodically refreshes the presence subscription for all buddies, some
* application may want to refresh the buddy's presence subscription * application may want to refresh the buddy's presence subscription
* immediately, and in this case it can use this function to accomplish * immediately, and in this case it can use this function to accomplish
* this. * this.
skipping to change at line 3744 skipping to change at line 2981
pjsip_evsub_state state, pjsip_evsub_state state,
const pj_str_t *state_str, const pj_str_t *state_str,
const pj_str_t *reason, const pj_str_t *reason,
pj_bool_t with_body, pj_bool_t with_body,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* Dump presence subscriptions to log. * Dump presence subscriptions to log.
* *
* @param verbose Yes or no. * @param verbose Yes or no.
*
* \par Python:
* \code
py_pjsua.pres_dump()
* \endcode
*/ */
PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose); PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose);
/** /**
* The MESSAGE method (defined in pjsua_im.c) * The MESSAGE method (defined in pjsua_im.c)
*/ */
extern const pjsip_method pjsip_message_method; extern const pjsip_method pjsip_message_method;
/** /**
* Send instant messaging outside dialog, using the specified account for * Send instant messaging outside dialog, using the specified account for
skipping to change at line 3773 skipping to change at line 3005
* @param mime_type Optional MIME type. If NULL, then "text/plain" is * @param mime_type Optional MIME type. If NULL, then "text/plain" is
* assumed. * assumed.
* @param content The message content. * @param content The message content.
* @param msg_data Optional list of headers etc to be included in outgo ing * @param msg_data Optional list of headers etc to be included in outgo ing
* request. The body descriptor in the msg_data is * request. The body descriptor in the msg_data is
* ignored. * ignored.
* @param user_data Optional user data, which will be given back when * @param user_data Optional user data, which will be given back when
* the IM callback is called. * the IM callback is called.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.im_send(acc_id, to, mime_type, content, msg_data, use
r_data)
* \endcode
* Arguments \a mime_type and \a msg_data may be set to None if not require
d.
*/ */
PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id,
const pj_str_t *to, const pj_str_t *to,
const pj_str_t *mime_type, const pj_str_t *mime_type,
const pj_str_t *content, const pj_str_t *content,
const pjsua_msg_data *msg_data, const pjsua_msg_data *msg_data,
void *user_data); void *user_data);
/** /**
* Send typing indication outside dialog. * Send typing indication outside dialog.
* *
* @param acc_id Account ID to be used to send the request. * @param acc_id Account ID to be used to send the request.
* @param to Remote URI. * @param to Remote URI.
* @param is_typing If non-zero, it tells remote person that local perso n * @param is_typing If non-zero, it tells remote person that local perso n
* is currently composing an IM. * is currently composing an IM.
* @param msg_data Optional list of headers etc to be added to outgoing * @param msg_data Optional list of headers etc to be added to outgoing
* request. * request.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.im_typing(acc_id, to, is_typing, msg_data)
* \endcode
* Argument \a msg_data may be set to None if not requried.
*/ */
PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id, PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
const pj_str_t *to, const pj_str_t *to,
pj_bool_t is_typing, pj_bool_t is_typing,
const pjsua_msg_data *msg_data); const pjsua_msg_data *msg_data);
/** /**
* @} * @}
*/ */
skipping to change at line 3946 skipping to change at line 3166
* The maximum file player. * The maximum file player.
*/ */
#ifndef PJSUA_MAX_RECORDERS #ifndef PJSUA_MAX_RECORDERS
# define PJSUA_MAX_RECORDERS 32 # define PJSUA_MAX_RECORDERS 32
#endif #endif
/** /**
* This structure describes media configuration, which will be specified * This structure describes media configuration, which will be specified
* when calling #pjsua_init(). Application MUST initialize this structure * when calling #pjsua_init(). Application MUST initialize this structure
* by calling #pjsua_media_config_default(). * by calling #pjsua_media_config_default().
*
* \par Python:
* This data type in Python is <tt>py_pjsua.Media_Config</tt>. To create
* an object of this type, it is recommended to call
* <tt>py_pjsua.media_config_default()</tt> function instead:
* \code
media_cfg = py_pjsua.media_config_default()
* \endcode
*/ */
struct pjsua_media_config struct pjsua_media_config
{ {
/** /**
* Clock rate to be applied to the conference bridge. * Clock rate to be applied to the conference bridge.
* If value is zero, default clock rate will be used * If value is zero, default clock rate will be used
* (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz). * (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
*/ */
unsigned clock_rate; unsigned clock_rate;
skipping to change at line 4127 skipping to change at line 3339
* Default: -1 (to use default stream settings, currently 360 msec) * Default: -1 (to use default stream settings, currently 360 msec)
*/ */
int jb_max; int jb_max;
/** /**
* Enable ICE * Enable ICE
*/ */
pj_bool_t enable_ice; pj_bool_t enable_ice;
/** /**
* Disable ICE host candidates. * Set the maximum number of host candidates.
*
* Default: -1 (maximum not set)
*/
int ice_max_host_cands;
/**
* ICE session options.
*/ */
pj_bool_t ice_no_host_cands; pj_ice_sess_options ice_opt;
/** /**
* Disable RTCP component. * Disable RTCP component.
* *
* Default: no * Default: no
*/ */
pj_bool_t ice_no_rtcp; pj_bool_t ice_no_rtcp;
/** /**
* Enable TURN relay candidate in ICE. * Enable TURN relay candidate in ICE.
skipping to change at line 4176 skipping to change at line 3395
* *
* Default : 1 * Default : 1
*/ */
int snd_auto_close_time; int snd_auto_close_time;
}; };
/** /**
* Use this function to initialize media config. * Use this function to initialize media config.
* *
* @param cfg The media config to be initialized. * @param cfg The media config to be initialized.
*
* \par Python:
* \code
media_cfg = py_pjsua.media_config_default()
* \endcode
*/ */
PJ_DECL(void) pjsua_media_config_default(pjsua_media_config *cfg); PJ_DECL(void) pjsua_media_config_default(pjsua_media_config *cfg);
/** /**
* This structure describes codec information, which can be retrieved by * This structure describes codec information, which can be retrieved by
* calling #pjsua_enum_codecs(). * calling #pjsua_enum_codecs().
*/ */
typedef struct pjsua_codec_info typedef struct pjsua_codec_info
{ {
/** /**
skipping to change at line 4211 skipping to change at line 3425
* Internal buffer. * Internal buffer.
*/ */
char buf_[32]; char buf_[32];
} pjsua_codec_info; } pjsua_codec_info;
/** /**
* This structure descibes information about a particular media port that * This structure descibes information about a particular media port that
* has been registered into the conference bridge. Application can query * has been registered into the conference bridge. Application can query
* this info by calling #pjsua_conf_get_port_info(). * this info by calling #pjsua_conf_get_port_info().
*
* \par Python:
* In Python, this type is <tt>py_pjsua.Conf_Port_Info</tt>.
*/ */
typedef struct pjsua_conf_port_info typedef struct pjsua_conf_port_info
{ {
/** Conference port number. */ /** Conference port number. */
pjsua_conf_port_id slot_id; pjsua_conf_port_id slot_id;
/** Port name. */ /** Port name. */
pj_str_t name; pj_str_t name;
/** Clock rate. */ /** Clock rate. */
skipping to change at line 4248 skipping to change at line 3459
/** Array of listeners (in other words, ports where this port is /** Array of listeners (in other words, ports where this port is
* transmitting to. * transmitting to.
*/ */
pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS]; pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS];
} pjsua_conf_port_info; } pjsua_conf_port_info;
/** /**
* This structure holds information about custom media transport to * This structure holds information about custom media transport to
* be registered to pjsua. * be registered to pjsua.
*
* \par Python:
* Not applicable.
*/ */
typedef struct pjsua_media_transport typedef struct pjsua_media_transport
{ {
/** /**
* Media socket information containing the address information * Media socket information containing the address information
* of the RTP and RTCP socket. * of the RTP and RTCP socket.
*/ */
pjmedia_sock_info skinfo; pjmedia_sock_info skinfo;
/** /**
* The media transport instance. * The media transport instance.
*/ */
pjmedia_transport *transport; pjmedia_transport *transport;
} pjsua_media_transport; } pjsua_media_transport;
/** /**
* Get maxinum number of conference ports. * Get maxinum number of conference ports.
* *
* @return Maximum number of ports in the conference bridge. * @return Maximum number of ports in the conference bridge.
*
* \par Python:
* \code
port_count = py_pjsua.conf_get_max_ports()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_conf_get_max_ports(void); PJ_DECL(unsigned) pjsua_conf_get_max_ports(void);
/** /**
* Get current number of active ports in the bridge. * Get current number of active ports in the bridge.
* *
* @return The number. * @return The number.
*
* \par Python:
* \code
count = py_pjsua.conf_get_active_ports()
* \endcode
*/ */
PJ_DECL(unsigned) pjsua_conf_get_active_ports(void); PJ_DECL(unsigned) pjsua_conf_get_active_ports(void);
/** /**
* Enumerate all conference ports. * Enumerate all conference ports.
* *
* @param id Array of conference port ID to be initialized. * @param id Array of conference port ID to be initialized.
* @param count On input, specifies max elements in the arra y. * @param count On input, specifies max elements in the arra y.
* On return, it contains actual number of elements * On return, it contains actual number of elements
* that have been initialized. * that have been initialized.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The Python functions returns list of conference port Ids:
* \code
[port_ids] = py_pjsua.enum_conf_ports()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[], PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[],
unsigned *count); unsigned *count);
/** /**
* Get information about the specified conference port * Get information about the specified conference port
* *
* @param port_id Port identification. * @param port_id Port identification.
* @param info Pointer to store the port info. * @param info Pointer to store the port info.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
port_info = py_pjsua.conf_get_port_info(port_id)
* \endcode
* The function will return None if \a port_id is not valid.
*/ */
PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id port_id, PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id port_id,
pjsua_conf_port_info *info); pjsua_conf_port_info *info);
/** /**
* Add arbitrary media port to PJSUA's conference bridge. Application * Add arbitrary media port to PJSUA's conference bridge. Application
* can use this function to add the media port that it creates. For * can use this function to add the media port that it creates. For
* media ports that are created by PJSUA-LIB (such as calls, file player, * media ports that are created by PJSUA-LIB (such as calls, file player,
* or file recorder), PJSUA-LIB will automatically add the port to * or file recorder), PJSUA-LIB will automatically add the port to
* the bridge. * the bridge.
* *
* @param pool Pool to use. * @param pool Pool to use.
* @param port Media port to be added to the bridge. * @param port Media port to be added to the bridge.
* @param p_id Optional pointer to receive the conference * @param p_id Optional pointer to receive the conference
* slot id. * slot id.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not applicable (for now)
*/ */
PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool, PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool,
pjmedia_port *port, pjmedia_port *port,
pjsua_conf_port_id *p_id); pjsua_conf_port_id *p_id);
/** /**
* Remove arbitrary slot from the conference bridge. Application should onl y * Remove arbitrary slot from the conference bridge. Application should onl y
* call this function if it registered the port manually with previous call * call this function if it registered the port manually with previous call
* to #pjsua_conf_add_port(). * to #pjsua_conf_add_port().
* *
* @param port_id The slot id of the port to be removed. * @param port_id The slot id of the port to be removed.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.conf_remove_port(port_id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id port_id); PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id port_id);
/** /**
* Establish unidirectional media flow from souce to sink. One source * Establish unidirectional media flow from souce to sink. One source
* may transmit to multiple destinations/sink. And if multiple * may transmit to multiple destinations/sink. And if multiple
* sources are transmitting to the same sink, the media will be mixed * sources are transmitting to the same sink, the media will be mixed
* together. Source and sink may refer to the same ID, effectively * together. Source and sink may refer to the same ID, effectively
* looping the media. * looping the media.
* *
* If bidirectional media flow is desired, application needs to call * If bidirectional media flow is desired, application needs to call
* this function twice, with the second one having the arguments * this function twice, with the second one having the arguments
* reversed. * reversed.
* *
* @param source Port ID of the source media/transmitter. * @param source Port ID of the source media/transmitter.
* @param sink Port ID of the destination media/received. * @param sink Port ID of the destination media/received.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.conf_connect(source, sink)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source, PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source,
pjsua_conf_port_id sink); pjsua_conf_port_id sink);
/** /**
* Disconnect media flow from the source to destination port. * Disconnect media flow from the source to destination port.
* *
* @param source Port ID of the source media/transmitter. * @param source Port ID of the source media/transmitter.
* @param sink Port ID of the destination media/received. * @param sink Port ID of the destination media/received.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.conf_disconnect(source, sink)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source, PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source,
pjsua_conf_port_id sink); pjsua_conf_port_id sink);
/** /**
* Adjust the signal level to be transmitted from the bridge to the * Adjust the signal level to be transmitted from the bridge to the
* specified port by making it louder or quieter. * specified port by making it louder or quieter.
* *
* @param slot The conference bridge slot number. * @param slot The conference bridge slot number.
* @param level Signal level adjustment. Value 1.0 means no level * @param level Signal level adjustment. Value 1.0 means no level
* adjustment, while value 0 means to mute the port. * adjustment, while value 0 means to mute the port.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not implemented (yet)
*/ */
PJ_DECL(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot, PJ_DECL(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot,
float level); float level);
/** /**
* Adjust the signal level to be received from the specified port (to * Adjust the signal level to be received from the specified port (to
* the bridge) by making it louder or quieter. * the bridge) by making it louder or quieter.
* *
* @param slot The conference bridge slot number. * @param slot The conference bridge slot number.
* @param level Signal level adjustment. Value 1.0 means no level * @param level Signal level adjustment. Value 1.0 means no level
* adjustment, while value 0 means to mute the port. * adjustment, while value 0 means to mute the port.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not implemented (yet)
*/ */
PJ_DECL(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot, PJ_DECL(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot,
float level); float level);
/** /**
* Get last signal level transmitted to or received from the specified port . * Get last signal level transmitted to or received from the specified port .
* The signal level is an integer value in zero to 255, with zero indicates * The signal level is an integer value in zero to 255, with zero indicates
* no signal, and 255 indicates the loudest signal level. * no signal, and 255 indicates the loudest signal level.
* *
* @param slot The conference bridge slot number. * @param slot The conference bridge slot number.
* @param tx_level Optional argument to receive the level of signal * @param tx_level Optional argument to receive the level of signal
* transmitted to the specified port (i.e. the directio n * transmitted to the specified port (i.e. the directio n
* is from the bridge to the port). * is from the bridge to the port).
* @param rx_level Optional argument to receive the level of signal * @param rx_level Optional argument to receive the level of signal
* received from the port (i.e. the direction is from t he * received from the port (i.e. the direction is from t he
* port to the bridge). * port to the bridge).
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* Not implemented (yet)
*/ */
PJ_DECL(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot, PJ_DECL(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot,
unsigned *tx_level, unsigned *tx_level,
unsigned *rx_level); unsigned *rx_level);
/************************************************************************** *** /************************************************************************** ***
* File player and playlist. * File player and playlist.
*/ */
/** /**
skipping to change at line 4475 skipping to change at line 3634
* *
* @param filename The filename to be played. Currently only * @param filename The filename to be played. Currently only
* WAV files are supported, and the WAV file MUST be * WAV files are supported, and the WAV file MUST be
* formatted as 16bit PCM mono/single channel (any * formatted as 16bit PCM mono/single channel (any
* clock rate is supported). * clock rate is supported).
* @param options Optional option flag. Application may specify * @param options Optional option flag. Application may specify
* PJMEDIA_FILE_NO_LOOP to prevent playback loop. * PJMEDIA_FILE_NO_LOOP to prevent playback loop.
* @param p_id Pointer to receive player ID. * @param p_id Pointer to receive player ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function returns (status, id) tuple:
* \code
status, id = py_pjsua.player_create(filename, options)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename, PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename,
unsigned options, unsigned options,
pjsua_player_id *p_id); pjsua_player_id *p_id);
/** /**
* Create a file playlist media port, and automatically add the port * Create a file playlist media port, and automatically add the port
* to the conference bridge. * to the conference bridge.
* *
* @param file_names Array of file names to be added to the play list. * @param file_names Array of file names to be added to the play list.
* Note that the files must have the same clock rate, * Note that the files must have the same clock rate,
* number of channels, and number of bits per sample. * number of channels, and number of bits per sample.
* @param file_count Number of files in the array. * @param file_count Number of files in the array.
* @param label Optional label to be set for the media port. * @param label Optional label to be set for the media port.
* @param options Optional option flag. Application may specify * @param options Optional option flag. Application may specify
* PJMEDIA_FILE_NO_LOOP to prevent looping. * PJMEDIA_FILE_NO_LOOP to prevent looping.
* @param p_id Optional pointer to receive player ID. * @param p_id Optional pointer to receive player ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not implemented yet.
*/ */
PJ_DECL(pj_status_t) pjsua_playlist_create(const pj_str_t file_names[], PJ_DECL(pj_status_t) pjsua_playlist_create(const pj_str_t file_names[],
unsigned file_count, unsigned file_count,
const pj_str_t *label, const pj_str_t *label,
unsigned options, unsigned options,
pjsua_player_id *p_id); pjsua_player_id *p_id);
/** /**
* Get conference port ID associated with player or playlist. * Get conference port ID associated with player or playlist.
* *
* @param id The file player ID. * @param id The file player ID.
* *
* @return Conference port ID associated with this player. * @return Conference port ID associated with this player.
*
* \par Python:
* \code
port_id = py_pjsua.player_get_conf_port(id)
* \endcode
*/ */
PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id); PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id);
/** /**
* Get the media port for the player or playlist. * Get the media port for the player or playlist.
* *
* @param id The player ID. * @param id The player ID.
* @param p_port The media port associated with the player. * @param p_port The media port associated with the player.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* Not applicable.
*/ */
PJ_DECL(pj_status_t) pjsua_player_get_port(pjsua_player_id id, PJ_DECL(pj_status_t) pjsua_player_get_port(pjsua_player_id id,
pjmedia_port **p_port); pjmedia_port **p_port);
/** /**
* Set playback position. This operation is not valid for playlist. * Set playback position. This operation is not valid for playlist.
* *
* @param id The file player ID. * @param id The file player ID.
* @param samples The playback position, in samples. Application can * @param samples The playback position, in samples. Application can
* specify zero to re-start the playback. * specify zero to re-start the playback.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.player_set_pos(id, samples)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id, PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id,
pj_uint32_t samples); pj_uint32_t samples);
/** /**
* Close the file of playlist, remove the player from the bridge, and free * Close the file of playlist, remove the player from the bridge, and free
* resources associated with the file player or playlist. * resources associated with the file player or playlist.
* *
* @param id The file player ID. * @param id The file player ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.player_destroy(id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id); PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id);
/************************************************************************** *** /************************************************************************** ***
* File recorder. * File recorder.
*/ */
/** /**
* Create a file recorder, and automatically connect this recorder to * Create a file recorder, and automatically connect this recorder to
* the conference bridge. The recorder currently supports recording WAV fil e. * the conference bridge. The recorder currently supports recording WAV fil e.
skipping to change at line 4595 skipping to change at line 3727
* encodings. This value must be zero for now. * encodings. This value must be zero for now.
* @param enc_param Optionally specify codec specific parameter to be * @param enc_param Optionally specify codec specific parameter to be
* passed to the file writer. * passed to the file writer.
* For .WAV recorder, this value must be NULL. * For .WAV recorder, this value must be NULL.
* @param max_size Maximum file size. Specify zero or -1 to remove size * @param max_size Maximum file size. Specify zero or -1 to remove size
* limitation. This value must be zero or -1 for now. * limitation. This value must be zero or -1 for now.
* @param options Optional options. * @param options Optional options.
* @param p_id Pointer to receive the recorder instance. * @param p_id Pointer to receive the recorder instance.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status, id = py_pjsua.recorder_create(filename, enc_type, enc_param, ma
x_size, options)
* \endcode
* The \a enc_param is a string in Python.
*/ */
PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename, PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename,
unsigned enc_type, unsigned enc_type,
void *enc_param, void *enc_param,
pj_ssize_t max_size, pj_ssize_t max_size,
unsigned options, unsigned options,
pjsua_recorder_id *p_id); pjsua_recorder_id *p_id);
/** /**
* Get conference port associated with recorder. * Get conference port associated with recorder.
* *
* @param id The recorder ID. * @param id The recorder ID.
* *
* @return Conference port ID associated with this recorder. * @return Conference port ID associated with this recorder.
*
* \par Python:
* \code
port_id = py_pjsua.recorder_get_conf_port(id)
* \endcode
*/ */
PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id); PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id);
/** /**
* Get the media port for the recorder. * Get the media port for the recorder.
* *
* @param id The recorder ID. * @param id The recorder ID.
* @param p_port The media port associated with the recorder. * @param p_port The media port associated with the recorder.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* Not applicable.
*/ */
PJ_DECL(pj_status_t) pjsua_recorder_get_port(pjsua_recorder_id id, PJ_DECL(pj_status_t) pjsua_recorder_get_port(pjsua_recorder_id id,
pjmedia_port **p_port); pjmedia_port **p_port);
/** /**
* Destroy recorder (this will complete recording). * Destroy recorder (this will complete recording).
* *
* @param id The recorder ID. * @param id The recorder ID.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.recorder_destroy(id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id); PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id);
/************************************************************************** *** /************************************************************************** ***
* Sound devices. * Sound devices.
*/ */
/** /**
* Enum all audio devices installed in the system. * Enum all audio devices installed in the system.
* *
skipping to change at line 4677 skipping to change at line 3790
/** /**
* Enum all sound devices installed in the system (old API). * Enum all sound devices installed in the system (old API).
* *
* @param info Array of info to be initialized. * @param info Array of info to be initialized.
* @param count On input, specifies max elements in the arra y. * @param count On input, specifies max elements in the arra y.
* On return, it contains actual number of elements * On return, it contains actual number of elements
* that have been initialized. * that have been initialized.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
*
* \par Python:
* The function returns list of sound device info:
* \code
[dev_infos] = py_pjsua.enum_snd_devs()
* \endcode
*
*/ */
PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[], PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[],
unsigned *count); unsigned *count);
/** /**
* Get currently active sound devices. If sound devices has not been create d * Get currently active sound devices. If sound devices has not been create d
* (for example when pjsua_start() is not called), it is possible that * (for example when pjsua_start() is not called), it is possible that
* the function returns PJ_SUCCESS with -1 as device IDs. * the function returns PJ_SUCCESS with -1 as device IDs.
* *
* @param capture_dev On return it will be filled with device ID of the * @param capture_dev On return it will be filled with device ID of the
* capture device. * capture device.
* @param playback_dev On return it will be filled with device ID of the * @param playback_dev On return it will be filled with device ID of the
* device ID of the playback device. * device ID of the playback device.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The function takes no argument and return an (integer,integer) tuple:
* \code
capture_dev, playback_dev = py_pjsua.get_snd_dev()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev, PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev,
int *playback_dev); int *playback_dev);
/** /**
* Select or change sound device. Application may call this function at * Select or change sound device. Application may call this function at
* any time to replace current sound device. * any time to replace current sound device.
* *
* @param capture_dev Device ID of the capture device. * @param capture_dev Device ID of the capture device.
* @param playback_dev Device ID of the playback device. * @param playback_dev Device ID of the playback device.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.set_snd_dev(capture_dev, playback_dev)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev, PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
int playback_dev); int playback_dev);
/** /**
* Set pjsua to use null sound device. The null sound device only provides * Set pjsua to use null sound device. The null sound device only provides
* the timing needed by the conference bridge, and will not interract with * the timing needed by the conference bridge, and will not interract with
* any hardware. * any hardware.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.set_null_snd_dev()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void); PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void);
/** /**
* Disconnect the main conference bridge from any sound devices, and let * Disconnect the main conference bridge from any sound devices, and let
* application connect the bridge to it's own sound device/master port. * application connect the bridge to it's own sound device/master port.
* *
* @return The port interface of the conference bridge, * @return The port interface of the conference bridge,
* so that application can connect this to it's own * so that application can connect this to it's own
* sound device or master port. * sound device or master port.
*
* \par Python:
* Not applicable (for now).
*/ */
PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void); PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void);
/** /**
* Change the echo cancellation settings. * Change the echo cancellation settings.
* *
* The behavior of this function depends on whether the sound device is * The behavior of this function depends on whether the sound device is
* currently active, and if it is, whether device or software AEC is * currently active, and if it is, whether device or software AEC is
* being used. * being used.
* *
skipping to change at line 4778 skipping to change at line 3864
* If the sound device is not currently active, this will only change the * If the sound device is not currently active, this will only change the
* default AEC settings and the setting will be applied next time the * default AEC settings and the setting will be applied next time the
* sound device is opened. * sound device is opened.
* *
* @param tail_ms The tail length, in miliseconds. Set to zero to * @param tail_ms The tail length, in miliseconds. Set to zero to
* disable AEC. * disable AEC.
* @param options Options to be passed to pjmedia_echo_create(). * @param options Options to be passed to pjmedia_echo_create().
* Normally the value should be zero. * Normally the value should be zero.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* \code
status = py_pjsua.set_ec(tail_ms, options)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options); PJ_DECL(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options);
/** /**
* Get current echo canceller tail length. * Get current echo canceller tail length.
* *
* @param p_tail_ms Pointer to receive the tail length, in miliseconds. * @param p_tail_ms Pointer to receive the tail length, in miliseconds.
* If AEC is disabled, the value will be zero. * If AEC is disabled, the value will be zero.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*
* \par Python:
* \code
tail_ms = py_pjsua.get_ec_tail()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms); PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms);
/** /**
* Check whether the sound device is currently active. The sound device * Check whether the sound device is currently active. The sound device
* may be inactive if the application has set the auto close feature to * may be inactive if the application has set the auto close feature to
* non-zero (the snd_auto_close_time setting in #pjsua_media_config), or * non-zero (the snd_auto_close_time setting in #pjsua_media_config), or
* if null sound device or no sound device has been configured via the * if null sound device or no sound device has been configured via the
* #pjsua_set_no_snd_dev() function. * #pjsua_set_no_snd_dev() function.
*/ */
skipping to change at line 4876 skipping to change at line 3952
/** /**
* Enum all supported codecs in the system. * Enum all supported codecs in the system.
* *
* @param id Array of ID to be initialized. * @param id Array of ID to be initialized.
* @param count On input, specifies max elements in the arra y. * @param count On input, specifies max elements in the arra y.
* On return, it contains actual number of elements * On return, it contains actual number of elements
* that have been initialized. * that have been initialized.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* This function takes no argument and returns list of codec infos:
* \code
[codec_info] = py_pjsua.enum_codecs()
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[], PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[],
unsigned *count ); unsigned *count );
/** /**
* Change codec priority. * Change codec priority.
* *
* @param codec_id Codec ID, which is a string that uniquely identify * @param codec_id Codec ID, which is a string that uniquely identify
* the codec (such as "speex/8000"). Please see pjsua * the codec (such as "speex/8000"). Please see pjsua
* manual or pjmedia codec reference for details. * manual or pjmedia codec reference for details.
* @param priority Codec priority, 0-255, where zero means to disable * @param priority Codec priority, 0-255, where zero means to disable
* the codec. * the codec.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* \code
status = py_pjsua.codec_set_priority(codec_id, priority)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *codec_id, PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *codec_id,
pj_uint8_t priority ); pj_uint8_t priority );
/** /**
* Get codec parameters. * Get codec parameters.
* *
* @param codec_id Codec ID. * @param codec_id Codec ID.
* @param param Structure to receive codec parameters. * @param param Structure to receive codec parameters.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The Python function is experimental:
* \code
codec_param = py_pjsua.codec_get_param(codec_id)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *codec_id, PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *codec_id,
pjmedia_codec_param *param ); pjmedia_codec_param *param );
/** /**
* Set codec parameters. * Set codec parameters.
* *
* @param codec_id Codec ID. * @param codec_id Codec ID.
* @param param Codec parameter to set. * @param param Codec parameter to set.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* The Python function is experimental:
* \code
status = py_pjsua.codec_set_param(codec_id, param)
* \endcode
*/ */
PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *codec_id, PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *codec_id,
const pjmedia_codec_param *param ); const pjmedia_codec_param *param );
/** /**
* Create UDP media transports for all the calls. This function creates * Create UDP media transports for all the calls. This function creates
* one UDP media transport for each call. * one UDP media transport for each call.
* *
* @param cfg Media transport configuration. The "port" field in t he * @param cfg Media transport configuration. The "port" field in t he
* configuration is used as the start port to bind the * configuration is used as the start port to bind the
* sockets. * sockets.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Not implemented yet.
*/ */
PJ_DECL(pj_status_t) PJ_DECL(pj_status_t)
pjsua_media_transports_create(const pjsua_transport_config *cfg); pjsua_media_transports_create(const pjsua_transport_config *cfg);
/** /**
* Register custom media transports to be used by calls. There must * Register custom media transports to be used by calls. There must
* enough media transports for all calls. * enough media transports for all calls.
* *
* @param tp The media transport array. * @param tp The media transport array.
* @param count Number of elements in the array. This number MUST * @param count Number of elements in the array. This number MUST
* match the number of maximum calls configured when * match the number of maximum calls configured when
* pjsua is created. * pjsua is created.
* @param auto_delete Flag to indicate whether the transports should be * @param auto_delete Flag to indicate whether the transports should be
* destroyed when pjsua is shutdown. * destroyed when pjsua is shutdown.
* *
* @return PJ_SUCCESS on success, or the appropriate error code . * @return PJ_SUCCESS on success, or the appropriate error code .
*
* \par Python:
* Note applicable.
*/ */
PJ_DECL(pj_status_t) PJ_DECL(pj_status_t)
pjsua_media_transports_attach( pjsua_media_transport tp[], pjsua_media_transports_attach( pjsua_media_transport tp[],
unsigned count, unsigned count,
pj_bool_t auto_delete); pj_bool_t auto_delete);
/** /**
* @} * @}
*/ */
 End of changes. 158 change blocks. 
991 lines changed or deleted 22 lines changed or added


 presence.h   presence.h 
/* $Id: presence.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: presence.h 2762 2009-06-15 16:03:40Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 86 skipping to change at line 86
{ {
unsigned info_cnt; /**< Number of info in the status. */ unsigned info_cnt; /**< Number of info in the status. */
struct { struct {
pj_bool_t basic_open; /**< Basic status/availability. */ pj_bool_t basic_open; /**< Basic status/availability. */
pjrpid_element rpid; /**< Optional RPID info. */ pjrpid_element rpid; /**< Optional RPID info. */
pj_str_t id; /**< Tuple id. */ pj_str_t id; /**< Tuple id. */
pj_str_t contact; /**< Optional contact address. */ pj_str_t contact; /**< Optional contact address. */
pj_xml_node *tuple_node; /**< Pointer to tuple XML node of
parsed PIDF body received from
remote agent. Only valid for
client subscription. If the
last received NOTIFY request
does not contain any PIDF body,
this valud will be set to NULL
*/
} info[PJSIP_PRES_STATUS_MAX_INFO]; /**< Array of info. */ } info[PJSIP_PRES_STATUS_MAX_INFO]; /**< Array of info. */
pj_bool_t _is_valid; /**< Internal flag. */ pj_bool_t _is_valid; /**< Internal flag. */
}; };
/** /**
* @see pjsip_pres_status * @see pjsip_pres_status
*/ */
typedef struct pjsip_pres_status pjsip_pres_status; typedef struct pjsip_pres_status pjsip_pres_status;
 End of changes. 2 change blocks. 
1 lines changed or deleted 10 lines changed or added


 sip_config.h   sip_config.h 
/* $Id: sip_config.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sip_config.h 2762 2009-06-15 16:03:40Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 222 skipping to change at line 222
/** /**
* Maximum packet length. We set it more than MTU since a SIP PDU * Maximum packet length. We set it more than MTU since a SIP PDU
* containing presence information can be quite large (>1500). * containing presence information can be quite large (>1500).
*/ */
#ifndef PJSIP_MAX_PKT_LEN #ifndef PJSIP_MAX_PKT_LEN
# define PJSIP_MAX_PKT_LEN 2000 # define PJSIP_MAX_PKT_LEN 2000
#endif #endif
/** /**
* RFC 3261 section 18.1.1:
* If a request is within 200 bytes of the path MTU, or if it is larger
* than 1300 bytes and the path MTU is unknown, the request MUST be sent
* using an RFC 2914 [43] congestion controlled transport protocol, such
* as TCP.
*
* Disable the behavior of automatic switching to TCP whenever UDP packet
* size exceeds the threshold defined in PJSIP_UDP_SIZE_THRESHOLD.
*
* Default is 0 (no).
*/
#ifndef PJSIP_DONT_SWITCH_TO_TCP
# define PJSIP_DONT_SWITCH_TO_TCP 0
#endif
/**
* This setting controls the threshold of the UDP packet, which if it's
* larger than this value the request will be sent with TCP. This setting
* is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0.
*
* Default is 1300 bytes.
*/
#ifndef PJSIP_UDP_SIZE_THRESHOLD
# define PJSIP_UDP_SIZE_THRESHOLD 1300
#endif
/**
* Encode SIP headers in their short forms to reduce size. By default, * Encode SIP headers in their short forms to reduce size. By default,
* SIP headers in outgoing messages will be encoded in their full names. * SIP headers in outgoing messages will be encoded in their full names.
* If this option is enabled, then SIP headers for outgoing messages * If this option is enabled, then SIP headers for outgoing messages
* will be encoded in their short forms, to reduce message size. * will be encoded in their short forms, to reduce message size.
* Note that this does not affect the ability of PJSIP to parse incoming * Note that this does not affect the ability of PJSIP to parse incoming
* SIP messages, as the parser always supports parsing both the long * SIP messages, as the parser always supports parsing both the long
* and short version of the headers. * and short version of the headers.
* *
* Note that there is also an undocumented variable defined in sip_msg.c * Note that there is also an undocumented variable defined in sip_msg.c
* to control whether compact form should be used for encoding SIP * to control whether compact form should be used for encoding SIP
skipping to change at line 745 skipping to change at line 772
* *
* This setting can be changed in run-time by setting * This setting can be changed in run-time by setting
* \a regc.add_xuid_param field of pjsip_cfg(). * \a regc.add_xuid_param field of pjsip_cfg().
* *
* Default is 0. * Default is 0.
*/ */
#ifndef PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM #ifndef PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM
# define PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM 0 # define PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM 0
#endif #endif
/**************************************************************************
***
* SIP Event framework and presence settings.
*/
/**
* Specify the time (in seconds) to send SUBSCRIBE to refresh client
* subscription before the actual interval expires.
*
* Default: 5 seconds
*/
#ifndef PJSIP_EVSUB_TIME_UAC_REFRESH
# define PJSIP_EVSUB_TIME_UAC_REFRESH 5
#endif
/**
* Specify the time (in seconds) to send PUBLISH to refresh client
* publication before the actual interval expires.
*
* Default: 5 seconds
*/
#ifndef PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH
# define PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH 5
#endif
/**
* Specify the time (in seconds) to wait for the final NOTIFY from the
* server after client has sent un-SUBSCRIBE request.
*
* Default: 5 seconds
*/
#ifndef PJSIP_EVSUB_TIME_UAC_TERMINATE
# define PJSIP_EVSUB_TIME_UAC_TERMINATE 5
#endif
/**
* Specify the time (in seconds) for client subscription to wait for anothe
r
* NOTIFY from the server, if it has rejected the last NOTIFY with non-2xx
* final response (such as 401). If further NOTIFY is not received within
* this period, the client will unsubscribe.
*
* Default: 5 seconds
*/
#ifndef PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY
# define PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY 5
#endif
/**
* Specify the default expiration time for presence event subscription, for
* both client and server subscription. For client subscription, applicatio
n
* can override this by specifying positive non-zero value in "expires"
* parameter when calling #pjsip_pres_initiate(). For server subscription,
* we would take the expiration value from the Expires header sent by clien
t
* in the SUBSCRIBE request if the header exists and its value is less than
* this setting, otherwise this setting will be used.
*
* Default: 600 seconds (10 minutes)
*/
#ifndef PJSIP_PRES_DEFAULT_EXPIRES
# define PJSIP_PRES_DEFAULT_EXPIRES 600
#endif
/**
* Add "timestamp" information in generated PIDF document for both server
* subscription and presence publication.
*
* Default: 1 (yes)
*/
#ifndef PJSIP_PRES_PIDF_ADD_TIMESTAMP
# define PJSIP_PRES_PIDF_ADD_TIMESTAMP 1
#endif
PJ_END_DECL PJ_END_DECL
/** /**
* @} * @}
*/ */
#include <pj/config.h> #include <pj/config.h>
#endif /* __PJSIP_SIP_CONFIG_H__ */ #endif /* __PJSIP_SIP_CONFIG_H__ */
 End of changes. 3 change blocks. 
1 lines changed or deleted 103 lines changed or added


 sip_transport.h   sip_transport.h 
/* $Id: sip_transport.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sip_transport.h 2724 2009-05-29 13:04:03Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 568 skipping to change at line 568
* caller is informed with PJSIP_EBUFDESTROYED return status. * caller is informed with PJSIP_EBUFDESTROYED return status.
* *
* @param tdata The transmit buffer data. * @param tdata The transmit buffer data.
* @return This function will always succeeded eventhough the retur n * @return This function will always succeeded eventhough the retur n
* status is non-zero. A status PJSIP_EBUFDESTROYED will be * status is non-zero. A status PJSIP_EBUFDESTROYED will be
* returned to inform that buffer is destroyed. * returned to inform that buffer is destroyed.
*/ */
PJ_DECL(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata ); PJ_DECL(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata );
/** /**
* Print the SIP message to transmit data buffer's internal buffer. This
* may allocate memory for the buffer, if the buffer has not been allocated
* yet, and encode the SIP message to that buffer.
*
* @param tdata The transmit buffer.
*
* @return PJ_SUCCESS on success of the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsip_tx_data_encode(pjsip_tx_data *tdata);
/**
* Check if transmit data buffer contains a valid message. * Check if transmit data buffer contains a valid message.
* *
* @param tdata The transmit buffer. * @param tdata The transmit buffer.
* @return Non-zero (PJ_TRUE) if buffer contains a valid message. * @return Non-zero (PJ_TRUE) if buffer contains a valid message.
*/ */
PJ_DECL(pj_bool_t) pjsip_tx_data_is_valid( pjsip_tx_data *tdata ); PJ_DECL(pj_bool_t) pjsip_tx_data_is_valid( pjsip_tx_data *tdata );
/** /**
* Invalidate the print buffer to force message to be re-printed. Call * Invalidate the print buffer to force message to be re-printed. Call
* when the message has changed after it has been printed to buffer. The * when the message has changed after it has been printed to buffer. The
 End of changes. 2 change blocks. 
1 lines changed or deleted 12 lines changed or added


 sock.h   sock.h 
/* $Id: sock.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sock.h 2743 2009-06-04 15:11:25Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 919 skipping to change at line 919
* Set the port number of an IPv4 socket address. * Set the port number of an IPv4 socket address.
* *
* @see pj_sockaddr_set_port() * @see pj_sockaddr_set_port()
* *
* @param addr The IP socket address. * @param addr The IP socket address.
* @param hostport The port number, in host byte order. * @param hostport The port number, in host byte order.
*/ */
PJ_DECL(void) pj_sockaddr_in_set_port(pj_sockaddr_in *addr, PJ_DECL(void) pj_sockaddr_in_set_port(pj_sockaddr_in *addr,
pj_uint16_t hostport); pj_uint16_t hostport);
/**
* Parse string containing IP address and optional port into socket address
,
* possibly also with address family detection. This function supports both
* IPv4 and IPv6 parsing, however IPv6 parsing may only be done if IPv6 is
* enabled during compilation.
*
* This function supports parsing several formats. Sample IPv4 inputs and
* their default results::
* - "10.0.0.1:80": address 10.0.0.1 and port 80.
* - "10.0.0.1": address 10.0.0.1 and port zero.
* - "10.0.0.1:": address 10.0.0.1 and port zero.
* - "10.0.0.1:0": address 10.0.0.1 and port zero.
* - ":80": address 0.0.0.0 and port 80.
* - ":": address 0.0.0.0 and port 0.
* - "localhost": address 127.0.0.1 and port 0.
* - "localhost:": address 127.0.0.1 and port 0.
* - "localhost:80": address 127.0.0.1 and port 80.
*
* Sample IPv6 inputs and their default results:
* - "[fec0::01]:80": address fec0::01 and port 80
* - "[fec0::01]": address fec0::01 and port 0
* - "[fec0::01]:": address fec0::01 and port 0
* - "[fec0::01]:0": address fec0::01 and port 0
* - "fec0::01": address fec0::01 and port 0
* - "fec0::01:80": address fec0::01:80 and port 0
* - "::": address zero (::) and port 0
* - "[::]": address zero (::) and port 0
* - "[::]:": address zero (::) and port 0
* - ":::": address zero (::) and port 0
* - "[::]:80": address zero (::) and port 0
* - ":::80": address zero (::) and port 80
*
* Note: when the IPv6 socket address contains port number, the IP
* part of the socket address should be enclosed with square brackets,
* otherwise the port number will be included as part of the IP address
* (see "fec0::01:80" example above).
*
* @param af Optionally specify the address family to be used. If the
* address family is to be deducted from the input, specify
* pj_AF_UNSPEC() here.
* @param options Additional options to assist the parsing, must be zero
* for now.
* @param str The input string to be parsed.
* @param addr Pointer to store the result.
*
* @return PJ_SUCCESS if the parsing is successful.
*/
PJ_DECL(pj_status_t) pj_sockaddr_parse(int af, unsigned options,
const pj_str_t *str,
pj_sockaddr *addr);
/************************************************************************** *** /************************************************************************** ***
* *
* HOST NAME AND ADDRESS. * HOST NAME AND ADDRESS.
* *
************************************************************************** *** ************************************************************************** ***
*/ */
/** /**
* Get system's host name. * Get system's host name.
* *
 End of changes. 2 change blocks. 
1 lines changed or deleted 53 lines changed or added


 string_i.h   string_i.h 
/* $Id: string_i.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: string_i.h 2749 2009-06-04 22:08:16Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 35 skipping to change at line 35
pj_str_t dst; pj_str_t dst;
dst.ptr = str; dst.ptr = str;
dst.slen = str ? pj_ansi_strlen(str) : 0; dst.slen = str ? pj_ansi_strlen(str) : 0;
return dst; return dst;
} }
PJ_IDEF(pj_str_t*) pj_strdup(pj_pool_t *pool, PJ_IDEF(pj_str_t*) pj_strdup(pj_pool_t *pool,
pj_str_t *dst, pj_str_t *dst,
const pj_str_t *src) const pj_str_t *src)
{ {
/* Without this, destination will be corrupted */
if (dst == src)
return dst;
if (src->slen) { if (src->slen) {
dst->ptr = (char*)pj_pool_alloc(pool, src->slen); dst->ptr = (char*)pj_pool_alloc(pool, src->slen);
pj_memcpy(dst->ptr, src->ptr, src->slen); pj_memcpy(dst->ptr, src->ptr, src->slen);
} }
dst->slen = src->slen; dst->slen = src->slen;
return dst; return dst;
} }
PJ_IDEF(pj_str_t*) pj_strdup_with_null( pj_pool_t *pool, PJ_IDEF(pj_str_t*) pj_strdup_with_null( pj_pool_t *pool,
pj_str_t *dst, pj_str_t *dst,
 End of changes. 2 change blocks. 
1 lines changed or deleted 5 lines changed or added


 stun_msg.h   stun_msg.h 
/* $Id: stun_msg.h 2642 2009-04-22 17:20:24Z bennylp $ */ /* $Id: stun_msg.h 2724 2009-05-29 13:04:03Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 190 skipping to change at line 190
* Successful response to STUN BINDING-REQUEST. * Successful response to STUN BINDING-REQUEST.
*/ */
PJ_STUN_BINDING_RESPONSE = 0x0101, PJ_STUN_BINDING_RESPONSE = 0x0101,
/** /**
* Error response to STUN BINDING-REQUEST. * Error response to STUN BINDING-REQUEST.
*/ */
PJ_STUN_BINDING_ERROR_RESPONSE = 0x0111, PJ_STUN_BINDING_ERROR_RESPONSE = 0x0111,
/** /**
* Binding Indication (ICE)
*/
PJ_STUN_BINDING_INDICATION = 0x0011,
/**
* STUN SHARED-SECRET reqeust. * STUN SHARED-SECRET reqeust.
*/ */
PJ_STUN_SHARED_SECRET_REQUEST = 0x0002, PJ_STUN_SHARED_SECRET_REQUEST = 0x0002,
/** /**
* Successful response to STUN SHARED-SECRET reqeust. * Successful response to STUN SHARED-SECRET reqeust.
*/ */
PJ_STUN_SHARED_SECRET_RESPONSE = 0x0102, PJ_STUN_SHARED_SECRET_RESPONSE = 0x0102,
/** /**
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 stun_session.h   stun_session.h 
/* $Id: stun_session.h 2642 2009-04-22 17:20:24Z bennylp $ */ /* $Id: stun_session.h 2724 2009-05-29 13:04:03Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 480 skipping to change at line 480
pj_stun_auth_type auth_type, pj_stun_auth_type auth_type,
const pj_stun_auth_cred *cre d); const pj_stun_auth_cred *cre d);
/** /**
* Configure message logging. By default all flags are enabled. * Configure message logging. By default all flags are enabled.
* *
* @param sess The STUN session instance. * @param sess The STUN session instance.
* @param flags Bitmask combination of #pj_stun_sess_msg_log_fla g * @param flags Bitmask combination of #pj_stun_sess_msg_log_fla g
*/ */
PJ_DECL(void) pj_stun_session_set_log(pj_stun_session *sess, PJ_DECL(void) pj_stun_session_set_log(pj_stun_session *sess,
unsigned flags); unsigned flags);
/**
* Configure whether the STUN session should utilize FINGERPRINT in
* outgoing messages.
*
* @param sess The STUN session instance.
* @param use Boolean for the setting.
*
* @return The previous configured value of FINGERPRINT
* utilization of the sessoin.
*/
PJ_DECL(pj_bool_t) pj_stun_session_use_fingerprint(pj_stun_session *sess,
pj_bool_t use);
/** /**
* Create a STUN request message. After the message has been successfully * Create a STUN request message. After the message has been successfully
* created, application can send the message by calling * created, application can send the message by calling
* pj_stun_session_send_msg(). * pj_stun_session_send_msg().
* *
* @param sess The STUN session instance. * @param sess The STUN session instance.
* @param msg_type The STUN request message type, from pj_stun_method_e or * @param msg_type The STUN request message type, from pj_stun_method_e or
* from pj_stun_msg_type. * from pj_stun_msg_type.
* @param magic STUN magic, use PJ_STUN_MAGIC. * @param magic STUN magic, use PJ_STUN_MAGIC.
 End of changes. 2 change blocks. 
1 lines changed or deleted 13 lines changed or added


 xml.h   xml.h 
/* $Id: xml.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: xml.h 2727 2009-06-01 09:28:28Z bennylp $ */
/* /*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
skipping to change at line 148 skipping to change at line 148
/** /**
* Add attribute to a node. * Add attribute to a node.
* *
* @param node Node. * @param node Node.
* @param attr Attribute to add to node. * @param attr Attribute to add to node.
*/ */
PJ_DECL(void) pj_xml_add_attr( pj_xml_node *node, pj_xml_attr *attr ); PJ_DECL(void) pj_xml_add_attr( pj_xml_node *node, pj_xml_attr *attr );
/** /**
* Find first node with the specified name. * Find first direct child node with the specified name.
* *
* @param parent Parent node. * @param parent Parent node.
* @param name Node name to find. * @param name Node name to find.
* *
* @return XML node found or NULL. * @return XML node found or NULL.
*/ */
PJ_DECL(pj_xml_node*) pj_xml_find_node(pj_xml_node *parent, const pj_str_t PJ_DECL(pj_xml_node*) pj_xml_find_node(const pj_xml_node *parent,
*name); const pj_str_t *name);
/** /**
* Find first node with the specified name. * Find next direct child node with the specified name.
* *
* @param parent Parent node. * @param parent Parent node.
* @param node node->next is the starting point. * @param node node->next is the starting point.
* @param name Node name to find. * @param name Node name to find.
* *
* @return XML node found or NULL. * @return XML node found or NULL.
*/ */
PJ_DECL(pj_xml_node*) pj_xml_find_next_node(pj_xml_node *parent, pj_xml_nod PJ_DECL(pj_xml_node*) pj_xml_find_next_node(const pj_xml_node *parent,
e *node, const pj_xml_node *node,
const pj_str_t *name); const pj_str_t *name);
/** /**
* Find first attribute within a node with the specified name and optional * Recursively find the first node with the specified name in the child nod
value. es
* and their children.
*
* @param parent Parent node.
* @param name Node name to find.
*
* @return XML node found or NULL.
*/
PJ_DECL(pj_xml_node*) pj_xml_find_node_rec(const pj_xml_node *parent,
const pj_str_t *name);
/**
* Find first attribute within a node with the specified name and optional
* value.
* *
* @param node XML Node. * @param node XML Node.
* @param name Attribute name to find. * @param name Attribute name to find.
* @param value Optional value to match. * @param value Optional value to match.
* *
* @return XML attribute found, or NULL. * @return XML attribute found, or NULL.
*/ */
PJ_DECL(pj_xml_attr*) pj_xml_find_attr(pj_xml_node *node, const pj_str_t *n PJ_DECL(pj_xml_attr*) pj_xml_find_attr(const pj_xml_node *node,
ame, const pj_str_t *name,
const pj_str_t *value); const pj_str_t *value);
/** /**
* Find a direct child node with the specified name and match the function. * Find a direct child node with the specified name and match the function.
* *
* @param parent Parent node. * @param parent Parent node.
* @param name Optional name. * @param name Optional name. If this is NULL, the name will not be
* matched.
* @param data Data to be passed to matching function. * @param data Data to be passed to matching function.
* @param match Optional matching function. * @param match Optional matching function.
* *
* @return The first matched node, or NULL. * @return The first matched node, or NULL.
*/ */
PJ_DECL(pj_xml_node*) pj_xml_find( pj_xml_node *parent, const pj_str_t *nam PJ_DECL(pj_xml_node*) pj_xml_find( const pj_xml_node *parent,
e, const pj_str_t *name,
const void *data, const void *data,
pj_bool_t (*match)(pj_xml_node *, const v pj_bool_t (*match)(const pj_xml_node *,
oid*)); const void*));
/**
* Recursively find a child node with the specified name and match the
* function.
*
* @param parent Parent node.
* @param name Optional name. If this is NULL, the name will not be
* matched.
* @param data Data to be passed to matching function.
* @param match Optional matching function.
*
* @return The first matched node, or NULL.
*/
PJ_DECL(pj_xml_node*) pj_xml_find_rec(const pj_xml_node *parent,
const pj_str_t *name,
const void *data,
pj_bool_t (*match)(const pj_xml_node*,
const void*));
/** /**
* @} * @}
*/ */
PJ_END_DECL PJ_END_DECL
#endif /* __PJ_XML_H__ */ #endif /* __PJ_XML_H__ */
 End of changes. 10 change blocks. 
16 lines changed or deleted 48 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/