codec.h   codec.h 
/* $Id: codec.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: codec.h 3146 2010-04-26 13:57:28Z 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 30 skipping to change at line 30
#ifndef __PJMEDIA_CODEC_H__ #ifndef __PJMEDIA_CODEC_H__
#define __PJMEDIA_CODEC_H__ #define __PJMEDIA_CODEC_H__
/** /**
* @file codec.h * @file codec.h
* @brief Codec framework. * @brief Codec framework.
*/ */
#include <pjmedia/port.h> #include <pjmedia/port.h>
#include <pj/list.h> #include <pj/list.h>
#include <pj/pool.h>
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* @defgroup PJMEDIA_CODEC Codec Framework * @defgroup PJMEDIA_CODEC Codec Framework
* @brief Media codec framework and management * @brief Media codec framework and management
* @{ * @{
* *
* @section codec_mgmt_sec Codec Management * @section codec_mgmt_sec Codec Management
* @subsection codec_fact_sec Codec Manager * @subsection codec_fact_sec Codec Manager
skipping to change at line 195 skipping to change at line 196
/** /**
* Standard RTP static payload types, as defined by RFC 3551. * Standard RTP static payload types, as defined by RFC 3551.
* The header file <pjmedia-codec/types.h> also declares dynamic payload * The header file <pjmedia-codec/types.h> also declares dynamic payload
* type numbers that are used by PJMEDIA when advertising the capability * type numbers that are used by PJMEDIA when advertising the capability
* for example in SDP message. * for example in SDP message.
*/ */
enum pjmedia_rtp_pt enum pjmedia_rtp_pt
{ {
PJMEDIA_RTP_PT_PCMU = 0, /**< audio PCMU */ PJMEDIA_RTP_PT_PCMU = 0, /**< audio PCMU */
PJMEDIA_RTP_PT_G726_32 = 2, /**< audio G726-32 */
PJMEDIA_RTP_PT_GSM = 3, /**< audio GSM */ PJMEDIA_RTP_PT_GSM = 3, /**< audio GSM */
PJMEDIA_RTP_PT_G723 = 4, /**< audio G723 */ PJMEDIA_RTP_PT_G723 = 4, /**< audio G723 */
PJMEDIA_RTP_PT_DVI4_8K = 5, /**< audio DVI4 8KHz */ PJMEDIA_RTP_PT_DVI4_8K = 5, /**< audio DVI4 8KHz */
PJMEDIA_RTP_PT_DVI4_16K = 6, /**< audio DVI4 16Khz */ PJMEDIA_RTP_PT_DVI4_16K = 6, /**< audio DVI4 16Khz */
PJMEDIA_RTP_PT_LPC = 7, /**< audio LPC */ PJMEDIA_RTP_PT_LPC = 7, /**< audio LPC */
PJMEDIA_RTP_PT_PCMA = 8, /**< audio PCMA */ PJMEDIA_RTP_PT_PCMA = 8, /**< audio PCMA */
PJMEDIA_RTP_PT_G722 = 9, /**< audio G722 */ PJMEDIA_RTP_PT_G722 = 9, /**< audio G722 */
PJMEDIA_RTP_PT_L16_2 = 10, /**< audio 16bit linear 44.1KHz stereo */ PJMEDIA_RTP_PT_L16_2 = 10, /**< audio 16bit linear 44.1KHz stereo */
PJMEDIA_RTP_PT_L16_1 = 11, /**< audio 16bit linear 44.1KHz mono */ PJMEDIA_RTP_PT_L16_1 = 11, /**< audio 16bit linear 44.1KHz mono */
PJMEDIA_RTP_PT_QCELP = 12, /**< audio QCELP */ PJMEDIA_RTP_PT_QCELP = 12, /**< audio QCELP */
skipping to change at line 243 skipping to change at line 243
pj_str_t encoding_name; /**< Encoding name. */ pj_str_t encoding_name; /**< Encoding name. */
unsigned clock_rate; /**< Sampling rate. */ unsigned clock_rate; /**< Sampling rate. */
unsigned channel_cnt; /**< Channel count. */ unsigned channel_cnt; /**< Channel count. */
} pjmedia_codec_info; } pjmedia_codec_info;
#define PJMEDIA_CODEC_MAX_FMTP_CNT 8 #define PJMEDIA_CODEC_MAX_FMTP_CNT 8
/** /**
* Structure of codec specific parameters which contains name=value pairs. * Structure of codec specific parameters which contains name=value pairs.
* The codec specific parameters are to be used with SDP according to * The codec specific parameters are to be used with SDP according to
* the standards (e.g: RFC 3555). * the standards (e.g: RFC 3555) in SDP 'a=fmtp' attribute.
*/ */
typedef struct pjmedia_codec_fmtp typedef struct pjmedia_codec_fmtp
{ {
pj_uint8_t cnt; pj_uint8_t cnt; /**< Number of parameters. */
struct param { struct param {
pj_str_t name; pj_str_t name; /**< Parameter name. */
pj_str_t val; pj_str_t val; /**< Parameter value. */
} param [PJMEDIA_CODEC_MAX_FMTP_CNT]; } param [PJMEDIA_CODEC_MAX_FMTP_CNT]; /**< The parameters. */
} pjmedia_codec_fmtp; } pjmedia_codec_fmtp;
/** /**
* Detailed codec attributes used both to configure a codec and to query * Detailed codec attributes used in configuring a codec and in querying
* the capability of codec factories. * the capability of codec factories. Default attributes of any codecs coul
d
* be queried using #pjmedia_codec_mgr_get_default_param() and modified
* using #pjmedia_codec_mgr_set_default_param().
*
* Please note that codec parameter also contains SDP specific setting,
* #dec_fmtp and #enc_fmtp, which may need to be set appropriately based on
* the effective setting. See each codec documentation for more detail.
*/ */
typedef struct pjmedia_codec_param typedef struct pjmedia_codec_param
{ {
/** /**
* The "info" part of codec param describes the capability of the codec , * The "info" part of codec param describes the capability of the codec ,
* and the value should NOT be changed by application. * and the value should NOT be changed by application.
*/ */
struct { struct {
unsigned clock_rate; /**< Sampling rate in Hz */ unsigned clock_rate; /**< Sampling rate in Hz */
unsigned channel_cnt; /**< Channel count. */ unsigned channel_cnt; /**< Channel count. */
skipping to change at line 614 skipping to change at line 620
} pjmedia_codec_priority; } pjmedia_codec_priority;
/** /**
* Codec identification (e.g. "pcmu/8000/1"). * Codec identification (e.g. "pcmu/8000/1").
* See @ref codec_ident for more info. * See @ref codec_ident for more info.
*/ */
typedef char pjmedia_codec_id[32]; typedef char pjmedia_codec_id[32];
/** /**
* Opaque declaration of default codecs parameters.
*/
typedef struct pjmedia_codec_default_param pjmedia_codec_default_param;
/**
* Codec manager maintains array of these structs for each supported * Codec manager maintains array of these structs for each supported
* codec. * codec.
*/ */
struct pjmedia_codec_desc struct pjmedia_codec_desc
{ {
pjmedia_codec_info info; /**< Codec info. */ pjmedia_codec_info info; /**< Codec info. */
pjmedia_codec_id id; /**< Fully qualified name */ pjmedia_codec_id id; /**< Fully qualified name */
pjmedia_codec_priority prio; /**< Priority. */ pjmedia_codec_priority prio; /**< Priority. */
pjmedia_codec_factory *factory; /**< The factory. */ pjmedia_codec_factory *factory; /**< The factory. */
pjmedia_codec_default_param *param; /**< Default codecs
parameters. */
}; };
/** /**
* The declaration for codec manager. Application doesn't normally need * The declaration for codec manager. Application doesn't normally need
* to see this declaration, but nevertheless this declaration is needed * to see this declaration, but nevertheless this declaration is needed
* by media endpoint to instantiate the codec manager. * by media endpoint to instantiate the codec manager.
*/ */
typedef struct pjmedia_codec_mgr typedef struct pjmedia_codec_mgr
{ {
/** Media endpoint instance. */
pj_pool_factory *pf;
/** Codec manager pool. */
pj_pool_t *pool;
/** Codec manager mutex. */
pj_mutex_t *mutex;
/** List of codec factories registered to codec manager. */ /** List of codec factories registered to codec manager. */
pjmedia_codec_factory factory_list; pjmedia_codec_factory factory_list;
/** Number of supported codesc. */ /** Number of supported codecs. */
unsigned codec_cnt; unsigned codec_cnt;
/** Array of codec descriptor. */ /** Array of codec descriptor. */
struct pjmedia_codec_desc codec_desc[PJMEDIA_CODEC_MGR_MAX_CODECS]; struct pjmedia_codec_desc codec_desc[PJMEDIA_CODEC_MGR_MAX_CODECS];
} pjmedia_codec_mgr; } pjmedia_codec_mgr;
/** /**
* Initialize codec manager. Normally this function is called by pjmedia * Initialize codec manager. Normally this function is called by pjmedia
* endpoint's initialization code. * endpoint's initialization code.
* *
* @param mgr Codec manager instance. * @param mgr Codec manager instance.
* @param pf Pool factory instance.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_mgr_init(pjmedia_codec_mgr *mgr,
pj_pool_factory *pf);
/**
* Destroy codec manager. Normally this function is called by pjmedia
* endpoint's deinitialization code.
*
* @param mgr Codec manager instance.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_mgr_init(pjmedia_codec_mgr *mgr); PJ_DECL(pj_status_t) pjmedia_codec_mgr_destroy(pjmedia_codec_mgr *mgr);
/** /**
* Register codec factory to codec manager. This will also register * Register codec factory to codec manager. This will also register
* all supported codecs in the factory to the codec manager. * all supported codecs in the factory to the codec manager.
* *
* @param mgr The codec manager instance. Application can get the * @param mgr The codec manager instance. Application can get the
* instance by calling #pjmedia_endpt_get_codec_mgr(). * instance by calling #pjmedia_endpt_get_codec_mgr().
* @param factory The codec factory to be registered. * @param factory The codec factory to be registered.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
skipping to change at line 800 skipping to change at line 834
* parameter. * parameter.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) PJ_DECL(pj_status_t)
pjmedia_codec_mgr_get_default_param( pjmedia_codec_mgr *mgr, pjmedia_codec_mgr_get_default_param( pjmedia_codec_mgr *mgr,
const pjmedia_codec_info *info, const pjmedia_codec_info *info,
pjmedia_codec_param *param ); pjmedia_codec_param *param );
/** /**
* Set default codec param for the specified codec info.
*
* @param mgr The codec manager instance. Application can get the
* instance by calling #pjmedia_endpt_get_codec_mgr().
* @param info The codec info, which default parameter's is being
* updated.
* @param param The new default codec parameter. Set to NULL to
reset
* codec parameter to library default settings.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t)
pjmedia_codec_mgr_set_default_param( pjmedia_codec_mgr *mgr,
const pjmedia_codec_info *info,
const pjmedia_codec_param *param );
/**
* Request the codec manager to allocate one instance of codec with the * Request the codec manager to allocate one instance of codec with the
* specified codec info. The codec will enumerate all codec factories * specified codec info. The codec will enumerate all codec factories
* until it finds factory that is able to create the specified codec. * until it finds factory that is able to create the specified codec.
* *
* @param mgr The codec manager instance. Application can get the * @param mgr The codec manager instance. Application can get the
* instance by calling #pjmedia_endpt_get_codec_mgr(). * instance by calling #pjmedia_endpt_get_codec_mgr().
* @param info The information about the codec to be created. * @param info The information about the codec to be created.
* @param p_codec Pointer to receive the codec instance. * @param p_codec Pointer to receive the codec instance.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
 End of changes. 16 change blocks. 
14 lines changed or deleted 67 lines changed or added


 config.h   config.h 
/* $Id: config.h 2970 2009-10-26 15:47:52Z nanang $ */ /* $Id: config.h 3066 2010-01-20 19:42:46Z 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 177 skipping to change at line 177
# undef PJ_M_IA64 # undef PJ_M_IA64
# define PJ_M_IA64 1 # define PJ_M_IA64 1
# define PJ_M_NAME "ia64" # define PJ_M_NAME "ia64"
# define PJ_HAS_PENTIUM 1 # define PJ_HAS_PENTIUM 1
# define PJ_IS_LITTLE_ENDIAN 1 # define PJ_IS_LITTLE_ENDIAN 1
# define PJ_IS_BIG_ENDIAN 0 # define PJ_IS_BIG_ENDIAN 0
#elif defined (PJ_M_M68K) && PJ_M_M68K != 0 #elif defined (PJ_M_M68K) && PJ_M_M68K != 0
/* /*
* Motorola m64k processor, little endian * Motorola m68k processor, big endian
*/ */
# undef PJ_M_M68K # undef PJ_M_M68K
# define PJ_M_M68K 1 # define PJ_M_M68K 1
# define PJ_M_NAME "m68k" # define PJ_M_NAME "m68k"
# define PJ_HAS_PENTIUM 0 # define PJ_HAS_PENTIUM 0
# define PJ_IS_LITTLE_ENDIAN 1 # define PJ_IS_LITTLE_ENDIAN 0
# define PJ_IS_BIG_ENDIAN 0 # define PJ_IS_BIG_ENDIAN 1
#elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \ #elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \
defined (_M_ALPHA) defined (_M_ALPHA)
/* /*
* DEC Alpha processor, little endian * DEC Alpha processor, little endian
*/ */
# undef PJ_M_ALPHA # undef PJ_M_ALPHA
# define PJ_M_ALPHA 1 # define PJ_M_ALPHA 1
# define PJ_M_NAME "alpha" # define PJ_M_NAME "alpha"
# define PJ_HAS_PENTIUM 0 # define PJ_HAS_PENTIUM 0
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 g711.h   g711.h 
/* $Id: g711.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: g711.h 3083 2010-01-29 15:51: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 31 skipping to change at line 31
#define __PJMEDIA_G711_H__ #define __PJMEDIA_G711_H__
/** /**
* @file g711.h * @file g711.h
* @brief G711 Codec * @brief G711 Codec
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_G711 G711 G.711 Codec * @defgroup PJMED_G711 G.711 Codec
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Standard G.711/PCMA and PCMU codec. * @brief Standard G.711/PCMA and PCMU codec.
* @{ * @{
* This section describes functions to register and register G.711 codec *
* This section describes functions to initialize and register G.711 codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
*
* The G.711 is an ultra low complexity codecs and in trade-off it results
* in high bitrate, i.e: 64kbps for 16-bit PCM with sampling rate 8000Hz.
*
* The factory contains two main compression algorithms, PCMU/u-Law and
* PCMA/A-Law.
*
* \section codec_setting Codec Settings
*
* \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* Currently none.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register G711 codec factory to pjmedia endpoint. * Initialize and register G711 codec factory to pjmedia endpoint.
* This will register PCMU and PCMA codec, in that order. * This will register PCMU and PCMA codec, in that order.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* *
 End of changes. 4 change blocks. 
3 lines changed or deleted 22 lines changed or added


 g722.h   g722.h 
/* $Id: g722.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: g722.h 3083 2010-01-29 15:51: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 36 skipping to change at line 36
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_G722 G.722 Codec * @defgroup PJMED_G722 G.722 Codec
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of G.722 Codec * @brief Implementation of G.722 Codec
* @{ * @{
* *
* This section describes functions to register and register G.722 codec * This section describes functions to initialize and register G.722 codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
* *
* The G.722 implementation uses 16-bit PCM with sampling rate 16000Hz and
* 20ms frame length resulting in 64kbps bitrate.
*
* The G.722 codec implementation is provided as part of pjmedia-codec * The G.722 codec implementation is provided as part of pjmedia-codec
* library, and does not depend on external G.722 codec implementation. * library, and does not depend on external G.722 codec implementation.
*
* \section codec_setting Codec Settings
*
* \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* Currently none.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register G.722 codec factory to pjmedia endpoint. * Initialize and register G.722 codec factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
 End of changes. 4 change blocks. 
2 lines changed or deleted 17 lines changed or added


 g7221.h   g7221.h 
/* $Id: g7221.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: g7221.h 3083 2010-01-29 15:51: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 31 skipping to change at line 31
#define __PJMEDIA_CODECS_G7221_H__ #define __PJMEDIA_CODECS_G7221_H__
/** /**
* @file pjmedia-codec/g7221.h * @file pjmedia-codec/g7221.h
* @brief G722.1 codec. * @brief G722.1 codec.
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_G7221_CODEC G722.1 Codec * @defgroup PJMED_G7221_CODEC G.722.1 Codec (Siren7/Siren14)
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of G722.1 codec * @brief Implementation of G.722.1 codec
* @{ * @{
* *
* <b>G722.1 licensed from Polycom * <b>G.722.1 licensed from Polycom
* <b>G722.1 Annex C licensed from Polycom * <b>G.722.1 Annex C licensed from Polycom
* *
* This section describes functions to register and register G722.1 codec * This section describes functions to initialize and register G.722.1 code c
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
* *
* PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation * PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation
* G.722.1 (05/2005) C fixed point implementation including its Annex C. * G.722.1 (05/2005) C fixed point implementation including its Annex C.
* *
* G722.1 is a low complexity codec that supports for 7kHz and 14kHz bandwi * G.722.1 is a low complexity codec that supports 7kHz and 14kHz audio
dth * bandwidth working at bitrates ranging from 16kbps to 48kbps. It may be
* audio signals working at bitrates ranging from 16kbps to 48kbps. It may
be
* used with speech or music inputs. * used with speech or music inputs.
* *
* The codec implementation supports for standard and non-standard bitrates *
. * \section codec_setting Codec Settings
* By default, the standard bitrates are enabled upon initialization, i.e.: *
* - 24kbps and 32kbps for audio bandwidth 7 kHz (16kHz sampling rate), * \subsection general_setting General Settings
* - 24kbps, 32kbps, and 48kbps for audio bandwidth 14 kHz (32kHz sampling *
* rate). * General codec settings for this codec such as VAD and PLC can be
* The usage of non-standard bitrates must follow this requirements: * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* - for sampling rate 16kHz: 16000 to 32000 bps, it must be a multiple of * Please see the documentation of #pjmedia_codec_param for more info.
400 *
* - for sampling rate 32kHz: 24000 to 48000 bps, it must be a multiple of * \subsection specific_setting Codec Specific Settings
400 *
* Note that currently it is only up to two non-standard modes can be enabl * The following settings are applicable for this codec.
ed *
* at one time. * \subsubsection bitrate Bitrate
*
* The codec implementation supports standard and non-standard bitrates.
* Use #pjmedia_codec_g7221_set_mode() to enable or disable the bitrates.
*
* By default, only standard bitrates are enabled upon initialization:
* - for 7kHz audio bandwidth (16kHz sampling rate): 24kbps and 32kbps,
* - for 14kHz audio bandwidth (32kHz sampling rate): 24kbps, 32kbps, and
* 48kbps.
*
* The usage of non-standard bitrates must follow these requirements:
* - for 7kHz audio bandwidth (16kHz sampling rate): 16000 to 32000 bps,
* multiplication of 400
* - for 14kHz audio bandwidth (32kHz sampling rate): 24000 to 48000 bps,
* multiplication of 400
*
* \note
* Currently only up to two non-standard modes can be enabled.
*
* \remark
* There is a flaw in the codec manager as currently it could not
* differentiate G.722.1 codecs by bitrates, hence invoking
* #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec
* with the highest priority (or first index found in codec enumeration
* when they have same priority) and invoking
* #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1
* codecs with sampling rate as specified.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register G722.1 codec factory to pjmedia endpoint. * Initialize and register G.722.1 codec factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt ); PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt );
/** /**
* Enable and disable G722.1 mode. By default, the standard modes are * Enable and disable G.722.1 mode. By default, the standard modes are
* enabled upon initialization, i.e.: * enabled upon initialization, i.e.:
* - sampling rate 16kHz, bitrate 24kbps and 32kbps. * - sampling rate 16kHz, bitrate 24kbps and 32kbps.
* - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps. * - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps.
* This function can also be used for enabling non-standard modes. * This function can also be used for enabling non-standard modes.
* Note that currently it is only up to two non-standard modes can be * Note that currently only up to two non-standard modes can be enabled
* enabled at one time. * at one time.
* *
* @param sample_rate PCM sampling rate, in Hz, valid values are only * @param sample_rate PCM sampling rate, in Hz, valid values are only
* 16000 and 32000. * 16000 and 32000.
* @param bitrate G722.1 bitrate, in bps, the valid values are * @param bitrate G722.1 bitrate, in bps, the valid values are
* standard and non-standard bitrates as described * standard and non-standard bitrates as described
* above. * above.
* @param enabled PJ_TRUE for enabling specified mode. * @param enabled PJ_TRUE for enabling specified mode.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
skipping to change at line 110 skipping to change at line 140
* *
* Default value is PJMEDIA_G7221_DEFAULT_PCM_SHIFT. * Default value is PJMEDIA_G7221_DEFAULT_PCM_SHIFT.
* *
* @param val The value * @param val The value
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_pcm_shift(int val); PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_pcm_shift(int val);
/** /**
* Unregister G722.1 codecs factory from pjmedia endpoint. * Unregister G.722.1 codecs factory from pjmedia endpoint.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_g7221_deinit(void); PJ_DECL(pj_status_t) pjmedia_codec_g7221_deinit(void);
PJ_END_DECL PJ_END_DECL
/** /**
* @} * @}
*/ */
 End of changes. 11 change blocks. 
29 lines changed or deleted 53 lines changed or added


 gsm.h   gsm.h 
/* $Id: gsm.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: gsm.h 3083 2010-01-29 15:51: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 36 skipping to change at line 36
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_GSM GSM 06.10 Codec * @defgroup PJMED_GSM GSM 06.10 Codec
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of GSM FR based on GSM 06.10 library * @brief Implementation of GSM FR based on GSM 06.10 library
* @{ * @{
* *
* This section describes functions to register and register GSM codec * This section describes functions to initialize and register GSM codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
*
* The GSM codec supports 16-bit PCM with sampling rate of 8000Hz resulting
* in 13.2kbps bitrate.
*
* \section codec_setting Codec Settings
*
* \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* Currently none.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register GSM codec factory to pjmedia endpoint. * Initialize and register GSM codec factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
 End of changes. 3 change blocks. 
2 lines changed or deleted 17 lines changed or added


 ilbc.h   ilbc.h 
/* $Id: ilbc.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: ilbc.h 3083 2010-01-29 15:51: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 36 skipping to change at line 36
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_ILBC iLBC Codec * @defgroup PJMED_ILBC iLBC Codec
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of iLBC Codec * @brief Implementation of iLBC Codec
* @{ * @{
* *
* This section describes functions to register and register iLBC codec * This section describes functions to initialize and register iLBC codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
*
* The iLBC codec is developed by Global IP Solutions (GIPS), formerly
* Global IP Sound. The iLBC offers low bitrate and graceful audio quality
* degradation on frame losses.
*
* The iLBC codec supports 16-bit PCM audio signal with sampling rate of
* 8000Hz operating at two modes: 20ms and 30ms frame length modes, resulti
ng
* in bitrates of 15.2kbps for 20ms mode and 13.33kbps for 30ms mode.
*
*
* \section codec_setting Codec Settings
*
* \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* The following settings are applicable for this codec.
*
* \subsubsection mode Mode
*
* The default mode should be set upon initialization, see
* #pjmedia_codec_ilbc_init(). After the codec is initialized, the default
* mode can be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, iLBC mode can be set by specifying SDP
* format parameter "mode" in the SDP "a=fmtp" attribute for decoding
* direction. Valid values are "20" and "30" (for 20ms and 30ms mode
* respectively).
*
* Here is an example to set up #pjmedia_codec_param to use mode 20ms:
* \code
pjmedia_codec_param param;
...
// setting iLBC mode in SDP
param.setting.dec_fmtp.cnt = 1;
param.setting.dec_fmtp.param[0].name = pj_str("mode");
param.setting.dec_fmtp.param[0].val = pj_str("20");
...
\endcode
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register iLBC codec factory to pjmedia endpoint. * Initialize and register iLBC codec factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* @param mode Default decoder mode to be used. Valid values are * @param mode Default decoder mode to be used. Valid values are
* 20 and 30 ms. Note that encoder mode follows the * 20 and 30 ms. Note that encoder mode follows the
 End of changes. 3 change blocks. 
2 lines changed or deleted 46 lines changed or added


 ipp_codecs.h   ipp_codecs.h 
/* $Id: ipp_codecs.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: ipp_codecs.h 3083 2010-01-29 15:51: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 36 skipping to change at line 36
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_IPP_CODEC IPP Codecs * @defgroup PJMED_IPP_CODEC IPP Codecs
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of IPP codecs * @brief Implementation of IPP codecs
* @{ * @{
* *
* This section describes functions to register and register IPP codec * This section describes functions to initialize and register IPP codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
* This codec factory contains various codecs, e.g: G.729, G.723.1, G.726, *
* G.728, G.722.1, AMR. * This codec factory contains various codecs, i.e: G.729, G.723.1, G.726,
* G.728, G.722.1, AMR, and AMR-WB.
*
*
* \section pjmedia_codec_ipp_g729 IPP G.729
*
* IPP G.729 is compliant with ITU-T G.729 and Annexes A, B, C, C+, D,
* E, I specifications. However, currently the pjmedia implementation is
* using Annexes A and B only.
*
* IPP G.729 supports 16-bit PCM audio signal with sampling rate 8000Hz,
* frame length 10ms, and resulting in bitrate 8000bps (annexes D and E
* introduce bitrates 6400bps and 11800bps).
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* Note that G.729 VAD status should be signalled in SDP, see more
* description below.
*
* \subsubsection annexb Annex B
*
* The capability of VAD/DTX is specified in Annex B.
*
* By default, Annex B is enabled. This default setting of Annex B can
* be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, Annex B is configured via VAD setting and
* format parameter "annexb" in the SDP "a=fmtp" attribute in
* decoding fmtp field. Valid values are "yes" and "no",
* the implementation default is "yes". When this parameter is omitted
* in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9).
*
* Here is an example of modifying default setting of Annex B to
* be disabled using #pjmedia_codec_mgr_set_default_param():
\code
pjmedia_codec_param param;
pjmedia_codec_mgr_get_default_param(.., &param);
...
// Set VAD
param.setting.vad = 0;
// Set SDP format parameter
param.setting.dec_fmtp.cnt = 1;
param.setting.dec_fmtp.param[0].name = pj_str("annexb");
param.setting.dec_fmtp.param[0].val = pj_str("no");
...
pjmedia_codec_mgr_set_default_param(.., &param);
\endcode
*
* \note
* The difference of Annex B status in SDP offer/answer may be considered a
s
* incompatible codec in SDP negotiation.
*
*
* \section pjmedia_codec_ipp_g7231 IPP G.723.1
*
* IPP G.723.1 speech codec is compliant with ITU-T G.723.1 and Annex A
* specifications.
*
* IPP G.723.1 supports 16-bit PCM audio signal with sampling rate 8000Hz,
* frame length 30ms, and resulting in bitrates 5300bps and 6300bps.
*
* By default, pjmedia implementation uses encoding bitrate of 6300bps.
* The bitrate is signalled in-band in G.723.1 frames and interoperable.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
*
* \section pjmedia_codec_ipp_g726 IPP G.726
*
* IPP G.726 is compliant with ITU-T G.726 and G.726 Annex A specifications
.
*
* IPP G.726 supports 16-bit PCM audio signal with sampling rate 8000Hz,
* 10ms frame length and producing 16kbps, 24kbps, 32kbps, 48kbps bitrates.
* The bitrate is specified explicitly in its encoding name, i.e: G726-16,
* G726-24, G726-32, G726-48.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
*
* \section pjmedia_codec_ipp_g728 IPP G.728
*
* IPP G.728 is compliant with ITU-T G.728 with I, G, H Appendixes
* specifications for Low-Delay CELP coder.
*
* IPP G.728 supports 16-bit PCM audio signal with sampling rate 8000Hz,
* 20ms frame length and producing 9.6kbps, 12.8kbps, and 16kbps bitrates.
*
* The pjmedia implementation currently uses 16kbps bitrate only.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
*
* \section pjmedia_codec_ipp_g7221 IPP G.722.1
*
* The pjmedia implementation of IPP G.722.1 supports 16-bit PCM audio
* signal with sampling rate 16000Hz, 20ms frame length and producing
* 16kbps, 24kbps, and 32kbps bitrates.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsubsection bitrate Bitrate
*
* The codec implementation supports only standard bitrates, i.e:
* 24kbps and 32kbps. Both are enabled by default.
*
* \remark
* There is a flaw in the codec manager as currently it could not
* differentiate G.722.1 codecs by bitrates, hence invoking
* #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec
* with the highest priority (or first index found in codec enumeration
* when they have same priority) and invoking
* #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1
* codecs with sampling rate as specified.
*
*
* \section pjmedia_codec_ipp_amr IPP AMR
*
* The IPP AMR is compliant with GSM06.90-94 specifications for GSM Adaptiv
e
* Multi-Rate codec.
*
* IPP AMR supports 16-bit PCM audio signal with sampling rate 8000Hz,
* 20ms frame length and producing various bitrates that ranges from 4.75kb
ps
* to 12.2kbps.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsubsection bitrate Bitrate
*
* By default, encoding bitrate is 7400bps. This default setting can be
* modified using #pjmedia_codec_mgr_set_default_param() by specifying
* prefered AMR bitrate in field <tt>info::avg_bps</tt> of
* #pjmedia_codec_param. Valid bitrates could be seen in
* #pjmedia_codec_amrnb_bitrates.
*
* \subsubsection payload_format Payload Format
*
* There are two AMR payload format types, bandwidth-efficient and
* octet-aligned. Default setting is using octet-aligned. This default payl
oad
* format can be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, payload format can be set by specifying SDP
* format parameters "octet-align" in the SDP "a=fmtp" attribute for
* decoding direction. Valid values are "0" (for bandwidth efficient mode)
* and "1" (for octet-aligned mode).
*
* \subsubsection mode_set Mode-Set
*
* Mode-set is used for restricting AMR modes in decoding direction.
*
* By default, no mode-set restriction applied. This default setting can be
* be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, mode-set could be specified via format paramete
rs
* "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid
* value is a comma separated list of modes from the set 0 - 7, e.g:
* "4,5,6,7". When this parameter is omitted, no mode-set restrictions appl
ied.
*
* Here is an example of modifying AMR default codec param:
\code
pjmedia_codec_param param;
pjmedia_codec_mgr_get_default_param(.., &param);
...
// set default encoding bitrate to the highest 12.2kbps
param.info.avg_bps = 12200;
// restrict decoding bitrate to 10.2kbps and 12.2kbps only
param.setting.dec_fmtp.param[0].name = pj_str("mode-set");
param.setting.dec_fmtp.param[0].val = pj_str("6,7");
// also set to use bandwidth-efficient payload format
param.setting.dec_fmtp.param[1].name = pj_str("octet-align");
param.setting.dec_fmtp.param[1].val = pj_str("0");
param.setting.dec_fmtp.cnt = 2;
...
pjmedia_codec_mgr_set_default_param(.., &param);
\endcode
*
*
* \section pjmedia_codec_ipp_amrwb IPP AMR-WB
*
* The IPP AMR-WB is compliant with 3GPP TS 26.190-192, 194, 201
* specifications for Adaptive Multi-Rate WideBand codec.
*
* IPP AMR-WB supports 16-bit PCM audio signal with sampling rate 16000Hz,
* 20ms frame length and producing various bitrates. Valid bitrates could b
e
* seen in #pjmedia_codec_amrwb_bitrates. The pjmedia implementation defaul
t
* bitrate is 15850bps.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsubsection bitrate Bitrate
*
* By default, encoding bitrate is 15850bps. This default setting can be
* modified using #pjmedia_codec_mgr_set_default_param() by specifying
* prefered AMR bitrate in field <tt>info::avg_bps</tt> of
* #pjmedia_codec_param.
*
* \subsubsection payload_format Payload Format
*
* There are two AMR payload format types, bandwidth-efficient and
* octet-aligned. Default setting is using octet-aligned. This default payl
oad
* format can be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, payload format can be set by specifying SDP
* format parameters "octet-align" in the SDP "a=fmtp" attribute for
* decoding direction. Valid values are "0" (for bandwidth efficient mode)
* and "1" (for octet-aligned mode).
*
* \subsubsection mode_set Mode-Set
*
* Mode-set is used for restricting AMR modes in decoding direction.
*
* By default, no mode-set restriction applied. This default setting can be
* be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, mode-set could be specified via format paramete
rs
* "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid
* value is a comma separated list of modes from the set 0 - 7, e.g:
* "4,5,6,7". When this parameter is omitted, no mode-set restrictions appl
ied.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register IPP codecs factory to pjmedia endpoint. * Initialize and register IPP codecs factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
 End of changes. 3 change blocks. 
4 lines changed or deleted 265 lines changed or added


 jbuf.h   jbuf.h 
/* $Id: jbuf.h 2844 2009-07-29 12:14:21Z bennylp $ */ /* $Id: jbuf.h 3065 2010-01-20 01:02:37Z 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 74 skipping to change at line 74
* This structure describes jitter buffer state. * This structure describes jitter buffer state.
*/ */
struct pjmedia_jb_state struct pjmedia_jb_state
{ {
/* Setting */ /* Setting */
unsigned frame_size; /**< Individual frame size, in bytes. */ unsigned frame_size; /**< Individual frame size, in bytes. */
unsigned min_prefetch; /**< Minimum allowed prefetch, in frms. */ unsigned min_prefetch; /**< Minimum allowed prefetch, in frms. */
unsigned max_prefetch; /**< Maximum allowed prefetch, in frms. */ unsigned max_prefetch; /**< Maximum allowed prefetch, in frms. */
/* Status */ /* Status */
unsigned burst; /**< Current burst level, in frames */
unsigned prefetch; /**< Current prefetch value, in frames */ unsigned prefetch; /**< Current prefetch value, in frames */
unsigned size; /**< Current buffer size, in frames. */ unsigned size; /**< Current buffer size, in frames. */
/* Statistic */ /* Statistic */
unsigned avg_delay; /**< Average delay, in ms. */ unsigned avg_delay; /**< Average delay, in ms. */
unsigned min_delay; /**< Minimum delay, in ms. */ unsigned min_delay; /**< Minimum delay, in ms. */
unsigned max_delay; /**< Maximum delay, in ms. */ unsigned max_delay; /**< Maximum delay, in ms. */
unsigned dev_delay; /**< Standard deviation of delay, in ms. */ unsigned dev_delay; /**< Standard deviation of delay, in ms. */
unsigned avg_burst; /**< Average burst, in frames. */ unsigned avg_burst; /**< Average burst, in frames. */
unsigned lost; /**< Number of lost frames. */ unsigned lost; /**< Number of lost frames. */
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 l16.h   l16.h 
/* $Id: l16.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: l16.h 3083 2010-01-29 15:51: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 28 skipping to change at line 28
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
*/ */
#ifndef __PJMEDIA_CODEC_L16_H__ #ifndef __PJMEDIA_CODEC_L16_H__
#define __PJMEDIA_CODEC_L16_H__ #define __PJMEDIA_CODEC_L16_H__
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_L16 L16 Codec Family * @defgroup PJMED_L16 L16 Codec Family
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief PCM/16bit/linear codecs * @brief Implementation of PCM/16bit/linear codecs
* @{ * @{
* *
* This section describes functions to register and register L16 codec * This section describes functions to initialize and register L16 codec
* factory to the codec manager. After the codec factory has been registere d, * factory to the codec manager. After the codec factory has been registere d,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
* *
* Note that the L16 codec factory registers several (about fourteen!) * Note that the L16 codec factory registers several (about fourteen!)
* L16 codec types to codec manager (different combinations of clock * L16 codec types to codec manager (different combinations of clock
* rate and number of channels). * rate and number of channels).
*
* \section codec_setting Codec Settings
*
* \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* Currently none.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Initialize and register L16 codec factory to pjmedia endpoint. * Initialize and register L16 codec factory to pjmedia endpoint.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* @param options Must be zero for now. * @param options Must be zero for now.
* *
 End of changes. 4 change blocks. 
3 lines changed or deleted 15 lines changed or added


 os_auto.h   os_auto.h 
/* pjlib/include/pj/compat/os_auto.h. Generated from os_auto.h.in by confi gure. */ /* pjlib/include/pj/compat/os_auto.h. Generated from os_auto.h.in by confi gure. */
/* $Id: os_auto.h.in 2970 2009-10-26 15:47:52Z nanang $ */ /* $Id: os_auto.h.in 3059 2010-01-13 21:28:06Z 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 75 skipping to change at line 75
#define PJ_HAS_STDIO_H 1 #define PJ_HAS_STDIO_H 1
#define PJ_HAS_STDINT_H 1 #define PJ_HAS_STDINT_H 1
#define PJ_HAS_STDLIB_H 1 #define PJ_HAS_STDLIB_H 1
#define PJ_HAS_STRING_H 1 #define PJ_HAS_STRING_H 1
#define PJ_HAS_SYS_IOCTL_H 1 #define PJ_HAS_SYS_IOCTL_H 1
#define PJ_HAS_SYS_SELECT_H 1 #define PJ_HAS_SYS_SELECT_H 1
#define PJ_HAS_SYS_SOCKET_H 1 #define PJ_HAS_SYS_SOCKET_H 1
#define PJ_HAS_SYS_TIME_H 1 #define PJ_HAS_SYS_TIME_H 1
#define PJ_HAS_SYS_TIMEB_H 1 #define PJ_HAS_SYS_TIMEB_H 1
#define PJ_HAS_SYS_TYPES_H 1 #define PJ_HAS_SYS_TYPES_H 1
/* #undef PJ_HAS_SYS_FILIO_H */
/* #undef PJ_HAS_SYS_SOCKIO_H */
#define PJ_HAS_TIME_H 1 #define PJ_HAS_TIME_H 1
#define PJ_HAS_UNISTD_H 1 #define PJ_HAS_UNISTD_H 1
/* #undef PJ_HAS_MSWSOCK_H */ /* #undef PJ_HAS_MSWSOCK_H */
/* #undef PJ_HAS_WINSOCK_H */ /* #undef PJ_HAS_WINSOCK_H */
/* #undef PJ_HAS_WINSOCK2_H */ /* #undef PJ_HAS_WINSOCK2_H */
/* #undef PJ_HAS_WS2TCPIP_H */ /* #undef PJ_HAS_WS2TCPIP_H */
#define PJ_SOCK_HAS_INET_ATON 1 #define PJ_SOCK_HAS_INET_ATON 1
#define PJ_SOCK_HAS_INET_PTON 1 #define PJ_SOCK_HAS_INET_PTON 1
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added


 os_auto.h.in   os_auto.h.in 
/* $Id: os_auto.h.in 2970 2009-10-26 15:47:52Z nanang $ */ /* $Id: os_auto.h.in 3059 2010-01-13 21:28:06Z 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 74 skipping to change at line 74
#undef PJ_HAS_STDIO_H #undef PJ_HAS_STDIO_H
#undef PJ_HAS_STDINT_H #undef PJ_HAS_STDINT_H
#undef PJ_HAS_STDLIB_H #undef PJ_HAS_STDLIB_H
#undef PJ_HAS_STRING_H #undef PJ_HAS_STRING_H
#undef PJ_HAS_SYS_IOCTL_H #undef PJ_HAS_SYS_IOCTL_H
#undef PJ_HAS_SYS_SELECT_H #undef PJ_HAS_SYS_SELECT_H
#undef PJ_HAS_SYS_SOCKET_H #undef PJ_HAS_SYS_SOCKET_H
#undef PJ_HAS_SYS_TIME_H #undef PJ_HAS_SYS_TIME_H
#undef PJ_HAS_SYS_TIMEB_H #undef PJ_HAS_SYS_TIMEB_H
#undef PJ_HAS_SYS_TYPES_H #undef PJ_HAS_SYS_TYPES_H
#undef PJ_HAS_SYS_FILIO_H
#undef PJ_HAS_SYS_SOCKIO_H
#undef PJ_HAS_TIME_H #undef PJ_HAS_TIME_H
#undef PJ_HAS_UNISTD_H #undef PJ_HAS_UNISTD_H
#undef PJ_HAS_MSWSOCK_H #undef PJ_HAS_MSWSOCK_H
#undef PJ_HAS_WINSOCK_H #undef PJ_HAS_WINSOCK_H
#undef PJ_HAS_WINSOCK2_H #undef PJ_HAS_WINSOCK2_H
#undef PJ_HAS_WS2TCPIP_H #undef PJ_HAS_WS2TCPIP_H
#undef PJ_SOCK_HAS_INET_ATON #undef PJ_SOCK_HAS_INET_ATON
#undef PJ_SOCK_HAS_INET_PTON #undef PJ_SOCK_HAS_INET_PTON
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added


 passthrough.h   passthrough.h 
/* $Id: passthrough.h 2875 2009-08-13 15:57:26Z bennylp $ */ /* $Id: passthrough.h 3083 2010-01-29 15:51: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 36 skipping to change at line 36
*/ */
#include <pjmedia-codec/types.h> #include <pjmedia-codec/types.h>
/** /**
* @defgroup PJMED_PASSTHROUGH_CODEC Passthrough Codecs * @defgroup PJMED_PASSTHROUGH_CODEC Passthrough Codecs
* @ingroup PJMEDIA_CODEC_CODECS * @ingroup PJMEDIA_CODEC_CODECS
* @brief Implementation of passthrough codecs * @brief Implementation of passthrough codecs
* @{ * @{
* *
* This section describes functions to register and register passthrough * This section describes functions to initialize and register passthrough
* codecs factory to the codec manager. After the codec factory has been * codecs factory to the codec manager. After the codec factory has been
* registered, application can use @ref PJMEDIA_CODEC API to manipulate * registered, application can use @ref PJMEDIA_CODEC API to manipulate
* the codec. This codec factory contains various codecs, e.g: G.729, iLBC, * the codec.
* AMR, and G.711.
* *
* Passthrough codecs are codecs wrapper that does not perform encoding * Passthrough codecs are codecs wrapper that does NOT perform encoding
* or decoding, it just pack and parse encoded audio data from/into RTP * or decoding, it just PACK and PARSE encoded audio data from/into RTP
* payload. This will accomodate pjmedia ports which work with encoded * payload. This will accomodate pjmedia ports which work with encoded
* audio data, e.g: encoded audio files, sound device with capability * audio data, e.g: encoded audio files, sound device with capability
* of playing/recording encoded audio data. * of playing/recording encoded audio data.
*
* This codec factory contains various codecs, i.e: G.729, iLBC,
* AMR, and G.711.
*
*
* \section pjmedia_codec_passthrough_g729 Passthrough G.729
*
* G.729 supports 16-bit PCM audio signal with sampling rate 8000Hz,
* frame length 10ms, and resulting in bitrate 8000bps.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* Note that G.729 VAD status should be signalled in SDP, see more
* description below.
*
* \subsubsection annexb Annex B
*
* The capability of VAD/DTX is specified in Annex B.
*
* By default, Annex B is enabled. This default setting of Annex B can
* be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, Annex B is configured via VAD setting and
* format parameter "annexb" in the SDP "a=fmtp" attribute in
* decoding fmtp field. Valid values are "yes" and "no",
* the implementation default is "yes". When this parameter is omitted
* in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9).
*
* Here is an example of modifying default setting of Annex B to
* be disabled using #pjmedia_codec_mgr_set_default_param():
\code
pjmedia_codec_param param;
pjmedia_codec_mgr_get_default_param(.., &param);
...
// Set VAD
param.setting.vad = 0;
// Set SDP format parameter
param.setting.dec_fmtp.cnt = 1;
param.setting.dec_fmtp.param[0].name = pj_str("annexb");
param.setting.dec_fmtp.param[0].val = pj_str("no");
...
pjmedia_codec_mgr_set_default_param(.., &param);
\endcode
*
* \note
* The difference of Annex B status in SDP offer/answer may be considered a
s
* incompatible codec in SDP negotiation.
*
*
* \section pjmedia_codec_passthrough_ilbc Passthrough iLBC
*
* The iLBC codec is developed by Global IP Solutions (GIPS), formerly
* Global IP Sound. The iLBC offers low bitrate and graceful audio quality
* degradation on frame losses.
*
* The iLBC codec supports 16-bit PCM audio signal with sampling rate of
* 8000Hz operating at two modes: 20ms and 30ms frame length modes, resulti
ng
* in bitrates of 15.2kbps for 20ms mode and 13.33kbps for 30ms mode.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsubsection mode Mode
*
* The default mode should be set upon initialization, see
* #pjmedia_codec_passthrough_init2(). After the codec is initialized, the
* default mode can be modified using #pjmedia_codec_mgr_set_default_param(
).
*
* In #pjmedia_codec_param, iLBC mode can be set by specifying SDP
* format parameter "mode" in the SDP "a=fmtp" attribute for decoding
* direction. Valid values are "20" and "30" (for 20ms and 30ms mode
* respectively).
*
* Here is an example to set up #pjmedia_codec_param to use mode 20ms:
* \code
pjmedia_codec_param param;
...
// setting iLBC mode in SDP
param.setting.dec_fmtp.cnt = 1;
param.setting.dec_fmtp.param[0].name = pj_str("mode");
param.setting.dec_fmtp.param[0].val = pj_str("20");
...
\endcode
*
*
* \section pjmedia_codec_passthrough_amr Passthrough AMR
*
* IPP AMR supports 16-bit PCM audio signal with sampling rate 8000Hz,
* 20ms frame length and producing various bitrates that ranges from 4.75kb
ps
* to 12.2kbps.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsubsection bitrate Bitrate
*
* By default, encoding bitrate is 7400bps. This default setting can be
* modified using #pjmedia_codec_mgr_set_default_param() by specifying
* prefered AMR bitrate in field <tt>info::avg_bps</tt> of
* #pjmedia_codec_param. Valid bitrates could be seen in
* #pjmedia_codec_amrnb_bitrates.
*
* \subsubsection payload_format Payload Format
*
* There are two AMR payload format types, bandwidth-efficient and
* octet-aligned. Default setting is using octet-aligned. This default payl
oad
* format can be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, payload format can be set by specifying SDP
* format parameters "octet-align" in the SDP "a=fmtp" attribute for
* decoding direction. Valid values are "0" (for bandwidth efficient mode)
* and "1" (for octet-aligned mode).
*
* \subsubsection mode_set Mode-Set
*
* Mode-set is used for restricting AMR modes in decoding direction.
*
* By default, no mode-set restriction applied. This default setting can be
* be modified using #pjmedia_codec_mgr_set_default_param().
*
* In #pjmedia_codec_param, mode-set could be specified via format paramete
rs
* "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid
* value is a comma separated list of modes from the set 0 - 7, e.g:
* "4,5,6,7". When this parameter is omitted, no mode-set restrictions appl
ied.
*
* Here is an example of modifying AMR default codec param:
\code
pjmedia_codec_param param;
pjmedia_codec_mgr_get_default_param(.., &param);
...
// set default encoding bitrate to the highest 12.2kbps
param.info.avg_bps = 12200;
// restrict decoding bitrate to 10.2kbps and 12.2kbps only
param.setting.dec_fmtp.param[0].name = pj_str("mode-set");
param.setting.dec_fmtp.param[0].val = pj_str("6,7");
// also set to use bandwidth-efficient payload format
param.setting.dec_fmtp.param[1].name = pj_str("octet-align");
param.setting.dec_fmtp.param[1].val = pj_str("0");
param.setting.dec_fmtp.cnt = 2;
...
pjmedia_codec_mgr_set_default_param(.., &param);
\endcode
*
*
* \section pjmedia_codec_passthrough_g711 Passthrough G.711
*
* The G.711 is an ultra low complexity codecs and in trade-off it results
* in high bitrate, i.e: 64kbps for 16-bit PCM with sampling rate 8000Hz.
*
* The factory contains two main compression algorithms, PCMU/u-Law and
* PCMA/A-Law.
*
* \subsection codec_setting Codec Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*/ */
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* Codec passthrough configuration settings. * Codec passthrough configuration settings.
*/ */
typedef struct pjmedia_codec_passthrough_setting typedef struct pjmedia_codec_passthrough_setting
{ {
unsigned fmt_cnt; /**< Number of encoding formats unsigned fmt_cnt; /**< Number of encoding formats
skipping to change at line 78 skipping to change at line 249
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_passthrough_init( pjmedia_endpt *endpt ) ; PJ_DECL(pj_status_t) pjmedia_codec_passthrough_init( pjmedia_endpt *endpt ) ;
/** /**
* Initialize and register passthrough codecs factory to pjmedia endpoint * Initialize and register passthrough codecs factory to pjmedia endpoint
* with only specified encoding formats enabled. * with only specified encoding formats enabled.
* *
* @param endpt The pjmedia endpoint. * @param endpt The pjmedia endpoint.
* @param setting The settings, see @pjmedia_codec_passthrough_setting. * @param setting The settings.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjmedia_codec_passthrough_init2( PJ_DECL(pj_status_t) pjmedia_codec_passthrough_init2(
pjmedia_endpt *endpt, pjmedia_endpt *endpt,
const pjmedia_codec_passthrough_setting *setting); const pjmedia_codec_passthrough_setting *setting);
/** /**
* Unregister passthrough codecs factory from pjmedia endpoint. * Unregister passthrough codecs factory from pjmedia endpoint.
* *
 End of changes. 6 change blocks. 
7 lines changed or deleted 185 lines changed or added


 pjlib-util.h   pjlib-util.h 
/* $Id: pjlib-util.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: pjlib-util.h 3087 2010-02-04 18:29:16Z ming $ */
/* /*
* 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 63 skipping to change at line 63
/* XML */ /* XML */
#include <pjlib-util/xml.h> #include <pjlib-util/xml.h>
/* Old STUN */ /* Old STUN */
#include <pjlib-util/stun_simple.h> #include <pjlib-util/stun_simple.h>
/* PCAP */ /* PCAP */
#include <pjlib-util/pcap.h> #include <pjlib-util/pcap.h>
/* HTTP */
#include <pjlib-util/http_client.h>
#endif /* __PJLIB_UTIL_H__ */ #endif /* __PJLIB_UTIL_H__ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 pjsua.h   pjsua.h 
/* $Id: pjsua.h 3021 2009-11-20 23:33:07Z bennylp $ */ #include <pjsua-lib/pjsua.h>
/*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A
*/
#ifndef __PJSUA_H__
#define __PJSUA_H__
/**
* @file pjsua.h
* @brief PJSUA API.
*/
/* Include all PJSIP core headers. */
#include <pjsip.h>
/* Include all PJMEDIA headers. */
#include <pjmedia.h>
/* Include all PJMEDIA-CODEC headers. */
#include <pjmedia-codec.h>
/* Include all PJSIP-UA headers */
#include <pjsip_ua.h>
/* Include all PJSIP-SIMPLE headers */
#include <pjsip_simple.h>
/* Include all PJNATH headers */
#include <pjnath.h>
/* Include all PJLIB-UTIL headers. */
#include <pjlib-util.h>
/* Include all PJLIB headers. */
#include <pjlib.h>
PJ_BEGIN_DECL
/**
* @defgroup PJSUA_LIB PJSUA API - High Level Softphone API
* @brief Very high level API for constructing SIP UA applications.
* @{
*
* @section pjsua_api_intro A SIP User Agent API for C/C++
*
* PJSUA API is very high level API for constructing SIP multimedia user ag
ent
* applications. It wraps together the signaling and media functionalities
* into an easy to use call API, provides account management, buddy
* management, presence, instant messaging, along with multimedia
* features such as conferencing, file streaming, local playback,
* voice recording, and so on.
*
* @subsection pjsua_for_c_cpp C/C++ Binding
* Application must link with <b>pjsua-lib</b> to use this API. In addition
,
* this library depends on the following libraries:
* - <b>pjsip-ua</b>,
* - <b>pjsip-simple</b>,
* - <b>pjsip-core</b>,
* - <b>pjmedia</b>,
* - <b>pjmedia-codec</b>,
* - <b>pjlib-util</b>, and
* - <b>pjlib</b>,
*
* so application must also link with these libraries as well. For more
* information, please refer to
* <A HREF="http://www.pjsip.org/using.htm">Getting Started with PJSIP</A>
* page.
*
* @section pjsua_samples
*
* Few samples are provided:
*
- @ref page_pjsip_sample_simple_pjsuaua_c\n
Very simple SIP User Agent with registration, call, and media, using
PJSUA-API, all in under 200 lines of code.
- @ref page_pjsip_samples_pjsua\n
This is the reference implementation for PJSIP and PJMEDIA.
PJSUA is a console based application, designed to be simple enough
to be readble, but powerful enough to demonstrate all features
available in PJSIP and PJMEDIA.\n
* @section root_using_pjsua_lib Using PJSUA 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
* about specific subject.
*/
/**************************************************************************
***
* BASE API
*/
/**
* @defgroup PJSUA_LIB_BASE PJSUA-API Basic API
* @ingroup PJSUA_LIB
* @brief Basic application creation/initialization, logging configuration,
etc.
* @{
*
* The base PJSUA API controls PJSUA creation, initialization, and startup,
and
* also provides various auxiliary functions.
*
* @section using_pjsua_lib Using PJSUA Library
*
* @subsection creating_pjsua_lib Creating PJSUA
*
* Before anything else, application must create PJSUA by calling
* #pjsua_create().
* This, among other things, will initialize PJLIB, which is crucial before
* 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
* #pjsua_pool_create()) and read configurations from command line or file
to
* build the settings to initialize PJSUA below.
*
* @subsection init_pjsua_lib Initializing PJSUA
*
* After PJSUA is created, application can initialize PJSUA by calling
* #pjsua_init(). This function takes several optional configuration settin
gs
* in the argument, if application wants to set them.
*
* @subsubsection init_pjsua_lib_c_cpp PJSUA-LIB Initialization (in C)
* Sample code to initialize PJSUA in C code:
\code
#include <pjsua-lib/pjsua.h>
#define THIS_FILE __FILE__
static pj_status_t app_init(void)
{
pjsua_config ua_cfg;
pjsua_logging_config log_cfg;
pjsua_media_config media_cfg;
pj_status_t status;
// Must create pjsua before anything else!
status = pjsua_create();
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
return status;
}
// Initialize configs with default settings.
pjsua_config_default(&ua_cfg);
pjsua_logging_config_default(&log_cfg);
pjsua_media_config_default(&media_cfg);
// 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 = ..
...
// Customize other settings (or initialize them from application specif
ic
// configuration file):
...
// Initialize pjsua
status = pjsua_init(&ua_cfg, &log_cfg, &media_cfg);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error initializing pjsua", status);
return status;
}
.
...
}
\endcode
*
*
* @subsection other_init_pjsua_lib Other Initialization
*
* After PJSUA is initialized with #pjsua_init(), application will normally
* need/want to perform the following tasks:
*
* - create SIP transport with #pjsua_transport_create(). Application woul
d
* to call #pjsua_transport_create() for each transport types that it
* wants to support (for example, UDP, TCP, and TLS). Please see
* @ref PJSUA_LIB_TRANSPORT section for more info.
* - create one or more SIP accounts with #pjsua_acc_add() or
* #pjsua_acc_add_local(). The SIP account is used for registering with
* the SIP server, if any. Please see @ref PJSUA_LIB_ACC for more info.
* - add one or more buddies with #pjsua_buddy_add(). Please see
* @ref PJSUA_LIB_BUDDY section for more info.
* - optionally configure the sound device, codec settings, and other
* media settings. Please see @ref PJSUA_LIB_MEDIA for more info.
*
*
* @subsection starting_pjsua_lib Starting PJSUA
*
* After all initializations have been done, application must call
* #pjsua_start() to start PJSUA. This function will check that all setting
s
* have been properly configured, and apply default settings when they have
n't,
* or report error status when it is unable to recover from missing setting
s.
*
* Most settings can be changed during run-time. For example, application
* may add, modify, or delete accounts, buddies, or change media settings
* during run-time.
*
* @subsubsection starting_pjsua_lib_c C Example for Starting PJSUA
* Sample code:
\code
static pj_status_t app_run(void)
{
pj_status_t status;
// Start pjsua
status = pjsua_start();
if (status != PJ_SUCCESS) {
pjsua_destroy();
pjsua_perror(THIS_FILE, "Error starting pjsua", status);
return status;
}
// Run application loop
while (1) {
char choice[10];
printf("Select menu: ");
fgets(choice, sizeof(choice), stdin);
...
}
}
\endcode
*/
/** Constant to identify invalid ID for all sorts of IDs. */
#define PJSUA_INVALID_ID (-1)
/** Call identification */
typedef int pjsua_call_id;
/** Account identification */
typedef int pjsua_acc_id;
/** Buddy identification */
typedef int pjsua_buddy_id;
/** File player identification */
typedef int pjsua_player_id;
/** File recorder identification */
typedef int pjsua_recorder_id;
/** Conference port identification */
typedef int pjsua_conf_port_id;
/** Opaque declaration for server side presence subscription */
typedef struct pjsua_srv_pres pjsua_srv_pres;
/** Forward declaration for pjsua_msg_data */
typedef struct pjsua_msg_data pjsua_msg_data;
/**
* Maximum proxies in account.
*/
#ifndef PJSUA_ACC_MAX_PROXIES
# define PJSUA_ACC_MAX_PROXIES 8
#endif
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/**
* Default value of SRTP mode usage. Valid values are PJMEDIA_SRTP_DISABLED
,
* PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.
*/
#ifndef PJSUA_DEFAULT_USE_SRTP
#define PJSUA_DEFAULT_USE_SRTP PJMEDIA_SRTP_DISABLED
#endif
/**
* Default value of secure signaling requirement for SRTP.
* Valid values are:
* 0: SRTP does not require secure signaling
* 1: SRTP requires secure transport such as TLS
* 2: SRTP requires secure end-to-end transport (SIPS)
*/
#ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
#define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 1
#endif
#endif
/**
* Logging configuration, which can be (optionally) specified when calling
* #pjsua_init(). Application must call #pjsua_logging_config_default() to
* initialize this structure with the default values.
*/
typedef struct pjsua_logging_config
{
/**
* Log incoming and outgoing SIP message? Yes!
*/
pj_bool_t msg_logging;
/**
* Input verbosity level. Value 5 is reasonable.
*/
unsigned level;
/**
* Verbosity level for console. Value 4 is reasonable.
*/
unsigned console_level;
/**
* Log decoration.
*/
unsigned decor;
/**
* Optional log filename.
*/
pj_str_t log_filename;
/**
* Additional flags to be given to #pj_file_open() when opening
* the log file. By default, the flag is PJ_O_WRONLY. Application
* may set PJ_O_APPEND here so that logs are appended to existing
* file instead of overwriting it.
*
* Default is 0.
*/
unsigned log_file_flags;
/**
* Optional callback function to be called to write log to
* application specific device. This function will be called for
* log messages on input verbosity level.
*/
void (*cb)(int level, const char *data, int len);
} pjsua_logging_config;
/**
* Use this function to initialize logging config.
*
* @param cfg The logging config to be initialized.
*/
PJ_DECL(void) pjsua_logging_config_default(pjsua_logging_config *cfg);
/**
* Use this function to duplicate logging config.
*
* @param pool Pool to use.
* @param dst Destination config.
* @param src Source config.
*/
PJ_DECL(void) pjsua_logging_config_dup(pj_pool_t *pool,
pjsua_logging_config *dst,
const pjsua_logging_config *src);
/**
* Structure to be passed on MWI callback.
*/
typedef struct pjsua_mwi_info
{
pjsip_evsub *evsub; /**< Event subscription session, for
reference. */
pjsip_rx_data *rdata; /**< The received NOTIFY request. */
} pjsua_mwi_info;
/**
* This structure describes application callback to receive various event
* notification from PJSUA-API. All of these callbacks are OPTIONAL,
* although definitely application would want to implement some of
* the important callbacks (such as \a on_incoming_call).
*/
typedef struct pjsua_callback
{
/**
* Notify application when invite state has changed.
* Application may then query the call info to get the
* detail call states by calling pjsua_call_get_info() function.
*
* @param call_id The call index.
* @param e Event which causes the call state to change.
*/
void (*on_call_state)(pjsua_call_id call_id, pjsip_event *e);
/**
* Notify application on incoming call.
*
* @param acc_id The account which match the incoming call.
* @param call_id The call id that has just been created for
* the call.
* @param rdata The incoming INVITE request.
*/
void (*on_incoming_call)(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata);
/**
* This is a general notification callback which is called whenever
* a transaction within the call has changed state. Application can
* implement this callback for example to monitor the state of
* outgoing requests, or to answer unhandled incoming requests
* (such as INFO) with a final response.
*
* @param call_id Call identification.
* @param tsx The transaction which has changed state.
* @param e Transaction event that caused the state chan
ge.
*/
void (*on_call_tsx_state)(pjsua_call_id call_id,
pjsip_transaction *tsx,
pjsip_event *e);
/**
* Notify application when media state in the call has changed.
* Normal application would need to implement this callback, e.g.
* to connect the call's media to sound device. When ICE is used,
* this callback will also be called to report ICE negotiation
* failure.
*
* @param call_id The call index.
*/
void (*on_call_media_state)(pjsua_call_id call_id);
/**
* Notify application when media session is created and before it is
* 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 then will be added to the conference bridge instead.
*
* @param call_id Call identification.
* @param sess Media session for the call.
* @param stream_idx Stream index in the media session.
* @param p_port On input, it specifies the media port of the
* stream. Application may modify this pointer to
* point to different media port to be registered
* to the conference bridge.
*/
void (*on_stream_created)(pjsua_call_id call_id,
pjmedia_session *sess,
unsigned stream_idx,
pjmedia_port **p_port);
/**
* Notify application when media session has been unregistered from the
* conference bridge and about to be destroyed.
*
* @param call_id Call identification.
* @param sess Media session for the call.
* @param stream_idx Stream index in the media session.
*/
void (*on_stream_destroyed)(pjsua_call_id call_id,
pjmedia_session *sess,
unsigned stream_idx);
/**
* Notify application upon incoming DTMF digits.
*
* @param call_id The call index.
* @param digit DTMF ASCII digit.
*/
void (*on_dtmf_digit)(pjsua_call_id call_id, int digit);
/**
* Notify application on call being transfered (i.e. REFER is received)
.
* Application can decide to accept/reject transfer request
* by setting the code (default is 202). When this callback
* is not defined, the default behavior is to accept the
* transfer.
*
* @param call_id The call index.
* @param dst The destination where the call will be
* transfered to.
* @param code Status code to be returned for the call transfer
* request. On input, it contains status code 200.
*/
void (*on_call_transfer_request)(pjsua_call_id call_id,
const pj_str_t *dst,
pjsip_status_code *code);
/**
* Notify application of the status of previously sent call
* transfer request. Application can monitor the status of the
* call transfer request, for example to decide whether to
* terminate existing call.
*
* @param call_id Call ID.
* @param st_code Status progress of the transfer request.
* @param st_text Status progress text.
* @param final If non-zero, no further notification will
* be reported. The st_code specified in
* this callback is the final status.
* @param p_cont Initially will be set to non-zero, application
* can set this to FALSE if it no longer wants
* to receie further notification (for example,
* after it hangs up the call).
*/
void (*on_call_transfer_status)(pjsua_call_id call_id,
int st_code,
const pj_str_t *st_text,
pj_bool_t final,
pj_bool_t *p_cont);
/**
* Notify application about incoming INVITE with Replaces header.
* Application may reject the request by setting non-2xx code.
*
* @param call_id The call ID to be replaced.
* @param rdata The incoming INVITE request to replace the call.
* @param st_code Status code to be set by application. Applicatio
n
* should only return a final status (200-699).
* @param st_text Optional status text to be set by application.
*/
void (*on_call_replace_request)(pjsua_call_id call_id,
pjsip_rx_data *rdata,
int *st_code,
pj_str_t *st_text);
/**
* Notify application that an existing call has been replaced with
* a new call. This happens when PJSUA-API receives incoming INVITE
* request with Replaces header.
*
* After this callback is called, normally PJSUA-API will disconnect
* \a old_call_id and establish \a new_call_id.
*
* @param old_call_id Existing call which to be replaced with the
* new call.
* @param new_call_id The new call.
* @param rdata The incoming INVITE with Replaces request.
*/
void (*on_call_replaced)(pjsua_call_id old_call_id,
pjsua_call_id new_call_id);
/**
* Notify application when registration status has changed.
* Application may then query the account info to get the
* registration details.
*
* @param acc_id Account ID.
*/
void (*on_reg_state)(pjsua_acc_id acc_id);
/**
* Notification when incoming SUBSCRIBE request is received. Applicatio
n
* may use this callback to authorize the incoming subscribe request
* (e.g. ask user permission if the request should be granted).
*
* If this callback is not implemented, all incoming presence subscript
ion
* requests will be accepted.
*
* If this callback is implemented, application has several choices on
* what to do with the incoming request:
* - it may reject the request immediately by specifying non-200 class
* final response in the \a code argument.
* - it may immediately accept the request by specifying 200 as the
* \a code argument. This is the default value if application doesn't
* set any value to the \a code argument. In this case, the library
* will automatically send NOTIFY request upon returning from this
* callback.
* - it may delay the processing of the request, for example to reques
t
* user permission whether to accept or reject the request. In this
* case, the application MUST set the \a code argument to 202, and
* later calls #pjsua_pres_notify() to accept or reject the
* subscription request.
*
* Any \a code other than 200 and 202 will be treated as 200.
*
* Application MUST return from this callback immediately (e.g. it must
* not block in this callback while waiting for user confirmation).
*
* @param srv_pres Server presence subscription instance. If
* application delays the acceptance of the request
,
* it will need to specify this object when calling
* #pjsua_pres_notify().
* @param acc_id Account ID most appropriate for this request.
* @param buddy_id ID of the buddy matching the sender of the
* request, if any, or PJSUA_INVALID_ID if no
* matching buddy is found.
* @param from The From URI of the request.
* @param rdata The incoming request.
* @param code The status code to respond to the request. The
* default value is 200. Application may set this
* to other final status code to accept or reject
* the request.
* @param reason The reason phrase to respond to the request.
* @param msg_data If the application wants to send additional
* headers in the response, it can put it in this
* parameter.
*/
void (*on_incoming_subscribe)(pjsua_acc_id acc_id,
pjsua_srv_pres *srv_pres,
pjsua_buddy_id buddy_id,
const pj_str_t *from,
pjsip_rx_data *rdata,
pjsip_status_code *code,
pj_str_t *reason,
pjsua_msg_data *msg_data);
/**
* Notification when server side subscription state has changed.
* This callback is optional as application normally does not need
* to do anything to maintain server side presence subscription.
*
* @param acc_id The account ID.
* @param srv_pres Server presence subscription object.
* @param remote_uri Remote URI string.
* @param state New subscription state.
* @param event PJSIP event that triggers the state change.
*/
void (*on_srv_subscribe_state)(pjsua_acc_id acc_id,
pjsua_srv_pres *srv_pres,
const pj_str_t *remote_uri,
pjsip_evsub_state state,
pjsip_event *event);
/**
* Notify application when the buddy state has changed.
* Application may then query the buddy into to get the details.
*
* @param buddy_id The buddy id.
*/
void (*on_buddy_state)(pjsua_buddy_id buddy_id);
/**
* Notify application on incoming pager (i.e. MESSAGE request).
* Argument call_id will be -1 if MESSAGE request is not related to an
* existing call.
*
* See also \a on_pager2() callback for the version with \a pjsip_rx_da
ta
* passed as one of the argument.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param mime_type MIME type of the message.
* @param body The message content.
*/
void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body);
/**
* This is the alternative version of the \a on_pager() callback with
* \a pjsip_rx_data argument.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param mime_type MIME type of the message.
* @param body The message content.
* @param rdata The incoming MESSAGE request.
* @param acc_id Account ID most suitable for this message.
*/
void (*on_pager2)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
const pj_str_t *mime_type, const pj_str_t *body,
pjsip_rx_data *rdata, pjsua_acc_id acc_id);
/**
* Notify application about the delivery status of outgoing pager
* request. See also on_pager_status2() callback for the version with
* \a pjsip_rx_data in the argument list.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param to Destination URI.
* @param body Message body.
* @param user_data Arbitrary data that was specified when s
ending
* IM message.
* @param status Delivery status.
* @param reason Delivery status reason.
*/
void (*on_pager_status)(pjsua_call_id call_id,
const pj_str_t *to,
const pj_str_t *body,
void *user_data,
pjsip_status_code status,
const pj_str_t *reason);
/**
* Notify application about the delivery status of outgoing pager
* request.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param to Destination URI.
* @param body Message body.
* @param user_data Arbitrary data that was specified when s
ending
* IM message.
* @param status Delivery status.
* @param reason Delivery status reason.
* @param tdata The original MESSAGE request.
* @param rdata The incoming MESSAGE response, or NULL if the
* message transaction fails because of time out
* or transport error.
* @param acc_id Account ID from this the instant message was
* send.
*/
void (*on_pager_status2)(pjsua_call_id call_id,
const pj_str_t *to,
const pj_str_t *body,
void *user_data,
pjsip_status_code status,
const pj_str_t *reason,
pjsip_tx_data *tdata,
pjsip_rx_data *rdata,
pjsua_acc_id acc_id);
/**
* Notify application about typing indication.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param is_typing Non-zero if peer is typing, or zero if p
eer
* has stopped typing a message.
*/
void (*on_typing)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
pj_bool_t is_typing);
/**
* Notify application about typing indication.
*
* @param call_id Containts the ID of the call where the IM was
* sent, or PJSUA_INVALID_ID if the IM was sent
* outside call context.
* @param from URI of the sender.
* @param to URI of the destination message.
* @param contact The Contact URI of the sender, if present.
* @param is_typing Non-zero if peer is typing, or zero if p
eer
* has stopped typing a message.
* @param rdata The received request.
* @param acc_id Account ID most suitable for this message.
*/
void (*on_typing2)(pjsua_call_id call_id, const pj_str_t *from,
const pj_str_t *to, const pj_str_t *contact,
pj_bool_t is_typing, pjsip_rx_data *rdata,
pjsua_acc_id acc_id);
/**
* Callback when the library has finished performing NAT type
* detection.
*
* @param res NAT detection result.
*/
void (*on_nat_detect)(const pj_stun_nat_detect_result *res);
/**
* This callback is called when the call is about to resend the
* INVITE request to the specified target, following the previously
* received redirection response.
*
* Application may accept the redirection to the specified target
* (the default behavior if this callback is implemented), reject
* this target only and make the session continue to try the next
* target in the list if such target exists, stop the whole
* redirection process altogether and cause the session to be
* disconnected, or defer the decision to ask for user confirmation.
*
* This callback is optional. If this callback is not implemented,
* the default behavior is to NOT follow the redirection response.
*
* @param call_id The call ID.
* @param target The current target to be tried.
* @param e The event that caused this callback to be ca
lled.
* This could be the receipt of 3xx response, or
* 4xx/5xx response received for the INVITE sent to
* subsequent targets, or NULL if this callback is
* called from within #pjsua_call_process_redirect()
* context.
*
* @return Action to be performed for the target. Set this
* parameter to one of the value below:
* - PJSIP_REDIRECT_ACCEPT: immediately accept the
* redirection (default value). When set, the
* call will immediately resend INVITE request
* to the target.
* - PJSIP_REDIRECT_REJECT: immediately reject this
* target. The call will continue retrying with
* next target if present, or disconnect the call
* if there is no more target to try.
* - PJSIP_REDIRECT_STOP: stop the whole redirection
* process and immediately disconnect the call. The
* on_call_state() callback will be called with
* PJSIP_INV_STATE_DISCONNECTED state immediately
* after this callback returns.
* - PJSIP_REDIRECT_PENDING: set to this value if
* no decision can be made immediately (for example
* to request confirmation from user). Application
* then MUST call #pjsua_call_process_redirect()
* to either accept or reject the redirection upon
* getting user decision.
*/
pjsip_redirect_op (*on_call_redirected)(pjsua_call_id call_id,
const pjsip_uri *target,
const pjsip_event *e);
/**
* This callback is called when a NOTIFY request for message summary /
* message waiting indication is received.
*
* @param acc_id The account ID.
* @param mwi_info Structure containing details of the event,
* including the received NOTIFY request in the
* \a rdata field.
*/
void (*on_mwi_info)(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info);
} pjsua_callback;
/**
* This structure describes the settings to control the API and
* user agent behavior, and can be specified when calling #pjsua_init().
* Before setting the values, application must call #pjsua_config_default()
* to initialize this structure with the default values.
*/
typedef struct pjsua_config
{
/**
* Maximum calls to support (default: 4). The value specified here
* must be smaller than the compile time maximum settings
* PJSUA_MAX_CALLS, which by default is 32. To increase this
* limit, the library must be recompiled with new PJSUA_MAX_CALLS
* value.
*/
unsigned max_calls;
/**
* Number of worker threads. Normally application will want to have at
* least one worker thread, unless when it wants to poll the library
* periodically, which in this case the worker thread can be set to
* zero.
*/
unsigned thread_cnt;
/**
* Number of nameservers. If no name server is configured, the SIP SRV
* resolution would be disabled, and domain will be resolved with
* standard pj_gethostbyname() function.
*/
unsigned nameserver_count;
/**
* Array of nameservers to be used by the SIP resolver subsystem.
* The order of the name server specifies the priority (first name
* server will be used first, unless it is not reachable).
*/
pj_str_t nameserver[4];
/**
* Force loose-route to be used in all route/proxy URIs (outbound_proxy
* and account's proxy settings). When this setting is enabled, the
* library will check all the route/proxy URIs specified in the setting
s
* and append ";lr" parameter to the URI if the parameter is not presen
t.
*
* Default: 1
*/
pj_bool_t force_lr;
/**
* Number of outbound proxies in the \a outbound_proxy array.
*/
unsigned outbound_proxy_cnt;
/**
* Specify the URL of outbound proxies to visit for all outgoing reques
ts.
* The outbound proxies will be used for all accounts, and it will
* be used to build the route set for outgoing requests. The final
* route set for outgoing requests will consists of the outbound proxie
s
* and the proxy configured in the account.
*/
pj_str_t outbound_proxy[4];
/**
* Warning: deprecated, please use \a stun_srv field instead. To mainta
in
* backward compatibility, if \a stun_srv_cnt is zero then the value of
* this field will be copied to \a stun_srv field, if present.
*
* Specify domain name to be resolved with DNS SRV resolution to get th
e
* address of the STUN server. Alternatively application may specify
* \a stun_host instead.
*
* If DNS SRV resolution failed for this domain, then DNS A resolution
* will be performed only if \a stun_host is specified.
*/
pj_str_t stun_domain;
/**
* Warning: deprecated, please use \a stun_srv field instead. To mainta
in
* backward compatibility, if \a stun_srv_cnt is zero then the value of
* this field will be copied to \a stun_srv field, if present.
*
* Specify STUN server to be used, in "HOST[:PORT]" format. If port is
* not specified, default port 3478 will be used.
*/
pj_str_t stun_host;
/**
* Number of STUN server entries in \a stun_srv array.
*/
unsigned stun_srv_cnt;
/**
* Array of STUN servers to try. The library will try to resolve and
* contact each of the STUN server entry until it finds one that is
* usable. Each entry may be a domain name, host name, IP address, and
* it may contain an optional port number. For example:
* - "pjsip.org" (domain name)
* - "sip.pjsip.org" (host name)
* - "pjsip.org:33478" (domain name and a non-standard port number)
* - "10.0.0.1:3478" (IP address and port number)
*
* When nameserver is configured in the \a pjsua_config.nameserver fiel
d,
* if entry is not an IP address, it will be resolved with DNS SRV
* resolution first, and it will fallback to use DNS A resolution if th
is
* fails. Port number may be specified even if the entry is a domain na
me,
* in case the DNS SRV resolution should fallback to a non-standard por
t.
*
* When nameserver is not configured, entries will be resolved with
* #pj_gethostbyname() if it's not an IP address. Port number may be
* specified if the server is not listening in standard STUN port.
*/
pj_str_t stun_srv[8];
/**
* This specifies if the library startup should ignore failure with the
* STUN servers. If this is set to PJ_FALSE, the library will refuse to
* start if it fails to resolve or contact any of the STUN servers.
*
* Default: PJ_TRUE
*/
pj_bool_t stun_ignore_failure;
/**
* Support for adding and parsing NAT type in the SDP to assist
* troubleshooting. The valid values are:
* - 0: no information will be added in SDP, and parsing is disabled.
* - 1: only the NAT type number is added.
* - 2: add both NAT type number and name.
*
* Default: 1
*/
int nat_type_in_sdp;
/**
* Specify whether support for reliable provisional response (100rel an
d
* PRACK) should be required by default. Note that this setting can be
* further customized in account configuration (#pjsua_acc_config).
*
* Default: PJ_FALSE
*/
pj_bool_t require_100rel;
/**
* Specify whether support for Session Timers should be required by
* default. Note that this setting can be further customized in account
* configuration (#pjsua_acc_config).
*
* Default: PJ_FALSE
*/
pj_bool_t require_timer;
/**
* Handle unsolicited NOTIFY requests containing message waiting
* indication (MWI) info. Unsolicited MWI is incoming NOTIFY requests
* which are not requested by client with SUBSCRIBE request.
*
* If this is enabled, the library will respond 200/OK to the NOTIFY
* request and forward the request to \a on_mwi_info() callback.
*
* See also \a mwi_enabled field #on pjsua_acc_config.
*
* Default: PJ_TRUE
*
*/
pj_bool_t enable_unsolicited_mwi;
/**
* Specify Session Timer settings, see #pjsip_timer_setting.
* Note that this setting can be further customized in account
* configuration (#pjsua_acc_config).
*/
pjsip_timer_setting timer_setting;
/**
* Number of credentials in the credential array.
*/
unsigned cred_count;
/**
* Array of credentials. These credentials will be used by all accounts
,
* and can be used to authenticate against outbound proxies. If the
* credential is specific to the account, then application should set
* the credential in the pjsua_acc_config rather than the credential
* here.
*/
pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
/**
* Application callback to receive various event notifications from
* the library.
*/
pjsua_callback cb;
/**
* Optional user agent string (default empty). If it's empty, no
* User-Agent header will be sent with outgoing requests.
*/
pj_str_t user_agent;
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/**
* Specify default value of secure media transport usage.
* Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
* PJMEDIA_SRTP_MANDATORY.
*
* Note that this setting can be further customized in account
* configuration (#pjsua_acc_config).
*
* Default: #PJSUA_DEFAULT_USE_SRTP
*/
pjmedia_srtp_use use_srtp;
/**
* Specify whether SRTP requires secure signaling to be used. This opti
on
* is only used when \a use_srtp option above is non-zero.
*
* Valid values are:
* 0: SRTP does not require secure signaling
* 1: SRTP requires secure transport such as TLS
* 2: SRTP requires secure end-to-end transport (SIPS)
*
* Note that this setting can be further customized in account
* configuration (#pjsua_acc_config).
*
* Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
*/
int srtp_secure_signaling;
#endif
/**
* Disconnect other call legs when more than one 2xx responses for
* outgoing INVITE are received due to forking. Currently the library
* is not able to handle simultaneous forked media, so disconnecting
* the other call legs is necessary.
*
* With this setting enabled, the library will handle only one of the
* connected call leg, and the other connected call legs will be
* disconnected.
*
* Default: PJ_TRUE (only disable this setting for testing purposes).
*/
pj_bool_t hangup_forked_call;
} pjsua_config;
/**
* Use this function to initialize pjsua config.
*
* @param cfg pjsua config to be initialized.
*/
PJ_DECL(void) pjsua_config_default(pjsua_config *cfg);
/** The implementation has been moved to sip_auth.h */
#define pjsip_cred_dup pjsip_cred_info_dup
/**
* Duplicate pjsua_config.
*
* @param pool The pool to get memory from.
* @param dst Destination config.
* @param src Source config.
*/
PJ_DECL(void) pjsua_config_dup(pj_pool_t *pool,
pjsua_config *dst,
const pjsua_config *src);
/**
* This structure describes additional information to be sent with
* outgoing SIP message. It can (optionally) be specified for example
* with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup()
,
* #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more.
*
* Application MUST call #pjsua_msg_data_init() to initialize this
* structure before setting its values.
*/
struct pjsua_msg_data
{
/**
* Additional message headers as linked list. Application can add
* headers to the list by creating the header, either from the heap/poo
l
* or from temporary local variable, and add the header using
* linked list operation. See pjsip_apps.c for some sample codes.
*/
pjsip_hdr hdr_list;
/**
* MIME type of optional message body.
*/
pj_str_t content_type;
/**
* Optional message body.
*/
pj_str_t msg_body;
};
/**
* Initialize message data.
*
* @param msg_data Message data to be initialized.
*/
PJ_DECL(void) pjsua_msg_data_init(pjsua_msg_data *msg_data);
/**
* Instantiate pjsua application. Application must call this function befor
e
* calling any other functions, to make sure that the underlying libraries
* are properly initialized. Once this function has returned success,
* application must call pjsua_destroy() before quitting.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_create(void);
/** Forward declaration */
typedef struct pjsua_media_config pjsua_media_config;
/**
* Initialize pjsua with the specified settings. All the settings are
* optional, and the default values will be used when the config is not
* specified.
*
* Note that #pjsua_create() MUST be called before calling this function.
*
* @param ua_cfg User agent configuration.
* @param log_cfg Optional logging configuration.
* @param media_cfg Optional media configuration.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_init(const pjsua_config *ua_cfg,
const pjsua_logging_config *log_cfg,
const pjsua_media_config *media_cfg);
/**
* Application is recommended to call this function after all initializatio
n
* is done, so that the library can do additional checking set up
* additional
*
* Application may call this function anytime after #pjsua_init().
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_start(void);
/**
* Destroy pjsua. Application is recommended to perform graceful shutdown
* before calling this function (such as unregister the account from the SI
P
* server, terminate presense subscription, and hangup active calls), howev
er,
* 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
* one second to wait for replies from remote.
*
* Application.may safely call this function more than once if it doesn't
* keep track of it's state.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_destroy(void);
/**
* Poll pjsua for events, and if necessary block the caller thread for
* the specified maximum interval (in miliseconds).
*
* Application doesn't normally need to call this function if it has
* configured worker thread (\a thread_cnt field) in pjsua_config structure
,
* because polling then will be done by these worker threads instead.
*
* @param msec_timeout Maximum time to wait, in miliseconds.
*
* @return The number of events that have been handled during the
* poll. Negative value indicates error, and application
* can retrieve the error as (status = -return_value).
*/
PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout);
/**
* Create memory pool to be used by the application. Once application
* finished using the pool, it must be released with pj_pool_release().
*
* @param name Optional pool name.
* @param init_size Initial size of the pool.
* @param increment Increment size.
*
* @return The pool, or NULL when there's no memory.
*/
PJ_DECL(pj_pool_t*) pjsua_pool_create(const char *name, pj_size_t init_size
,
pj_size_t increment);
/**
* Application can call this function at any time (after pjsua_create(), of
* course) to change logging settings.
*
* @param c Logging configuration.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config *
c);
/**
* Internal function to get SIP endpoint instance of pjsua, which is
* needed for example to register module, create transports, etc.
* Only valid after #pjsua_init() is called.
*
* @return SIP endpoint instance.
*/
PJ_DECL(pjsip_endpoint*) pjsua_get_pjsip_endpt(void);
/**
* Internal function to get media endpoint instance.
* Only valid after #pjsua_init() is called.
*
* @return Media endpoint instance.
*/
PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
/**
* Internal function to get PJSUA pool factory.
* Only valid after #pjsua_create() is called.
*
* @return Pool factory currently used by PJSUA.
*/
PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void);
/**************************************************************************
***
* Utilities.
*
*/
/**
* This structure is used to represent the result of the STUN server
* resolution and testing, the #pjsua_resolve_stun_servers() function.
* This structure will be passed in #pj_stun_resolve_cb callback.
*/
typedef struct pj_stun_resolve_result
{
/**
* Arbitrary data that was passed to #pjsua_resolve_stun_servers()
* function.
*/
void *token;
/**
* This will contain PJ_SUCCESS if at least one usable STUN server
* is found, otherwise it will contain the last error code during
* the operation.
*/
pj_status_t status;
/**
* The server name that yields successful result. This will only
* contain value if status is successful.
*/
pj_str_t name;
/**
* The server IP address. This will only contain value if status
* is successful.
*/
pj_sockaddr addr;
} pj_stun_resolve_result;
/**
* Typedef of callback to be registered to #pjsua_resolve_stun_servers().
*/
typedef void (*pj_stun_resolve_cb)(const pj_stun_resolve_result *result);
/**
* This is a utility function to detect NAT type in front of this
* endpoint. Once invoked successfully, this function will complete
* asynchronously and report the result in \a on_nat_detect() callback
* of pjsua_callback.
*
* After NAT has been detected and the callback is called, application can
* get the detected NAT type by calling #pjsua_get_nat_type(). Application
* can also perform NAT detection by calling #pjsua_detect_nat_type()
* again at later time.
*
* Note that STUN must be enabled to run this function successfully.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_detect_nat_type(void);
/**
* Get the NAT type as detected by #pjsua_detect_nat_type() function.
* This function will only return useful NAT type after #pjsua_detect_nat_t
ype()
* has completed successfully and \a on_nat_detect() callback has been call
ed.
*
* @param type NAT type.
*
* @return When detection is in progress, this function will
* return PJ_EPENDING and \a type will be set to
* PJ_STUN_NAT_TYPE_UNKNOWN. After NAT type has been
* detected successfully, this function will return
* PJ_SUCCESS and \a type will be set to the correct
* value. Other return values indicate error and
* \a type will be set to PJ_STUN_NAT_TYPE_ERR_UNKNOWN.
*
* @see pjsua_call_get_rem_nat_type()
*/
PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type);
/**
* Auxiliary function to resolve and contact each of the STUN server
* entries (sequentially) to find which is usable. The #pjsua_init() must
* have been called before calling this function.
*
* @param count Number of STUN server entries to try.
* @param srv Array of STUN server entries to try. Please see
* the \a stun_srv field in the #pjsua_config
* documentation about the format of this entry.
* @param wait Specify non-zero to make the function block until
* it gets the result. In this case, the function
* will block while the resolution is being done,
* and the callback will be called before this function
* returns.
* @param token Arbitrary token to be passed back to applica
tion
* in the callback.
* @param cb Callback to be called to notify the result of
* the function.
*
* @return If \a wait parameter is non-zero, this will return
* PJ_SUCCESS if one usable STUN server is found.
* Otherwise it will always return PJ_SUCCESS, and
* application will be notified about the result in
* the callback.
*/
PJ_DECL(pj_status_t) pjsua_resolve_stun_servers(unsigned count,
pj_str_t srv[],
pj_bool_t wait,
void *token,
pj_stun_resolve_cb cb);
/**
* Cancel pending STUN resolution which match the specified token.
*
* @param token The token to match. This token was given to
* #pjsua_resolve_stun_servers()
* @param notify_cb Boolean to control whether the callback should
* be called for cancelled resolutions. When the
* callback is called, the status in the result
* will be set as PJ_ECANCELLED.
*
* @return PJ_SUCCESS if there is at least one pending STUN
* resolution cancelled, or PJ_ENOTFOUND if there is
* no matching one, or other error.
*/
PJ_DECL(pj_status_t) pjsua_cancel_stun_resolution(void *token,
pj_bool_t notify_cb);
/**
* This is a utility function to verify that valid SIP url is given. If the
* URL is valid, PJ_SUCCESS will be returned.
*
* @param url The URL, as NULL terminated string.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url);
/**
* Schedule a timer entry. Note that the timer callback may be executed
* by different thread, depending on whether worker thread is enabled or
* not.
*
* @param entry Timer heap entry.
* @param delay The interval to expire.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*
* @see pjsip_endpt_schedule_timer()
*/
PJ_DECL(pj_status_t) pjsua_schedule_timer(pj_timer_entry *entry,
const pj_time_val *delay);
/**
* Cancel the previously scheduled timer.
*
* @param entry Timer heap entry.
*
* @see pjsip_endpt_cancel_timer()
*/
PJ_DECL(void) pjsua_cancel_timer(pj_timer_entry *entry);
/**
* This is a utility function to display error message for the specified
* error code. The error message will be sent to the log.
*
* @param sender The log sender field.
* @param title Message title for the error.
* @param status Status code.
*/
PJ_DECL(void) pjsua_perror(const char *sender, const char *title,
pj_status_t status);
/**
* This is a utility function to dump the stack states to log, using
* verbosity level 3.
*
* @param detail Will print detailed output (such as list of
* SIP transactions) when non-zero.
*/
PJ_DECL(void) pjsua_dump(pj_bool_t detail);
/**
* @}
*/
/**************************************************************************
***
* TRANSPORT API
*/
/**
* @defgroup PJSUA_LIB_TRANSPORT PJSUA-API Signaling Transport
* @ingroup PJSUA_LIB
* @brief API for managing SIP transports
* @{
*
* PJSUA-API supports creating multiple transport instances, for example UD
P,
* TCP, and TLS transport. SIP transport must be created before adding an
* account.
*/
/** SIP transport identification.
*/
typedef int pjsua_transport_id;
/**
* Transport configuration for creating transports for both SIP
* and media. Before setting some values to this structure, application
* MUST call #pjsua_transport_config_default() to initialize its
* values with default settings.
*/
typedef struct pjsua_transport_config
{
/**
* UDP port number to bind locally. This setting MUST be specified
* even when default port is desired. If the value is zero, the
* transport will be bound to any available port, and application
* can query the port by querying the transport info.
*/
unsigned port;
/**
* Optional address to advertise as the address of this transport.
* Application can specify any address or hostname for this field,
* for example it can point to one of the interface address in the
* system, or it can point to the public address of a NAT router
* where port mappings have been configured for the application.
*
* Note: this option can be used for both UDP and TCP as well!
*/
pj_str_t public_addr;
/**
* Optional address where the socket should be bound to. This option
* SHOULD only be used to selectively bind the socket to particular
* interface (instead of 0.0.0.0), and SHOULD NOT be used to set the
* published address of a transport (the public_addr field should be
* used for that purpose).
*
* Note that unlike public_addr field, the address (or hostname) here
* MUST correspond to the actual interface address in the host, since
* this address will be specified as bind() argument.
*/
pj_str_t bound_addr;
/**
* This specifies TLS settings for TLS transport. It is only be used
* when this transport config is being used to create a SIP TLS
* transport.
*/
pjsip_tls_setting tls_setting;
/**
* QoS traffic type to be set on this transport. When application wants
* to apply QoS tagging to the transport, it's preferable to set this
* field rather than \a qos_param fields since this is more portable.
*
* Default is QoS not set.
*/
pj_qos_type qos_type;
/**
* Set the low level QoS parameters to the transport. This is a lower
* level operation than setting the \a qos_type field and may not be
* supported on all platforms.
*
* Default is QoS not set.
*/
pj_qos_params qos_params;
} pjsua_transport_config;
/**
* Call this function to initialize UDP config with default values.
*
* @param cfg The UDP config to be initialized.
*/
PJ_DECL(void) pjsua_transport_config_default(pjsua_transport_config *cfg);
/**
* Duplicate transport config.
*
* @param pool The pool.
* @param dst The destination config.
* @param src The source config.
*/
PJ_DECL(void) pjsua_transport_config_dup(pj_pool_t *pool,
pjsua_transport_config *dst,
const pjsua_transport_config *src);
/**
* This structure describes transport information returned by
* #pjsua_transport_get_info() function.
*/
typedef struct pjsua_transport_info
{
/**
* PJSUA transport identification.
*/
pjsua_transport_id id;
/**
* Transport type.
*/
pjsip_transport_type_e type;
/**
* Transport type name.
*/
pj_str_t type_name;
/**
* Transport string info/description.
*/
pj_str_t info;
/**
* Transport flag (see ##pjsip_transport_flags_e).
*/
unsigned flag;
/**
* Local address length.
*/
unsigned addr_len;
/**
* Local/bound address.
*/
pj_sockaddr local_addr;
/**
* Published address (or transport address name).
*/
pjsip_host_port local_name;
/**
* Current number of objects currently referencing this transport.
*/
unsigned usage_count;
} pjsua_transport_info;
/**
* Create and start a new SIP transport according to the specified
* settings.
*
* @param type Transport type.
* @param cfg Transport configuration.
* @param p_id Optional pointer to receive transport ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_transport_create(pjsip_transport_type_e type,
const pjsua_transport_config *cf
g,
pjsua_transport_id *p_id);
/**
* Register transport that has been created by application. This function
* is useful if application wants to implement custom SIP transport and use
* it with pjsua.
*
* @param tp Transport instance.
* @param p_id Optional pointer to receive transport ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_transport_register(pjsip_transport *tp,
pjsua_transport_id *p_id);
/**
* Enumerate all transports currently created in the system. This function
* will return all transport IDs, and application may then call
* #pjsua_transport_get_info() function to retrieve detailed information
* about the transport.
*
* @param id Array to receive transport ids.
* @param count In input, specifies the maximum number of el
ements.
* On return, it contains the actual number of elements
.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_transports( pjsua_transport_id id[],
unsigned *count );
/**
* Get information about transports.
*
* @param id Transport ID.
* @param info Pointer to receive transport info.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_transport_get_info(pjsua_transport_id id,
pjsua_transport_info *info);
/**
* Disable a transport or re-enable it. By default transport is always
* enabled after it is created. Disabling a transport does not necessarily
* close the socket, it will only discard incoming messages and prevent
* the transport from being used to send outgoing messages.
*
* @param id Transport ID.
* @param enabled Non-zero to enable, zero to disable.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_transport_set_enable(pjsua_transport_id id,
pj_bool_t enabled);
/**
* Close the transport. If transport is forcefully closed, it will be
* immediately closed, and any pending transactions that are using the
* transport may not terminate properly (it may even crash). Otherwise,
* the system will wait until all transactions are closed while preventing
* new users from using the transport, and will close the transport when
* it is safe to do so.
*
* @param id Transport ID.
* @param force Non-zero to immediately close the transport.
This
* is not recommended!
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
pj_bool_t force );
/**
* @}
*/
/**************************************************************************
***
* ACCOUNT API
*/
/**
* @defgroup PJSUA_LIB_ACC PJSUA-API Accounts Management
* @ingroup PJSUA_LIB
* @brief PJSUA Accounts management
* @{
*
* PJSUA accounts provide identity (or identities) of the user who is curre
ntly
* using the application. In SIP terms, the identity is used as the <b>From
</b>
* header in outgoing requests.
*
* PJSUA-API supports creating and managing multiple accounts. The maximum
* number of accounts is limited by a compile time constant
* <tt>PJSUA_MAX_ACC</tt>.
*
* Account may or may not have client registration associated with it.
* An account is also associated with <b>route set</b> and some <b>authenti
cation
* credentials</b>, which are used when sending SIP request messages using
the
* account. An account also has presence's <b>online status</b>, which
* will be reported to remote peer when they subscribe to the account's
* presence, or which is published to a presence server if presence
* publication is enabled for the account.
*
* At least one account MUST be created in the application. If no user
* association is required, application can create a userless account by
* calling #pjsua_acc_add_local(). A userless account identifies local endp
oint
* instead of a particular user, and it correspond with a particular
* transport instance.
*
* Also one account must be set as the <b>default account</b>, which is use
d as
* the account to use when PJSUA fails to match a request with any other
* accounts.
*
* When sending outgoing SIP requests (such as making calls or sending
* instant messages), normally PJSUA requires the application to specify
* which account to use for the request. If no account is specified,
* PJSUA may be able to select the account by matching the destination
* domain name, and fall back to default account when no match is found.
*/
/**
* Maximum accounts.
*/
#ifndef PJSUA_MAX_ACC
# define PJSUA_MAX_ACC 8
#endif
/**
* Default registration interval.
*/
#ifndef PJSUA_REG_INTERVAL
# define PJSUA_REG_INTERVAL 300
#endif
/**
* Default maximum time to wait for account unregistration transactions to
* complete during library shutdown sequence.
*
* Default: 4000 (4 seconds)
*/
#ifndef PJSUA_UNREG_TIMEOUT
# define PJSUA_UNREG_TIMEOUT 4000
#endif
/**
* Default PUBLISH expiration
*/
#ifndef PJSUA_PUBLISH_EXPIRATION
# define PJSUA_PUBLISH_EXPIRATION PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED
#endif
/**
* Default account priority.
*/
#ifndef PJSUA_DEFAULT_ACC_PRIORITY
# define PJSUA_DEFAULT_ACC_PRIORITY 0
#endif
/**
* This macro specifies the URI scheme to use in Contact header
* when secure transport such as TLS is used. Application can specify
* either "sip" or "sips".
*/
#ifndef PJSUA_SECURE_SCHEME
# define PJSUA_SECURE_SCHEME "sip"
#endif
/**
* Maximum time to wait for unpublication transaction(s) to complete
* during shutdown process, before sending unregistration. The library
* tries to wait for the unpublication (un-PUBLISH) to complete before
* sending REGISTER request to unregister the account, during library
* shutdown process. If the value is set too short, it is possible that
* the unregistration is sent before unpublication completes, causing
* unpublication request to fail.
*
* Default: 2000 (2 seconds)
*/
#ifndef PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC
# define PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 2000
#endif
/**
* This structure describes account configuration to be specified when
* adding a new account with #pjsua_acc_add(). Application MUST initialize
* this structure first by calling #pjsua_acc_config_default().
*/
typedef struct pjsua_acc_config
{
/**
* Arbitrary user data to be associated with the newly created account.
* Application may set this later with #pjsua_acc_set_user_data() and
* retrieve it with #pjsua_acc_get_user_data().
*/
void *user_data;
/**
* Account priority, which is used to control the order of matching
* incoming/outgoing requests. The higher the number means the higher
* the priority is, and the account will be matched first.
*/
int priority;
/**
* The full SIP URL for the account. The value can take name address or
* URL format, and will look something like "sip:account@serviceprovide
r".
*
* This field is mandatory.
*/
pj_str_t id;
/**
* This is the URL to be put in the request URI for the registration,
* and will look something like "sip:serviceprovider".
*
* This field should be specified if registration is desired. If the
* value is empty, no account registration will be performed.
*/
pj_str_t reg_uri;
/**
* Subscribe to message waiting indication events (RFC 3842).
*
* See also \a enable_unsolicited_mwi field on #pjsua_config.
*
* Default: no
*/
pj_bool_t mwi_enabled;
/**
* If this flag is set, the presence information of this account will
* be PUBLISH-ed to the server where the account belongs.
*
* Default: PJ_FALSE
*/
pj_bool_t publish_enabled;
/**
* Event publication options.
*/
pjsip_publishc_opt publish_opt;
/**
* Maximum time to wait for unpublication transaction(s) to complete
* during shutdown process, before sending unregistration. The library
* tries to wait for the unpublication (un-PUBLISH) to complete before
* sending REGISTER request to unregister the account, during library
* shutdown process. If the value is set too short, it is possible that
* the unregistration is sent before unpublication completes, causing
* unpublication request to fail.
*
* Default: PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC
*/
unsigned unpublish_max_wait_time_msec;
/**
* Authentication preference.
*/
pjsip_auth_clt_pref auth_pref;
/**
* Optional PIDF tuple ID for outgoing PUBLISH and NOTIFY. If this valu
e
* is not specified, a random string will be used.
*/
pj_str_t pidf_tuple_id;
/**
* Optional URI to be put as Contact for this account. It is recommende
d
* that this field is left empty, so that the value will be calculated
* automatically based on the transport address.
*/
pj_str_t force_contact;
/**
* Additional parameters that will be appended in the Contact header
* for this account. This will affect the Contact header in all SIP
* messages sent on behalf of this account, including but not limited t
o
* REGISTER, INVITE, and SUBCRIBE requests or responses.
*
* The parameters should be preceeded by semicolon, and all strings mus
t
* be properly escaped. Example:
* ";my-param=X;another-param=Hi%20there"
*/
pj_str_t contact_params;
/**
* Additional URI parameters that will be appended in the Contact URI
* for this account. This will affect the Contact URI in all SIP
* messages sent on behalf of this account, including but not limited t
o
* REGISTER, INVITE, and SUBCRIBE requests or responses.
*
* The parameters should be preceeded by semicolon, and all strings mus
t
* be properly escaped. Example:
* ";my-param=X;another-param=Hi%20there"
*/
pj_str_t contact_uri_params;
/**
* Specify whether support for reliable provisional response (100rel an
d
* PRACK) should be required for all sessions of this account.
*
* Default: PJ_FALSE
*/
pj_bool_t require_100rel;
/**
* Specify whether support for Session Timers should be required for al
l
* sessions of this account.
*
* Default: PJ_FALSE
*/
pj_bool_t require_timer;
/**
* Specify Session Timer settings, see #pjsip_timer_setting.
*/
pjsip_timer_setting timer_setting;
/**
* Number of proxies in the proxy array below.
*/
unsigned proxy_cnt;
/**
* Optional URI of the proxies to be visited for all outgoing requests
* that are using this account (REGISTER, INVITE, etc). Application nee
d
* to specify these proxies if the service provider requires that reque
sts
* destined towards its network should go through certain proxies first
* (for example, border controllers).
*
* 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
* first). If global outbound proxies are configured in pjsua_config,
* then these account proxies will be placed after the global outbound
* proxies in the routeset.
*/
pj_str_t proxy[PJSUA_ACC_MAX_PROXIES];
/**
* Optional interval for registration, in seconds. If the value is zero
,
* default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
*/
unsigned reg_timeout;
/**
* Specify the maximum time to wait for unregistration requests to
* complete during library shutdown sequence.
*
* Default: PJSUA_UNREG_TIMEOUT
*/
unsigned unreg_timeout;
/**
* Number of credentials in the credential array.
*/
unsigned cred_count;
/**
* Array of credentials. If registration is desired, normally there sho
uld
* be at least one credential specified, to successfully authenticate
* against the service provider. More credentials can be specified, for
* example when the requests are expected to be challenged by the
* proxies in the route set.
*/
pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];
/**
* Optionally bind this account to specific transport. This normally is
* not a good idea, as account should be able to send requests using
* any available transports according to the destination. But some
* application may want to have explicit control over the transport to
* use, so in that case it can set this field.
*
* Default: -1 (PJSUA_INVALID_ID)
*
* @see pjsua_acc_set_transport()
*/
pjsua_transport_id transport_id;
/**
* This option is used to update the UDP transport address and the Cont
act
* header of REGISTER request. When this option is enabled, the librar
y
* will keep track of the public IP address from the response of REGIST
ER
* request. Once it detects that the address has changed, it will
* unregister current Contact, update the Contact with transport addres
s
* learned from Via header, and register a new Contact to the registrar
.
* This will also update the public name of UDP transport if STUN is
* configured.
*
* Default: 1 (yes)
*/
pj_bool_t allow_contact_rewrite;
/**
* Set the interval for periodic keep-alive transmission for this accou
nt.
* If this value is zero, keep-alive will be disabled for this account.
* The keep-alive transmission will be sent to the registrar's address,
* after successful registration.
*
* Default: 15 (seconds)
*/
unsigned ka_interval;
/**
* Specify the data to be transmitted as keep-alive packets.
*
* Default: CR-LF
*/
pj_str_t ka_data;
#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
/**
* Specify whether secure media transport should be used for this accou
nt.
* Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
* PJMEDIA_SRTP_MANDATORY.
*
* Default: #PJSUA_DEFAULT_USE_SRTP
*/
pjmedia_srtp_use use_srtp;
/**
* Specify whether SRTP requires secure signaling to be used. This opti
on
* is only used when \a use_srtp option above is non-zero.
*
* Valid values are:
* 0: SRTP does not require secure signaling
* 1: SRTP requires secure transport such as TLS
* 2: SRTP requires secure end-to-end transport (SIPS)
*
* Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
*/
int srtp_secure_signaling;
#endif
} pjsua_acc_config;
/**
* Call this function to initialize account config with default values.
*
* @param cfg The account config to be initialized.
*/
PJ_DECL(void) pjsua_acc_config_default(pjsua_acc_config *cfg);
/**
* Duplicate account config.
*
* @param pool Pool to be used for duplicating the config.
* @param dst Destination configuration.
* @param src Source configuration.
*/
PJ_DECL(void) pjsua_acc_config_dup(pj_pool_t *pool,
pjsua_acc_config *dst,
const pjsua_acc_config *src);
/**
* Account info. Application can query account info by calling
* #pjsua_acc_get_info().
*/
typedef struct pjsua_acc_info
{
/**
* The account ID.
*/
pjsua_acc_id id;
/**
* Flag to indicate whether this is the default account.
*/
pj_bool_t is_default;
/**
* Account URI
*/
pj_str_t acc_uri;
/**
* Flag to tell whether this account has registration setting
* (reg_uri is not empty).
*/
pj_bool_t has_registration;
/**
* An up to date expiration interval for account registration session.
*/
int expires;
/**
* Last registration status code. If status code is zero, the account
* is currently not registered. Any other value indicates the SIP
* status code of the registration.
*/
pjsip_status_code status;
/**
* String describing the registration status.
*/
pj_str_t status_text;
/**
* Presence online status for this account.
*/
pj_bool_t online_status;
/**
* Presence online status text.
*/
pj_str_t online_status_text;
/**
* Extended RPID online status information.
*/
pjrpid_element rpid;
/**
* Buffer that is used internally to store the status text.
*/
char buf_[PJ_ERR_MSG_SIZE];
} pjsua_acc_info;
/**
* Get number of current accounts.
*
* @return Current number of accounts.
*/
PJ_DECL(unsigned) pjsua_acc_get_count(void);
/**
* Check if the specified account ID is valid.
*
* @param acc_id Account ID to check.
*
* @return Non-zero if account ID is valid.
*/
PJ_DECL(pj_bool_t) pjsua_acc_is_valid(pjsua_acc_id acc_id);
/**
* Set default account to be used when incoming and outgoing
* requests doesn't match any accounts.
*
* @param acc_id The account ID to be used as default.
*
* @return PJ_SUCCESS on success.
*/
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),
* when the destination of the incoming call doesn't match any other
* accounts.
*
* @return The default account ID, or PJSUA_INVALID_ID if no
* default account is configured.
*/
PJ_DECL(pjsua_acc_id) pjsua_acc_get_default(void);
/**
* Add a new account to pjsua. PJSUA must have been initialized (with
* #pjsua_init()) before calling this function. If registration is configur
ed
* for this account, this function would also start the SIP registration
* session with the SIP registrar server. This SIP registration session
* will be maintained internally by the library, and application doesn't
* need to do anything to maintain the registration session.
*
*
* @param acc_cfg Account configuration.
* @param is_default If non-zero, this account will be set as the default
* account. The default account will be used when sendi
ng
* outgoing requests (e.g. making call) when no account
is
* specified, and when receiving incoming requests when
the
* request does not match any accounts. It is recommend
ed
* that default account is set to local/LAN account.
* @param p_acc_id Pointer to receive account ID of the new account.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_add(const pjsua_acc_config *acc_cfg,
pj_bool_t is_default,
pjsua_acc_id *p_acc_id);
/**
* 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
* to obtain the local address information.
*
* @param tid Transport ID to generate account address.
* @param is_default If non-zero, this account will be set as the default
* account. The default account will be used when sendi
ng
* outgoing requests (e.g. making call) when no account
is
* specified, and when receiving incoming requests when
the
* request does not match any accounts. It is recommend
ed
* that default account is set to local/LAN account.
* @param p_acc_id Pointer to receive account ID of the new account.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_add_local(pjsua_transport_id tid,
pj_bool_t is_default,
pjsua_acc_id *p_acc_id);
/**
* Set arbitrary data to be associated with the account.
*
* @param acc_id The account ID.
* @param user_data User/application data.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_set_user_data(pjsua_acc_id acc_id,
void *user_data);
/**
* Retrieve arbitrary data associated with the account.
*
* @param acc_id The account ID.
*
* @return The user data. In the case where the account ID is
* not valid, NULL is returned.
*/
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,
* if necessary, and terminate server side presence subscriptions associate
d
* with this account.
*
* @param acc_id Id of the account to be deleted.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id);
/**
* Modify account information.
*
* @param acc_id Id of the account to be modified.
* @param acc_cfg New account configuration.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
const pjsua_acc_config *acc_cfg);
/**
* Modify account's presence status to be advertised to remote/presence
* subscribers. This would trigger the sending of outgoing NOTIFY request
* if there are server side presence subscription for this account, and/or
* outgoing PUBLISH if presence publication is enabled for this account.
*
* @see pjsua_acc_set_online_status2()
*
* @param acc_id The account ID.
* @param is_online True of false.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
pj_bool_t is_online);
/**
* Modify account's presence status to be advertised to remote/presence
* subscribers. This would trigger the sending of outgoing NOTIFY request
* if there are server side presence subscription for this account, and/or
* outgoing PUBLISH if presence publication is enabled for this account.
*
* @see pjsua_acc_set_online_status()
*
* @param acc_id The account ID.
* @param is_online True of false.
* @param pr Extended information in subset of RPID format
* which allows setting custom presence text.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_set_online_status2(pjsua_acc_id acc_id,
pj_bool_t is_online,
const pjrpid_element *pr);
/**
* Update registration or perform unregistration. If registration is
* configured for this account, then initial SIP REGISTER will be sent
* when the account is added with #pjsua_acc_add(). Application normally
* only need to call this function if it wants to manually update the
* registration or to unregister from the server.
*
* @param acc_id The account ID.
* @param renew If renew argument is zero, this will start
* unregistration process.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_id,
pj_bool_t renew);
/**
* Get information about the specified account.
*
* @param acc_id Account identification.
* @param info Pointer to receive account information.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_get_info(pjsua_acc_id acc_id,
pjsua_acc_info *info);
/**
* Enumerate all account currently active in the library. This will fill
* the array with the account Ids, and application can then query the
* account information for each id with #pjsua_acc_get_info().
*
* @see pjsua_acc_enum_info().
*
* @param ids Array of account IDs to be initialized.
* @param count In input, specifies the maximum number of el
ements.
* On return, it contains the actual number of elements
.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_accs(pjsua_acc_id ids[],
unsigned *count );
/**
* Enumerate account informations.
*
* @param info Array of account infos to be initialized.
* @param count In input, specifies the maximum number of el
ements.
* On return, it contains the actual number of elements
.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[],
unsigned *count );
/**
* This is an internal function to find the most appropriate account to
* used to reach to the specified URL.
*
* @param url The remote URL to reach.
*
* @return Account id.
*/
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
* used to handle incoming calls.
*
* @param rdata The incoming request message.
*
* @return Account id.
*/
PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata);
/**
* Create arbitrary requests using the account. Application should only use
* this function to create auxiliary requests outside dialog, such as
* OPTIONS, and use the call or presence API to create dialog related
* requests.
*
* @param acc_id The account ID.
* @param method The SIP method of the request.
* @param target Target URI.
* @param p_tdata Pointer to receive the request.
*
* @return PJ_SUCCESS or the error code.
*/
PJ_DECL(pj_status_t) pjsua_acc_create_request(pjsua_acc_id acc_id,
const pjsip_method *method,
const pj_str_t *target,
pjsip_tx_data **p_tdata);
/**
* Create a suitable Contact header value, based on the specified target UR
I
* for the specified account.
*
* @param pool Pool to allocate memory for the string.
* @param contact The string where the Contact will be stored.
* @param acc_id Account ID.
* @param uri Destination URI of the request.
*
* @return PJ_SUCCESS on success, other on error.
*/
PJ_DECL(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
pj_str_t *contact,
pjsua_acc_id acc_id,
const pj_str_t *uri);
/**
* Create a suitable Contact header value, based on the information in the
* incoming request.
*
* @param pool Pool to allocate memory for the string.
* @param contact The string where the Contact will be stored.
* @param acc_id Account ID.
* @param rdata Incoming request.
*
* @return PJ_SUCCESS on success, other on error.
*/
PJ_DECL(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
pj_str_t *contact,
pjsua_acc_id acc_id,
pjsip_rx_data *rdata );
/**
* Lock/bind this account to a specific transport/listener. Normally
* application shouldn't need to do this, as transports will be selected
* automatically by the stack according to the destination.
*
* When account is locked/bound to a specific transport, all outgoing
* requests from this account will use the specified transport (this
* includes SIP registration, dialog (call and event subscription), and
* out-of-dialog requests such as MESSAGE).
*
* Note that transport_id may be specified in pjsua_acc_config too.
*
* @param acc_id The account ID.
* @param tp_id The transport ID.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_acc_set_transport(pjsua_acc_id acc_id,
pjsua_transport_id tp_id);
/**
* @}
*/
/**************************************************************************
***
* CALLS API
*/
/**
* @defgroup PJSUA_LIB_CALL PJSUA-API Calls Management
* @ingroup PJSUA_LIB
* @brief Call manipulation.
* @{
*/
/**
* Maximum simultaneous calls.
*/
#ifndef PJSUA_MAX_CALLS
# define PJSUA_MAX_CALLS 32
#endif
/**
* This enumeration specifies the media status of a call, and it's part
* of pjsua_call_info structure.
*/
typedef enum pjsua_call_media_status
{
/** Call currently has no media */
PJSUA_CALL_MEDIA_NONE,
/** The media is active */
PJSUA_CALL_MEDIA_ACTIVE,
/** The media is currently put on hold by local endpoint */
PJSUA_CALL_MEDIA_LOCAL_HOLD,
/** The media is currently put on hold by remote endpoint */
PJSUA_CALL_MEDIA_REMOTE_HOLD,
/** The media has reported error (e.g. ICE negotiation) */
PJSUA_CALL_MEDIA_ERROR
} pjsua_call_media_status;
/**
* This structure describes the information and current status of a call.
*/
typedef struct pjsua_call_info
{
/** Call identification. */
pjsua_call_id id;
/** Initial call role (UAC == caller) */
pjsip_role_e role;
/** The account ID where this call belongs. */
pjsua_acc_id acc_id;
/** Local URI */
pj_str_t local_info;
/** Local Contact */
pj_str_t local_contact;
/** Remote URI */
pj_str_t remote_info;
/** Remote contact */
pj_str_t remote_contact;
/** Dialog Call-ID string. */
pj_str_t call_id;
/** Call state */
pjsip_inv_state state;
/** Text describing the state */
pj_str_t state_text;
/** Last status code heard, which can be used as cause code */
pjsip_status_code last_status;
/** The reason phrase describing the status. */
pj_str_t last_status_text;
/** Call media status. */
pjsua_call_media_status media_status;
/** Media direction */
pjmedia_dir media_dir;
/** The conference port number for the call */
pjsua_conf_port_id conf_slot;
/** Up-to-date call connected duration (zero when call is not
* established)
*/
pj_time_val connect_duration;
/** Total call duration, including set-up time */
pj_time_val total_duration;
/** Internal */
struct {
char local_info[128];
char local_contact[128];
char remote_info[128];
char remote_contact[128];
char call_id[128];
char last_status_text[128];
} buf_;
} pjsua_call_info;
/**
* Get maximum number of calls configured in pjsua.
*
* @return Maximum number of calls configured.
*/
PJ_DECL(unsigned) pjsua_call_get_max_count(void);
/**
* Get number of currently active calls.
*
* @return Number of currently active calls.
*/
PJ_DECL(unsigned) pjsua_call_get_count(void);
/**
* Enumerate all active calls. Application may then query the information a
nd
* state of each call by calling #pjsua_call_get_info().
*
* @param ids Array of account IDs to be initialized.
* @param count In input, specifies the maximum number of el
ements.
* On return, it contains the actual number of elements
.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_calls(pjsua_call_id ids[],
unsigned *count);
/**
* Make outgoing call to the specified URI using the specified account.
*
* @param acc_id The account to be used.
* @param dst_uri URI to be put in the To header (normally is the same
* as the target URI).
* @param options Options (must be zero at the moment).
* @param user_data Arbitrary user data to be attached to the call, and
* can be retrieved later.
* @param msg_data Optional headers etc to be added to outgoing INVITE
* request, or NULL if no custom header is desired.
* @param p_call_id Pointer to receive call identification.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
const pj_str_t *dst_uri,
unsigned options,
void *user_data,
const pjsua_msg_data *msg_data,
pjsua_call_id *p_call_id);
/**
* Check if the specified call has active INVITE session and the INVITE
* session has not been disconnected.
*
* @param call_id Call identification.
*
* @return Non-zero if call is active.
*/
PJ_DECL(pj_bool_t) pjsua_call_is_active(pjsua_call_id call_id);
/**
* Check if call has an active media session.
*
* @param call_id Call identification.
*
* @return Non-zero if yes.
*/
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
* 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
* may use the media session to retrieve more detailed information about th
e
* call's media.
*
* @param call_id Call identification.
*
* @return Call media session.
*/
PJ_DECL(pjmedia_session*) pjsua_call_get_media_session(pjsua_call_id call_i
d);
/**
* Retrieve the media transport instance that is used for this call.
* Application may use the media transport to query more detailed informati
on
* about the media transport.
*
* @param cid Call identification (the call_id).
*
* @return Call media transport.
*/
PJ_DECL(pjmedia_transport*) pjsua_call_get_media_transport(pjsua_call_id ci
d);
/**
* Get the conference port identification associated with the call.
*
* @param call_id Call identification.
*
* @return Conference port ID, or PJSUA_INVALID_ID when the
* media has not been established or is not active.
*/
PJ_DECL(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id)
;
/**
* Obtain detail information about the specified call.
*
* @param call_id Call identification.
* @param info Call info to be initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_get_info(pjsua_call_id call_id,
pjsua_call_info *info);
/**
* Attach application specific data to the call. Application can then
* inspect this data by calling #pjsua_call_get_user_data().
*
* @param call_id Call identification.
* @param user_data Arbitrary data to be attached to the call.
*
* @return The user data.
*/
PJ_DECL(pj_status_t) pjsua_call_set_user_data(pjsua_call_id call_id,
void *user_data);
/**
* Get user data attached to the call, which has been previously set with
* #pjsua_call_set_user_data().
*
* @param call_id Call identification.
*
* @return The user data.
*/
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
* of PJSUA-LIB which sends its NAT type in the SDP when \a nat_type_in_sdp
* is set in #pjsua_config.
*
* 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
* call is received as long as incoming call contains SDP, and for outgoing
* call, this function can be called only after SDP is received (normally i
n
* 200/OK response to INVITE). As a general case, application should call
* this function after or in \a on_call_media_state() callback.
*
* @param call_id Call identification.
* @param p_type Pointer to store the NAT type. Application can then
* retrieve the string description of the NAT type
* by calling pj_stun_get_nat_name().
*
* @return PJ_SUCCESS on success.
*
* @see pjsua_get_nat_type(), nat_type_in_sdp
*/
PJ_DECL(pj_status_t) pjsua_call_get_rem_nat_type(pjsua_call_id call_id,
pj_stun_nat_type *p_type);
/**
* Send response to incoming INVITE request. Depending on the status
* code specified as parameter, this function may send provisional
* response, establish the call, or terminate the call.
*
* @param call_id Incoming call identification.
* @param code Status code, (100-699).
* @param reason Optional reason phrase. If NULL, default text
* will be used.
* @param msg_data Optional list of headers etc to be added to outgoing
* response message.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_answer(pjsua_call_id call_id,
unsigned code,
const pj_str_t *reason,
const pjsua_msg_data *msg_data);
/**
* Hangup call by using method that is appropriate according to the
* call state. This function is different than answering the call with
* 3xx-6xx response (with #pjsua_call_answer()), in that this function
* will hangup the call regardless of the state and role of the call,
* while #pjsua_call_answer() only works with incoming calls on EARLY
* state.
*
* @param call_id Call identification.
* @param code Optional status code to be sent when we're rejecting
* incoming call. If the value is zero, "603/Decline"
* will be sent.
* @param reason Optional reason phrase to be sent when we're rejecti
ng
* incoming call. If NULL, default text will be used.
* @param msg_data Optional list of headers etc to be added to outgoing
* request/response message.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_hangup(pjsua_call_id call_id,
unsigned code,
const pj_str_t *reason,
const pjsua_msg_data *msg_data);
/**
* Accept or reject redirection response. Application MUST call this functi
on
* after it signaled PJSIP_REDIRECT_PENDING in the \a on_call_redirected()
* callback, to notify the call whether to accept or reject the redirection
* to the current target. Application can use the combination of
* PJSIP_REDIRECT_PENDING command in \a on_call_redirected() callback and
* this function to ask for user permission before redirecting the call.
*
* Note that if the application chooses to reject or stop redirection (by
* using PJSIP_REDIRECT_REJECT or PJSIP_REDIRECT_STOP respectively), the
* call disconnection callback will be called before this function returns.
* And if the application rejects the target, the \a on_call_redirected()
* callback may also be called before this function returns if there is
* another target to try.
*
* @param call_id The call ID.
* @param cmd Redirection operation to be applied to the current
* target. The semantic of this argument is similar
* to the description in the \a on_call_redirected()
* callback, except that the PJSIP_REDIRECT_PENDING is
* not accepted here.
*
* @return PJ_SUCCESS on successful operation.
*/
PJ_DECL(pj_status_t) pjsua_call_process_redirect(pjsua_call_id call_id,
pjsip_redirect_op cmd);
/**
* Put the specified call on hold. This will send re-INVITE with the
* 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
* \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed.
*
* @param call_id Call identification.
* @param msg_data Optional message components to be sent with
* the request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id,
const pjsua_msg_data *msg_data);
/**
* Send re-INVITE to release hold.
* The final status of the request itself will be reported on the
* \a on_call_media_state() callback, which inform the application that
* the media state of the call has changed.
*
* @param call_id Call identification.
* @param unhold If this argument is non-zero and the call is locally
* held, this will release the local hold.
* @param msg_data Optional message components to be sent with
* the request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
pj_bool_t unhold,
const pjsua_msg_data *msg_data);
/**
* Send UPDATE request.
*
* @param call_id Call identification.
* @param options Must be zero for now.
* @param msg_data Optional message components to be sent with
* the request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id,
unsigned options,
const pjsua_msg_data *msg_data);
/**
* Initiate call transfer to the specified address. This function will send
* REFER request to instruct remote call party to initiate a new INVITE
* session to the specified destination/target.
*
* If application is interested to monitor the successfulness and
* the progress of the transfer request, it can implement
* \a on_call_transfer_status() callback which will report the progress
* of the call transfer request.
*
* @param call_id The call id to be transfered.
* @param dest Address of new target to be contacted.
* @param msg_data Optional message components to be sent with
* the request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_xfer(pjsua_call_id call_id,
const pj_str_t *dest,
const pjsua_msg_data *msg_data);
/**
* Flag to indicate that "Require: replaces" should not be put in the
* outgoing INVITE request caused by REFER request created by
* #pjsua_call_xfer_replaces().
*/
#define PJSUA_XFER_NO_REQUIRE_REPLACES 1
/**
* Initiate attended call transfer. This function will send REFER request
* to instruct remote call party to initiate new INVITE session to the URL
* of \a dest_call_id. The party at \a dest_call_id then should "replace"
* the call with us with the new call from the REFER recipient.
*
* @param call_id The call id to be transfered.
* @param dest_call_id The call id to be replaced.
* @param options Application may specify PJSUA_XFER_NO_REQUIRE_REPLAC
ES
* to suppress the inclusion of "Require: replaces" in
* the outgoing INVITE request created by the REFER
* request.
* @param msg_data Optional message components to be sent with
* the request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_xfer_replaces(pjsua_call_id call_id,
pjsua_call_id dest_call_id,
unsigned options,
const pjsua_msg_data *msg_data
);
/**
* Send DTMF digits to remote using RFC 2833 payload formats.
*
* @param call_id Call identification.
* @param digits DTMF string digits to be sent.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id,
const pj_str_t *digits);
/**
* Send instant messaging inside INVITE session.
*
* @param call_id Call identification.
* @param mime_type Optional MIME type. If NULL, then "text/plain" is
* assumed.
* @param content The message content.
* @param msg_data Optional list of headers etc to be included in outgo
ing
* request. The body descriptor in the msg_data is
* ignored.
* @param user_data Optional user data, which will be given back when
* the IM callback is called.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_send_im( pjsua_call_id call_id,
const pj_str_t *mime_type,
const pj_str_t *content,
const pjsua_msg_data *msg_data,
void *user_data);
/**
* Send IM typing indication inside INVITE session.
*
* @param call_id Call identification.
* @param is_typing Non-zero to indicate to remote that local person is
* currently typing an IM.
* @param msg_data Optional list of headers etc to be included in outgo
ing
* request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_send_typing_ind(pjsua_call_id call_id,
pj_bool_t is_typing,
const pjsua_msg_data*msg_dat
a);
/**
* 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
* requests which would change the invite session's state, such as re-INVIT
E,
* UPDATE, PRACK, and BYE.
*
* @param call_id Call identification.
* @param method SIP method of the request.
* @param msg_data Optional message body and/or list of headers to be
* included in outgoing request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_call_send_request(pjsua_call_id call_id,
const pj_str_t *method,
const pjsua_msg_data *msg_data)
;
/**
* Terminate all calls. This will initiate #pjsua_call_hangup() for all
* currently active calls.
*/
PJ_DECL(void) pjsua_call_hangup_all(void);
/**
* Dump call and media statistics to string.
*
* @param call_id Call identification.
* @param with_media Non-zero to include media information too.
* @param buffer Buffer where the statistics are to be written to.
* @param maxlen Maximum length of buffer.
* @param indent Spaces for left indentation.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id,
pj_bool_t with_media,
char *buffer,
unsigned maxlen,
const char *indent);
/**
* @}
*/
/**************************************************************************
***
* BUDDY API
*/
/**
* @defgroup PJSUA_LIB_BUDDY PJSUA-API Buddy, Presence, and Instant Messagi
ng
* @ingroup PJSUA_LIB
* @brief Buddy management, buddy's presence, and instant messaging.
* @{
*
* This section describes PJSUA-APIs related to buddies management,
* presence management, and instant messaging.
*/
/**
* Max buddies in buddy list.
*/
#ifndef PJSUA_MAX_BUDDIES
# define PJSUA_MAX_BUDDIES 256
#endif
/**
* This specifies how long the library should wait before retrying failed
* SUBSCRIBE request, and there is no rule to automatically resubscribe
* (for example, no "retry-after" parameter in Subscription-State header).
*
* This also controls the duration before failed PUBLISH request will be
* retried.
*
* Default: 300 seconds
*/
#ifndef PJSUA_PRES_TIMER
# define PJSUA_PRES_TIMER 300
#endif
/**
* This structure describes buddy configuration when adding a buddy to
* the buddy list with #pjsua_buddy_add(). Application MUST initialize
* the structure with #pjsua_buddy_config_default() to initialize this
* structure with default configuration.
*/
typedef struct pjsua_buddy_config
{
/**
* Buddy URL or name address.
*/
pj_str_t uri;
/**
* Specify whether presence subscription should start immediately.
*/
pj_bool_t subscribe;
/**
* Specify arbitrary application data to be associated with with
* the buddy object.
*/
void *user_data;
} pjsua_buddy_config;
/**
* This enumeration describes basic buddy's online status.
*/
typedef enum pjsua_buddy_status
{
/**
* Online status is unknown (possibly because no presence subscription
* has been established).
*/
PJSUA_BUDDY_STATUS_UNKNOWN,
/**
* Buddy is known to be online.
*/
PJSUA_BUDDY_STATUS_ONLINE,
/**
* Buddy is offline.
*/
PJSUA_BUDDY_STATUS_OFFLINE,
} pjsua_buddy_status;
/**
* This structure describes buddy info, which can be retrieved by calling
* #pjsua_buddy_get_info().
*/
typedef struct pjsua_buddy_info
{
/**
* The buddy ID.
*/
pjsua_buddy_id id;
/**
* The full URI of the buddy, as specified in the configuration.
*/
pj_str_t uri;
/**
* Buddy's Contact, only available when presence subscription has
* been established to the buddy.
*/
pj_str_t contact;
/**
* Buddy's online status.
*/
pjsua_buddy_status status;
/**
* Text to describe buddy's online status.
*/
pj_str_t status_text;
/**
* Flag to indicate that we should monitor the presence information for
* this buddy (normally yes, unless explicitly disabled).
*/
pj_bool_t monitor_pres;
/**
* If \a monitor_pres is enabled, this specifies the last state of the
* presence subscription. If presence subscription session is currently
* active, the value will be PJSIP_EVSUB_STATE_ACTIVE. If presence
* subscription request has been rejected, the value will be
* PJSIP_EVSUB_STATE_TERMINATED, and the termination reason will be
* specified in \a sub_term_reason.
*/
pjsip_evsub_state sub_state;
/**
* String representation of subscription state.
*/
const char *sub_state_name;
/**
* Specifies the last presence subscription termination code. This woul
d
* return the last status of the SUBSCRIBE request. If the subscription
* is terminated with NOTIFY by the server, this value will be set to
* 200, and subscription termination reason will be given in the
* \a sub_term_reason field.
*/
unsigned sub_term_code;
/**
* Specifies the last presence subscription termination reason. If
* presence subscription is currently active, the value will be empty.
*/
pj_str_t sub_term_reason;
/**
* Extended RPID information about the person.
*/
pjrpid_element rpid;
/**
* Extended presence info.
*/
pjsip_pres_status pres_status;
/**
* Internal buffer.
*/
char buf_[512];
} pjsua_buddy_info;
/**
* Set default values to the buddy config.
*/
PJ_DECL(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg);
/**
* Get total number of buddies.
*
* @return Number of buddies.
*/
PJ_DECL(unsigned) pjsua_get_buddy_count(void);
/**
* Check if buddy ID is valid.
*
* @param buddy_id Buddy ID to check.
*
* @return Non-zero if buddy ID is valid.
*/
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
* #pjsua_buddy_get_info() to get the detail information for each buddy
* id.
*
* @param ids Array of ids to be initialized.
* @param count On input, specifies max elements in the arra
y.
* On return, it contains actual number of elements
* that have been initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_buddies(pjsua_buddy_id ids[],
unsigned *count);
/**
* Find the buddy ID with the specified URI.
*
* @param uri The buddy URI.
*
* @return The buddy ID, or PJSUA_INVALID_ID if not found.
*/
PJ_DECL(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri);
/**
* Get detailed buddy info.
*
* @param buddy_id The buddy identification.
* @param info Pointer to receive information about buddy.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_get_info(pjsua_buddy_id buddy_id,
pjsua_buddy_info *info);
/**
* Set the user data associated with the buddy object.
*
* @param buddy_id The buddy identification.
* @param user_data Arbitrary application data to be associated with
* the buddy object.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_set_user_data(pjsua_buddy_id buddy_id,
void *user_data);
/**
* Get the user data associated with the budy object.
*
* @param buddy_id The buddy identification.
*
* @return The application data.
*/
PJ_DECL(void*) pjsua_buddy_get_user_data(pjsua_buddy_id buddy_id);
/**
* Add new buddy to the buddy list. If presence subscription is enabled
* for this buddy, this function will also start the presence subscription
* session immediately.
*
* @param buddy_cfg Buddy configuration.
* @param p_buddy_id Pointer to receive buddy ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg,
pjsua_buddy_id *p_buddy_id);
/**
* Delete the specified buddy from the buddy list. Any presence subscriptio
n
* to this buddy will be terminated.
*
* @param buddy_id Buddy identification.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_del(pjsua_buddy_id buddy_id);
/**
* Enable/disable buddy's presence monitoring. Once buddy's presence is
* subscribed, application will be informed about buddy's presence status
* changed via \a on_buddy_state() callback.
*
* @param buddy_id Buddy identification.
* @param subscribe Specify non-zero to activate presence subscription t
o
* the specified buddy.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id,
pj_bool_t subscribe);
/**
* Update the presence information for the buddy. Although the library
* periodically refreshes the presence subscription for all buddies, some
* application may want to refresh the buddy's presence subscription
* immediately, and in this case it can use this function to accomplish
* this.
*
* Note that the buddy's presence subscription will only be initiated
* if presence monitoring is enabled for the buddy. See
* #pjsua_buddy_subscribe_pres() for more info. Also if presence subscripti
on
* for the buddy is already active, this function will not do anything.
*
* Once the presence subscription is activated successfully for the buddy,
* application will be notified about the buddy's presence status in the
* on_buddy_state() callback.
*
* @param buddy_id Buddy identification.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_buddy_update_pres(pjsua_buddy_id buddy_id);
/**
* Send NOTIFY to inform account presence status or to terminate server
* side presence subscription. If application wants to reject the incoming
* request, it should set the \a state to PJSIP_EVSUB_STATE_TERMINATED.
*
* @param acc_id Account ID.
* @param srv_pres Server presence subscription instance.
* @param state New state to set.
* @param state_str Optionally specify the state string name, if state
* is not "active", "pending", or "terminated".
* @param reason If the new state is PJSIP_EVSUB_STATE_TERMINATED,
* optionally specify the termination reason.
* @param with_body If the new state is PJSIP_EVSUB_STATE_TERMINATED,
* this specifies whether the NOTIFY request should
* contain message body containing account's presence
* information.
* @param msg_data Optional list of headers to be sent with the NOTIFY
* request.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_pres_notify(pjsua_acc_id acc_id,
pjsua_srv_pres *srv_pres,
pjsip_evsub_state state,
const pj_str_t *state_str,
const pj_str_t *reason,
pj_bool_t with_body,
const pjsua_msg_data *msg_data);
/**
* Dump presence subscriptions to log.
*
* @param verbose Yes or no.
*/
PJ_DECL(void) pjsua_pres_dump(pj_bool_t verbose);
/**
* The MESSAGE method (defined in pjsua_im.c)
*/
extern const pjsip_method pjsip_message_method;
/**
* Send instant messaging outside dialog, using the specified account for
* route set and authentication.
*
* @param acc_id Account ID to be used to send the request.
* @param to Remote URI.
* @param mime_type Optional MIME type. If NULL, then "text/plain" is
* assumed.
* @param content The message content.
* @param msg_data Optional list of headers etc to be included in outgo
ing
* request. The body descriptor in the msg_data is
* ignored.
* @param user_data Optional user data, which will be given back when
* the IM callback is called.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_im_send(pjsua_acc_id acc_id,
const pj_str_t *to,
const pj_str_t *mime_type,
const pj_str_t *content,
const pjsua_msg_data *msg_data,
void *user_data);
/**
* Send typing indication outside dialog.
*
* @param acc_id Account ID to be used to send the request.
* @param to Remote URI.
* @param is_typing If non-zero, it tells remote person that local perso
n
* is currently composing an IM.
* @param msg_data Optional list of headers etc to be added to outgoing
* request.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
const pj_str_t *to,
pj_bool_t is_typing,
const pjsua_msg_data *msg_data);
/**
* @}
*/
/**************************************************************************
***
* MEDIA API
*/
/**
* @defgroup PJSUA_LIB_MEDIA PJSUA-API Media Manipulation
* @ingroup PJSUA_LIB
* @brief Media manipulation.
* @{
*
* PJSUA has rather powerful media features, which are built around the
* PJMEDIA conference bridge. Basically, all media "ports" (such as calls,
WAV
* players, WAV playlist, file recorders, sound device, tone generators, et
c)
* are terminated in the conference bridge, and application can manipulate
* the interconnection between these terminations freely.
*
* The conference bridge provides powerful switching and mixing functionali
ty
* for application. With the conference bridge, each conference slot (e.g.
* a call) can transmit to multiple destinations, and one destination can
* receive from multiple sources. If more than one media terminations are
* terminated in the same slot, the conference bridge will mix the signal
* automatically.
*
* Application connects one media termination/slot to another by calling
* #pjsua_conf_connect() function. This will establish <b>unidirectional</b
>
* media flow from the source termination to the sink termination. To
* establish bidirectional media flow, application wound need to make anoth
er
* call to #pjsua_conf_connect(), this time inverting the source and
* destination slots in the parameter.
*
* For example, to stream a WAV file to remote call, application may use
* the following steps:
*
\code
pj_status_t stream_to_call( pjsua_call_id call_id )
{
pjsua_player_id player_id;
status = pjsua_player_create("mysong.wav", 0, NULL, &player_id);
if (status != PJ_SUCCESS)
return status;
status = pjsua_conf_connect( pjsua_player_get_conf_port(),
pjsua_call_get_conf_port() );
}
\endcode
*
*
* Other features of PJSUA media:
* - efficient N to M interconnections between media terminations.
* - media termination can be connected to itself to create loopback
* media.
* - the media termination may have different clock rates, and resampling
* will be done automatically by conference bridge.
* - media terminations may also have different frame time; the
* conference bridge will perform the necessary bufferring to adjust
* the difference between terminations.
* - interconnections are removed automatically when media termination
* is removed from the bridge.
* - sound device may be changed even when there are active media
* interconnections.
* - correctly report call's media quality (in #pjsua_call_dump()) from
* RTCP packet exchange.
*/
/**
* Max ports in the conference bridge. This setting is the default value
* for pjsua_media_config.max_media_ports.
*/
#ifndef PJSUA_MAX_CONF_PORTS
# define PJSUA_MAX_CONF_PORTS 254
#endif
/**
* The default clock rate to be used by the conference bridge. This setting
* is the default value for pjsua_media_config.clock_rate.
*/
#ifndef PJSUA_DEFAULT_CLOCK_RATE
# define PJSUA_DEFAULT_CLOCK_RATE 16000
#endif
/**
* Default frame length in the conference bridge. This setting
* is the default value for pjsua_media_config.audio_frame_ptime.
*/
#ifndef PJSUA_DEFAULT_AUDIO_FRAME_PTIME
# define PJSUA_DEFAULT_AUDIO_FRAME_PTIME 20
#endif
/**
* Default codec quality settings. This setting is the default value
* for pjsua_media_config.quality.
*/
#ifndef PJSUA_DEFAULT_CODEC_QUALITY
# define PJSUA_DEFAULT_CODEC_QUALITY 8
#endif
/**
* Default iLBC mode. This setting is the default value for
* pjsua_media_config.ilbc_mode.
*/
#ifndef PJSUA_DEFAULT_ILBC_MODE
# define PJSUA_DEFAULT_ILBC_MODE 30
#endif
/**
* The default echo canceller tail length. This setting
* is the default value for pjsua_media_config.ec_tail_len.
*/
#ifndef PJSUA_DEFAULT_EC_TAIL_LEN
# define PJSUA_DEFAULT_EC_TAIL_LEN 200
#endif
/**
* The maximum file player.
*/
#ifndef PJSUA_MAX_PLAYERS
# define PJSUA_MAX_PLAYERS 32
#endif
/**
* The maximum file player.
*/
#ifndef PJSUA_MAX_RECORDERS
# define PJSUA_MAX_RECORDERS 32
#endif
/**
* This structure describes media configuration, which will be specified
* when calling #pjsua_init(). Application MUST initialize this structure
* by calling #pjsua_media_config_default().
*/
struct pjsua_media_config
{
/**
* Clock rate to be applied to the conference bridge.
* If value is zero, default clock rate will be used
* (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
*/
unsigned clock_rate;
/**
* Clock rate to be applied when opening the sound device.
* If value is zero, conference bridge clock rate will be used.
*/
unsigned snd_clock_rate;
/**
* Channel count be applied when opening the sound device and
* conference bridge.
*/
unsigned channel_count;
/**
* Specify audio frame ptime. The value here will affect the
* samples per frame of both the sound device and the conference
* bridge. Specifying lower ptime will normally reduce the
* latency.
*
* Default value: PJSUA_DEFAULT_AUDIO_FRAME_PTIME
*/
unsigned audio_frame_ptime;
/**
* Specify maximum number of media ports to be created in the
* conference bridge. Since all media terminate in the bridge
* (calls, file player, file recorder, etc), the value must be
* large enough to support all of them. However, the larger
* the value, the more computations are performed.
*
* Default value: PJSUA_MAX_CONF_PORTS
*/
unsigned max_media_ports;
/**
* Specify whether the media manager should manage its own
* ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created
* and at least one worker thread will be created too. If no,
* the RTP/RTCP sockets will share the same ioqueue as SIP sockets,
* and no worker thread is needed.
*
* Normally application would say yes here, unless it wants to
* run everything from a single thread.
*/
pj_bool_t has_ioqueue;
/**
* Specify the number of worker threads to handle incoming RTP
* packets. A value of one is recommended for most applications.
*/
unsigned thread_cnt;
/**
* Media quality, 0-10, according to this table:
* 5-10: resampling use large filter,
* 3-4: resampling use small filter,
* 1-2: resampling use linear.
* The media quality also sets speex codec quality/complexity to the
* number.
*
* Default: 5 (PJSUA_DEFAULT_CODEC_QUALITY).
*/
unsigned quality;
/**
* Specify default codec ptime.
*
* Default: 0 (codec specific)
*/
unsigned ptime;
/**
* Disable VAD?
*
* Default: 0 (no (meaning VAD is enabled))
*/
pj_bool_t no_vad;
/**
* iLBC mode (20 or 30).
*
* Default: 30 (PJSUA_DEFAULT_ILBC_MODE)
*/
unsigned ilbc_mode;
/**
* Percentage of RTP packet to drop in TX direction
* (to simulate packet lost).
*
* Default: 0
*/
unsigned tx_drop_pct;
/**
* Percentage of RTP packet to drop in RX direction
* (to simulate packet lost).
*
* Default: 0
*/
unsigned rx_drop_pct;
/**
* Echo canceller options (see #pjmedia_echo_create())
*
* Default: 0.
*/
unsigned ec_options;
/**
* Echo canceller tail length, in miliseconds.
*
* Default: PJSUA_DEFAULT_EC_TAIL_LEN
*/
unsigned ec_tail_len;
/**
* Audio capture buffer length, in milliseconds.
*
* Default: PJMEDIA_SND_DEFAULT_REC_LATENCY
*/
unsigned snd_rec_latency;
/**
* Audio playback buffer length, in milliseconds.
*
* Default: PJMEDIA_SND_DEFAULT_PLAY_LATENCY
*/
unsigned snd_play_latency;
/**
* Jitter buffer initial prefetch delay in msec. The value must be
* between jb_min_pre and jb_max_pre below.
*
* Default: -1 (to use default stream settings, currently 150 msec)
*/
int jb_init;
/**
* Jitter buffer minimum prefetch delay in msec.
*
* Default: -1 (to use default stream settings, currently 60 msec)
*/
int jb_min_pre;
/**
* Jitter buffer maximum prefetch delay in msec.
*
* Default: -1 (to use default stream settings, currently 240 msec)
*/
int jb_max_pre;
/**
* Set maximum delay that can be accomodated by the jitter buffer msec.
*
* Default: -1 (to use default stream settings, currently 360 msec)
*/
int jb_max;
/**
* Enable ICE
*/
pj_bool_t enable_ice;
/**
* Set the maximum number of host candidates.
*
* Default: -1 (maximum not set)
*/
int ice_max_host_cands;
/**
* ICE session options.
*/
pj_ice_sess_options ice_opt;
/**
* Disable RTCP component.
*
* Default: no
*/
pj_bool_t ice_no_rtcp;
/**
* Enable TURN relay candidate in ICE.
*/
pj_bool_t enable_turn;
/**
* Specify TURN domain name or host name, in in "DOMAIN:PORT" or
* "HOST:PORT" format.
*/
pj_str_t turn_server;
/**
* Specify the connection type to be used to the TURN server. Valid
* values are PJ_TURN_TP_UDP or PJ_TURN_TP_TCP.
*
* Default: PJ_TURN_TP_UDP
*/
pj_turn_tp_type turn_conn_type;
/**
* Specify the credential to authenticate with the TURN server.
*/
pj_stun_auth_cred turn_auth_cred;
/**
* Specify idle time of sound device before it is automatically closed,
* in seconds. Use value -1 to disable the auto-close feature of sound
* device
*
* Default : 1
*/
int snd_auto_close_time;
};
/**
* Use this function to initialize media config.
*
* @param cfg The media config to be initialized.
*/
PJ_DECL(void) pjsua_media_config_default(pjsua_media_config *cfg);
/**
* This structure describes codec information, which can be retrieved by
* calling #pjsua_enum_codecs().
*/
typedef struct pjsua_codec_info
{
/**
* Codec unique identification.
*/
pj_str_t codec_id;
/**
* Codec priority (integer 0-255).
*/
pj_uint8_t priority;
/**
* Internal buffer.
*/
char buf_[32];
} pjsua_codec_info;
/**
* This structure descibes information about a particular media port that
* has been registered into the conference bridge. Application can query
* this info by calling #pjsua_conf_get_port_info().
*/
typedef struct pjsua_conf_port_info
{
/** Conference port number. */
pjsua_conf_port_id slot_id;
/** Port name. */
pj_str_t name;
/** Clock rate. */
unsigned clock_rate;
/** Number of channels. */
unsigned channel_count;
/** Samples per frame */
unsigned samples_per_frame;
/** Bits per sample */
unsigned bits_per_sample;
/** Number of listeners in the array. */
unsigned listener_cnt;
/** Array of listeners (in other words, ports where this port is
* transmitting to.
*/
pjsua_conf_port_id listeners[PJSUA_MAX_CONF_PORTS];
} pjsua_conf_port_info;
/**
* This structure holds information about custom media transport to
* be registered to pjsua.
*/
typedef struct pjsua_media_transport
{
/**
* Media socket information containing the address information
* of the RTP and RTCP socket.
*/
pjmedia_sock_info skinfo;
/**
* The media transport instance.
*/
pjmedia_transport *transport;
} pjsua_media_transport;
/**
* Get maxinum number of conference ports.
*
* @return Maximum number of ports in the conference bridge.
*/
PJ_DECL(unsigned) pjsua_conf_get_max_ports(void);
/**
* Get current number of active ports in the bridge.
*
* @return The number.
*/
PJ_DECL(unsigned) pjsua_conf_get_active_ports(void);
/**
* Enumerate all conference ports.
*
* @param id Array of conference port ID to be initialized.
* @param count On input, specifies max elements in the arra
y.
* On return, it contains actual number of elements
* that have been initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[],
unsigned *count);
/**
* Get information about the specified conference port
*
* @param port_id Port identification.
* @param info Pointer to store the port info.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id port_id,
pjsua_conf_port_info *info);
/**
* Add arbitrary media port to PJSUA's conference bridge. Application
* 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,
* or file recorder), PJSUA-LIB will automatically add the port to
* the bridge.
*
* @param pool Pool to use.
* @param port Media port to be added to the bridge.
* @param p_id Optional pointer to receive the conference
* slot id.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool,
pjmedia_port *port,
pjsua_conf_port_id *p_id);
/**
* Remove arbitrary slot from the conference bridge. Application should onl
y
* call this function if it registered the port manually with previous call
* to #pjsua_conf_add_port().
*
* @param port_id The slot id of the port to be removed.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
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
* may transmit to multiple destinations/sink. And if multiple
* sources are transmitting to the same sink, the media will be mixed
* together. Source and sink may refer to the same ID, effectively
* looping the media.
*
* If bidirectional media flow is desired, application needs to call
* this function twice, with the second one having the arguments
* reversed.
*
* @param source Port ID of the source media/transmitter.
* @param sink Port ID of the destination media/received.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_connect(pjsua_conf_port_id source,
pjsua_conf_port_id sink);
/**
* Disconnect media flow from the source to destination port.
*
* @param source Port ID of the source media/transmitter.
* @param sink Port ID of the destination media/received.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_disconnect(pjsua_conf_port_id source,
pjsua_conf_port_id sink);
/**
* Adjust the signal level to be transmitted from the bridge to the
* specified port by making it louder or quieter.
*
* @param slot The conference bridge slot number.
* @param level Signal level adjustment. Value 1.0 means no
level
* adjustment, while value 0 means to mute the port.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot,
float level);
/**
* Adjust the signal level to be received from the specified port (to
* the bridge) by making it louder or quieter.
*
* @param slot The conference bridge slot number.
* @param level Signal level adjustment. Value 1.0 means no
level
* adjustment, while value 0 means to mute the port.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot,
float level);
/**
* 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
* no signal, and 255 indicates the loudest signal level.
*
* @param slot The conference bridge slot number.
* @param tx_level Optional argument to receive the level of signal
* transmitted to the specified port (i.e. the directio
n
* is from the bridge to the port).
* @param rx_level Optional argument to receive the level of signal
* received from the port (i.e. the direction is from t
he
* port to the bridge).
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot,
unsigned *tx_level,
unsigned *rx_level);
/**************************************************************************
***
* File player and playlist.
*/
/**
* Create a file player, and automatically add this player to
* the conference bridge.
*
* @param filename The filename to be played. Currently only
* WAV files are supported, and the WAV file MUST be
* formatted as 16bit PCM mono/single channel (any
* clock rate is supported).
* @param options Optional option flag. Application may specify
* PJMEDIA_FILE_NO_LOOP to prevent playback loop.
* @param p_id Pointer to receive player ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_player_create(const pj_str_t *filename,
unsigned options,
pjsua_player_id *p_id);
/**
* Create a file playlist media port, and automatically add the port
* to the conference bridge.
*
* @param file_names Array of file names to be added to the play list.
* Note that the files must have the same clock rate,
* number of channels, and number of bits per sample.
* @param file_count Number of files in the array.
* @param label Optional label to be set for the media port.
* @param options Optional option flag. Application may specify
* PJMEDIA_FILE_NO_LOOP to prevent looping.
* @param p_id Optional pointer to receive player ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_playlist_create(const pj_str_t file_names[],
unsigned file_count,
const pj_str_t *label,
unsigned options,
pjsua_player_id *p_id);
/**
* Get conference port ID associated with player or playlist.
*
* @param id The file player ID.
*
* @return Conference port ID associated with this player.
*/
PJ_DECL(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id);
/**
* Get the media port for the player or playlist.
*
* @param id The player ID.
* @param p_port The media port associated with the player.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_player_get_port(pjsua_player_id id,
pjmedia_port **p_port);
/**
* Set playback position. This operation is not valid for playlist.
*
* @param id The file player ID.
* @param samples The playback position, in samples. Application can
* specify zero to re-start the playback.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_player_set_pos(pjsua_player_id id,
pj_uint32_t samples);
/**
* Close the file of playlist, remove the player from the bridge, and free
* resources associated with the file player or playlist.
*
* @param id The file player ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id);
/**************************************************************************
***
* File recorder.
*/
/**
* Create a file recorder, and automatically connect this recorder to
* the conference bridge. The recorder currently supports recording WAV fil
e.
* The type of the recorder to use is determined by the extension of the fi
le
* (e.g. ".wav").
*
* @param filename Output file name. The function will determine the
* default format to be used based on the file extensio
n.
* Currently ".wav" is supported on all platforms.
* @param enc_type Optionally specify the type of encoder to be used to
* compress the media, if the file can support differen
t
* encodings. This value must be zero for now.
* @param enc_param Optionally specify codec specific parameter to be
* passed to the file writer.
* For .WAV recorder, this value must be NULL.
* @param max_size Maximum file size. Specify zero or -1 to remove size
* limitation. This value must be zero or -1 for now.
* @param options Optional options.
* @param p_id Pointer to receive the recorder instance.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename,
unsigned enc_type,
void *enc_param,
pj_ssize_t max_size,
unsigned options,
pjsua_recorder_id *p_id);
/**
* Get conference port associated with recorder.
*
* @param id The recorder ID.
*
* @return Conference port ID associated with this recorder.
*/
PJ_DECL(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id
id);
/**
* Get the media port for the recorder.
*
* @param id The recorder ID.
* @param p_port The media port associated with the recorder.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_recorder_get_port(pjsua_recorder_id id,
pjmedia_port **p_port);
/**
* Destroy recorder (this will complete recording).
*
* @param id The recorder ID.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id);
/**************************************************************************
***
* Sound devices.
*/
/**
* Enum all audio devices installed in the system.
*
* @param info Array of info to be initialized.
* @param count On input, specifies max elements in the arra
y.
* On return, it contains actual number of elements
* that have been initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_aud_devs(pjmedia_aud_dev_info info[],
unsigned *count);
/**
* Enum all sound devices installed in the system (old API).
*
* @param info Array of info to be initialized.
* @param count On input, specifies max elements in the arra
y.
* On return, it contains actual number of elements
* that have been initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[],
unsigned *count);
/**
* 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
* the function returns PJ_SUCCESS with -1 as device IDs.
*
* @param capture_dev On return it will be filled with device ID of the
* capture device.
* @param playback_dev On return it will be filled with device ID of the
* device ID of the playback device.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_get_snd_dev(int *capture_dev,
int *playback_dev);
/**
* Select or change sound device. Application may call this function at
* any time to replace current sound device.
*
* @param capture_dev Device ID of the capture device.
* @param playback_dev Device ID of the playback device.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
int playback_dev);
/**
* 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
* any hardware.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void);
/**
* Disconnect the main conference bridge from any sound devices, and let
* application connect the bridge to it's own sound device/master port.
*
* @return The port interface of the conference bridge,
* so that application can connect this to it's own
* sound device or master port.
*/
PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void);
/**
* Change the echo cancellation settings.
*
* The behavior of this function depends on whether the sound device is
* currently active, and if it is, whether device or software AEC is
* being used.
*
* If the sound device is currently active, and if the device supports AEC,
* this function will forward the change request to the device and it will
* be up to the device on whether support the request. If software AEC is
* being used (the software EC will be used if the device does not support
* AEC), this function will change the software EC settings. In all cases,
* the setting will be saved for future opening of the sound device.
*
* 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
* sound device is opened.
*
* @param tail_ms The tail length, in miliseconds. Set to zero to
* disable AEC.
* @param options Options to be passed to pjmedia_echo_create().
* Normally the value should be zero.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options);
/**
* Get current echo canceller tail length.
*
* @param p_tail_ms Pointer to receive the tail length, in miliseconds.
* If AEC is disabled, the value will be zero.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms);
/**
* Check whether the sound device is currently active. The sound device
* 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
* if null sound device or no sound device has been configured via the
* #pjsua_set_no_snd_dev() function.
*/
PJ_DECL(pj_bool_t) pjsua_snd_is_active(void);
/**
* Configure sound device setting to the sound device being used. If sound
* device is currently active, the function will forward the setting to the
* sound device instance to be applied immediately, if it supports it.
*
* The setting will be saved for future opening of the sound device, if the
* "keep" argument is set to non-zero. If the sound device is currently
* inactive, and the "keep" argument is false, this function will return
* error.
*
* Note that in case the setting is kept for future use, it will be applied
* to any devices, even when application has changed the sound device to be
* used.
*
* Note also that the echo cancellation setting should be set with
* #pjsua_set_ec() API instead.
*
* See also #pjmedia_aud_stream_set_cap() for more information about settin
g
* an audio device capability.
*
* @param cap The sound device setting to change.
* @param pval Pointer to value. Please see #pjmedia_aud_dev_cap
* documentation about the type of value to be
* supplied for each setting.
* @param keep Specify whether the setting is to be kept for future
* use.
*
* @return PJ_SUCCESS on success or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsua_snd_set_setting(pjmedia_aud_dev_cap cap,
const void *pval,
pj_bool_t keep);
/**
* Retrieve a sound device setting. If sound device is currently active,
* the function will forward the request to the sound device. If sound devi
ce
* is currently inactive, and if application had previously set the setting
* and mark the setting as kept, then that setting will be returned.
* Otherwise, this function will return error.
*
* Note that echo cancellation settings should be retrieved with
* #pjsua_get_ec_tail() API instead.
*
* @param cap The sound device setting to retrieve.
* @param pval Pointer to receive the value.
* Please see #pjmedia_aud_dev_cap documentation about
* the type of value to be supplied for each setting.
*
* @return PJ_SUCCESS on success or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsua_snd_get_setting(pjmedia_aud_dev_cap cap,
void *pval);
/**************************************************************************
***
* Codecs.
*/
/**
* Enum all supported codecs in the system.
*
* @param id Array of ID to be initialized.
* @param count On input, specifies max elements in the arra
y.
* On return, it contains actual number of elements
* that have been initialized.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_enum_codecs( pjsua_codec_info id[],
unsigned *count );
/**
* Change codec priority.
*
* @param codec_id Codec ID, which is a string that uniquely identify
* the codec (such as "speex/8000"). Please see pjsua
* manual or pjmedia codec reference for details.
* @param priority Codec priority, 0-255, where zero means to disable
* the codec.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_codec_set_priority( const pj_str_t *codec_id,
pj_uint8_t priority );
/**
* Get codec parameters.
*
* @param codec_id Codec ID.
* @param param Structure to receive codec parameters.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_codec_get_param( const pj_str_t *codec_id,
pjmedia_codec_param *param );
/**
* Set codec parameters.
*
* @param codec_id Codec ID.
* @param param Codec parameter to set.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t) pjsua_codec_set_param( const pj_str_t *codec_id,
const pjmedia_codec_param *param
);
/**
* Create UDP media transports for all the calls. This function creates
* one UDP media transport for each call.
*
* @param cfg Media transport configuration. The "port" field in t
he
* configuration is used as the start port to bind the
* sockets.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t)
pjsua_media_transports_create(const pjsua_transport_config *cfg);
/**
* Register custom media transports to be used by calls. There must
* enough media transports for all calls.
*
* @param tp The media transport array.
* @param count Number of elements in the array. This number
MUST
* match the number of maximum calls configured when
* pjsua is created.
* @param auto_delete Flag to indicate whether the transports should be
* destroyed when pjsua is shutdown.
*
* @return PJ_SUCCESS on success, or the appropriate error code
.
*/
PJ_DECL(pj_status_t)
pjsua_media_transports_attach( pjsua_media_transport tp[],
unsigned count,
pj_bool_t auto_delete);
/**
* @}
*/
/**
* @}
*/
PJ_END_DECL
#endif /* __PJSUA_H__ */
 End of changes. 1 change blocks. 
