Index: /pjproject/branches/users/nanang/pjmedia/include/pjmedia/config.h
===================================================================
--- /pjproject/branches/users/nanang/pjmedia/include/pjmedia/config.h	(revision 1722)
+++ /pjproject/branches/users/nanang/pjmedia/include/pjmedia/config.h	(revision 1723)
@@ -496,4 +496,12 @@
 
 
+/**
+ * SRTP Transport
+ * By default it is enabled.
+ */
+#ifndef PJMEDIA_HAS_SRTP
+#   define PJMEDIA_HAS_SRTP			    1
+#endif
+
 
 /**
Index: /pjproject/branches/users/nanang/pjmedia/include/pjmedia/errno.h
===================================================================
--- /pjproject/branches/users/nanang/pjmedia/include/pjmedia/errno.h	(revision 1722)
+++ /pjproject/branches/users/nanang/pjmedia/include/pjmedia/errno.h	(revision 1723)
@@ -58,5 +58,7 @@
 
 
-/**
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+
+ /**
  * Mapping from LibSRTP error codes to pjmedia error space.
  */
@@ -69,4 +71,5 @@
 #define PJMEDIA_ERRNO_FROM_LIBSRTP(err)   (PJMEDIA_LIBSRTP_ERRNO_START+err)
 
+#endif
 
 /************************************************************
@@ -541,4 +544,5 @@
 
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 /************************************************************
  * SRTP TRANSPORT ERRORS
@@ -594,4 +598,6 @@
  */
 #define PJMEDIA_SRTP_ESDPREQSECTP   (PJMEDIA_ERRNO_START+229)    /* 220229 */
+
+#endif /* PJMEDIA_HAS_SRTP */
 
 
Index: /pjproject/branches/users/nanang/pjmedia/src/pjmedia/errno.c
===================================================================
--- /pjproject/branches/users/nanang/pjmedia/src/pjmedia/errno.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjmedia/src/pjmedia/errno.c	(revision 1723)
@@ -146,4 +146,5 @@
     PJ_BUILD_ERR( PJMEDIA_ESNDINSAMPLEFMT,  "Invalid sample format for sound device" ),
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* SRTP transport errors: */
     PJ_BUILD_ERR( PJMEDIA_SRTP_ECRYPTONOTMATCH, "SRTP crypto-suite name not match the offerer tag" ),
@@ -157,4 +158,6 @@
     PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQCRYPTO,   "SRTP crypto attribute required" ),
     PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQSECTP,    "Secure transport required in SDP media descriptor" )
+#endif
+
 };
 
Index: /pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_srtp.c
===================================================================
--- /pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_srtp.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_srtp.c	(revision 1723)
@@ -26,4 +26,7 @@
 #include <pj/os.h>
 #include <pj/pool.h>
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+
 #include <srtp.h>
 
@@ -1228,2 +1231,4 @@
     return pjmedia_transport_srtp_stop(tp);
 }
+
+#endif
Index: /pjproject/branches/users/nanang/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/branches/users/nanang/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1723)
@@ -121,5 +121,7 @@
     puts  ("SIP Account options:");
     puts  ("  --use-ims           Enable 3GPP/IMS related settings on this account");
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     puts  ("  --use-srtp=N        Use SRTP N= 0: disabled, 1: optional, 2: mandatory");
+#endif
     puts  ("  --registrar=url     Set the URL of registrar server");
     puts  ("  --id=url            Set the URL of local ID (used in From header)");
@@ -443,5 +445,7 @@
 	{ "rtp-port",	1, 0, OPT_RTP_PORT},
 	{ "use-ice",    0, 0, OPT_USE_ICE},
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 	{ "use-srtp",   1, 0, OPT_USE_SRTP},
+#endif
 	{ "add-codec",  1, 0, OPT_ADD_CODEC},
 	{ "dis-codec",  1, 0, OPT_DIS_CODEC},
@@ -474,5 +478,4 @@
     pjsua_acc_config *cur_acc;
     char *config_file = NULL;
-    int use_srtp = -1;
     unsigned i;
 
