summaryrefslogtreecommitdiff
path: root/pjsip-apps
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2009-08-11 12:42:38 +0000
committerNanang Izzuddin <nanang@teluu.com>2009-08-11 12:42:38 +0000
commit6f204c13ce8519524eb4da79359ac9b2aea08252 (patch)
treefd03248a6aa6c121822cbca2507113cf5b86b0f0 /pjsip-apps
parent04fbadef1554da3b61c412e030081d1f05c6a99a (diff)
Ticket #833:
- Initial version of Session Timers (RFC 4028). - Added new options in pjsua app to configure Session Timers settings. - Added python tests for Session Timers. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2858 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app.c36
-rw-r--r--pjsip-apps/src/python/_pjsua.h24
2 files changed, 59 insertions, 1 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index 41630132..94782173 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -190,6 +190,9 @@ static void usage(void)
puts (" --password=string Set authentication password");
puts (" --publish Send presence PUBLISH for this account");
puts (" --use-100rel Require reliable provisional response (100rel)");
+ puts (" --use-timer Require session timers");
+ puts (" --timer-se Session timers expiration period, in secs (def:1800)");
+ puts (" --timer-min-se Session timers minimum expiration period, in secs (def:90)");
puts (" --auto-update-nat=N Where N is 0 or 1 to enable/disable SIP traversal behind");
puts (" symmetric NAT (default 1)");
puts (" --next-cred Add another credentials");
@@ -498,7 +501,8 @@ static pj_status_t parse_args(int argc, char *argv[],
OPT_STDOUT_NO_BUF,
#endif
OPT_AUTO_UPDATE_NAT,OPT_USE_COMPACT_FORM,OPT_DIS_CODEC,
- OPT_NO_FORCE_LR
+ OPT_NO_FORCE_LR,
+ OPT_TIMER, OPT_TIMER_SE, OPT_TIMER_MIN_SE
};
struct pj_getopt_option long_options[] = {
{ "config-file",1, 0, OPT_CONFIG_FILE},
@@ -609,6 +613,9 @@ static pj_status_t parse_args(int argc, char *argv[],
#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6
{ "ipv6", 0, 0, OPT_IPV6},
#endif
+ { "use-timer", 0, 0, OPT_TIMER},
+ { "timer-se", 1, 0, OPT_TIMER_SE},
+ { "timer-min-se", 1, 0, OPT_TIMER_MIN_SE},
{ NULL, 0, 0, 0}
};
pj_status_t status;
@@ -825,6 +832,33 @@ static pj_status_t parse_args(int argc, char *argv[],
cfg->cfg.require_100rel = PJ_TRUE;
break;
+ case OPT_TIMER: /** session timer */
+ cur_acc->require_timer = PJ_TRUE;
+ cfg->cfg.require_timer = PJ_TRUE;
+ break;
+
+ case OPT_TIMER_SE: /** session timer session expiration */
+ cur_acc->timer_se = pj_strtoul(pj_cstr(&tmp, pj_optarg));
+ if (cur_acc->timer_se < 90) {
+ PJ_LOG(1,(THIS_FILE,
+ "Error: invalid value for --timer-se "
+ "(expecting higher than 90)"));
+ return PJ_EINVAL;
+ }
+ cfg->cfg.timer_se = cur_acc->timer_se;
+ break;
+
+ case OPT_TIMER_MIN_SE: /** session timer minimum session expiration */
+ cur_acc->timer_min_se = pj_strtoul(pj_cstr(&tmp, pj_optarg));
+ if (cur_acc->timer_min_se < 90) {
+ PJ_LOG(1,(THIS_FILE,
+ "Error: invalid value for --timer-min-se "
+ "(expecting higher than 90)"));
+ return PJ_EINVAL;
+ }
+ cfg->cfg.timer_min_se = cur_acc->timer_min_se;
+ break;
+
case OPT_USE_IMS: /* Activate IMS settings */
cur_acc->auth_pref.initial_auth = PJ_TRUE;
break;
diff --git a/pjsip-apps/src/python/_pjsua.h b/pjsip-apps/src/python/_pjsua.h
index d3958d76..931fcbe6 100644
--- a/pjsip-apps/src/python/_pjsua.h
+++ b/pjsip-apps/src/python/_pjsua.h
@@ -1656,6 +1656,9 @@ typedef struct
PyObject *contact_params;
PyObject *contact_uri_params;
int require_100rel;
+ int require_timer;
+ unsigned timer_se;
+ unsigned timer_min_se;
int allow_contact_rewrite;
int ka_interval;
PyObject *ka_data;
@@ -1730,6 +1733,9 @@ static void PyObj_pjsua_acc_config_import(PyObj_pjsua_acc_config *obj,
Py_XDECREF(obj->contact_uri_params);
obj->contact_uri_params = PyString_FromPJ(&cfg->contact_uri_params);
obj->require_100rel = cfg->require_100rel;
+ obj->require_timer = cfg->require_timer;
+ obj->timer_se = cfg->timer_se;
+ obj->timer_min_se = cfg->timer_min_se;
obj->allow_contact_rewrite = cfg->allow_contact_rewrite;
obj->ka_interval = cfg->ka_interval;
Py_XDECREF(obj->ka_data);
@@ -1776,6 +1782,9 @@ static void PyObj_pjsua_acc_config_export(pjsua_acc_config *cfg,
cfg->contact_params = PyString_ToPJ(obj->contact_params);
cfg->contact_uri_params = PyString_ToPJ(obj->contact_uri_params);
cfg->require_100rel = obj->require_100rel;
+ cfg->require_timer = obj->require_timer;
+ cfg->timer_se = obj->timer_se;
+ cfg->timer_min_se = obj->timer_min_se;
cfg->allow_contact_rewrite = obj->allow_contact_rewrite;
cfg->ka_interval = obj->ka_interval;
cfg->ka_data = PyString_ToPJ(obj->ka_data);
@@ -1921,6 +1930,21 @@ static PyMemberDef PyObj_pjsua_acc_config_members[] =
"Require reliable provisional response."
},
{
+ "require_timer", T_INT,
+ offsetof(PyObj_pjsua_acc_config, require_timer), 0,
+ "Require session timer."
+ },
+ {
+ "timer_se", T_INT,
+ offsetof(PyObj_pjsua_acc_config, timer_se), 0,
+ "Session timer expiration period, in seconds."
+ },
+ {
+ "timer_min_se", T_INT,
+ offsetof(PyObj_pjsua_acc_config, timer_min_se), 0,
+ "Session timer minimum expiration period, in seconds."
+ },
+ {
"allow_contact_rewrite", T_INT,
offsetof(PyObj_pjsua_acc_config, allow_contact_rewrite), 0,
"Re-REGISTER if behind symmetric NAT."