lines changed or deleted lines changed or added


 pjsua_internal.h   pjsua_internal.h 
/* $Id: pjsua_internal.h 2968 2009-10-26 11:21:37Z bennylp $ */ /* $Id: pjsua_internal.h 3144 2010-04-20 14:36:38Z 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 129 skipping to change at line 129
pj_str_t user_part; /**< User part of local URI. */ pj_str_t user_part; /**< User part of local URI. */
pj_str_t contact; /**< Our Contact header. */ pj_str_t contact; /**< Our Contact header. */
pj_str_t srv_domain; /**< Host part of reg server. */ pj_str_t srv_domain; /**< Host part of reg server. */
int srv_port; /**< Port number of reg server. */ int srv_port; /**< Port number of reg server. */
pjsip_regc *regc; /**< Client registration session. */ pjsip_regc *regc; /**< Client registration session. */
pj_status_t reg_last_err; /**< Last registration error. */ pj_status_t reg_last_err; /**< Last registration error. */
int reg_last_code; /**< Last status last register. */ int reg_last_code; /**< Last status last register. */
struct {
pj_bool_t active; /**< Flag of reregister status. */
pj_timer_entry timer; /**< Timer for reregistration. */
void *reg_tp; /**< Transport for registration. */
unsigned attempt_cnt; /**< Attempt counter. */
} auto_rereg; /**< Reregister/reconnect data. */
pj_timer_entry ka_timer; /**< Keep-alive timer for UDP. */ pj_timer_entry ka_timer; /**< Keep-alive timer for UDP. */
pjsip_transport *ka_transport; /**< Transport for keep-alive. */ pjsip_transport *ka_transport; /**< Transport for keep-alive. */
pj_sockaddr ka_target; /**< Destination address for K-A */ pj_sockaddr ka_target; /**< Destination address for K-A */
unsigned ka_target_len; /**< Length of ka_target. */ unsigned ka_target_len; /**< Length of ka_target. */
pjsip_route_hdr route_set; /**< Complete route set inc. out bnd.*/ pjsip_route_hdr route_set; /**< Complete route set inc. out bnd.*/
pj_uint32_t global_route_crc; /** CRC of global route setti
ng. */
pj_uint32_t local_route_crc; /** CRC of account route sett
ing.*/
unsigned cred_cnt; /**< Number of credentials. */ unsigned cred_cnt; /**< Number of credentials. */
pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */ pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */
pj_bool_t online_status; /**< Our online status. */ pj_bool_t online_status; /**< Our online status. */
pjrpid_element rpid; /**< RPID element information. */ pjrpid_element rpid; /**< RPID element information. */
pjsua_srv_pres pres_srv_list; /**< Server subscription list. */ pjsua_srv_pres pres_srv_list; /**< Server subscription list. */
pjsip_publishc *publish_sess; /**< Client publication session. */ pjsip_publishc *publish_sess; /**< Client publication session. */
pj_bool_t publish_state; /**< Last published online status */ pj_bool_t publish_state; /**< Last published online status */
skipping to change at line 248 skipping to change at line 257
pj_mutex_t *mutex; /**< Mutex protection for this data */ pj_mutex_t *mutex; /**< Mutex protection for this data */
/* Logging: */ /* Logging: */
pjsua_logging_config log_cfg; /**< Current logging config. */ pjsua_logging_config log_cfg; /**< Current logging config. */
pj_oshandle_t log_file; /**<Output log file handle */ pj_oshandle_t log_file; /**<Output log file handle */
/* SIP: */ /* SIP: */
pjsip_endpoint *endpt; /**< Global endpoint. */ pjsip_endpoint *endpt; /**< Global endpoint. */
pjsip_module mod; /**< pjsua's PJSIP module. */ pjsip_module mod; /**< pjsua's PJSIP module. */
pjsua_transport_data tpdata[8]; /**< Array of transports. */ pjsua_transport_data tpdata[8]; /**< Array of transports. */
pjsip_tp_state_callback old_tp_cb; /**< Old transport callback. */
/* Threading: */ /* Threading: */
pj_bool_t thread_quit_flag; /**< Thread quit flag. */ pj_bool_t thread_quit_flag; /**< Thread quit flag. */
pj_thread_t *thread[4]; /**< Array of threads. */ pj_thread_t *thread[4]; /**< Array of threads. */
/* STUN and resolver */ /* STUN and resolver */
pj_stun_config stun_cfg; /**< Global STUN settings. */ pj_stun_config stun_cfg; /**< Global STUN settings. */
pj_sockaddr stun_srv; /**< Resolved STUN server addres s */ pj_sockaddr stun_srv; /**< Resolved STUN server addres s */
pj_status_t stun_status; /**< STUN server status. */ pj_status_t stun_status; /**< STUN server status. */
pjsua_stun_resolve stun_res; /**< List of pending STUN resolution*/ pjsua_stun_resolve stun_res; /**< List of pending STUN resolution*/
skipping to change at line 433 skipping to change at line 443
* Init presence for aoocunt. * Init presence for aoocunt.
*/ */
pj_status_t pjsua_pres_init_acc(int acc_id); pj_status_t pjsua_pres_init_acc(int acc_id);
/** /**
* Send PUBLISH * Send PUBLISH
*/ */
pj_status_t pjsua_pres_init_publish_acc(int acc_id); pj_status_t pjsua_pres_init_publish_acc(int acc_id);
/** /**
* Send un-PUBLISH
*/
void pjsua_pres_unpublish(pjsua_acc *acc);
/**
* Terminate server subscription for the account * Terminate server subscription for the account
*/ */
void pjsua_pres_delete_acc(int acc_id); void pjsua_pres_delete_acc(int acc_id);
/** /**
* Init IM module handler to handle incoming MESSAGE outside dialog. * Init IM module handler to handle incoming MESSAGE outside dialog.
*/ */
pj_status_t pjsua_im_init(void); pj_status_t pjsua_im_init(void);
/** /**
 End of changes. 5 change blocks. 
1 lines changed or deleted 18 lines changed or added


 rtp.h   rtp.h 
/* $Id: rtp.h 2394 2008-12-23 17:27:53Z bennylp $ */
/* /*
* rtp.h * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* rtp interface for srtp reference implementation
*
* David A. McGrew
* Cisco Systems, Inc.
*
* data types:
*
* rtp_msg_t an rtp message (the data that goes on the wire)
* rtp_sender_t sender side socket and rtp info
* rtp_receiver_t receiver side socket and rtp info
* *
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A
*/ */
#ifndef __PJMEDIA_RTP_H__
#define __PJMEDIA_RTP_H__
/* /**
* * @file rtp.h
* Copyright (c) 2001-2006, Cisco Systems, Inc. * @brief RTP packet and RTP session declarations.
* All rights reserved. */
* #include <pjmedia/types.h>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions PJ_BEGIN_DECL
* are met:
* /**
* Redistributions of source code must retain the above copyright * @defgroup PJMED_RTP RTP Session and Encapsulation (RFC 3550)
* notice, this list of conditions and the following disclaimer. * @ingroup PJMEDIA_SESSION
* * @brief RTP format and session management
* Redistributions in binary form must reproduce the above * @{
* copyright notice, this list of conditions and the following *
* disclaimer in the documentation and/or other materials provided * The RTP module is designed to be dependent only to PJLIB, it does not de
* with the distribution. pend
* * on any other parts of PJMEDIA library. The RTP module does not even depe
* Neither the name of the Cisco Systems, Inc. nor the names of its nd
* contributors may be used to endorse or promote products derived * on any transports (sockets), to promote even more use, such as in DSP
* from this software without specific prior written permission. * development (where transport may be handled by different processor).
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * An RTCP implementation is available, in separate module. Please see
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * @ref PJMED_RTCP.
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * The functions that are provided by this module:
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * - creating RTP header for each outgoing packet.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * - decoding RTP packet into RTP header and payload.
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * - provide simple RTP session management (sequence number, etc.)
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * The RTP module does not use any dynamic memory at all.
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) *
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * \section P1 How to Use the RTP Module
* OF THE POSSIBILITY OF SUCH DAMAGE. *
* First application must call #pjmedia_rtp_session_init() to initialize th
e RTP
* session.
*
* When application wants to send RTP packet, it needs to call
* #pjmedia_rtp_encode_rtp() to build the RTP header. Note that this WILL N
OT build
* the complete RTP packet, but instead only the header. Application can
* then either concatenate the header with the payload, or send the two
* fragments (the header and the payload) using scatter-gather transport AP
I
* (e.g. \a sendv()).
*
* When application receives an RTP packet, first it should call
* #pjmedia_rtp_decode_rtp to decode RTP header and payload, then it should
call
* #pjmedia_rtp_session_update to check whether we can process the RTP payl
oad,
* and to let the RTP session updates its internal status. The decode funct
ion
* is guaranteed to point the payload to the correct position regardless of
* any options present in the RTP packet.
* *
*/ */
#ifndef RTP_H #ifdef _MSC_VER
#define RTP_H # pragma warning(disable:4214) // bit field types other than int
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#elif defined HAVE_WINSOCK2_H
# include <winsock2.h>
#endif #endif
#include "srtp.h" /**
* RTP packet header. Note that all RTP functions here will work with this
* header in network byte order.
*/
#pragma pack(1)
struct pjmedia_rtp_hdr
{
#if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0)
pj_uint16_t v:2; /**< packet type/version */
pj_uint16_t p:1; /**< padding flag */
pj_uint16_t x:1; /**< extension flag */
pj_uint16_t cc:4; /**< CSRC count */
pj_uint16_t m:1; /**< marker bit */
pj_uint16_t pt:7; /**< payload type */
#else
pj_uint16_t cc:4; /**< CSRC count */
pj_uint16_t x:1; /**< header extension flag */
pj_uint16_t p:1; /**< padding flag */
pj_uint16_t v:2; /**< packet type/version */
pj_uint16_t pt:7; /**< payload type */
pj_uint16_t m:1; /**< marker bit */
#endif
pj_uint16_t seq; /**< sequence number */
pj_uint32_t ts; /**< timestamp */
pj_uint32_t ssrc; /**< synchronization source */
};
#pragma pack()
typedef struct rtp_sender_ctx_t *rtp_sender_t; /**
* @see pjmedia_rtp_hdr
*/
typedef struct pjmedia_rtp_hdr pjmedia_rtp_hdr;
typedef struct rtp_receiver_ctx_t *rtp_receiver_t; /**
* RTP extendsion header.
*/
struct pjmedia_rtp_ext_hdr
{
pj_uint16_t profile_data; /**< Profile data. */
pj_uint16_t length; /**< Length. */
};
/**
* @see pjmedia_rtp_ext_hdr
*/
typedef struct pjmedia_rtp_ext_hdr pjmedia_rtp_ext_hdr;
unsigned int #pragma pack(1)
rtp_sendto(rtp_sender_t sender, const void* msg, int len);
unsigned int /**
rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len); * Declaration for DTMF telephony-events (RFC2833).
*/
struct pjmedia_rtp_dtmf_event
{
pj_uint8_t event; /**< Event type ID. */
pj_uint8_t e_vol; /**< Event volume. */
pj_uint16_t duration; /**< Event duration. */
};
int /**
rtp_receiver_init(rtp_receiver_t rcvr, int socket, * @see pjmedia_rtp_dtmf_event
struct sockaddr_in addr, unsigned int ssrc); */
typedef struct pjmedia_rtp_dtmf_event pjmedia_rtp_dtmf_event;
int #pragma pack()
rtp_sender_init(rtp_sender_t sender, int socket,
struct sockaddr_in addr, unsigned int ssrc);
/* /**
* srtp_sender_init(...) initializes an rtp_sender_t * A generic sequence number management, used by both RTP and RTCP.
*/ */
struct pjmedia_rtp_seq_session
{
pj_uint16_t max_seq; /**< Highest sequence number hea
rd */
pj_uint32_t cycles; /**< Shifted count of seq number
cycles */
pj_uint32_t base_seq; /**< Base seq number
*/
pj_uint32_t bad_seq; /**< Last 'bad' seq number + 1
*/
pj_uint32_t probation; /**< Sequ. packets till source i
s valid */
};
int /**
srtp_sender_init(rtp_sender_t rtp_ctx, /* structure to be init'ed * @see pjmedia_rtp_seq_session
*/ */
struct sockaddr_in name, /* socket name * typedef struct pjmedia_rtp_seq_session pjmedia_rtp_seq_session;
/
sec_serv_t security_services, /* sec. servs. to be used *
/
unsigned char *input_key /* master key/salt in hex *
/
);
int
srtp_receiver_init(rtp_receiver_t rtp_ctx, /* structure to be init'ed
*/
struct sockaddr_in name, /* socket name
*/
sec_serv_t security_services, /* sec. servs. to be used
*/
unsigned char *input_key /* master key/salt in hex
*/
);
int
rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy);
int /**
rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy); * RTP session descriptor.
*/
struct pjmedia_rtp_session
{
pjmedia_rtp_hdr out_hdr; /**< Saved hdr for outgoing pkts.
*/
pjmedia_rtp_seq_session seq_ctrl; /**< Sequence number management.
*/
pj_uint16_t out_pt; /**< Default outgoing payloa
d type. */
pj_uint32_t out_extseq; /**< Outgoing extended seq #
. */
pj_uint32_t peer_ssrc; /**< Peer SSRC.
*/
pj_uint32_t received; /**< Number of received pack
ets. */
};
rtp_sender_t /**
rtp_sender_alloc(); * @see pjmedia_rtp_session
*/
typedef struct pjmedia_rtp_session pjmedia_rtp_session;
rtp_receiver_t /**
rtp_receiver_alloc(); * This structure is used to receive additional information about the
* state of incoming RTP packet.
*/
struct pjmedia_rtp_status
{
union {
struct flag {
int bad:1; /**< General flag to indicate that sequence is
bad, and application should not process
this packet. More information will be given
in other flags.
*/
int badpt:1; /**< Bad payload type.
*/
int badssrc:1; /**< Bad SSRC
*/
int dup:1; /**< Indicates duplicate packet
*/
int outorder:1; /**< Indicates out of order packet
*/
int probation:1;/**< Indicates that session is in probation
until more packets are received.
*/
int restart:1; /**< Indicates that sequence number has made
a large jump, and internal base sequence
number has been adjusted.
*/
} flag; /**< Status flags.
*/
pj_uint16_t value; /**< Status value, to conveniently address all
flags.
*/
} status; /**< Status information union.
*/
pj_uint16_t diff; /**< Sequence number difference from pre
vious
packet. Normally the value should be 1.
Value greater than one may indicate packet
loss. If packet with lower sequence is
received, the value will be set to zero.
If base sequence has been restarted, the
value will be one.
*/
};
/* /**
* RTP_HEADER_LEN indicates the size of an RTP header * RTP session settings.
*/ */
#define RTP_HEADER_LEN 12 typedef struct pjmedia_rtp_session_setting
{
pj_uint8_t flags; /**< Bitmask flags to specify whether su
ch
field is set. Bitmask contents are:
(bit #0 is LSB)
bit #0: default payload type
bit #1: sender SSRC
bit #2: sequence
bit #3: timestamp
*/
int default_pt; /**< Default payload type.
*/
pj_uint32_t sender_ssrc; /**< Sender SSRC.
*/
pj_uint16_t seq; /**< Sequence.
*/
pj_uint32_t ts; /**< Timestamp.
*/
} pjmedia_rtp_session_setting;
/**
* @see pjmedia_rtp_status
*/
typedef struct pjmedia_rtp_status pjmedia_rtp_status;
/**
* This function will initialize the RTP session according to given paramet
ers.
*
* @param ses The session.
* @param default_pt Default payload type.
* @param sender_ssrc SSRC used for outgoing packets, in host byte order.
*
* @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjmedia_rtp_session_init( pjmedia_rtp_session *ses,
int default_pt,
pj_uint32_t sender_ssrc );
/**
* This function will initialize the RTP session according to given paramet
ers
* defined in RTP session settings.
*
* @param ses The session.
* @param settings RTP session settings.
*
* @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjmedia_rtp_session_init2(
pjmedia_rtp_session *ses,
pjmedia_rtp_session_setting settings);
/**
* Create the RTP header based on arguments and current state of the RTP
* session.
*
* @param ses The session.
* @param pt Payload type.
* @param m Marker flag.
* @param payload_len Payload length in bytes.
* @param ts_len Timestamp length.
* @param rtphdr Upon return will point to RTP packet header.
* @param hdrlen Upon return will indicate the size of RTP packet hea
der
*
* @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjmedia_rtp_encode_rtp( pjmedia_rtp_session *ses,
int pt, int m,
int payload_len, int ts_len,
const void **rtphdr,
int *hdrlen );
/**
* This function decodes incoming packet into RTP header and payload.
* The decode function is guaranteed to point the payload to the correct
* position regardless of any options present in the RTP packet.
*
* Note that this function does not modify the returned RTP header to
* host byte order.
*
* @param ses The session.
* @param pkt The received RTP packet.
* @param pkt_len The length of the packet.
* @param hdr Upon return will point to the location of the RTP
* header inside the packet. Note that the RTP header
* will be given back as is, meaning that the fields
* will be in network byte order.
* @param payload Upon return will point to the location of the
* payload inside the packet.
* @param payloadlen Upon return will indicate the size of the payload.
*
* @return PJ_SUCCESS if successfull.
*/
PJ_DECL(pj_status_t) pjmedia_rtp_decode_rtp( pjmedia_rtp_session *ses,
const void *pkt, int pkt_len,
const pjmedia_rtp_hdr **hdr,
const void **payload,
unsigned *payloadlen);
/**
* Call this function everytime an RTP packet is received to check whether
* the packet can be received and to let the RTP session performs its inter
nal
* calculations.
*
* @param ses The session.
* @param hdr The RTP header of the incoming packet. The header must
* be given with fields in network byte order.
* @param seq_st Optional structure to receive the status of the RTP pac
ket
* processing.
*/
PJ_DECL(void) pjmedia_rtp_session_update( pjmedia_rtp_session *ses,
const pjmedia_rtp_hdr *hdr,
pjmedia_rtp_status *seq_st);
/**
* Call this function everytime an RTP packet is received to check whether
* the packet can be received and to let the RTP session performs its inter
nal
* calculations.
*
* @param ses The session.
* @param hdr The RTP header of the incoming packet. The header must
* be given with fields in network byte order.
* @param seq_st Optional structure to receive the status of the RTP pac
ket
* processing.
* @param check_pt Flag to indicate whether payload type needs to be valid
ate.
*
* @see pjmedia_rtp_session_update()
*/
PJ_DECL(void) pjmedia_rtp_session_update2(pjmedia_rtp_session *ses,
const pjmedia_rtp_hdr *hdr,
pjmedia_rtp_status *seq_st,
pj_bool_t check_pt);
/* /*
* RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementati * INTERNAL:
on */
/**
* Internal function for creating sequence number control, shared by RTCP
* implementation.
*
* @param seq_ctrl The sequence control instance.
* @param seq Sequence number to initialize.
*/ */
#define RTP_MAX_BUF_LEN 16384 void pjmedia_rtp_seq_init(pjmedia_rtp_seq_session *seq_ctrl,
pj_uint16_t seq);
/**
* Internal function update sequence control, shared by RTCP implementation
.
*
* @param seq_ctrl The sequence control instance.
* @param seq Sequence number to update.
* @param seq_status Optional structure to receive additional information
* about the packet.
*/
void pjmedia_rtp_seq_update( pjmedia_rtp_seq_session *seq_ctrl,
pj_uint16_t seq,
pjmedia_rtp_status *seq_status);
/**
* @}
*/
PJ_END_DECL
#endif /* RTP_H */ #endif /* __PJMEDIA_RTP_H__ */
 End of changes. 24 change blocks. 