@@ -800,12 +803,13 @@
 	    break;
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 	case OPT_USE_SRTP:
-	    use_srtp = my_atoi(pj_optarg);
-	    if (!pj_isdigit(*pj_optarg) || use_srtp > 2) {
+	    app_config.cfg.use_srtp = my_atoi(pj_optarg);
+	    if (!pj_isdigit(*pj_optarg) || app_config.cfg.use_srtp > 2) {
 		PJ_LOG(1,(THIS_FILE, "Invalid value for --use-srtp option"));
 		return -1;
 	    }
-	    app_config.cfg.use_srtp = use_srtp;
-	    break;
+	    break;
+#endif
 
 	case OPT_RTP_PORT:
@@ -1039,6 +1043,4 @@
     for (i=0; i<cfg->acc_cnt; ++i) {
 	pjsua_acc_config *acfg = &cfg->acc_cfg[i];
-
-	acfg->use_srtp = (pjmedia_srtp_use) use_srtp;
 
 	if (acfg->cred_info[acfg->cred_count].username.slen)
@@ -1126,4 +1128,5 @@
     }
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* SRTP */
     if (acc_cfg->use_srtp) {
@@ -1132,4 +1135,5 @@
 	pj_strcat2(result, line);
     }
+#endif
 
     /* Proxy */
Index: /pjproject/branches/users/nanang/pjsip-apps/src/samples/streamutil.c
===================================================================
--- /pjproject/branches/users/nanang/pjsip-apps/src/samples/streamutil.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip-apps/src/samples/streamutil.c	(revision 1723)
@@ -56,4 +56,6 @@
  "  --send-only           Set stream direction to send only		\n"
  "  --recv-only           Set stream direction to recv only (default)   \n"
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
  "  --use-srtp[=NAME]     Enable SRTP with crypto suite NAME            \n"
  "                        e.g: AES_CM_128_HMAC_SHA1_80 (default),       \n"
@@ -63,4 +65,6 @@
  "  --srtp-tx-key         SRTP key for transmiting                      \n"
  "  --srtp-rx-key         SRTP key for receiving                        \n"
+#endif
+
  "\n"
 ;
@@ -133,14 +137,18 @@
 				  pj_uint16_t local_port,
 				  const pj_sockaddr_in *rem_addr,
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 				  pj_bool_t use_srtp,
 				  const pj_str_t *crypto_suite,
 				  const pj_str_t *srtp_tx_key,
 				  const pj_str_t *srtp_rx_key,
+#endif
 				  pjmedia_stream **p_stream )
 {
     pjmedia_stream_info info;
     pjmedia_transport *transport = NULL;
+    pj_status_t status;
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     pjmedia_transport *srtp_tp = NULL;
-    pj_status_t status;
+#endif
 
 
@@ -174,4 +182,5 @@
 	return status;
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* Check if SRTP enabled */
     if (use_srtp) {
@@ -194,5 +203,8 @@
 	if (status != PJ_SUCCESS)
 	    return status;
-    }
+
+	transport = srtp_tp;
+    }
+#endif
 
     /* Now that the stream info is initialized, we can create the 
@@ -201,5 +213,5 @@
 
     status = pjmedia_stream_create( med_endpt, pool, &info, 
-				    (use_srtp?srtp_tp:transport), 
+				    transport, 
 				    NULL, p_stream);
 
@@ -239,4 +251,5 @@
     pj_status_t status; 
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* SRTP variables */
     pj_bool_t use_srtp = PJ_FALSE;
@@ -247,4 +260,5 @@
     pj_str_t  srtp_crypto_suite = {NULL, 0};
     int	tmp_key_len;
+#endif
 
     /* Default values */
@@ -266,5 +280,7 @@
 	OPT_SEND_ONLY	= 's',
 	OPT_RECV_ONLY	= 'i',
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 	OPT_USE_SRTP	= 'S',
+#endif
 	OPT_SRTP_TX_KEY	= 'x',
 	OPT_SRTP_RX_KEY	= 'y',
@@ -281,7 +297,9 @@
 	{ "send-only",      0, 0, OPT_SEND_ONLY },
 	{ "recv-only",      0, 0, OPT_RECV_ONLY },
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 	{ "use-srtp",	    2, 0, OPT_USE_SRTP },
 	{ "srtp-tx-key",    1, 0, OPT_SRTP_TX_KEY },
 	{ "srtp-rx-key",    1, 0, OPT_SRTP_RX_KEY },
+#endif
 	{ "help",	    0, 0, OPT_HELP },
 	{ NULL, 0, 0, 0 },
@@ -350,4 +368,5 @@
 	    break;
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 	case OPT_USE_SRTP:
 	    use_srtp = PJ_TRUE;
@@ -368,4 +387,5 @@
 	    pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2);
 	    break;
+#endif
 
 	case OPT_HELP:
@@ -394,7 +414,8 @@
     }
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* SRTP validation */
     if (use_srtp) {
-	if (((dir & PJMEDIA_DIR_ENCODING) && !srtp_tx_key.slen) ||
-	    ((dir & PJMEDIA_DIR_DECODING) && !srtp_rx_key.slen))
+	if (!srtp_tx_key.slen || !srtp_rx_key.slen)
 	{
 	    printf("Error: Key for each SRTP stream direction must be set\n");
@@ -402,4 +423,5 @@
 	}
     }
+#endif
 
     /* Must create a pool factory before we can allocate any memory. */
