Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3304)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3305)
@@ -202,5 +202,5 @@
     puts  ("  --use-srtp=N        Use SRTP?  0:disabled, 1:optional, 2:mandatory,");
     puts  ("                      3:optional by duplicating media offer (def:0)");
-    puts  ("  --srtp-secure=N     SRTP require secure SIP? 0:no, 1:tls, 1:sips (def:1)");
+    puts  ("  --srtp-secure=N     SRTP require secure SIP? 0:no, 1:tls, 2:sips (def:1)");
 #endif
     puts  ("  --registrar=url     Set the URL of registrar server");
@@ -223,5 +223,6 @@
     puts  ("  --mwi               Subscribe to message summary/waiting indication");
     puts  ("  --use-100rel        Require reliable provisional response (100rel)");
-    puts  ("  --use-timer         Require SIP session timers");
+    puts  ("  --use-timer=N       Use SIP session timers? (default=1)");
+    puts  ("                      0:inactive, 1:optional, 2:mandatory, 3:always");
     printf("  --timer-se=N        Session timers expiration period, in secs (def:%d)\n",
 	    PJSIP_SESS_TIMER_DEF_SE);
@@ -263,5 +264,5 @@
     puts  ("  --tls-verify-client Verify client's certificate (default=no)");
     puts  ("  --tls-neg-timeout   Specify TLS negotiation timeout (default=no)");
-    puts  ("  --tls-srv-name      Specify TLS server name for multi-hosting server (optional)");
+    puts  ("  --tls-srv-name      Specify TLS server name for multihosting server");
 
     puts  ("");
@@ -654,5 +655,5 @@
 #endif
 	{ "set-qos",	 0, 0, OPT_QOS},
-	{ "use-timer",  0, 0, OPT_TIMER},
+	{ "use-timer",  1, 0, OPT_TIMER},
 	{ "timer-se",   1, 0, OPT_TIMER_SE},
 	{ "timer-min-se", 1, 0, OPT_TIMER_MIN_SE},
@@ -882,6 +883,12 @@
 
 	case OPT_TIMER: /** session timer */
-	    cur_acc->require_timer = PJ_TRUE;
-	    cfg->cfg.require_timer = PJ_TRUE;
+	    lval = pj_strtoul(pj_cstr(&tmp, pj_optarg));
+	    if (lval < 0 || lval > 3) {
+		PJ_LOG(1,(THIS_FILE, 
+			  "Error: expecting integer value 0-3 for --use-timer"));
+		return PJ_EINVAL;
+	    }
+	    cur_acc->use_timer = lval;
+	    cfg->cfg.use_timer = lval;
 	    break;
 
@@ -1625,6 +1632,8 @@
 
     /* Session Timer extension */
-    if (acc_cfg->require_timer) {
-	pj_strcat2(result, "--use-timer\n");
+    if (acc_cfg->use_timer) {
+	pj_ansi_sprintf(line, "--use-timer %d\n",
+			      acc_cfg->use_timer);
+	pj_strcat2(result, line);
     }
     if (acc_cfg->timer_setting.min_se != 90) {
@@ -2104,6 +2113,8 @@
     }
     /* Session Timer extension */
-    if (config->cfg.require_timer) {
-	pj_strcat2(&cfg, "--use-timer\n");
+    if (config->cfg.use_timer) {
+	pj_ansi_sprintf(line, "--use-timer %d\n",
+			      config->cfg.use_timer);
+	pj_strcat2(&cfg, line);
     }
     if (config->cfg.timer_setting.min_se != 90) {
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3304)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3305)
@@ -887,4 +887,34 @@
 
 
+/**
+ * This enumeration specifies the usage of SIP Session Timers extension.
+ */
+typedef enum pjsua_sip_timer_use
+{
+    /**
+     * When this flag is specified, Session Timers will not be used in any
+     * session, except it is explicitly required in the remote request.
+     */
+    PJSUA_SIP_TIMER_INACTIVE,
+
+    /**
+     * When this flag is specified, Session Timers will be used in all 
+     * sessions whenever remote supports and uses it.
+     */
+    PJSUA_SIP_TIMER_OPTIONAL,
+
+    /**
+     * When this flag is specified, Session Timers support will be 
+     * a requirement for the remote to be able to establish a session.
+     */
+    PJSUA_SIP_TIMER_REQUIRED,
+
+    /**
+     * When this flag is specified, Session Timers will always be used
+     * in all sessions, regardless whether remote supports/uses it or not.
+     */
+    PJSUA_SIP_TIMER_ALWAYS
+
+} pjsua_sip_timer_use;
 
 
@@ -1034,11 +1064,11 @@
 
     /**
-     * Specify whether support for Session Timers should be required by 
-     * default. Note that this setting can be further customized in account
-     * configuration (#pjsua_acc_config).
-     *
-     * Default: PJ_FALSE
-     */
-    pj_bool_t	    require_timer;
+     * Specify the usage of Session Timers for all sessions. See the
+     * #pjsua_sip_timer_use for possible values. Note that this setting can be
+     * further customized in account configuration (#pjsua_acc_config).
+     *
+     * Default: PJSUA_SIP_TIMER_OPTIONAL
+     */
+    pjsua_sip_timer_use use_timer;
 
     /**
@@ -2099,10 +2129,10 @@
 
     /**
-     * Specify whether support for Session Timers should be required for all 
-     * sessions of this account.
-     *
-     * Default: PJ_FALSE
-     */
-    pj_bool_t	    require_timer;
+     * Specify the usage of Session Timers for all sessions. See the
+     * #pjsua_sip_timer_use for possible values.
+     *
+     * Default: PJSUA_SIP_TIMER_OPTIONAL
+     */
+    pjsua_sip_timer_use use_timer;
 
     /**
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3304)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3305)
@@ -738,5 +738,5 @@
 
     /* Session timer */
-    acc->cfg.require_timer = cfg->require_timer;
+    acc->cfg.use_timer = cfg->use_timer;
     acc->cfg.timer_setting = cfg->timer_setting;
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3304)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3305)
@@ -494,9 +494,13 @@
     /* Create the INVITE session: */
     options |= PJSIP_INV_SUPPORT_100REL;