103 lines changed or deleted 396 lines changed or added


 sha1.h   sha1.h 
/* $Id: sha1.h 2394 2008-12-23 17:27:53Z bennylp $ */
/* /*
* sha1.h * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
* *
* interface to the Secure Hash Algorithm v.1 (SHA-1), specified in * This program is free software; you can redistribute it and/or modify
* FIPS 180-1 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* *
* David A. McGrew * This program is distributed in the hope that it will be useful,
* Cisco Systems, Inc. * but WITHOUT ANY WARRANTY; without even the implied warranty of
*/ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
/*
*
* Copyright (c) 2001-2006, Cisco Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of the Cisco Systems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A
*/ */
#ifndef __PJLIB_UTIL_SHA1_H__
#define __PJLIB_UTIL_SHA1_H__
#ifndef SHA1_H /**
#define SHA1_H * @file sha1.h
* @brief SHA1 encryption implementation
*/
#include "err.h" #include <pj/types.h>
#include "datatypes.h"
typedef struct { PJ_BEGIN_DECL
uint32_t H[5]; /* state vector */
uint32_t M[16]; /* message buffer */
int octets_in_buffer; /* octets of message in buffer */
uint32_t num_bits_in_msg; /* total number of bits in message */
} sha1_ctx_t;
/* /**
* sha1(&ctx, msg, len, output) hashes the len octets starting at msg * @defgroup PJLIB_UTIL_SHA1 SHA1
* into the SHA1 context, then writes the result to the 20 octets at * @ingroup PJLIB_UTIL_ENCRYPTION
* output * @{
*
*/ */
void /** SHA1 context */
sha1(const uint8_t *message, int octets_in_msg, uint32_t output[5]); typedef struct pj_sha1_context
{
pj_uint32_t state[5]; /**< State */
pj_uint32_t count[2]; /**< Count */
pj_uint8_t buffer[64]; /**< Buffer */
} pj_sha1_context;
/* /** SHA1 digest size is 20 bytes */
* sha1_init(&ctx) initializes the SHA1 context ctx #define PJ_SHA1_DIGEST_SIZE 20
*
* sha1_update(&ctx, msg, len) hashes the len octets starting at msg
* into the SHA1 context
*
* sha1_final(&ctx, output) performs the final processing of the SHA1
* context and writes the result to the 20 octets at output
*
*/
void
sha1_init(sha1_ctx_t *ctx);
void /** Initialize the algorithm.
sha1_update(sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg); * @param ctx SHA1 context.
*/
PJ_DECL(void) pj_sha1_init(pj_sha1_context *ctx);
void /** Append a stream to the message.
sha1_final(sha1_ctx_t *ctx, uint32_t output[5]); * @param ctx SHA1 context.
* @param data Data.
* @param nbytes Length of data.
*/
PJ_DECL(void) pj_sha1_update(pj_sha1_context *ctx,
const pj_uint8_t *data,
const pj_size_t nbytes);
/* /** Finish the message and return the digest.
* The sha1_core function is INTERNAL to SHA-1, but it is declared * @param ctx SHA1 context.
* here because it is also used by the cipher SEAL 3.0 in its key * @param digest 16 byte digest.
* setup algorithm.
*/ */
PJ_DECL(void) pj_sha1_final(pj_sha1_context *ctx,
pj_uint8_t digest[PJ_SHA1_DIGEST_SIZE]);
/* /**
* sha1_core(M, H) computes the core sha1 compression function, where M is * @}
* the next part of the message and H is the intermediate state {H0,
* H1, ...}
*
* this function does not do any of the padding required in the
* complete sha1 function
*/ */
void PJ_END_DECL
sha1_core(const uint32_t M[16], uint32_t hash_value[5]);
#endif /* SHA1_H */ #endif /* __PJLIB_UTIL_SHA1_H__ */
 End of changes. 19 change blocks. 
