summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip/sip_auth.h79
-rw-r--r--pjsip/include/pjsip/sip_config.h50
-rw-r--r--pjsip/include/pjsip/sip_endpoint.h73
-rw-r--r--pjsip/include/pjsip/sip_transport.h110
-rw-r--r--pjsip/include/pjsip/sip_transport_tls.h42
-rw-r--r--pjsip/include/pjsip/sip_types.h7
-rw-r--r--pjsip/include/pjsip/sip_uri.h10
-rw-r--r--pjsip/include/pjsip/sip_util.h9
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h346
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h31
10 files changed, 722 insertions, 35 deletions
diff --git a/pjsip/include/pjsip/sip_auth.h b/pjsip/include/pjsip/sip_auth.h
index 613e0d5..cd59372 100644
--- a/pjsip/include/pjsip/sip_auth.h
+++ b/pjsip/include/pjsip/sip_auth.h
@@ -1,4 +1,4 @@
-/* $Id: sip_auth.h 3553 2011-05-05 06:14:19Z nanang $ */
+/* $Id: sip_auth.h 4214 2012-07-25 14:29:28Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -275,6 +275,37 @@ typedef pj_status_t pjsip_auth_lookup_cred( pj_pool_t *pool,
const pj_str_t *acc_name,
pjsip_cred_info *cred_info );
+
+/**
+ * This structure describes input param for credential lookup.
+ */
+typedef struct pjsip_auth_lookup_cred_param
+{
+ pj_str_t realm; /**< Realm to find the account. */
+ pj_str_t acc_name; /**< Account name to look for. */
+ pjsip_rx_data *rdata; /**< Incoming request to be authenticated. */
+
+} pjsip_auth_lookup_cred_param;
+
+
+/**
+ * Type of function to lookup credential for the specified name.
+ *
+ * @param pool Pool to initialize the credential info.
+ * @param param The input param for credential lookup.
+ * @param cred_info The structure to put the credential when it's found.
+ *
+ * @return The function MUST return PJ_SUCCESS when it found
+ * a correct credential for the specified account and
+ * realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUND
+ * or PJSIP_EAUTHACCDISABLED.
+ */
+typedef pj_status_t pjsip_auth_lookup_cred2(
+ pj_pool_t *pool,
+ const pjsip_auth_lookup_cred_param *param,
+ pjsip_cred_info *cred_info );
+
+
/** Flag to specify that server is a proxy. */
#define PJSIP_AUTH_SRV_IS_PROXY 1
@@ -286,7 +317,8 @@ typedef struct pjsip_auth_srv
pj_str_t realm; /**< Realm to serve. */
pj_bool_t is_proxy; /**< Will issue 407 instead of 401 */
pjsip_auth_lookup_cred *lookup; /**< Lookup function. */
-
+ pjsip_auth_lookup_cred2 *lookup2; /**< Lookup function with additional
+ info in its input param. */
} pjsip_auth_srv;
@@ -434,6 +466,49 @@ PJ_DECL(pj_status_t) pjsip_auth_srv_init( pj_pool_t *pool,
/**
+ * This structure describes initialization settings of server authorization
+ * session.
+ */
+typedef struct pjsip_auth_srv_init_param
+{
+ /**
+ * Realm to be served by the server.
+ */
+ const pj_str_t *realm;
+
+ /**
+ * Account lookup function.
+ */
+ pjsip_auth_lookup_cred2 *lookup2;
+
+ /**
+ * Options, bitmask of:
+ * - PJSIP_AUTH_SRV_IS_PROXY: to specify that the server will authorize
+ * clients as a proxy server (instead of as UAS), which means that
+ * Proxy-Authenticate will be used instead of WWW-Authenticate.
+ */
+ unsigned options;
+
+} pjsip_auth_srv_init_param;
+
+
+/**
+ * Initialize server authorization session data structure to serve the
+ * specified realm and to use lookup_func function to look for the credential
+ * info.
+ *
+ * @param pool Pool used to initialize the authentication server.
+ * @param auth_srv The authentication server structure.
+ * @param param The initialization param.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_auth_srv_init2(
+ pj_pool_t *pool,
+ pjsip_auth_srv *auth_srv,
+ const pjsip_auth_srv_init_param *param);
+
+/**
* Request the authorization server framework to verify the authorization
* information in the specified request in rdata.
*
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h
index 9035b1e..bde0777 100644
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -1,4 +1,4 @@
-/* $Id: sip_config.h 4172 2012-06-19 14:35:18Z nanang $ */
+/* $Id: sip_config.h 4285 2012-10-19 04:23:57Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -73,18 +73,41 @@ typedef struct pjsip_cfg_t
/**
* Specify port number should be allowed to appear in To and From
* header. Note that RFC 3261 disallow this, see Table 1 in section
- * 19.1.1 of the RFC. Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR.
+ * 19.1.1 of the RFC.
+ *
+ * Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR.
*/
pj_bool_t allow_port_in_fromto_hdr;
/**
+ * Accept call replace in early state when invite is not initiated
+ * by the user agent. RFC 3891 Section 3 disallows this, however,
+ * for better interoperability reason, this might be ignored.
+ *
+ * Default is PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE.
+ */
+ pj_bool_t accept_replace_in_early_state;
+
+ /**
+ * Allow hash character ('#') to appear in outgoing URIs. See
+ * https://trac.pjsip.org/repos/ticket/1569.
+ *
+ * Default is PJ_FALSE.
+ */
+ pj_bool_t allow_tx_hash_in_uri;
+
+ /**
* Disable rport in request.
+ *
+ * Default is PJ_FALSE.
*/
pj_bool_t disable_rport;
/**
* Disable automatic switching from UDP to TCP if outgoing request
- * is greater than 1300 bytes. See PJSIP_DONT_SWITCH_TO_TCP.
+ * is greater than 1300 bytes.
+ *
+ * Default is PJSIP_DONT_SWITCH_TO_TCP.
*/
pj_bool_t disable_tcp_switch;
@@ -269,6 +292,21 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
/**
+ * Accept call replace in early state when invite is not initiated
+ * by the user agent. RFC 3891 Section 3 disallows this, however,
+ * for better interoperability reason, this might be ignored.
+ *
+ * This option can also be controlled at run-time by the
+ * \a accept_replace_in_early_state setting in pjsip_cfg_t.
+ *
+ * Default is 0 (no).
+ */
+#ifndef PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE
+# define PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE 0
+#endif
+
+
+/**
* This setting controls the threshold of the UDP packet, which if it's
* larger than this value the request will be sent with TCP. This setting
* is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0.
@@ -362,9 +400,13 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
* response is received, the response will be discarded since its Via
* sent-by now contains address that is different than the transport
* address.
+ *
+ * Update:
+ * As of version 2.1, the default value is 0. This change was part of
+ * https://trac.pjsip.org/repos/ticket/1412
*/
#ifndef PJSIP_CHECK_VIA_SENT_BY
-# define PJSIP_CHECK_VIA_SENT_BY 1
+# define PJSIP_CHECK_VIA_SENT_BY 0
#endif
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h
index ac3f525..63c65d7 100644
--- a/pjsip/include/pjsip/sip_endpoint.h
+++ b/pjsip/include/pjsip/sip_endpoint.h
@@ -1,4 +1,4 @@
-/* $Id: sip_endpoint.h 4154 2012-06-05 10:41:17Z bennylp $ */
+/* $Id: sip_endpoint.h 4275 2012-10-04 06:11:58Z bennylp $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -213,6 +213,77 @@ PJ_DECL(pj_status_t) pjsip_endpt_register_module( pjsip_endpoint *endpt,
PJ_DECL(pj_status_t) pjsip_endpt_unregister_module( pjsip_endpoint *endpt,
pjsip_module *module );
+/**
+ * This describes additional parameters to pjsip_endpt_process_rx_data()
+ * function. Application MUST call pjsip_process_rdata_param_default() to
+ * initialize this structure.
+ */
+typedef struct pjsip_process_rdata_param
+{
+ /**
+ * Specify the minimum priority number of the modules that are allowed
+ * to process the message. Default is zero to allow all modules to
+ * process the message.
+ */
+ unsigned start_prio;
+
+ /**
+ * Specify the pointer of the module where processing will start.
+ * The default is NULL, meaning processing will start from the start
+ * of the module list.
+ */
+ void *start_mod;
+
+ /**
+ * Set to N, then processing will start at Nth module after start
+ * module (where start module can be an explicit module as specified
+ * by \a start_mod or the start of module list when \a start_mod is
+ * NULL). For example, if set to 1, then processing will start from
+ * the next module after start module. Default is zero.
+ */
+ unsigned idx_after_start;
+
+ /**
+ * Print nothing to log. Default is PJ_FALSE.
+ */
+ pj_bool_t silent;
+
+} pjsip_process_rdata_param;
+
+/**
+ * Initialize with default.
+ *
+ * @param p The param.
+ */
+PJ_DECL(void) pjsip_process_rdata_param_default(pjsip_process_rdata_param *p);
+
+/**
+ * Manually distribute the specified pjsip_rx_data to registered modules.
+ * Normally application does not need to call this function because received
+ * messages will be given to endpoint automatically by transports.
+ *
+ * Application can use this function when it has postponed the processing of
+ * an incoming message, for example to perform long operations such as
+ * database operation or to consult other servers to decide what to do with
+ * the message. In this case, application clones the original rdata, return
+ * from the callback, and perform the long operation. Upon completing the
+ * long operation, it resumes pjsip's module processing by calling this
+ * function, and then free the cloned rdata.
+ *
+ * @param endpt The endpoint instance.
+ * @param rdata The rdata to be distributed.
+ * @param p Optional pointer to param to specify from which module
+ * the processing should start.
+ * @param p_handled Optional pointer to receive last return value of
+ * module's \a on_rx_request() or \a on_rx_response()
+ * callback.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_endpt_process_rx_data(pjsip_endpoint *endpt,
+ pjsip_rx_data *rdata,
+ pjsip_process_rdata_param *p,
+ pj_bool_t *p_handled);
/**
* Create pool from the endpoint. All SIP components should allocate their
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h
index c8ea6fd..21b2238 100644
--- a/pjsip/include/pjsip/sip_transport.h
+++ b/pjsip/include/pjsip/sip_transport.h
@@ -1,4 +1,4 @@
-/* $Id: sip_transport.h 4173 2012-06-20 10:39:05Z ming $ */
+/* $Id: sip_transport.h 4275 2012-10-04 06:11:58Z bennylp $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -427,6 +427,42 @@ struct pjsip_rx_data
*/
PJ_DECL(char*) pjsip_rx_data_get_info(pjsip_rx_data *rdata);
+/**
+ * Clone pjsip_rx_data. This will duplicate the contents of
+ * pjsip_rx_data and add reference count to the transport.
+ * Once application has finished using the cloned pjsip_rx_data,
+ * it must release it by calling #pjsip_rx_data_free_cloned().
+ *
+ * By default (if flags is set to zero), this function copies the
+ * transport pointer in \a tp_info, duplicates the \a pkt_info,
+ * perform deep clone of the \a msg_info parts of the rdata, and
+ * fills the \a endpt_info (i.e. the \a mod_data) with zeros.
+ *
+ * @param src The source to be cloned.
+ * @param flags Optional flags. Must be zero for now.
+ * @param p_rdata Pointer to receive the cloned rdata.
+ *
+ * @return PJ_SUCCESS on success or the appropriate error.
+ */
+PJ_DECL(pj_status_t) pjsip_rx_data_clone(const pjsip_rx_data *src,
+ unsigned flags,
+ pjsip_rx_data **p_rdata);
+
+/**
+ * Free cloned pjsip_rx_data. This function must be and must only
+ * be called for a cloned pjsip_rx_data. Specifically, it must NOT
+ * be called for the original pjsip_rx_data that is returned by
+ * transports.
+ *
+ * This function will free the memory used by the pjsip_rx_data and
+ * decrement the transport reference counter.
+ *
+ * @param rdata The receive data buffer.
+ *
+ * @return PJ_SUCCESS on success or the appropriate error.
+ */
+PJ_DECL(pj_status_t) pjsip_rx_data_free_cloned(pjsip_rx_data *rdata);
+
/*****************************************************************************
*
@@ -1076,6 +1112,8 @@ PJ_DECL(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool,
* In this implementation, it will only select the transport based on
* the transport type in the request.
*
+ * @see pjsip_tpmgr_find_local_addr2()
+ *
* @param tpmgr The transport manager.
* @param pool Pool to allocate memory for the IP address.
* @param type Destination address to contact.
@@ -1093,6 +1131,76 @@ PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr( pjsip_tpmgr *tpmgr,
int *port);
/**
+ * Parameter for pjsip_tpmgr_find_local_addr2() function.
+ */
+typedef struct pjsip_tpmgr_fla2_param
+{
+ /**
+ * Specify transport type to use. This must be set.
+ */
+ pjsip_transport_type_e tp_type;
+
+ /**
+ * Optional pointer to preferred transport, if any.
+ */
+ const pjsip_tpselector *tp_sel;
+
+ /**
+ * Destination host, if known. The destination host is needed
+ * if \a local_if field below is set.
+ */
+ pj_str_t dst_host;
+
+ /**
+ * Specify if the function should return which local interface
+ * to use for the specified destination in \a dst_host. By definition,
+ * the returned address will always be local interface address.
+ */
+ pj_bool_t local_if;
+
+ /**
+ * The returned address.
+ */
+ pj_str_t ret_addr;
+
+ /**
+ * The returned port.
+ */
+ pj_uint16_t ret_port;
+
+ /**
+ * Returned pointer to the transport. Only set if local_if is set.
+ */
+ const void *ret_tp;
+
+} pjsip_tpmgr_fla2_param;
+
+/**
+ * Initialize with default values.
+ *
+ * @param prm The parameter to be initialized.
+ */
+PJ_DECL(void) pjsip_tpmgr_fla2_param_default(pjsip_tpmgr_fla2_param *prm);
+
+/**
+ * Find out the appropriate local address info (IP address and port) to
+ * advertise in Contact or Via header header based on the remote address
+ * to be contacted. The local address info would be the address name of the
+ * transport or listener which will be used to send the request.
+ *
+ * @see pjsip_tpmgr_find_local_addr()
+ *
+ * @param tpmgr The transport manager.
+ * @param pool Pool to allocate memory for the IP address.
+ * @param param Function input and output parameters.
+ *
+ * @return PJ_SUCCESS, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr2(pjsip_tpmgr *tpmgr,
+ pj_pool_t *pool,
+ pjsip_tpmgr_fla2_param *prm);
+
+/**
* Return number of transports currently registered to the transport
* manager.
*
diff --git a/pjsip/include/pjsip/sip_transport_tls.h b/pjsip/include/pjsip/sip_transport_tls.h
index cbc1d75..8164c63 100644
--- a/pjsip/include/pjsip/sip_transport_tls.h
+++ b/pjsip/include/pjsip/sip_transport_tls.h
@@ -1,4 +1,4 @@
-/* $Id: sip_transport_tls.h 3999 2012-03-30 07:10:13Z bennylp $ */
+/* $Id: sip_transport_tls.h 4262 2012-09-20 06:00:23Z bennylp $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -262,6 +262,8 @@ PJ_INLINE(void) pjsip_tls_setting_copy(pj_pool_t *pool,
* instance of SIP TLS transport factory and register it to the
* transport manager.
*
+ * See also #pjsip_tls_transport_start2() which supports IPv6.
+ *
* @param endpt The SIP endpoint.
* @param opt Optional TLS settings.
* @param local Optional local address to bind, or specify the
@@ -294,7 +296,43 @@ PJ_DECL(pj_status_t) pjsip_tls_transport_start(pjsip_endpoint *endpt,
unsigned async_cnt,
pjsip_tpfactory **p_factory);
-
+/**
+ * Variant of #pjsip_tls_transport_start() that supports IPv6. To instantiate
+ * IPv6 listener, set the address family of the "local" argument to IPv6
+ * (the host and port part may be left unspecified if not desired, i.e. by
+ * filling them with zeroes).
+ *
+ * @param endpt The SIP endpoint.
+ * @param opt Optional TLS settings.
+ * @param local Optional local address to bind, or specify the
+ * address to bind the server socket to. Both IP
+ * interface address and port fields are optional.
+ * If IP interface address is not specified, socket
+ * will be bound to any address. If port is not
+ * specified, socket will be bound to any port
+ * selected by the operating system.
+ * @param a_name Optional published address, which is the address to be
+ * advertised as the address of this SIP transport.
+ * If this argument is NULL, then the bound address
+ * will be used as the published address.
+ * @param async_cnt Number of simultaneous asynchronous accept()
+ * operations to be supported. It is recommended that
+ * the number here corresponds to the number of
+ * processors in the system (or the number of SIP
+ * worker threads).
+ * @param p_factory Optional pointer to receive the instance of the
+ * SIP TLS transport factory just created.
+ *
+ * @return PJ_SUCCESS when the transport has been successfully
+ * started and registered to transport manager, or
+ * the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_tls_transport_start2(pjsip_endpoint *endpt,
+ const pjsip_tls_setting *opt,
+ const pj_sockaddr *local,
+ const pjsip_host_port *a_name,
+ unsigned async_cnt,
+ pjsip_tpfactory **p_factory);
PJ_END_DECL
diff --git a/pjsip/include/pjsip/sip_types.h b/pjsip/include/pjsip/sip_types.h
index 8cd98ae..9809983 100644
--- a/pjsip/include/pjsip/sip_types.h
+++ b/pjsip/include/pjsip/sip_types.h
@@ -1,4 +1,4 @@
-/* $Id: sip_types.h 3553 2011-05-05 06:14:19Z nanang $ */
+/* $Id: sip_types.h 4262 2012-09-20 06:00:23Z bennylp $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -92,7 +92,10 @@ typedef enum pjsip_transport_type_e
PJSIP_TRANSPORT_UDP6 = PJSIP_TRANSPORT_UDP + PJSIP_TRANSPORT_IPV6,
/** TCP over IPv6 */
- PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6
+ PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6,
+
+ /** TLS over IPv6 */
+ PJSIP_TRANSPORT_TLS6 = PJSIP_TRANSPORT_TLS + PJSIP_TRANSPORT_IPV6
} pjsip_transport_type_e;
diff --git a/pjsip/include/pjsip/sip_uri.h b/pjsip/include/pjsip/sip_uri.h
index 849392f..47b63bd 100644
--- a/pjsip/include/pjsip/sip_uri.h
+++ b/pjsip/include/pjsip/sip_uri.h
@@ -1,4 +1,4 @@
-/* $Id: sip_uri.h 3553 2011-05-05 06:14:19Z nanang $ */
+/* $Id: sip_uri.h 4370 2013-02-26 05:30:00Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -226,12 +226,12 @@ struct pjsip_uri
};
/**
- * This macro checks that the URL is a "sip:" or "sips:" URL.
+ * This macro checks that the URL is a "sip:" URL.
* @param url The URL (pointer to)
* @return non-zero if TRUE.
*/
#define PJSIP_URI_SCHEME_IS_SIP(url) \
- (pj_strnicmp2(pjsip_uri_get_scheme(url), "sip", 3)==0)
+ (pj_stricmp2(pjsip_uri_get_scheme(url), "sip")==0)
/**
* This macro checks that the URL is a "sips:" URL (not SIP).
@@ -239,7 +239,7 @@ struct pjsip_uri
* @return non-zero if TRUE.
*/
#define PJSIP_URI_SCHEME_IS_SIPS(url) \
- (pj_strnicmp2(pjsip_uri_get_scheme(url), "sips", 4)==0)
+ (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0)
/**
* This macro checks that the URL is a "tel:" URL.
@@ -247,7 +247,7 @@ struct pjsip_uri
* @return non-zero if TRUE.
*/
#define PJSIP_URI_SCHEME_IS_TEL(url) \
- (pj_strnicmp2(pjsip_uri_get_scheme(url), "tel", 3)==0)
+ (pj_stricmp2(pjsip_uri_get_scheme(url), "tel")==0)
/**
diff --git a/pjsip/include/pjsip/sip_util.h b/pjsip/include/pjsip/sip_util.h
index 6efa45f..018ad87 100644
--- a/pjsip/include/pjsip/sip_util.h
+++ b/pjsip/include/pjsip/sip_util.h
@@ -1,4 +1,4 @@
-/* $Id: sip_util.h 3553 2011-05-05 06:14:19Z nanang $ */
+/* $Id: sip_util.h 4347 2013-02-13 10:19:25Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -92,6 +92,13 @@ typedef enum pjsip_redirect_op
PJSIP_REDIRECT_ACCEPT,
/**
+ * Accept the redirection to the current target and replace the To
+ * header in the INVITE request with the current target. The INVITE
+ * request will be resent to the current target.
+ */
+ PJSIP_REDIRECT_ACCEPT_REPLACE,
+
+ /**
* Defer the redirection decision, for example to request permission
* from the end user.
*/
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 856d853..88c0d46 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -1,4 +1,4 @@
-/* $Id: pjsua.h 4180 2012-06-26 09:37:41Z ming $ */
+/* $Id: pjsua.h 4347 2013-02-13 10:19:25Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -906,9 +906,10 @@ typedef struct pjsua_callback
* callback.
* - it may delay the processing of the request, for example to request
* 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.
+ * case, the application MUST set the \a code argument to 202, then
+ * IMMEDIATELY calls #pjsua_pres_notify() with state
+ * PJSIP_EVSUB_STATE_PENDING and later calls #pjsua_pres_notify()
+ * again to accept or reject the subscription request.
*
* Any \a code other than 200 and 202 will be treated as 200.
*
@@ -1124,9 +1125,8 @@ typedef struct pjsua_callback
* 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
+ * Application may accept the redirection to the specified target,
+ * 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.
@@ -1146,9 +1146,12 @@ typedef struct pjsua_callback
* @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.
+ * redirection. When set, the call will immediately
+ * resend INVITE request to the target.
+ * - PJSIP_REDIRECT_ACCEPT_REPLACE: immediately accept
+ * the redirection and replace the To header with the
+ * current target. 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
@@ -1461,6 +1464,15 @@ typedef struct pjsua_config
pj_bool_t stun_ignore_failure;
/**
+ * This specifies whether STUN requests for resolving socket mapped
+ * address should use the new format, i.e: having STUN magic cookie
+ * in its transaction ID.
+ *
+ * Default: PJ_FALSE
+ */
+ pj_bool_t stun_map_use_stun2;
+
+ /**
* 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.
@@ -2143,6 +2155,15 @@ typedef struct pjsua_transport_config
unsigned port;
/**
+ * Specify the port range for socket binding, relative to the start
+ * port number specified in \a port. Note that this setting is only
+ * applicable when the start port number is non zero.
+ *
+ * Default value is zero.
+ */
+ unsigned port_range;
+
+ /**
* 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
@@ -2566,6 +2587,147 @@ typedef enum pjsua_call_hold_type
#endif
/**
+ * This enumeration controls the use of STUN in the account.
+ */
+typedef enum pjsua_stun_use
+{
+ /**
+ * Follow the default setting in the global \a pjsua_config.
+ */
+ PJSUA_STUN_USE_DEFAULT,
+
+ /**
+ * Disable STUN. If STUN is not enabled in the global \a pjsua_config,
+ * this setting has no effect.
+ */
+ PJSUA_STUN_USE_DISABLED
+
+} pjsua_stun_use;
+
+/**
+ * This enumeration controls the use of ICE settings in the account.
+ */
+typedef enum pjsua_ice_config_use
+{
+ /**
+ * Use the default settings in the global \a pjsua_media_config.
+ */
+ PJSUA_ICE_CONFIG_USE_DEFAULT,
+
+ /**
+ * Use the custom \a pjsua_ice_config setting in the account.
+ */
+ PJSUA_ICE_CONFIG_USE_CUSTOM
+
+} pjsua_ice_config_use;
+
+/**
+ * This enumeration controls the use of TURN settings in the account.
+ */
+typedef enum pjsua_turn_config_use
+{
+ /**
+ * Use the default setting in the global \a pjsua_media_config.
+ */
+ PJSUA_TURN_CONFIG_USE_DEFAULT,
+
+ /**
+ * Use the custom \a pjsua_turn_config setting in the account.
+ */
+ PJSUA_TURN_CONFIG_USE_CUSTOM
+
+} pjsua_turn_config_use;
+
+/**
+ * ICE setting. This setting is used in the pjsua_acc_config.
+ */
+typedef struct pjsua_ice_config
+{
+ /**
+ * 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;
+
+ /**
+ * Send re-INVITE/UPDATE every after ICE connectivity check regardless
+ * the default ICE transport address is changed or not. When this is set
+ * to PJ_FALSE, re-INVITE/UPDATE will be sent only when the default ICE
+ * transport address is changed.
+ *
+ * Default: yes
+ */
+ pj_bool_t ice_always_update;
+
+} pjsua_ice_config;
+
+/**
+ * TURN setting. This setting is used in the pjsua_acc_config.
+ */
+typedef struct pjsua_turn_config
+{
+ /**
+ * Enable TURN 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;
+
+} pjsua_turn_config;
+
+/**
+ * Specify how IPv6 transport should be used in account config.
+ */
+typedef enum pjsua_ipv6_use
+{
+ /**
+ * IPv6 is not used.
+ */
+ PJSUA_IPV6_DISABLED,
+
+ /**
+ * IPv6 is enabled.
+ */
+ PJSUA_IPV6_ENABLED
+
+} pjsua_ipv6_use;
+
+/**
* 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().
@@ -2588,7 +2750,8 @@ typedef struct pjsua_acc_config
/**
* The full SIP URL for the account. The value can take name address or
- * URL format, and will look something like "sip:account@serviceprovider".
+ * URL format, and will look something like "sip:account@serviceprovider"
+ * or "\"Display Name\" <sip:account@provider>".
*
* This field is mandatory.
*/
@@ -2743,6 +2906,15 @@ typedef struct pjsua_acc_config
*/
pj_str_t proxy[PJSUA_ACC_MAX_PROXIES];
+ /**
+ * If remote sends SDP answer containing more than one format or codec in
+ * the media line, send re-INVITE or UPDATE with just one codec to lock
+ * which codec to use.
+ *
+ * Default: 1 (Yes). Set to zero to disable.
+ */
+ unsigned lock_codec;
+
/**
* Optional interval for registration, in seconds. If the value is zero,
* default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
@@ -2957,13 +3129,60 @@ typedef struct pjsua_acc_config
pjsua_transport_config rtp_cfg;
/**
+ * Specify whether IPv6 should be used on media.
+ */
+ pjsua_ipv6_use ipv6_media_use;
+
+ /**
+ * Control the use of STUN for the SIP signaling.
+ *
+ * Default: PJSUA_STUN_USE_DEFAULT
+ */
+ pjsua_stun_use sip_stun_use;
+
+ /**
+ * Control the use of STUN for the media transports.
+ *
+ * Default: PJSUA_STUN_USE_DEFAULT
+ */
+ pjsua_stun_use media_stun_use;
+
+ /**
+ * Control the use of ICE in the account. By default, the settings in the
+ * \a pjsua_media_config will be used.
+ *
+ * Default: PJSUA_ICE_CONFIG_USE_DEFAULT
+ */
+ pjsua_ice_config_use ice_cfg_use;
+
+ /**
+ * The custom ICE setting for this account. This setting will only be
+ * used if \a ice_cfg_use is set to PJSUA_ICE_CONFIG_USE_CUSTOM
+ */
+ pjsua_ice_config ice_cfg;
+
+ /**
+ * Control the use of TURN in the account. By default, the settings in the
+ * \a pjsua_media_config will be used
+ *
+ * Default: PJSUA_TURN_CONFIG_USE_DEFAULT
+ */
+ pjsua_turn_config_use turn_cfg_use;
+
+ /**
+ * The custom TURN setting for this account. This setting will only be
+ * used if \a turn_cfg_use is set to PJSUA_TURN_CONFIG_USE_CUSTOM
+ */
+ pjsua_turn_config turn_cfg;
+
+ /**
* Specify whether secure media transport should be used for this account.
* Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
* PJMEDIA_SRTP_MANDATORY.
*
* Default: #PJSUA_DEFAULT_USE_SRTP
*/
- pjmedia_srtp_use use_srtp;
+ pjmedia_srtp_use use_srtp;
/**
* Specify whether SRTP requires secure signaling to be used. This option
@@ -3061,6 +3280,52 @@ typedef struct pjsua_acc_config
/**
+ * Initialize ICE config from a media config. If the \a pool argument
+ * is NULL, a simple memcpy() will be used.
+ *
+ * @param pool Memory to duplicate strings.
+ * @param dst Destination config.
+ * @param src Source config.
+ */
+PJ_DECL(void) pjsua_ice_config_from_media_config(pj_pool_t *pool,
+ pjsua_ice_config *dst,
+ const pjsua_media_config *src);
+
+/**
+ * Clone. If the \a pool argument is NULL, a simple memcpy() will be used.
+ *
+ * @param pool Memory to duplicate strings.
+ * @param dst Destination config.
+ * @param src Source config.
+ */
+PJ_DECL(void) pjsua_ice_config_dup( pj_pool_t *pool,
+ pjsua_ice_config *dst,
+ const pjsua_ice_config *src);
+
+/**
+ * Initialize TURN config from a media config. If the \a pool argument
+ * is NULL, a simple memcpy() will be used.
+ *
+ * @param pool Memory to duplicate strings.
+ * @param dst Destination config.
+ * @param src Source config.
+ */
+PJ_DECL(void) pjsua_turn_config_from_media_config(pj_pool_t *pool,
+ pjsua_turn_config *dst,
+ const pjsua_media_config *src);
+
+/**
+ * Clone. If the \a pool argument is NULL, a simple memcpy() will be used.
+ *
+ * @param pool Memory to duplicate strings.
+ * @param dst Destination config.
+ * @param src Source config.
+ */
+PJ_DECL(void) pjsua_turn_config_dup(pj_pool_t *pool,
+ pjsua_turn_config *dst,
+ const pjsua_turn_config *src);
+
+/**
* Call this function to initialize account config with default values.
*
* @param cfg The account config to be initialized.
@@ -4291,7 +4556,8 @@ PJ_DECL(pj_status_t) pjsua_call_update2(pjsua_call_id call_id,
* of the call transfer request.
*
* @param call_id The call id to be transfered.
- * @param dest Address of new target to be contacted.
+ * @param dest URI of new target to be contacted. The URI may be
+ * in name address or addr-spec format.
* @param msg_data Optional message components to be sent with
* the request.
*
@@ -5015,6 +5281,28 @@ PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
/**
+ * Specify whether the third party stream has the capability of retrieving
+ * the stream info, i.e: pjmedia_stream_get_info() and
+ * pjmedia_vid_stream_get_info(). Currently this capability is required
+ * by smart media update and call dump.
+ */
+#ifndef PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO
+# define PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO 0
+#endif
+
+
+/**
+ * Specify whether the third party stream has the capability of retrieving
+ * the stream statistics, i.e: pjmedia_stream_get_stat() and
+ * pjmedia_vid_stream_get_stat(). Currently this capability is required
+ * by call dump.
+ */
+#ifndef PJSUA_THIRD_PARTY_STREAM_HAS_GET_STAT
+# define PJSUA_THIRD_PARTY_STREAM_HAS_GET_STAT 0
+#endif
+
+
+/**
* Max ports in the conference bridge. This setting is the default value
* for pjsua_media_config.max_media_ports.
*/
@@ -5081,6 +5369,14 @@ PJ_DECL(pj_status_t) pjsua_im_typing(pjsua_acc_id acc_id,
/**
+ * Enable/disable "c=" line in SDP session level. Set to zero to disable it.
+ */
+#ifndef PJSUA_SDP_SESS_HAS_CONN
+# define PJSUA_SDP_SESS_HAS_CONN 0
+#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().
@@ -5276,6 +5572,16 @@ struct pjsua_media_config
pj_bool_t ice_no_rtcp;
/**
+ * Send re-INVITE/UPDATE every after ICE connectivity check regardless
+ * the default ICE transport address is changed or not. When this is set
+ * to PJ_FALSE, re-INVITE/UPDATE will be sent only when the default ICE
+ * transport address is changed.
+ *
+ * Default: yes
+ */
+ pj_bool_t ice_always_update;
+
+ /**
* Enable TURN relay candidate in ICE.
*/
pj_bool_t enable_turn;
@@ -5319,6 +5625,20 @@ struct pjsua_media_config
* Default: PJ_TRUE
*/
pj_bool_t vid_preview_enable_native;
+
+ /**
+ * Disable smart media update (ticket #1568). The smart media update
+ * will check for any changes in the media properties after a successful
+ * SDP negotiation and the media will only be reinitialized when any
+ * change is found. When it is disabled, media streams will always be
+ * reinitialized after a successful SDP negotiation.
+ *
+ * Note for third party media, the smart media update requires stream info
+ * retrieval capability, see #PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO.
+ *
+ * Default: PJ_FALSE
+ */
+ pj_bool_t no_smart_media_update;
};
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index c228513..3b38679 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -1,4 +1,4 @@
-/* $Id: pjsua_internal.h 4175 2012-06-22 08:53:11Z nanang $ */
+/* $Id: pjsua_internal.h 4342 2013-02-06 13:48:45Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -155,10 +155,7 @@ struct pjsua_call
char last_text_buf_[128]; /**< Buffer for last_text. */
struct {
- pj_timer_entry reinv_timer;/**< Reinvite retry timer. */
- pj_uint32_t sdp_ver; /**< SDP version of the bad answer */
int retry_cnt; /**< Retry count. */
- pj_bool_t pending; /**< Pending until CONFIRMED state */
} lock_codec; /**< Data for codec locking when answer
contains multiple codecs. */
@@ -170,6 +167,7 @@ struct pjsua_call
union {
struct {
pjsua_msg_data *msg_data;/**< Headers for outgoing INVITE. */
+ pj_bool_t hangup; /**< Call is hangup? */
} out_call;
struct {
call_answer answers;/**< A list of call answers. */
@@ -184,6 +182,10 @@ struct pjsua_call
offer. */
unsigned rem_vid_cnt; /**< No of active video in last remote
offer. */
+
+ pj_timer_entry reinv_timer; /**< Reinvite retry timer. */
+ pj_bool_t reinv_pending;/**< Pending until CONFIRMED state. */
+ pj_bool_t reinv_ice_sent;/**< Has reinvite for ICE upd sent? */
};
@@ -336,6 +338,9 @@ typedef struct pjsua_stun_resolve
PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve);
pj_pool_t *pool; /**< Pool */
+ int ref_cnt; /**< Reference count */
+ pj_bool_t destroy_flag; /**< To be destroyed */
+ pj_bool_t has_result;
unsigned count; /**< # of entries */
pj_str_t *srv; /**< Array of entries */
unsigned idx; /**< Current index */
@@ -583,6 +588,20 @@ pj_status_t resolve_stun_server(pj_bool_t wait);
*/
pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri);
+/* acc use stun? */
+pj_bool_t pjsua_sip_acc_is_using_stun(pjsua_acc_id acc_id);
+
+/* Get local transport address suitable to be used for Via or Contact address
+ * to send request to the specified destination URI.
+ */
+pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id,
+ pj_pool_t *pool,
+ const pj_str_t *dst_uri,
+ pjsip_host_port *addr,
+ pjsip_transport_type_e *p_tp_type,
+ int *p_secure,
+ const void **p_tp);
+
/**
* Handle incoming invite request.
*/
@@ -798,6 +817,10 @@ PJ_DECL(void) pjsua_vid_win_reset(pjsua_vid_win_id wid);
# define pjsua_vid_win_reset(wid)
#endif
+/*
+ * Schedule check for the need of re-INVITE/UPDATE after media update
+ */
+void pjsua_call_schedule_reinvite_check(pjsua_call *call, unsigned delay_ms);
PJ_END_DECL