From bfce50ca66e811fa21aec4385ce14ea46ce1f84e Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Tue, 30 Mar 2010 11:13:59 +0000 Subject: Ticket #1044: - Added initial version of automatic re-registration after registration failure and automatic call disconnection after re-registration attempt fails. - Published auto re-registration setting to pjsua app. - Updated pjsip_regc_send() to retrieve the transport earlier (was only in tsx_callback()). - Fixed TCP and TLS transport to prevent transport deletion in transport disconnection callback. - Fixed wrong keep-alive settings used by TLS transport (was using TCP keep-alive settings). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3128 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsip-ua/sip_regc.h | 1 + pjsip/include/pjsua-lib/pjsua.h | 30 ++++++++++++++++++++++++++++++ pjsip/include/pjsua-lib/pjsua_internal.h | 7 +++++++ 3 files changed, 38 insertions(+) (limited to 'pjsip/include') diff --git a/pjsip/include/pjsip-ua/sip_regc.h b/pjsip/include/pjsip-ua/sip_regc.h index eb8b33c0..a003641a 100644 --- a/pjsip/include/pjsip-ua/sip_regc.h +++ b/pjsip/include/pjsip-ua/sip_regc.h @@ -94,6 +94,7 @@ struct pjsip_regc_info pj_bool_t auto_reg; /**< Will register automatically? */ int interval; /**< Registration interval (seconds). */ int next_reg; /**< Time until next registration (seconds). */ + pjsip_transport *transport; /**< Last transport used. */ }; /** diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 451b8c9c..5d228083 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -1864,6 +1864,18 @@ PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id, #endif +/** + * Default auto retry re-registration interval, in seconds. Set to 0 + * to disable this. Application can set the timer on per account basis + * by setting the pjsua_acc_config.reg_retry_interval field instead. + * + * Default: 300 (5 minutes) + */ +#ifndef PJSUA_REG_RETRY_INTERVAL +# define PJSUA_REG_RETRY_INTERVAL 300 +#endif + + /** * This structure describes account configuration to be specified when * adding a new account with #pjsua_acc_add(). Application MUST initialize @@ -2116,6 +2128,24 @@ typedef struct pjsua_acc_config int srtp_secure_signaling; #endif + /** + * Specify interval of auto registration retry upon registration failure + * (including caused by transport problem), in second. Set to 0 to + * disable auto re-registration. + * + * Default: #PJSUA_REG_RETRY_INTERVAL + */ + unsigned reg_retry_interval; + + /** + * Specify whether calls of the configured account should be dropped + * after registration failure and an attempt of re-registration has + * also failed. + * + * Default: PJ_FALSE (disabled) + */ + pj_bool_t drop_calls_on_reg_fail; + } pjsua_acc_config; diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 527b53ae..647adc06 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -128,6 +128,13 @@ typedef struct pjsua_acc pj_status_t reg_last_err; /**< Last registration error. */ 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. */ pjsip_transport *ka_transport; /**< Transport for keep-alive. */ pj_sockaddr ka_target; /**< Destination address for K-A */ -- cgit v1.2.3