87 lines changed or deleted 56 lines changed or added


 sip_auth.h   sip_auth.h 
/* $Id: sip_auth.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sip_auth.h 3144 2010-04-20 14:36:38Z 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 230 skipping to change at line 230
* *
* @param pool The memory pool. * @param pool The memory pool.
* @param dst Destination credential. * @param dst Destination credential.
* @param src Source credential. * @param src Source credential.
*/ */
PJ_DECL(void) pjsip_cred_info_dup(pj_pool_t *pool, PJ_DECL(void) pjsip_cred_info_dup(pj_pool_t *pool,
pjsip_cred_info *dst, pjsip_cred_info *dst,
const pjsip_cred_info *src); const pjsip_cred_info *src);
/** /**
* Compare two credential infos.
*
* @param cred1 The credential info to compare.
* @param cred2 The credential info to compare.
*
* @return 0 if both credentials are equal.
*/
PJ_DECL(int) pjsip_cred_info_cmp(const pjsip_cred_info *cred1,
const pjsip_cred_info *cred2);
/**
* Type of function to lookup credential for the specified name. * Type of function to lookup credential for the specified name.
* *
* @param pool Pool to initialize the credential info. * @param pool Pool to initialize the credential info.
* @param realm Realm to find the account. * @param realm Realm to find the account.
* @param acc_name Account name to look for. * @param acc_name Account name to look for.
* @param cred_info The structure to put the credential when it's found. * @param cred_info The structure to put the credential when it's found.
* *
* @return The function MUST return PJ_SUCCESS when it found * @return The function MUST return PJ_SUCCESS when it found
* a correct credential for the specified account and * a correct credential for the specified account and
* realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUN D * realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUN D
 End of changes. 2 change blocks. 
1 lines changed or deleted 12 lines changed or added


 sip_dialog.h   sip_dialog.h 
/* $Id: sip_dialog.h 2855 2009-08-05 18:41:23Z nanang $ */ /* $Id: sip_dialog.h 3068 2010-01-21 10:04:26Z 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 364 skipping to change at line 364
* @param mod_data Optional arbitrary data to be attached to dialog 's * @param mod_data Optional arbitrary data to be attached to dialog 's
* mod_data array at the module's index. * mod_data array at the module's index.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
PJ_DECL(pj_status_t) pjsip_dlg_add_usage( pjsip_dialog *dlg, PJ_DECL(pj_status_t) pjsip_dlg_add_usage( pjsip_dialog *dlg,
pjsip_module *module, pjsip_module *module,
void *mod_data ); void *mod_data );
/** /**
* Check if the specified module has been registered as usage to the dialog
.
*
* @param dlg The dialog.
* @param module The module.
*
* @return PJ_TRUE if the specified module is currently
* registered as a usage to the dialog.
*/
PJ_DECL(pj_bool_t) pjsip_dlg_has_usage(pjsip_dialog *dlg,
pjsip_module *module);
/**
* Attach module specific data to the dialog. Application can also set * Attach module specific data to the dialog. Application can also set
* the value directly by accessing dlg->mod_data[module_id]. * the value directly by accessing dlg->mod_data[module_id].
* *
* @param dlg The dialog * @param dlg The dialog
* @param mod_id The ID of the module from which the data is to b e * @param mod_id The ID of the module from which the data is to b e
* set to the dialog. * set to the dialog.
* @param data Arbitrary data. * @param data Arbitrary data.
* *
* @return PJ_SUCCESS on success. * @return PJ_SUCCESS on success.
*/ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 14 lines changed or added


 sip_endpoint.h   sip_endpoint.h 
