Index: /pjproject/trunk/pjsip/include/pjsip/sip_config.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_config.h	(revision 5089)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_config.h	(revision 5090)
@@ -218,4 +218,28 @@
     } regc;
 
+    /** TCP transport settings */
+    struct {
+        /**
+         * Set the interval to send keep-alive packet for TCP transports.
+         * If the value is zero, keep-alive will be disabled for TCP.
+         *
+         * Default is PJSIP_TCP_KEEP_ALIVE_INTERVAL.
+         */
+        long keep_alive_interval;
+
+    } tcp;
+
+    /** TLS transport settings */
+    struct {
+        /**
+         * Set the interval to send keep-alive packet for TLS transports.
+         * If the value is zero, keep-alive will be disabled for TLS.
+         *
+         * Default is PJSIP_TLS_KEEP_ALIVE_INTERVAL.
+         */
+        long keep_alive_interval;
+
+    } tls;
+
 } pjsip_cfg_t;
 
@@ -650,4 +674,7 @@
  * If the value is zero, keep-alive will be disabled for TCP.
  *
+ * This option can be changed in run-time by settting
+ * \a tcp.keep_alive_interval field of pjsip_cfg().
+ *
  * Default: 90 (seconds)
  *
@@ -672,4 +699,7 @@
  * Set the interval to send keep-alive packet for TLS transports.
  * If the value is zero, keep-alive will be disabled for TLS.
+ *
+ * This option can be changed in run-time by settting
+ * \a tls.keep_alive_interval field of pjsip_cfg().
  *
  * Default: 90 (seconds)
Index: /pjproject/trunk/pjsip/src/pjsip/sip_config.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_config.c	(revision 5089)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_config.c	(revision 5090)
@@ -50,4 +50,14 @@
     {
 	PJSIP_REGISTER_CLIENT_CHECK_CONTACT
+    },
+
+    /* TCP transport settings */
+    {
+        PJSIP_TCP_KEEP_ALIVE_INTERVAL
+    },
+
+    /* TLS transport settings */
+    {
+        PJSIP_TLS_KEEP_ALIVE_INTERVAL
     }
 };
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 5089)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 5090)
@@ -1141,6 +1141,6 @@
 	    }
 	    /* Start keep-alive timer */
-	    if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) {
-		pj_time_val delay = {PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0};
+	    if (pjsip_cfg()->tcp.keep_alive_interval) {
+		pj_time_val delay = {pjsip_cfg()->tcp.keep_alive_interval, 0};
 		pjsip_endpt_schedule_timer(listener->endpt, 
 					   &tcp->ka_timer, 
@@ -1500,6 +1500,6 @@
 
     /* Start keep-alive timer */
-    if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) {
-	pj_time_val delay = { PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0 };
+    if (pjsip_cfg()->tcp.keep_alive_interval) {
+	pj_time_val delay = { pjsip_cfg()->tcp.keep_alive_interval, 0 };
 	pjsip_endpt_schedule_timer(tcp->base.endpt, &tcp->ka_timer, 
 				   &delay);
@@ -1527,7 +1527,7 @@
     PJ_TIME_VAL_SUB(now, tcp->last_activity);
 
-    if (now.sec > 0 && now.sec < PJSIP_TCP_KEEP_ALIVE_INTERVAL) {
+    if (now.sec > 0 && now.sec < pjsip_cfg()->tcp.keep_alive_interval) {
 	/* There has been activity, so don't send keep-alive */
-	delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL - now.sec;
+	delay.sec = pjsip_cfg()->tcp.keep_alive_interval - now.sec;
 	delay.msec = 0;
 
@@ -1556,5 +1556,5 @@
 
     /* Register next keep-alive */
-    delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL;
+    delay.sec = pjsip_cfg()->tcp.keep_alive_interval;
     delay.msec = 0;
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c	(revision 5089)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c	(revision 5090)
@@ -1282,6 +1282,6 @@
     } else {
 	/* Start keep-alive timer */
-	if (PJSIP_TLS_KEEP_ALIVE_INTERVAL) {
-	    pj_time_val delay = {PJSIP_TLS_KEEP_ALIVE_INTERVAL, 0};
+	if (pjsip_cfg()->tls.keep_alive_interval) {
+	    pj_time_val delay = {pjsip_cfg()->tls.keep_alive_interval, 0};
 	    pjsip_endpt_schedule_timer(listener->endpt, 
 				       &tls->ka_timer, 
@@ -1748,6 +1748,6 @@
 
     /* Start keep-alive timer */
-    if (PJSIP_TLS_KEEP_ALIVE_INTERVAL) {
-	pj_time_val delay = { PJSIP_TLS_KEEP_ALIVE_INTERVAL, 0 };
+    if (pjsip_cfg()->tls.keep_alive_interval) {
+	pj_time_val delay = { pjsip_cfg()->tls.keep_alive_interval, 0 };
 	pjsip_endpt_schedule_timer(tls->base.endpt, &tls->ka_timer, 
 				   &delay);
@@ -1781,7 +1781,7 @@
     PJ_TIME_VAL_SUB(now, tls->last_activity);
 
-    if (now.sec > 0 && now.sec < PJSIP_TLS_KEEP_ALIVE_INTERVAL) {
+    if (now.sec > 0 && now.sec < pjsip_cfg()->tls.keep_alive_interval) {
 	/* There has been activity, so don't send keep-alive */
-	delay.sec = PJSIP_TLS_KEEP_ALIVE_INTERVAL - now.sec;
+	delay.sec = pjsip_cfg()->tls.keep_alive_interval - now.sec;
 	delay.msec = 0;
 
@@ -1811,5 +1811,5 @@
 
     /* Register next keep-alive */
-    delay.sec = PJSIP_TLS_KEEP_ALIVE_INTERVAL;
+    delay.sec = pjsip_cfg()->tls.keep_alive_interval;
     delay.msec = 0;
 