@@ -448,6 +470,8 @@
     status = create_stream(pool, med_endpt, codec_info, dir, local_port, 
 			   &remote_addr, 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
 			   use_srtp, &srtp_crypto_suite, 
 			   &srtp_tx_key, &srtp_rx_key,
+#endif
 			   &stream);
     if (status != PJ_SUCCESS)
Index: /pjproject/branches/users/nanang/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/branches/users/nanang/pjsip/include/pjsua-lib/pjsua.h	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip/include/pjsua-lib/pjsua.h	(revision 1723)
@@ -404,5 +404,26 @@
 #endif
 
-
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+
+/**
+ * Default value of SRTP mode usage. Valid values are PJMEDIA_SRTP_DISABLED, 
+ * PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY.
+ */
+#ifndef PJSUA_DEFAULT_USE_SRTP
+    #define PJSUA_DEFAULT_USE_SRTP  PJMEDIA_SRTP_DISABLED
+#endif
+
+/**
+ * Default value of secure signaling requirement for SRTP.
+ * Valid values are:
+ *	0: SRTP does not require secure signaling
+ *	1: SRTP requires secure transport such as TLS
+ *	2: SRTP requires secure end-to-end transport (SIPS)
+ */
+#ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
+    #define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 0
+#endif
+
+#endif
 
 /**
@@ -1035,4 +1056,5 @@
     pj_str_t	    user_agent;
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /**
      * Specify default value of secure media transport usage. 
@@ -1043,6 +1065,5 @@
      * configuration (#pjsua_acc_config).
      *
-     * Default:
-     *	PJMEDIA_SRTP_DISABLED
+     * Default: #PJSUA_DEFAULT_USE_SRTP
      */
     pjmedia_srtp_use	use_srtp;
@@ -1060,7 +1081,8 @@
      * configuration (#pjsua_acc_config).
      *
-     * Default: 0
+     * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
      */
     int		     srtp_secure_signaling;
+#endif
 
 } pjsua_config;
@@ -2001,4 +2023,5 @@
     pj_str_t	     ka_data;
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /**
      * Specify whether secure media transport should be used for this account.
@@ -2006,6 +2029,5 @@
      * PJMEDIA_SRTP_MANDATORY.
      *
-     * Default:
-     *	PJMEDIA_SRTP_DISABLED
+     * Default: #PJSUA_DEFAULT_USE_SRTP
      */
     pjmedia_srtp_use	use_srtp;
@@ -2020,7 +2042,8 @@
      *	2: SRTP requires secure end-to-end transport (SIPS)
      *
-     * Default: 0
+     * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
      */
     int		     srtp_secure_signaling;
+#endif
 
 } pjsua_acc_config;
Index: /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1723)
@@ -627,8 +627,12 @@
     acc_id = call->acc_id = pjsua_acc_find_for_incoming(rdata);
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* Get signaling security level, only when required by SRTP */
     if (pjsua_var.acc[acc_id].cfg.srtp_secure_signaling < 2) {
 	secure_level = PJSIP_TRANSPORT_IS_SECURE(rdata->tp_info.transport)!=0;
-    } else {
+    } else 
+#endif
+
+    {
 	char *uri;
 	int uri_len;
Index: /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1723)
@@ -88,4 +88,8 @@
     cfg->thread_cnt = 1;
     cfg->nat_type_in_sdp = 1;
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    cfg->use_srtp = PJSUA_DEFAULT_USE_SRTP;
+    cfg->srtp_secure_signaling = PJSUA_DEFAULT_SRTP_SECURE_SIGNALING;
+#endif
 }
 
@@ -143,6 +147,8 @@
     cfg->ka_interval = 15;
     cfg->ka_data = pj_str("\r\n");
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     cfg->use_srtp = pjsua_var.ua_cfg.use_srtp;
     cfg->srtp_secure_signaling = pjsua_var.ua_cfg.srtp_secure_signaling;
+#endif
 }
 
Index: /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_media.c	(revision 1722)
+++ /pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_media.c	(revision 1723)
@@ -750,8 +750,11 @@
 {
     pjsua_call *call = &pjsua_var.calls[call_id];
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     pjsua_acc *acc = &pjsua_var.acc[call->acc_id];
     pjmedia_srtp_setting srtp_opt;
     pjmedia_transport *srtp;
     pj_status_t status;
+#endif
 
     PJ_UNUSED_ARG(role);
@@ -767,4 +770,5 @@
     pjmedia_transport_media_stop(call->med_tp);
 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
     /* Check if SRTP requires secure signaling */
     if (acc->cfg.use_srtp != PJMEDIA_SRTP_DISABLED) {
@@ -787,4 +791,8 @@
     call->med_orig = call->med_tp;
     call->med_tp = srtp;
+#else
+    call->med_orig = call->med_tp;
+    PJ_UNUSED_ARG(security_level);
+#endif
 
     return PJ_SUCCESS;