/* $Id: sip_endpoint.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sip_endpoint.h 3106 2010-02-24 05:43:34Z 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 371 skipping to change at line 371
* @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) PJ_DECL(pj_status_t)
pjsip_endpt_acquire_transport( pjsip_endpoint *endpt, pjsip_endpt_acquire_transport( pjsip_endpoint *endpt,
pjsip_transport_type_e type, pjsip_transport_type_e type,
const pj_sockaddr_t *remote, const pj_sockaddr_t *remote,
int addr_len, int addr_len,
const pjsip_tpselector *sel, const pjsip_tpselector *sel,
pjsip_transport **p_tp); pjsip_transport **p_tp);
/**
* Find a SIP transport suitable for sending SIP message to the specified
* address by also considering the outgoing SIP message data. If transport
* selector ("sel") is set, then the function will check if the transport
* selected is suitable to send requests to the specified address.
*
* @see pjsip_tpmgr_acquire_transport
*
* @param endpt The SIP endpoint instance.
* @param type The type of transport to be acquired.
* @param remote The remote address to send message to.
* @param addr_len Length of the remote address.
* @param sel Optional pointer to transport selector instance which is
* used to find explicit transport, if required.
* @param tdata Optional pointer to SIP message data to be sent.
* @param p_tp Pointer to receive the transport instance, if one is fou
nd.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t)
pjsip_endpt_acquire_transport2(pjsip_endpoint *endpt,
pjsip_transport_type_e type,
const pj_sockaddr_t *remote,
int addr_len,
const pjsip_tpselector *sel,
pjsip_tx_data *tdata,
pjsip_transport **p_tp);
/************************************************************************** *** /************************************************************************** ***
* *
* Capabilities Management * Capabilities Management
* *
* Modules may implement new capabilities to the stack. These capabilities * Modules may implement new capabilities to the stack. These capabilities
* are indicated by the appropriate SIP header fields, such as Accept, * are indicated by the appropriate SIP header fields, such as Accept,
* Accept-Encoding, Accept-Language, Allow, Supported, etc. * Accept-Encoding, Accept-Language, Allow, Supported, etc.
* *
* When a module provides new capabilities to the stack, it registers these * When a module provides new capabilities to the stack, it registers these
* capabilities to the endpoint by supplying new tags (strings) to the * capabilities to the endpoint by supplying new tags (strings) to the
 End of changes. 2 change blocks. 
1 lines changed or deleted 30 lines changed or added


 sip_errno.h   sip_errno.h 
/* $Id: sip_errno.h 2394 2008-12-23 17:27:53Z bennylp $ */ /* $Id: sip_errno.h 3110 2010-02-25 11:58:19Z 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 502 skipping to change at line 502
/** /**
* @hideinitializer * @hideinitializer
* Unknown error when reading SSL data * Unknown error when reading SSL data
*/ */
#define PJSIP_TLS_EREAD (PJSIP_ERRNO_START_PJSIP+171) /* 1 71171 */ #define PJSIP_TLS_EREAD (PJSIP_ERRNO_START_PJSIP+171) /* 1 71171 */
/** /**
* @hideinitializer * @hideinitializer
* SSL negotiation has exceeded the maximum configured timeout. * SSL negotiation has exceeded the maximum configured timeout.
*/ */
#define PJSIP_TLS_ETIMEDOUT (PJSIP_ERRNO_START_PJSIP+172) /* 171172 */ #define PJSIP_TLS_ETIMEDOUT (PJSIP_ERRNO_START_PJSIP+172) /* 171172 */
/**
* @hideinitializer
* SSL certificate verification error.
*/
#define PJSIP_TLS_ECERTVERIF (PJSIP_ERRNO_START_PJSIP+173) /* 171173 */
/** /**
* Get error message for the specified error code. Note that this * Get error message for the specified error code. Note that this
* function is only able to decode PJSIP specific error code. * function is only able to decode PJSIP specific error code.
* Application should use pj_strerror(), which should be able to * Application should use pj_strerror(), which should be able to
* decode all error codes belonging to all subsystems (e.g. pjlib, * decode all error codes belonging to all subsystems (e.g. pjlib,
* pjmedia, pjsip, etc). * pjmedia, pjsip, etc).
* *
* @param status The error code. * @param status The error code.
* @param buffer The buffer where to put the error message. * @param buffer The buffer where to put the error message.
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 sip_regc.h   sip_regc.h 
/* $Id: sip_regc.h 2855 2009-08-05 18:41:23Z nanang $ */ /* $Id: sip_regc.h 3128 2010-03-30 11:13:59Z 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 94 skipping to change at line 94
* Client registration information. * Client registration information.
*/ */
struct pjsip_regc_info struct pjsip_regc_info
{ {
pj_str_t server_uri; /**< Server URI, */ pj_str_t server_uri; /**< Server URI, */
pj_str_t client_uri; /**< Client URI (From header). */ pj_str_t client_uri; /**< Client URI (From header). */
pj_bool_t is_busy; /**< Have pending transaction? */ pj_bool_t is_busy; /**< Have pending transaction? */
pj_bool_t auto_reg; /**< Will register automatically? */ pj_bool_t auto_reg; /**< Will register automatically? */
int interval; /**< Registration interval (seconds). */ int interval; /**< Registration interval (seconds). */
int next_reg; /**< Time until next registration (secon ds). */ int next_reg; /**< Time until next registration (secon ds). */
pjsip_transport *transport; /**< Last transport used. */
}; };
/** /**
* @see pjsip_regc_info * @see pjsip_regc_info
*/ */
typedef struct pjsip_regc_info pjsip_regc_info; typedef struct pjsip_regc_info pjsip_regc_info;
/** /**
* Get the module instance for client registration module. * Get the module instance for client registration module.
* *
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 sip_transaction.h   sip_transaction.h 
/* $Id: sip_transaction.h 2646 2009-04-26 11:02:04Z bennylp $ */ /* $Id: sip_transaction.h 3138 2010-04-14 06:57:35Z 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 99 skipping to change at line 99
/* /*
* Transaction identification. * Transaction identification.
*/ */
char obj_name[PJ_MAX_OBJ_NAME]; /**< Log info. */ char obj_name[PJ_MAX_OBJ_NAME]; /**< Log info. */
pjsip_role_e role; /**< Role (UAS or UAC) */ pjsip_role_e role; /**< Role (UAS or UAC) */
pjsip_method method; /**< The method. */ pjsip_method method; /**< The method. */
pj_int32_t cseq; /**< The CSeq */ pj_int32_t cseq; /**< The CSeq */
pj_str_t transaction_key;/**< Hash table key. */ pj_str_t transaction_key;/**< Hash table key. */
pj_uint32_t hashed_key; /**< Key's hashed va lue. */ pj_uint32_t hashed_key; /**< Key's hashed va lue. */
pj_str_t branch; /**< The branch Id. */ pj_str_t branch; /**< The branch Id. */
pjsip_tpselector tp_sel; /**< Transport selector. */
/* /*
* State and status. * State and status.
*/ */
int status_code; /**< Last status cod e seen. */ int status_code; /**< Last status cod e seen. */
pj_str_t status_text; /**< Last reason phrase. */ pj_str_t status_text; /**< Last reason phrase. */
pjsip_tsx_state_e state; /**< State. */ pjsip_tsx_state_e state; /**< State. */
int handle_200resp; /**< UAS 200/INVITE retrsm.*/ int handle_200resp; /**< UAS 200/INVITE retrsm.*/
int tracing; /**< Tracing enabled? */ int tracing; /**< Tracing enabled? */
skipping to change at line 123 skipping to change at line 122
/* /*
* Transport. * Transport.
*/ */
pjsip_transport *transport; /**< Transport to use. */ pjsip_transport *transport; /**< Transport to use. */
pj_bool_t is_reliable; /**< Transport is reliable. */ pj_bool_t is_reliable; /**< Transport is reliable. */
pj_sockaddr addr; /**< Destination add ress. */ pj_sockaddr addr; /**< Destination add ress. */
int addr_len; /**< Address length. */ int addr_len; /**< Address length. */
pjsip_response_addr res_addr; /**< Response addres s. */ pjsip_response_addr res_addr; /**< Response addres s. */
unsigned transport_flag; /**< Miscelaneous flag. */ unsigned transport_flag; /**< Miscelaneous flag. */
pj_status_t transport_err; /**< Internal error code. */ pj_status_t transport_err; /**< Internal error code. */
pjsip_tpselector tp_sel; /**< Transport selector.
*/
pjsip_tx_data *pending_tx; /**< Tdata which caused
pending transport flag
to be set on tsx.
*/
pjsip_tp_state_listener_key *tp_st_key; /**< Transport state listen
er
key.
*/
/* /*
* Messages and timer. * Messages and timer.
*/ */
pjsip_tx_data *last_tx; /**< Msg kept for retrans. */ pjsip_tx_data *last_tx; /**< Msg kept for retrans. */
int retransmit_count;/**< Retransmission count. */ int retransmit_count;/**< Retransmission count. */
pj_timer_entry retransmit_timer;/**< Retransmit timer. */ pj_timer_entry retransmit_timer;/**< Retransmit timer. */
pj_timer_entry timeout_timer; /**< Timeout timer. */ pj_timer_entry timeout_timer; /**< Timeout timer. */
/** Module specific data. */ /** Module specific data. */
 End of changes. 3 change blocks. 
