summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-05-13 10:56:48 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-05-13 10:56:48 +0000
commit7f59e4d6d01926c2535937463095e8d769be4ad9 (patch)
tree8b95e6a62838cb82e8856a9b19fdc64fcafe259a /pjsip/include
parentf5034fe8896342601b10dd2381b06dcb754e3f6c (diff)
Fixed #1918: Add API to update STUN servers and option to retry STUN for media on failure
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5297 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h40
-rw-r--r--pjsip/include/pjsua2/endpoint.hpp28
2 files changed, 66 insertions, 2 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 769cb4b3..458ea379 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -1581,6 +1581,11 @@ typedef struct pjsua_config
* 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.
*
+ * This setting will also determine what happens if STUN servers are
+ * unavailable during runtime (if set to PJ_FALSE, calls will
+ * directly fail, otherwise (if PJ_TRUE) call medias will
+ * fallback to proceed as though not using STUN servers.
+ *
* Default: PJ_TRUE
*/
pj_bool_t stun_ignore_failure;
@@ -2085,6 +2090,30 @@ PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type);
/**
+ * Update the STUN servers list. The #pjsua_init() must have been called
+ * before calling this function.
+ *
+ * @param count Number of STUN server entries.
+ * @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.
+ *
+ * @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 #on_stun_resolution_complete.
+ */
+PJ_DECL(pj_status_t) pjsua_update_stun_servers(unsigned count, pj_str_t srv[],
+ pj_bool_t wait);
+
+
+/**
* 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.
@@ -2722,7 +2751,16 @@ typedef enum pjsua_stun_use
* 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_DISABLED,
+
+ /**
+ * Retry other STUN servers if the STUN server selected during
+ * startup (#pjsua_init()) or after calling #pjsua_update_stun_servers()
+ * is unavailable during runtime. This setting is valid only for
+ * account's media STUN setting and if the call is using UDP media
+ * transport.
+ */
+ PJSUA_STUN_RETRY_ON_FAILURE
} pjsua_stun_use;
diff --git a/pjsip/include/pjsua2/endpoint.hpp b/pjsip/include/pjsua2/endpoint.hpp
index 09149c70..e16da908 100644
--- a/pjsip/include/pjsua2/endpoint.hpp
+++ b/pjsip/include/pjsua2/endpoint.hpp
@@ -904,6 +904,32 @@ public:
pj_stun_nat_type natGetType() throw(Error);
/**
+ * Update the STUN servers list. The libInit() must have been called
+ * before calling this function.
+ *
+ * @param prmServers Array of STUN servers to try. The endpoint
+ * 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)
+ * @param prmWait Specify if the function should block until
+ * it gets the result. In this case, the
+ * function will block while the resolution
+ * is being done, and the callback
+ * onNatCheckStunServersComplete() will be called
+ * before this function returns.
+ *
+ */
+ void natUpdateStunServers(const StringVector &prmServers,
+ bool prmWait) throw(Error);
+
+ /**
* Auxiliary function to resolve and contact each of the STUN server
* entries (sequentially) to find which is usable. The libInit() must
* have been called before calling this function.
@@ -1189,7 +1215,7 @@ public:
/**
* Callback when the Endpoint has finished performing STUN server
* checking that is initiated when calling libInit(), or by
- * calling natCheckStunServers().
+ * calling natCheckStunServers() or natUpdateStunServers().
*
* @param prm Callback parameters.
*/