-    options |= PJSIP_INV_SUPPORT_TIMER;
     if (acc->cfg.require_100rel)
 	options |= PJSIP_INV_REQUIRE_100REL;
-    if (acc->cfg.require_timer)
-	options |= PJSIP_INV_REQUIRE_TIMER;
+    if (acc->cfg.use_timer != PJSUA_SIP_TIMER_INACTIVE) {
+	options |= PJSIP_INV_SUPPORT_TIMER;
+	if (acc->cfg.use_timer == PJSUA_SIP_TIMER_REQUIRED)
+	    options |= PJSIP_INV_REQUIRE_TIMER;
+	else if (acc->cfg.use_timer == PJSUA_SIP_TIMER_ALWAYS)
+	    options |= PJSIP_INV_ALWAYS_USE_TIMER;
+    }
 
     status = pjsip_inv_create_uac( dlg, offer, options, &inv);
@@ -840,8 +844,10 @@
     if (pjsua_var.acc[acc_id].cfg.require_100rel)
 	options |= PJSIP_INV_REQUIRE_100REL;
-    if (pjsua_var.acc[acc_id].cfg.require_timer)
-	options |= PJSIP_INV_REQUIRE_TIMER;
     if (pjsua_var.media_cfg.enable_ice)
 	options |= PJSIP_INV_SUPPORT_ICE;
+    if (pjsua_var.acc[acc_id].cfg.use_timer == PJSUA_SIP_TIMER_REQUIRED)
+	options |= PJSIP_INV_REQUIRE_TIMER;
+    else if (pjsua_var.acc[acc_id].cfg.use_timer == PJSUA_SIP_TIMER_ALWAYS)
+	options |= PJSIP_INV_ALWAYS_USE_TIMER;
 
     status = pjsip_inv_verify_request2(rdata, &options, offer, answer, NULL,
@@ -909,4 +915,13 @@
     pjsip_auth_clt_set_prefs(&dlg->auth_sess, 
 			     &pjsua_var.acc[acc_id].cfg.auth_pref);
+
+    /* Disable Session Timers if not prefered and the incoming INVITE request
+     * did not require it.
+     */
+    if (pjsua_var.acc[acc_id].cfg.use_timer == PJSUA_SIP_TIMER_INACTIVE && 
+	(options & PJSIP_INV_REQUIRE_TIMER) == 0)
+    {
+	options &= ~(PJSIP_INV_SUPPORT_TIMER);
+    }
 
     /* Create invite session: */
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 3304)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 3305)
@@ -110,4 +110,5 @@
     cfg->hangup_forked_call = PJ_TRUE;
 
+    cfg->use_timer = PJSUA_SIP_TIMER_OPTIONAL;
     pjsip_timer_setting_default(&cfg->timer_setting);
 }
@@ -172,5 +173,5 @@
     cfg->allow_contact_rewrite = PJ_TRUE;
     cfg->require_100rel = pjsua_var.ua_cfg.require_100rel;
-    cfg->require_timer = pjsua_var.ua_cfg.require_timer;
+    cfg->use_timer = pjsua_var.ua_cfg.use_timer;
     cfg->timer_setting = pjsua_var.ua_cfg.timer_setting;
     cfg->ka_interval = 15;