2 lines changed or deleted 11 lines changed or added


 sip_transport.h   sip_transport.h 
/* $Id: sip_transport.h 2985 2009-11-04 13:17:31Z bennylp $ */ /* $Id: sip_transport.h 3138 2010-04-14 06:57:35Z 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 529 skipping to change at line 529
/** Destination information, to be used to determine the network addres s /** Destination information, to be used to determine the network addres s
* of the message. For a request, this information is initialized whe n * of the message. For a request, this information is initialized whe n
* the request is sent with #pjsip_endpt_send_request_stateless() and * the request is sent with #pjsip_endpt_send_request_stateless() and
* network address is resolved. For CANCEL request, this information * network address is resolved. For CANCEL request, this information
* will be copied from the original INVITE to make sure that the CANCE L * will be copied from the original INVITE to make sure that the CANCE L
* request goes to the same physical network address as the INVITE * request goes to the same physical network address as the INVITE
* request. * request.
*/ */
struct struct
{ {
/** Server name.
*/
pj_str_t name;
/** Server addresses resolved. /** Server addresses resolved.
*/ */
pjsip_server_addresses addr; pjsip_server_addresses addr;
/** Current server address being tried. /** Current server address being tried.
*/ */
unsigned cur_addr; unsigned cur_addr;
} dest_info; } dest_info;
skipping to change at line 558 skipping to change at line 562
int dst_port; /**< Destination port. */ int dst_port; /**< Destination port. */
} tp_info; } tp_info;
/** /**
* Transport selector, to specify which transport to be used. * Transport selector, to specify which transport to be used.
* The value here must be set with pjsip_tx_data_set_transport(), * The value here must be set with pjsip_tx_data_set_transport(),
* to allow reference counter to be set properly. * to allow reference counter to be set properly.
*/ */
pjsip_tpselector tp_sel; pjsip_tpselector tp_sel;
/**
* Arbitrary data attached by PJSIP modules.
*/
void *mod_data[PJSIP_MAX_MODULE];
}; };
/** /**
* Create a new, blank transmit buffer. The reference count is initialized * Create a new, blank transmit buffer. The reference count is initialized
* to zero. * to zero.
* *
* @param mgr The transport manager. * @param mgr The transport manager.
* @param tdata Pointer to receive transmit data. * @param tdata Pointer to receive transmit data.
* *
* @return PJ_SUCCESS, or the appropriate error code. * @return PJ_SUCCESS, or the appropriate error code.
skipping to change at line 679 skipping to change at line 687
long type; long type;
/** /**
* Destination address. * Destination address.
*/ */
pj_sockaddr rem_addr; pj_sockaddr rem_addr;
} pjsip_transport_key; } pjsip_transport_key;
/** /**
* Enumeration of transport direction types.
*/
typedef enum pjsip_transport_dir
{
PJSIP_TP_DIR_NONE, /**< Direction not set, normally used by
connectionless transports such as
UDP transport.
*/
PJSIP_TP_DIR_OUTGOING, /**< Outgoing connection or client mode,
this is only for connection-oriente
d
transports.
*/
PJSIP_TP_DIR_INCOMING, /**< Incoming connection or server mode,
this is only for connection-oriente
d
transports.
*/
} pjsip_transport_dir;
/**
* This structure represent the "public" interface of a SIP transport. * This structure represent the "public" interface of a SIP transport.
* Applications normally extend this structure to include transport * Applications normally extend this structure to include transport
* specific members. * specific members.
*/ */
struct pjsip_transport struct pjsip_transport
{ {
char obj_name[PJ_MAX_OBJ_NAME]; /**< Name. */ char obj_name[PJ_MAX_OBJ_NAME]; /**< Name. */
pj_pool_t *pool; /**< Pool used by transport. */ pj_pool_t *pool; /**< Pool used by transport. */
pj_atomic_t *ref_cnt; /**< Reference counter. */ pj_atomic_t *ref_cnt; /**< Reference counter. */
pj_lock_t *lock; /**< Lock object. */ pj_lock_t *lock; /**< Lock object. */
pj_bool_t tracing; /**< Tracing enabled? */ pj_bool_t tracing; /**< Tracing enabled? */
pj_bool_t is_shutdown; /**< Being shutdown? */ pj_bool_t is_shutdown; /**< Being shutdown? */
pj_bool_t is_destroying; /**< Destroy in progress? */
/** Key for indexing this transport in hash table. */ /** Key for indexing this transport in hash table. */
pjsip_transport_key key; pjsip_transport_key key;
char *type_name; /**< Type name. */ char *type_name; /**< Type name. */
unsigned flag; /**< #pjsip_transport_flags_e */ unsigned flag; /**< #pjsip_transport_flags_e */
char *info; /**< Transport info/description. */ char *info; /**< Transport info/description. */
int addr_len; /**< Length of addresses . */ int addr_len; /**< Length of addresses . */
pj_sockaddr local_addr; /**< Bound address. */ pj_sockaddr local_addr; /**< Bound address. */
pjsip_host_port local_name; /**< Published name (eg. STUN). */ pjsip_host_port local_name; /**< Published name (eg. STUN). */
pjsip_host_port remote_name; /**< Remote address name. */ pjsip_host_port remote_name; /**< Remote address name. */
pjsip_transport_dir dir; /**< Connection directio n. */
pjsip_endpoint *endpt; /**< Endpoint instance. */ pjsip_endpoint *endpt; /**< Endpoint instance. */
pjsip_tpmgr *tpmgr; /**< Transport manager. */ pjsip_tpmgr *tpmgr; /**< Transport manager. */
pj_timer_entry idle_timer; /**< Timer when ref cnt is zero. */ pj_timer_entry idle_timer; /**< Timer when ref cnt is zero. */
void *data; /**< Internal transport data.
*/
/** /**
* Function to be called by transport manager to send SIP message. * Function to be called by transport manager to send SIP message.
* *
* @param transport The transport to send the message. * @param transport The transport to send the message.
* @param packet The buffer to send. * @param packet The buffer to send.
* @param length The length of the buffer to send. * @param length The length of the buffer to send.
* @param op_key Completion token, which will be supplied to * @param op_key Completion token, which will be supplied to
* caller when pending send operation completes. * caller when pending send operation completes.
* @param rem_addr The remote destination address. * @param rem_addr The remote destination address.
* @param addr_len Size of remote address. * @param addr_len Size of remote address.
skipping to change at line 895 skipping to change at line 923
pj_lock_t *lock; /**< Lock object. */ pj_lock_t *lock; /**< Lock object. */
pjsip_transport_type_e type; /**< Transport type. */ pjsip_transport_type_e type; /**< Transport type. */
char *type_name; /**< Type string name. */ char *type_name; /**< Type string name. */
unsigned flag; /**< Transport flag. */ unsigned flag; /**< Transport flag. */
pj_sockaddr local_addr; /**< Bound address. */ pj_sockaddr local_addr; /**< Bound address. */
pjsip_host_port addr_name; /**< Published name. */ pjsip_host_port addr_name; /**< Published name. */
/** /**
* Create new outbound connection. * Create new outbound connection suitable for sending SIP message
* to specified remote address.
* Note that the factory is responsible for both creating the * Note that the factory is responsible for both creating the
* transport and registering it to the transport manager. * transport and registering it to the transport manager.
*/ */
pj_status_t (*create_transport)(pjsip_tpfactory *factory, pj_status_t (*create_transport)(pjsip_tpfactory *factory,
pjsip_tpmgr *mgr, pjsip_tpmgr *mgr,
pjsip_endpoint *endpt, pjsip_endpoint *endpt,
const pj_sockaddr *rem_addr, const pj_sockaddr *rem_addr,
int addr_len, int addr_len,
pjsip_transport **transport); pjsip_transport **transport);
/** /**
* Create new outbound connection suitable for sending SIP message
* to specified remote address by also considering outgoing SIP
* message data.
* Note that the factory is responsible for both creating the
* transport and registering it to the transport manager.
*/
pj_status_t (*create_transport2)(pjsip_tpfactory *factory,
pjsip_tpmgr *mgr,
pjsip_endpoint *endpt,
const pj_sockaddr *rem_addr,
int addr_len,
pjsip_tx_data *tdata,
pjsip_transport **transport);
/**
* Destroy the listener. * Destroy the listener.
*/ */
pj_status_t (*destroy)(pjsip_tpfactory *factory); pj_status_t (*destroy)(pjsip_tpfactory *factory);
/* /*
* Application may extend this structure.. * Application may extend this structure..
*/ */
}; };
/** /**
skipping to change at line 1069 skipping to change at line 1113
* @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) pjsip_tpmgr_acquire_transport(pjsip_tpmgr *mgr, PJ_DECL(pj_status_t) pjsip_tpmgr_acquire_transport(pjsip_tpmgr *mgr,
pjsip_transport_type_e ty pe, pjsip_transport_type_e ty pe,
const pj_sockaddr_t *remo te, const pj_sockaddr_t *remo te,
int addr_len, int addr_len,
const pjsip_tpselector *s el, const pjsip_tpselector *s el,
pjsip_transport **tp); pjsip_transport **tp);
/** /**
* Find suitable transport for sending SIP message to specified remote
* destination by also considering the outgoing SIP message. If no suitable
* transport is found, a new one will be created.
*
* This is an internal function since normally application doesn't have acc
ess
* to transport manager. Application should use pjsip_endpt_acquire_transpo
rt2()
* instead.
*
* @param mgr The transport manager instance.
* @param type The type of transport to be acquired.
* @param remote The remote address to send message to.
* @param addr_len Length of the remote address.
* @param sel Optional pointer to transport selector instance which is
* used to find explicit transport, if required.
* @param tdata Optional pointer to data to be sent.
* @param tp Pointer to receive the transport instance, if one is fou
nd.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
pjsip_transport_type_e t
ype,
const pj_sockaddr_t *rem
ote,
int addr_len,
const pjsip_tpselector *
sel,
pjsip_tx_data *tdata,
pjsip_transport **tp);
/**
* Type of callback to receive notification when message or raw data * Type of callback to receive notification when message or raw data
* has been sent. * has been sent.
* *
* @param token The token that was given when calling the fu nction * @param token The token that was given when calling the fu nction
* to send message or raw data. * to send message or raw data.
* @param tdata The transmit buffer used to send the message . * @param tdata The transmit buffer used to send the message .
* @param bytes_sent Number of bytes sent. On success, the value will be * @param bytes_sent Number of bytes sent. On success, the value will be
* positive number indicating the number of bytes sent. * positive number indicating the number of bytes sent.
* On failure, the value will be a negative number of * On failure, the value will be a negative number of
* the error code (i.e. bytes_sent = -status). * the error code (i.e. bytes_sent = -status).
skipping to change at line 1155 skipping to change at line 1227
const pjsip_tpselector *sel, const pjsip_tpselector *sel,
pjsip_tx_data *tdata, pjsip_tx_data *tdata,
const void *raw_data, const void *raw_data,
pj_size_t data_len, pj_size_t data_len,
const pj_sockaddr_t *addr, const pj_sockaddr_t *addr,
int addr_len, int addr_len,
void *token, void *token,
pjsip_tp_send_callback cb); pjsip_tp_send_callback cb);
/** /**
* Enumeration of transport state types.
*/
typedef enum pjsip_transport_state
{
PJSIP_TP_STATE_CONNECTED, /**< Transport connected, applicable onl
y
to connection-oriented transports
such as TCP and TLS.
*/
PJSIP_TP_STATE_DISCONNECTED /**< Transport disconnected, app
licable
only to connection-oriented
transports such as TCP and TLS.
*/
} pjsip_transport_state;
/**
* Definition of transport state listener key.
*/
typedef void pjsip_tp_state_listener_key;
/**
* Structure of transport state info passed by #pjsip_tp_state_callback.
*/
typedef struct pjsip_transport_state_info {
/**
* The last error code related to the transport state.
*/
pj_status_t status;
/**
* Optional extended info, the content is specific for each transport t
ype.
*/
void *ext_info;
/**
* Optional user data. In global transport state notification, this wil
l
* always be NULL.
*/
void *user_data;
} pjsip_transport_state_info;
/**
* Type of callback to receive transport state notifications, such as
* transport connected/disconnected. Application may shutdown the transport
* in this callback.
*
* @param tp The transport instance.
* @param state The transport state.
* @param info The transport state info.
*/
typedef void (*pjsip_tp_state_callback)(
pjsip_transport *tp,
pjsip_transport_state state,
const pjsip_transport_state_info *info);
/**
* Set callback of global transport state notification. The caller will be
* notified whenever the state of any transport is changed. The type of eve
nts
* are defined in #pjsip_transport_state.
*
* Note that this function will override the existing callback, if any, so
* application is recommended to keep the old callback and manually forward
* the notification to the old callback, otherwise other component that
* concerns about the transport state will no longer receive transport stat
e
* events.
*
* @param mgr Transport manager.
* @param cb Callback to be called to notify caller about transport
* state changing.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsip_tpmgr_set_state_cb(pjsip_tpmgr *mgr,
pjsip_tp_state_callback cb);
/**
* Get the callback of global transport state notification.
*
* @param mgr Transport manager.
*
* @return The transport state callback or NULL if it is not set.
*/
PJ_DECL(pjsip_tp_state_callback) pjsip_tpmgr_get_state_cb(
const pjsip_tpmgr *mgr);
/**
* Add a listener to the specified transport for transport state notificati
on.
*
* @param tp The transport.
* @param cb Callback to be called to notify listener about transport
* state changing.
* @param user_data The user data.
* @param key Output key, used to remove this listener.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsip_transport_add_state_listener (
pjsip_transport *tp,
pjsip_tp_state_callback cb,
void *user_data,
pjsip_tp_state_listener_key **ke
y);
/**
* Remove a listener from the specified transport for transport state
* notification.
*
* @param tp The transport.
* @param key The listener key.
* @param user_data The user data, for validation purpose.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjsip_transport_remove_state_listener (
pjsip_transport *tp,
pjsip_tp_state_listener_key *key,
const void *user_data);
/**
* @} * @}
*/ */
PJ_END_DECL PJ_END_DECL
#endif /* __PJSIP_SIP_TRANSPORT_H__ */ #endif /* __PJSIP_SIP_TRANSPORT_H__ */
 End of changes. 11 change blocks. 
