From ef040a9c543b0b51e0f278ebb7a3e6a9588e9b83 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 31 Oct 2007 13:28:08 +0000 Subject: Ticket #407: keep-alive for UDP transports in PJSUA-LIB git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1536 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsua-lib/pjsua.h | 38 ++++++++++++++++++++++++++++++-- pjsip/include/pjsua-lib/pjsua_internal.h | 6 ++++- 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'pjsip/include') diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 579d722f..fb324f4d 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -1768,7 +1768,7 @@ PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id, * Default registration interval. */ #ifndef PJSUA_REG_INTERVAL -# define PJSUA_REG_INTERVAL 55 +# define PJSUA_REG_INTERVAL 300 #endif @@ -1897,7 +1897,7 @@ typedef struct pjsua_acc_config /** * Optional interval for registration, in seconds. If the value is zero, - * default interval will be used (PJSUA_REG_INTERVAL, 55 seconds). + * default interval will be used (PJSUA_REG_INTERVAL, 300 seconds). */ unsigned reg_timeout; @@ -1947,6 +1947,28 @@ typedef struct pjsua_acc_config */ pj_bool_t auto_update_nat; + /** + * Set the interval for periodic keep-alive transmission for this account. + * 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. + * + * Even if this setting is enabled, keep-alive transmission is only done + * when STUN is enabled in the global #pjsua_config, and the transport + * used for registration is UDP. For TCP and TLS transports, keep-alive + * is done by the transport themselves. + * + * Default: 15 (seconds) + */ + unsigned ka_interval; + + /** + * Specify the data to be transmitted as keep-alive packets. + * + * Default: CR-LF + */ + pj_str_t ka_data; + } pjsua_acc_config; @@ -1965,6 +1987,18 @@ typedef struct pjsua_acc_config 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(). diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 004c1ca1..87d30b99 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -86,10 +86,14 @@ typedef struct pjsua_acc int srv_port; /**< Port number of reg server. */ pjsip_regc *regc; /**< Client registration session. */ - pj_timer_entry reg_timer; /**< Registration timer. */ pj_status_t reg_last_err; /**< Last registration error. */ int reg_last_code; /**< Last status last register. */ + pj_timer_entry ka_timer; /**< Keep-alive timer for UDP. */ + pjsip_transport *ka_transport; /**< Transport for keep-alive. */ + pj_sockaddr ka_target; /**< Destination address for K-A */ + unsigned ka_target_len; /**< Length of ka_target. */ + pjsip_route_hdr route_set; /**< Complete route set inc. outbnd.*/ unsigned cred_cnt; /**< Number of credentials. */ -- cgit v1.2.3