2 lines changed or deleted 212 lines changed or added


 sip_transport_tls.h   sip_transport_tls.h 
/* $Id: sip_transport_tls.h 2998 2009-11-09 08:51:34Z bennylp $ */ /* $Id: sip_transport_tls.h 3110 2010-02-25 11:58:19Z 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 29 skipping to change at line 29
*/ */
#ifndef __PJSIP_TRANSPORT_TLS_H__ #ifndef __PJSIP_TRANSPORT_TLS_H__
#define __PJSIP_TRANSPORT_TLS_H__ #define __PJSIP_TRANSPORT_TLS_H__
/** /**
* @file sip_transport_tls.h * @file sip_transport_tls.h
* @brief SIP TLS Transport. * @brief SIP TLS Transport.
*/ */
#include <pjsip/sip_transport.h> #include <pjsip/sip_transport.h>
#include <pj/ssl_sock.h>
#include <pj/string.h> #include <pj/string.h>
#include <pj/sock_qos.h> #include <pj/sock_qos.h>
PJ_BEGIN_DECL PJ_BEGIN_DECL
/** /**
* @defgroup PJSIP_TRANSPORT_TLS TLS Transport * @defgroup PJSIP_TRANSPORT_TLS TLS Transport
* @ingroup PJSIP_TRANSPORT * @ingroup PJSIP_TRANSPORT
* @brief API to create and register TLS transport. * @brief API to create and register TLS transport.
* @{ * @{
skipping to change at line 120 skipping to change at line 121
* Optionally specify the server name instance to be contacted when * Optionally specify the server name instance to be contacted when
* making outgoing TLS connection. This setting is useful when the * making outgoing TLS connection. This setting is useful when the
* server is hosting multiple domains for the same TLS listening * server is hosting multiple domains for the same TLS listening
* socket. * socket.
* *
* Default: empty. * Default: empty.
*/ */
pj_str_t server_name; pj_str_t server_name;
/** /**
* When PJSIP is acting as a client (outgoing TLS connections), * Specifies TLS transport behavior on the server TLS certificate
* it will always receive a certificate from the peer. * verification result:
* If \a verify_server is disabled (set to zero), PJSIP will not * - If \a verify_server is disabled (set to PJ_FALSE), TLS transport
* verifiy the certificate and allows TLS connections to servers * will just notify the application via #pjsip_tp_state_callback with
* which do not present a valid certificate. * state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
* If \a tls_verify_server is non-zero, PJSIP verifies the server * - If \a verify_server is enabled (set to PJ_TRUE), TLS transport
* certificate and will close the TLS connection if the server * will be shutdown and application will be notified with state
* certificate is not valid. * PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
* error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
* *
* This setting corresponds to OpenSSL SSL_VERIFY_PEER flag. * In any cases, application can inspect #pjsip_tls_state_info in the
* Default value is zero. * callback to see the verification detail.
*
* Default value is PJ_FALSE.
*/ */
pj_bool_t verify_server; pj_bool_t verify_server;
/** /**
* When acting as server (incoming TLS connections), setting * Specifies TLS transport behavior on the client TLS certificate
* \a verify_client to non-zero will cause the transport to activate * verification result:
* peer verification upon receiving incoming TLS connection. * - If \a verify_client is disabled (set to PJ_FALSE), TLS transport
* will just notify the application via #pjsip_tp_state_callback with
* state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
* - If \a verify_client is enabled (set to PJ_TRUE), TLS transport
* will be shutdown and application will be notified with state
* PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
* error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
*
* In any cases, application can inspect #pjsip_tls_state_info in the
* callback to see the verification detail.
* *
* This setting corresponds to OpenSSL SSL_VERIFY_PEER flag. * Default value is PJ_FALSE.
* Default value is zero.
*/ */
pj_bool_t verify_client; pj_bool_t verify_client;
/** /**
* When acting as server (incoming TLS connections), reject inocming * When acting as server (incoming TLS connections), reject inocming
* connection if client doesn't have a valid certificate. * connection if client doesn't supply a TLS certificate.
* *
* This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag. * This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag.
* Default value is zero. * Default value is PJ_FALSE.
*/ */
pj_bool_t require_client_cert; pj_bool_t require_client_cert;
/** /**
* TLS negotiation timeout to be applied for both outgoing and * TLS negotiation timeout to be applied for both outgoing and
* incoming connection. If both sec and msec member is set to zero, * incoming connection. If both sec and msec member is set to zero,
* the SSL negotiation doesn't have a timeout. * the SSL negotiation doesn't have a timeout.
*/ */
pj_time_val timeout; pj_time_val timeout;
skipping to change at line 189 skipping to change at line 201
* Specify if the transport should ignore any errors when setting the Q oS * Specify if the transport should ignore any errors when setting the Q oS
* traffic type/parameters. * traffic type/parameters.
* *
* Default: PJ_TRUE * Default: PJ_TRUE
*/ */
pj_bool_t qos_ignore_error; pj_bool_t qos_ignore_error;
} pjsip_tls_setting; } pjsip_tls_setting;
/** /**
* This structure defines TLS transport extended info in <tt>ext_info</tt>
* field of #pjsip_transport_state_info for the transport state notificatio
n
* callback #pjsip_tp_state_callback.
*/
typedef struct pjsip_tls_state_info
{
/**
* SSL socket info.
*/
pj_ssl_sock_info *ssl_sock_info;
} pjsip_tls_state_info;
/**
* Initialize TLS setting with default values. * Initialize TLS setting with default values.
* *
* @param tls_opt The TLS setting to be initialized. * @param tls_opt The TLS setting to be initialized.
*/ */
PJ_INLINE(void) pjsip_tls_setting_default(pjsip_tls_setting *tls_opt) PJ_INLINE(void) pjsip_tls_setting_default(pjsip_tls_setting *tls_opt)
{ {
pj_memset(tls_opt, 0, sizeof(*tls_opt)); pj_memset(tls_opt, 0, sizeof(*tls_opt));
tls_opt->qos_type = PJ_QOS_TYPE_BEST_EFFORT; tls_opt->qos_type = PJ_QOS_TYPE_BEST_EFFORT;
tls_opt->qos_ignore_error = PJ_TRUE; tls_opt->qos_ignore_error = PJ_TRUE;
} }
 End of changes. 9 change blocks. 
18 lines changed or deleted 45 lines changed or added


 sock.h   sock.h 
/* $Id: sock.h 2966 2009-10-25 09:02:07Z bennylp $ */ /* $Id: sock.h 3145 2010-04-26 07:08:53Z 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 506 skipping to change at line 506
typedef union pj_in6_addr typedef union pj_in6_addr
{ {
/* This is the main entry */ /* This is the main entry */
pj_uint8_t s6_addr[16]; /**< 8-bit array */ pj_uint8_t s6_addr[16]; /**< 8-bit array */
/* While these are used for proper alignment */ /* While these are used for proper alignment */
pj_uint32_t u6_addr32[4]; pj_uint32_t u6_addr32[4];
/* Do not use this with Winsock2, as this will align pj_sockaddr_in6 /* Do not use this with Winsock2, as this will align pj_sockaddr_in6
* to 64-bit boundary and Winsock2 doesn't like it! * to 64-bit boundary and Winsock2 doesn't like it!
* Update 26/04/2010:
* This is now disabled, see http://trac.pjsip.org/repos/ticket/1058
*/ */
#if defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0 && \ #if 0 && defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0 && \
(!defined(PJ_WIN32) || PJ_WIN32==0) (!defined(PJ_WIN32) || PJ_WIN32==0)
pj_int64_t u6_addr64[2]; pj_int64_t u6_addr64[2];
#endif #endif
} pj_in6_addr; } pj_in6_addr;
/** Initializer value for pj_in6_addr. */ /** Initializer value for pj_in6_addr. */
#define PJ_IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #define PJ_IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
/** Initializer value for pj_in6_addr. */ /** Initializer value for pj_in6_addr. */
 End of changes. 3 change blocks. 
2 lines changed or deleted 4 lines changed or added


 socket.h   socket.h 
/* $Id: socket.h 2962 2009-10-24 00:00:40Z bennylp $ */ /* $Id: socket.h 3059 2010-01-13 21:28:06Z 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 141 skipping to change at line 141
#endif #endif
#if defined(PJ_HAS_NETDB_H) && PJ_HAS_NETDB_H != 0 #if defined(PJ_HAS_NETDB_H) && PJ_HAS_NETDB_H != 0
# include <netdb.h> # include <netdb.h>
#endif #endif
#if defined(PJ_HAS_UNISTD_H) && PJ_HAS_UNISTD_H != 0 #if defined(PJ_HAS_UNISTD_H) && PJ_HAS_UNISTD_H != 0
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined(PJ_HAS_SYS_FILIO_H) && PJ_HAS_SYS_FILIO_H != 0
# include <sys/filio.h>
#endif
#if defined(PJ_HAS_SYS_SOCKIO_H) && PJ_HAS_SYS_SOCKIO_H != 0
# include <sys/sockio.h>
#endif
/* /*
* Define common errors. * Define common errors.
*/ */
#if (defined(PJ_WIN32) && PJ_WIN32!=0) || \ #if (defined(PJ_WIN32) && PJ_WIN32!=0) || \
(defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0) (defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0)
# define OSERR_EWOULDBLOCK WSAEWOULDBLOCK # define OSERR_EWOULDBLOCK WSAEWOULDBLOCK
# define OSERR_EINPROGRESS WSAEINPROGRESS # define OSERR_EINPROGRESS WSAEINPROGRESS
# define OSERR_ECONNRESET WSAECONNRESET # define OSERR_ECONNRESET WSAECONNRESET
# define OSERR_ENOTCONN WSAENOTCONN # define OSERR_ENOTCONN WSAENOTCONN
#elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 speex.h   speex.h 
/* Copyright (C) 2002-2006 Jean-Marc Valin*/ /* $Id: speex.h 3083 2010-01-29 15:51:09Z nanang $ */
/**
@file speex.h
@brief Describes the different modes of the codec
*/
/* /*
Redistribution and use in source and binary forms, with or without * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
modification, are permitted provided that the following conditions * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
are met: *
* This program is free software; you can redistribute it and/or modify
- Redistributions of source code must retain the above copyright * it under the terms of the GNU General Public License as published by
notice, this list of conditions and the following disclaimer. * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- Redistributions in binary form must reproduce the above copyright *
notice, this list of conditions and the following disclaimer in the * This program is distributed in the hope that it will be useful,
documentation and/or other materials provided with the distribution. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Neither the name of the Xiph.org Foundation nor the names of its * GNU General Public License for more details.
contributors may be used to endorse or promote products derived from *
this software without specific prior written permission. * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT A
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O
R
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SPEEX_H
#define SPEEX_H
/** @defgroup Codec Speex encoder and decoder
* This is the Speex codec itself.
* @{
*/ */
#ifndef __PJMEDIA_CODEC_SPEEX_H__
#define __PJMEDIA_CODEC_SPEEX_H__
#include "speex/speex_bits.h" /**
#include "speex/speex_types.h" * @file speex.h
* @brief Speex codec header.
#ifdef __cplusplus */
extern "C" {
#endif
/* Values allowed for *ctl() requests */
/** Set enhancement on/off (decoder only) */
#define SPEEX_SET_ENH 0
/** Get enhancement state (decoder only) */
#define SPEEX_GET_ENH 1
/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
/** Obtain frame size used by encoder/decoder */
#define SPEEX_GET_FRAME_SIZE 3
/** Set quality value */
#define SPEEX_SET_QUALITY 4
/** Get current quality setting */
/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
/** Set sub-mode to use */
#define SPEEX_SET_MODE 6
/** Get current sub-mode in use */
#define SPEEX_GET_MODE 7
/** Set low-band sub-mode to use (wideband only)*/
#define SPEEX_SET_LOW_MODE 8
/** Get current low-band mode in use (wideband only)*/
#define SPEEX_GET_LOW_MODE 9
/** Set high-band sub-mode to use (wideband only)*/
#define SPEEX_SET_HIGH_MODE 10
/** Get current high-band mode in use (wideband only)*/
#define SPEEX_GET_HIGH_MODE 11
/** Set VBR on (1) or off (0) */
#define SPEEX_SET_VBR 12
/** Get VBR status (1 for on, 0 for off) */
#define SPEEX_GET_VBR 13
/** Set quality value for VBR encoding (0-10) */
#define SPEEX_SET_VBR_QUALITY 14
/** Get current quality value for VBR encoding (0-10) */
#define SPEEX_GET_VBR_QUALITY 15
/** Set complexity of the encoder (0-10) */
#define SPEEX_SET_COMPLEXITY 16
/** Get current complexity of the encoder (0-10) */
#define SPEEX_GET_COMPLEXITY 17
/** Set bit-rate used by the encoder (or lower) */
#define SPEEX_SET_BITRATE 18
/** Get current bit-rate used by the encoder or decoder */
#define SPEEX_GET_BITRATE 19
/** Define a handler function for in-band Speex request*/
#define SPEEX_SET_HANDLER 20
/** Define a handler function for in-band user-defined request*/
#define SPEEX_SET_USER_HANDLER 22
/** Set sampling rate used in bit-rate computation */
#define SPEEX_SET_SAMPLING_RATE 24
/** Get sampling rate used in bit-rate computation */
#define SPEEX_GET_SAMPLING_RATE 25
/** Reset the encoder/decoder memories to zero*/
#define SPEEX_RESET_STATE 26
/** Get VBR info (mostly used internally) */
#define SPEEX_GET_RELATIVE_QUALITY 29
/** Set VAD status (1 for on, 0 for off) */
#define SPEEX_SET_VAD 30
/** Get VAD status (1 for on, 0 for off) */
#define SPEEX_GET_VAD 31
/** Set Average Bit-Rate (ABR) to n bits per seconds */
#define SPEEX_SET_ABR 32
/** Get Average Bit-Rate (ABR) setting (in bps) */
#define SPEEX_GET_ABR 33
/** Set DTX status (1 for on, 0 for off) */
#define SPEEX_SET_DTX 34
/** Get DTX status (1 for on, 0 for off) */
#define SPEEX_GET_DTX 35
/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no
breaks the standard) */
#define SPEEX_SET_SUBMODE_ENCODING 36
/** Get submode encoding in each frame */
#define SPEEX_GET_SUBMODE_ENCODING 37
/*#define SPEEX_SET_LOOKAHEAD 38*/
/** Returns the lookahead used by Speex */
#define SPEEX_GET_LOOKAHEAD 39
/** Sets tuning for packet-loss concealment (expected loss rate) */
#define SPEEX_SET_PLC_TUNING 40
/** Gets tuning for PLC */
#define SPEEX_GET_PLC_TUNING 41
/** Sets the max bit-rate allowed in VBR mode */
#define SPEEX_SET_VBR_MAX_BITRATE 42
/** Gets the max bit-rate allowed in VBR mode */
#define SPEEX_GET_VBR_MAX_BITRATE 43
/** Turn on/off input/output high-pass filtering */
#define SPEEX_SET_HIGHPASS 44
/** Get status of input/output high-pass filtering */
#define SPEEX_GET_HIGHPASS 45
/** Get "activity level" of the last decoded frame, i.e.
how much damage we cause if we remove the frame */
#define SPEEX_GET_ACTIVITY 47
/* Preserving compatibility:*/
/** Equivalent to SPEEX_SET_ENH */
#define SPEEX_SET_PF 0
/** Equivalent to SPEEX_GET_ENH */
#define SPEEX_GET_PF 1
/* Values allowed for mode queries */
/** Query the frame size of a mode */
#define SPEEX_MODE_FRAME_SIZE 0
/** Query the size of an encoded frame for a particular sub-mode */
#define SPEEX_SUBMODE_BITS_PER_FRAME 1
/** Get major Speex version */
#define SPEEX_LIB_GET_MAJOR_VERSION 1
/** Get minor Speex version */
#define SPEEX_LIB_GET_MINOR_VERSION 3
/** Get micro Speex version */
#define SPEEX_LIB_GET_MICRO_VERSION 5
/** Get extra Speex version */
#define SPEEX_LIB_GET_EXTRA_VERSION 7
/** Get Speex version string */
#define SPEEX_LIB_GET_VERSION_STRING 9
/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
#define SPEEX_LIB_GET_ALLOC_FUNC 11
#define SPEEX_LIB_SET_FREE_FUNC 12
#define SPEEX_LIB_GET_FREE_FUNC 13
#define SPEEX_LIB_SET_WARNING_FUNC 14
#define SPEEX_LIB_GET_WARNING_FUNC 15
#define SPEEX_LIB_SET_ERROR_FUNC 16
#define SPEEX_LIB_GET_ERROR_FUNC 17
*/
/** Number of defined modes in Speex */
#define SPEEX_NB_MODES 3
/** modeID for the defined narrowband mode */
#define SPEEX_MODEID_NB 0
/** modeID for the defined wideband mode */
#define SPEEX_MODEID_WB 1
/** modeID for the defined ultra-wideband mode */
#define SPEEX_MODEID_UWB 2
struct SpeexMode;
/* Prototypes for mode function pointers */
/** Encoder state initialization function */
typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
/** Encoder state destruction function */
typedef void (*encoder_destroy_func)(void *st);
/** Main encoding function */
typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
/** Function for controlling the encoder options */
typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
/** Decoder state initialization function */
typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
/** Decoder state destruction function */
typedef void (*decoder_destroy_func)(void *st);
/** Main decoding function */
typedef int (*decode_func)(void *state, SpeexBits *bits, void *out);
/** Function for controlling the decoder options */
typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
/** Query function for a mode */
typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
/** Struct defining a Speex mode */
typedef struct SpeexMode {
/** Pointer to the low-level mode data */
const void *mode;
/** Pointer to the mode query function */
mode_query_func query;
/** The name of the mode (you should not rely on this to identify the mo
de)*/
const char *modeName;
/**ID of the mode*/
int modeID;
/**Version number of the bitstream (incremented every time we break
bitstream compatibility*/
int bitstream_version;
/** Pointer to encoder initialization function */
encoder_init_func enc_init;
/** Pointer to encoder destruction function */
encoder_destroy_func enc_destroy;
/** Pointer to frame encoding function */
encode_func enc;
/** Pointer to decoder initialization function */
decoder_init_func dec_init;
/** Pointer to decoder destruction function */
decoder_destroy_func dec_destroy;
/** Pointer to frame decoding function */
decode_func dec;
/** ioctl-like requests for encoder */
encoder_ctl_func enc_ctl;
/** ioctl-like requests for decoder */
decoder_ctl_func dec_ctl;
} SpeexMode; #include <pjmedia-codec/types.h>;
/** /**
* Returns a handle to a newly created Speex encoder state structure. For n * @defgroup PJMED_SPEEX Speex Codec Family
ow, * @ingroup PJMEDIA_CODEC_CODECS
* the "mode" argument can be &nb_mode or &wb_mode . In the future, more mo * @brief Implementation of Speex codecs (narrow/wide/ultrawide-band).
des * @{
* may be added. Note that for now if you have more than one channels to
* encode, you need one state per channel.
* *
* @param mode The mode to use (either speex_nb_mode or speex_wb.mode) * This section describes functions to initialize and register speex codec
* @return A newly created encoder state or NULL if state allocation fails * factory to the codec manager. After the codec factory has been registere
*/ d,
void *speex_encoder_init(const SpeexMode *mode); * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
*
/** Frees all resources associated to an existing Speex encoder state. * The Speex codec uses multiple bit rates, and supports ultra-wideband
* @param state Encoder state to be destroyed */ * (32 kHz sampling rate), wideband (16 kHz sampling rate) and narrowband
void speex_encoder_destroy(void *state); * (telephone quality, 8 kHz sampling rate)
*
/** Uses an existing encoder state to encode one frame of speech pointed to * By default, the speex codec factory registers three Speex codecs:
by * "speex/8000" narrowband codec, "speex/16000" wideband codec, and
"in". The encoded bit-stream is saved in "bits". * "speex/32000" ultra-wideband codec. This behavior can be changed by
@param state Encoder state * specifying #pjmedia_speex_options flags during initialization.
@param in Frame that will be encoded with a +-2^15 range. This data MAY be *
overwritten by the encoder and should be considered uninitialised *
after the call. * \section codec_setting Codec Settings
@param bits Bit-stream where the data will be written *
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise * \subsection general_setting General Settings
*
* General codec settings for this codec such as VAD and PLC can be
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
* Please see the documentation of #pjmedia_codec_param for more info.
*
* \subsection specific_setting Codec Specific Settings
*
* The following settings are applicable for this codec.
*
* \subsubsection quality_vs_complexity Quality vs Complexity
*
* The Speex codec quality versus computational complexity and bandwidth
* requirement can be adjusted by modifying the quality and complexity
* setting, by calling #pjmedia_codec_speex_set_param(). The RFC 5574
* Section 5 shows the relationship between quality setting and the
* resulting bitrate.
*
* The default setting of quality is specified in
* #PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY. And the default setting of
* complexity is specified in #PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY.
*/ */
int speex_encode(void *state, float *in, SpeexBits *bits);
/** Uses an existing encoder state to encode one frame of speech pointed to PJ_BEGIN_DECL
by
"in". The encoded bit-stream is saved in "bits".
@param state Encoder state
@param in Frame that will be encoded with a +-2^15 range
@param bits Bit-stream where the data will be written
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise
*/
int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
/** Used like the ioctl function to control the encoder parameters /**
* * Bitmask options to be passed during Speex codec factory initialization.
* @param state Encoder state
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid paramete
r
*/ */
int speex_encoder_ctl(void *state, int request, void *ptr); enum pjmedia_speex_options
{
PJMEDIA_SPEEX_NO_NB = 1, /**< Disable narrowband mode.
*/
PJMEDIA_SPEEX_NO_WB = 2, /**< Disable wideband mode.
*/
PJMEDIA_SPEEX_NO_UWB = 4, /**< Disable ultra-wideband mode. */
};
/** Returns a handle to a newly created decoder state structure. For now, /**
* the mode argument can be &nb_mode or &wb_mode . In the future, more mode * Initialize and register Speex codec factory to pjmedia endpoint.
s
* may be added. Note that for now if you have more than one channels to
* decode, you need one state per channel.
* *
* @param mode Speex mode (one of speex_nb_mode or speex_wb_mode) * @param endpt The pjmedia endpoint.
* @return A newly created decoder state or NULL if state allocation fails * @param options Bitmask of pjmedia_speex_options (default=0).
*/ * @param quality Specify encoding quality, or use -1 for default
void *speex_decoder_init(const SpeexMode *mode); * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).
* @param complexity Specify encoding complexity , or use -1 for default
* (@see PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_speex_init( pjmedia_endpt *endpt,
unsigned options,
int quality,
int complexity );
/** Frees all resources associated to an existing decoder state. /**
* Initialize Speex codec factory using default settings and register to
* pjmedia endpoint.
* *
* @param state State to be destroyed * @param endpt The pjmedia endpoint.
*/
void speex_decoder_destroy(void *state);
/** Uses an existing decoder state to decode one frame of speech from
* bit-stream bits. The output speech is saved written to out.
* *
* @param state Decoder state * @return PJ_SUCCESS on success.
* @param bits Bit-stream from which to decode the frame (NULL if the packe
t was lost)
* @param out Where to write the decoded frame
* @return return status (0 for no error, -1 for end of stream, -2 corrupt
stream)
*/ */
int speex_decode(void *state, SpeexBits *bits, float *out); PJ_DECL(pj_status_t) pjmedia_codec_speex_init_default(pjmedia_endpt *endpt) ;
/** Uses an existing decoder state to decode one frame of speech from /**
* bit-stream bits. The output speech is saved written to out. * Change the settings of Speex codec.
* *
* @param state Decoder state * @param clock_rate Clock rate of Speex mode to be set.
* @param bits Bit-stream from which to decode the frame (NULL if the packe * @param quality Specify encoding quality, or use -1 for default
t was lost) * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).
* @param out Where to write the decoded frame * @param complexity Specify encoding complexity , or use -1 for default
* @return return status (0 for no error, -1 for end of stream, -2 corrupt * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).
stream) *
*/ * @return PJ_SUCCESS on success.
int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out); */
PJ_DECL(pj_status_t) pjmedia_codec_speex_set_param(unsigned clock_rate,
int quality,
int complexity);
/** Used like the ioctl function to control the encoder parameters /**
* Unregister Speex codec factory from pjmedia endpoint and deinitialize
* the Speex codec library.
* *
* @param state Decoder state * @return PJ_SUCCESS on success.
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid paramete
r
*/ */
int speex_decoder_ctl(void *state, int request, void *ptr); PJ_DECL(pj_status_t) pjmedia_codec_speex_deinit(void);
/** Query function for mode information PJ_END_DECL
*
* @param mode Speex mode
* @param request ioctl-type request (one of the SPEEX_* macros)
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid paramete
r
*/
int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
/** Functions for controlling the behavior of libspeex /**
* @param request ioctl-type request (one of the SPEEX_LIB_* macros) * @}
* @param ptr Data exchanged to-from function
* @return 0 if no error, -1 if request in unknown, -2 for invalid paramete
r
*/ */
int speex_lib_ctl(int request, void *ptr);
/** Default narrowband mode */
extern const SpeexMode speex_nb_mode;
/** Default wideband mode */
extern const SpeexMode speex_wb_mode;
/** Default "ultra-wideband" mode */
extern const SpeexMode speex_uwb_mode;
/** List of all modes available */
extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
/** Obtain one of the modes available */
const SpeexMode * speex_lib_get_mode (int mode);
#ifndef WIN32
/* We actually override the function in the narrowband case so that we can
avoid linking in the wideband stuff */
#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode
: speex_lib_get_mode (mode))
#endif
#ifdef __cplusplus
}
#endif
/** @}*/ #endif /* __PJMEDIA_CODEC_SPEEX_H__ */
#endif
 End of changes. 26 change blocks. 
404 lines changed or deleted 120 lines changed or added


 ssl_sock.h   ssl_sock.h 
/* $Id: ssl_sock.h 2998 2009-11-09 08:51:34Z bennylp $ */ /* $Id: ssl_sock.h 3110 2010-02-25 11:58:19Z nanang $ */
/* /*
* Copyright (C) 2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2009 Teluu Inc. (http://www.teluu.com)
* *
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 59 skipping to change at line 59
* This opaque structure describes the secure socket. * This opaque structure describes the secure socket.
*/ */
typedef struct pj_ssl_sock_t pj_ssl_sock_t; typedef struct pj_ssl_sock_t pj_ssl_sock_t;
/** /**
* Opaque declaration of endpoint certificate or credentials. This may cont ains * Opaque declaration of endpoint certificate or credentials. This may cont ains
* certificate, private key, and trusted Certificate Authorities list. * certificate, private key, and trusted Certificate Authorities list.
*/ */
typedef struct pj_ssl_cert_t pj_ssl_cert_t; typedef struct pj_ssl_cert_t pj_ssl_cert_t;
typedef enum pj_ssl_cert_verify_flag_t
{
/**
* No error in verification.
*/
PJ_SSL_CERT_ESUCCESS = 0,
/**
* The issuer certificate cannot be found.
*/
PJ_SSL_CERT_EISSUER_NOT_FOUND = (1 << 0),
/**
* The certificate is untrusted.
*/
PJ_SSL_CERT_EUNTRUSTED = (1 << 1),
/**
* The certificate has expired or not yet valid.
*/
PJ_SSL_CERT_EVALIDITY_PERIOD = (1 << 2),
/**
* One or more fields of the certificate cannot be decoded due to
* invalid format.
*/
PJ_SSL_CERT_EINVALID_FORMAT = (1 << 3),
/**
* The certificate cannot be used for the specified purpose.
*/
PJ_SSL_CERT_EINVALID_PURPOSE = (1 << 4),
/**
* The issuer info in the certificate does not match to the (candidate)
* issuer certificate, e.g: issuer name not match to subject name
* of (candidate) issuer certificate.
*/
PJ_SSL_CERT_EISSUER_MISMATCH = (1 << 5),
/**
* The CRL certificate cannot be found or cannot be read properly.
*/
PJ_SSL_CERT_ECRL_FAILURE = (1 << 6),
/**
* The certificate has been revoked.
*/
PJ_SSL_CERT_EREVOKED = (1 << 7),
/**
* The certificate chain length is too long.
*/
PJ_SSL_CERT_ECHAIN_TOO_LONG = (1 << 8),
/**
* The server identity does not match to any identities specified in
* the certificate, e.g: subjectAltName extension, subject common name.
* This flag will only be set by application as SSL socket does not
* perform server identity verification.
*/
PJ_SSL_CERT_EIDENTITY_NOT_MATCH = (1 << 30),
/**
* Unknown verification error.
*/
PJ_SSL_CERT_EUNKNOWN = (1 << 31)
} pj_ssl_cert_verify_flag_t;
typedef enum pj_ssl_cert_name_type
{
PJ_SSL_CERT_NAME_UNKNOWN = 0,
PJ_SSL_CERT_NAME_RFC822,
PJ_SSL_CERT_NAME_DNS,
PJ_SSL_CERT_NAME_URI,
PJ_SSL_CERT_NAME_IP
} pj_ssl_cert_name_type;
/** /**
* Describe structure of certificate info. * Describe structure of certificate info.
*/ */
typedef struct pj_ssl_cert_info { typedef struct pj_ssl_cert_info {
pj_str_t subject; /**< Subject. */
pj_str_t issuer; /**< Issuer. */ unsigned version; /**< Certificate version */
unsigned version; /**< Certificate version. */
pj_time_val validity_start; /**< Validity start. */ pj_uint8_t serial_no[20]; /**< Serial number, array of
pj_time_val validity_end; /**< Validity end. */ octets, first index is
pj_bool_t validity_use_gmt; /**< Flag if validity date/time MSB */
use GMT. */
struct {
pj_str_t cn; /**< Common name */
pj_str_t info; /**< One line subject, fields
are separated by slash, e.g:
"CN=sample.org/OU=HRD" */
} subject; /**< Subject */
struct {
pj_str_t cn; /**< Common name */
pj_str_t info; /**< One line subject, fields
are separated by slash.*/
} issuer; /**< Issuer */
struct {
pj_time_val start; /**< Validity start */
pj_time_val end; /**< Validity end */
pj_bool_t gmt; /**< Flag if validity date/time
use GMT */
} validity; /**< Validity */
struct {
unsigned cnt; /**< # of entry */
struct {
pj_ssl_cert_name_type type;
/**< Name type */
pj_str_t name; /**< The name */
} *entry; /**< Subject alt name entry */
} subj_alt_name; /**< Subject alternative
name extension */
} pj_ssl_cert_info; } pj_ssl_cert_info;
/** /**
* Create credential from files. * Create credential from files.
* *
* @param CA_file The file of trusted CA list. * @param CA_file The file of trusted CA list.
* @param cert_file The file of certificate. * @param cert_file The file of certificate.
* @param privkey_file The file of private key. * @param privkey_file The file of private key.
* @param privkey_pass The password of private key, if any. * @param privkey_pass The password of private key, if any.
* @param p_cert Pointer to credential instance to be created. * @param p_cert Pointer to credential instance to be created.
skipping to change at line 91 skipping to change at line 200
* @return PJ_SUCCESS when successful. * @return PJ_SUCCESS when successful.
*/ */
PJ_DECL(pj_status_t) pj_ssl_cert_load_from_files(pj_pool_t *pool, PJ_DECL(pj_status_t) pj_ssl_cert_load_from_files(pj_pool_t *pool,
const pj_str_t *CA_file, const pj_str_t *CA_file,
const pj_str_t *cert_file, const pj_str_t *cert_file,
const pj_str_t *privkey_fil e, const pj_str_t *privkey_fil e,
const pj_str_t *privkey_pas s, const pj_str_t *privkey_pas s,
pj_ssl_cert_t **p_cert); pj_ssl_cert_t **p_cert);
/** /**
* Dump SSL certificate info.
*
* @param ci The certificate info.
* @param indent String for left indentation.
* @param buf The buffer where certificate info will be printed on
.
* @param buf_size The buffer size.
*
* @return The length of the dump result, or -1 when buffer siz
e
* is not sufficient.
*/
PJ_DECL(pj_ssize_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci,
const char *indent,
char *buf,
pj_size_t buf_size);
/**
* Get SSL certificate verification error messages from verification status
.
*
* @param verify_status The SSL certificate verification status.
* @param error_strings Array of strings to receive the verification
error
* messages.
* @param count On input it specifies maximum error messages
should be
* retrieved. On output it specifies the number of erro
r
* messages retrieved.
*
* @return PJ_SUCCESS when successful.
*/
PJ_DECL(pj_status_t) pj_ssl_cert_get_verify_status_strings(
pj_uint32_t verify_status,
const char *error_strings[]
,
unsigned *count);
/**
* Cipher suites enumeration. * Cipher suites enumeration.
*/ */
typedef enum pj_ssl_cipher { typedef enum pj_ssl_cipher {
/* NULL */ /* NULL */
TLS_NULL_WITH_NULL_NULL = 0x00000000, PJ_TLS_NULL_WITH_NULL_NULL = 0x00000000,
/* TLS/SSLv3 */ /* TLS/SSLv3 */
TLS_RSA_WITH_NULL_MD5 = 0x00000001, PJ_TLS_RSA_WITH_NULL_MD5 = 0x00000001,
TLS_RSA_WITH_NULL_SHA = 0x00000002, PJ_TLS_RSA_WITH_NULL_SHA = 0x00000002,
TLS_RSA_WITH_NULL_SHA256 = 0x0000003B, PJ_TLS_RSA_WITH_NULL_SHA256 = 0x0000003B,
TLS_RSA_WITH_RC4_128_MD5 = 0x00000004, PJ_TLS_RSA_WITH_RC4_128_MD5 = 0x00000004,
TLS_RSA_WITH_RC4_128_SHA = 0x00000005, PJ_TLS_RSA_WITH_RC4_128_SHA = 0x00000005,
TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x0000000A, PJ_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x0000000A,
TLS_RSA_WITH_AES_128_CBC_SHA = 0x0000002F, PJ_TLS_RSA_WITH_AES_128_CBC_SHA = 0x0000002F,
TLS_RSA_WITH_AES_256_CBC_SHA = 0x00000035, PJ_TLS_RSA_WITH_AES_256_CBC_SHA = 0x00000035,
TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003C, PJ_TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003C,
TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x0000003D, PJ_TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x0000003D,
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x0000000D, PJ_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x0000000D,
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000010, PJ_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000010,
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x00000013, PJ_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x00000013,
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000016, PJ_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000016,
TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x00000030, PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x00000030,
TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x00000031, PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x00000031,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x00000032, PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x00000032,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x00000033, PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x00000033,
TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x00000036, PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x00000036,
TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x00000037, PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x00000037,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x00000038, PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x00000038,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x00000039, PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x00000039,
TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x0000003E, PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x0000003E,
TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003F, PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003F,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x00000040, PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x00000040,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x00000067, PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x00000067,
TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x00000068, PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x00000068,
TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x00000069, PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x00000069,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x0000006A, PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x0000006A,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x0000006B, PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x0000006B,
TLS_DH_anon_WITH_RC4_128_MD5 = 0x00000018, PJ_TLS_DH_anon_WITH_RC4_128_MD5 = 0x00000018,
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x0000001B, PJ_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x0000001B,
TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x00000034, PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x00000034,
TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x0000003A, PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x0000003A,
TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x0000006C, PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x0000006C,
TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x0000006D, PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x0000006D,
/* TLS (deprecated) */ /* TLS (deprecated) */
TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x00000003, PJ_TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x00000003,
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x00000006, PJ_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x00000006,
TLS_RSA_WITH_IDEA_CBC_SHA = 0x00000007, PJ_TLS_RSA_WITH_IDEA_CBC_SHA = 0x00000007,
TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000008, PJ_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000008,
TLS_RSA_WITH_DES_CBC_SHA = 0x00000009, PJ_TLS_RSA_WITH_DES_CBC_SHA = 0x00000009,
TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0000000B, PJ_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0000000B,
TLS_DH_DSS_WITH_DES_CBC_SHA = 0x0000000C, PJ_TLS_DH_DSS_WITH_DES_CBC_SHA = 0x0000000C,
TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0000000E, PJ_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0000000E,
TLS_DH_RSA_WITH_DES_CBC_SHA = 0x0000000F, PJ_TLS_DH_RSA_WITH_DES_CBC_SHA = 0x0000000F,
TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x00000011, PJ_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x00000011,
TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x00000012, PJ_TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x00000012,
TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000014, PJ_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000014,
TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x00000015, PJ_TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x00000015,
TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x00000017, PJ_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x00000017,
TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x00000019, PJ_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x00000019,
TLS_DH_anon_WITH_DES_CBC_SHA = 0x0000001A, PJ_TLS_DH_anon_WITH_DES_CBC_SHA = 0x0000001A,
/* SSLv3 */ /* SSLv3 */
SSL_FORTEZZA_KEA_WITH_NULL_SHA = 0x0000001C, PJ_SSL_FORTEZZA_KEA_WITH_NULL_SHA = 0x0000001C,
SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA= 0x0000001D, PJ_SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA = 0x0000001D,
SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 0x0000001E, PJ_SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 0x0000001E,
/* SSLv2 */ /* SSLv2 */
SSL_CK_RC4_128_WITH_MD5 = 0x00010080, PJ_SSL_CK_RC4_128_WITH_MD5 = 0x00010080,
SSL_CK_RC4_128_EXPORT40_WITH_MD5 = 0x00020080, PJ_SSL_CK_RC4_128_EXPORT40_WITH_MD5 = 0x00020080,
SSL_CK_RC2_128_CBC_WITH_MD5 = 0x00030080, PJ_SSL_CK_RC2_128_CBC_WITH_MD5 = 0x00030080,
SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 = 0x00040080, PJ_SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 = 0x00040080,
SSL_CK_IDEA_128_CBC_WITH_MD5 = 0x00050080, PJ_SSL_CK_IDEA_128_CBC_WITH_MD5 = 0x00050080,
SSL_CK_DES_64_CBC_WITH_MD5 = 0x00060040, PJ_SSL_CK_DES_64_CBC_WITH_MD5 = 0x00060040,
SSL_CK_DES_192_EDE3_CBC_WITH_MD5 = 0x000700C0 PJ_SSL_CK_DES_192_EDE3_CBC_WITH_MD5 = 0x000700C0
} pj_ssl_cipher; } pj_ssl_cipher;
/** /**
* Get cipher list supported by SSL/TLS backend. * Get cipher list supported by SSL/TLS backend.
* *
* @param ciphers The ciphers buffer to receive cipher list. * @param ciphers The ciphers buffer to receive cipher list.
* @param cipher_num Maximum number of ciphers to be received. * @param cipher_num Maximum number of ciphers to be received.
* *
* @return PJ_SUCCESS when successful. * @return PJ_SUCCESS when successful.
skipping to change at line 355 skipping to change at line 497
pj_sockaddr local_addr; pj_sockaddr local_addr;
/** /**
* Describes remote address. * Describes remote address.
*/ */
pj_sockaddr remote_addr; pj_sockaddr remote_addr;
/** /**
* Describes active local certificate info. * Describes active local certificate info.
*/ */
pj_ssl_cert_info local_cert_info; pj_ssl_cert_info *local_cert_info;
/** /**
* Describes active remote certificate info. * Describes active remote certificate info.
*/ */
pj_ssl_cert_info remote_cert_info; pj_ssl_cert_info *remote_cert_info;
/**
* Status of peer certificate verification.
*/
pj_uint32_t verify_status;
} pj_ssl_sock_info; } pj_ssl_sock_info;
/** /**
* Definition of secure socket creation parameters. * Definition of secure socket creation parameters.
*/ */
typedef struct pj_ssl_sock_param typedef struct pj_ssl_sock_param
{ {
/** /**
* Specifies socket address family, either pj_AF_INET() and pj_AF_INET6 (). * Specifies socket address family, either pj_AF_INET() and pj_AF_INET6 ().
skipping to change at line 514 skipping to change at line 661
/** /**
* When secure socket is acting as server (handles incoming connection) , * When secure socket is acting as server (handles incoming connection) ,
* it will require the client to provide certificate. * it will require the client to provide certificate.
* *
* Default value is PJ_FALSE. * Default value is PJ_FALSE.
*/ */
pj_bool_t require_client_cert; pj_bool_t require_client_cert;
/** /**
* When secure socket is acting as client (perform outgoing connection) * Server name indication. When secure socket is acting as client
* and it needs to verify server name (e.g: host or domain name) by * (perform outgoing connection) and the server may host multiple
* matching it to the name specified in the server certificate. This * 'virtual' servers at a single underlying network address, setting
* setting is useful when the server is hosting multiple domains for * this will allow client to tell the server a name of the server
* the same listening socket. * it is contacting.
* *
* Default value is zero/not-set. * Default value is zero/not-set.
*/ */
pj_str_t server_name; pj_str_t server_name;
/** /**
* QoS traffic type to be set on this transport. When application wants * QoS traffic type to be set on this transport. When application wants
* to apply QoS tagging to the transport, it's preferable to set this * to apply QoS tagging to the transport, it's preferable to set this
* field rather than \a qos_param fields since this is more portable. * field rather than \a qos_param fields since this is more portable.
* *
 End of changes. 12 change blocks. 
78 lines changed or deleted 232 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/