Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3631)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3632)
@@ -3135,4 +3135,13 @@
 
 /*
+ * Notification on sound device operation.
+ */
+static pj_status_t on_snd_dev_operation(int operation)
+{
+    PJ_LOG(3,(THIS_FILE, "Turning sound device %s", (operation? "ON":"OFF")));
+    return PJ_SUCCESS;
+}
+
+/*
  * Print buddy list.
  */
@@ -5052,4 +5061,5 @@
     app_config.cfg.cb.on_transport_state = &on_transport_state;
     app_config.cfg.cb.on_ice_transport_error = &on_ice_transport_error;
+    app_config.cfg.cb.on_snd_dev_operation = &on_snd_dev_operation;
     app_config.log_cfg.cb = log_cb;
 
Index: pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua.h	(revision 3631)
+++ pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua.h	(revision 3632)
@@ -962,4 +962,21 @@
 				   pj_status_t status, void *param);
 
+    /**
+     * Callback when the sound device is about to be opened or closed.
+     * This callback will be called even when null sound device or no
+     * sound device is configured by the application (i.e. the
+     * #pjsua_set_null_snd_dev() and #pjsua_set_no_snd_dev() APIs).
+     * This API is mostly useful when the application wants to manage
+     * the sound device by itself (i.e. with #pjsua_set_no_snd_dev()),
+     * to get notified when it should open or close the sound device.
+     *
+     * @param operation	The value will be set to 0 to signal that sound
+     * 			device is about to be closed, and 1 to be opened.
+     *
+     * @return		The callback must return PJ_SUCCESS at the moment.
+     */
+    pj_status_t (*on_snd_dev_operation)(int operation);
+
+
 } pjsua_callback;
 
Index: pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua_internal.h
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 3631)
+++ pjproject/branches/projects/2.0-dev/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 3632)
@@ -401,5 +401,5 @@
     pjmedia_master_port	*null_snd;  /**< Master port for null sound.	*/
     pjmedia_port	*null_port; /**< Null port.			*/
-
+    pj_bool_t		 snd_is_on; /**< Media flow is currently active */
 
     /* Video device */
Index: pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3631)
+++ pjproject/branches/projects/2.0-dev/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3632)
@@ -377,6 +377,9 @@
      * It is idle when there is no port connection in the bridge and
      * there is no active call.
+     *
+     * Note: this block is now valid if no snd dev is used because of #1299
      */
-    if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL) &&
+    if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL ||
+	    pjsua_var.no_snd) &&
 	pjsua_var.snd_idle_timer.id == PJ_FALSE &&
 	pjmedia_conf_get_connect_count(pjsua_var.mconf) == 0 &&
@@ -2422,4 +2425,12 @@
 		}
 	    }
+	} else if (pjsua_var.no_snd) {
+	    if (!pjsua_var.snd_is_on) {
+		pjsua_var.snd_is_on = PJ_TRUE;
+	    	/* Notify app */
+	    	if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
+	    	    (*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1);
+	    	}
+	    }
 	}
 
@@ -2438,6 +2449,11 @@
 		return status;
 	    }
-	}
-
+	} else if (pjsua_var.no_snd && !pjsua_var.snd_is_on) {
+	    pjsua_var.snd_is_on = PJ_TRUE;
+	    /* Notify app */
+	    if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
+		(*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1);
+	    }
+	}
     }
 
@@ -3093,4 +3109,9 @@
     /* Close existing sound port */
     close_snd_dev();
+
+    /* Notify app */
+    if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
+	(*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1);
+    }
 
     /* Create memory pool for sound device. */
@@ -3230,4 +3251,9 @@
 static void close_snd_dev(void)
 {
+    /* Notify app */
+    if (pjsua_var.snd_is_on && pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
+	(*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(0);
+    }
+
     /* Close sound device */
     if (pjsua_var.snd_port) {
@@ -3263,4 +3289,5 @@
 	pj_pool_release(pjsua_var.snd_pool);
     pjsua_var.snd_pool = NULL;
+    pjsua_var.snd_is_on = PJ_FALSE;
 }
 
@@ -3325,4 +3352,5 @@
 
     pjsua_var.no_snd = PJ_FALSE;
+    pjsua_var.snd_is_on = PJ_TRUE;
 
     return PJ_SUCCESS;
@@ -3359,4 +3387,9 @@
     /* Close existing sound device */
     close_snd_dev();
+
+    /* Notify app */
+    if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
+	(*pjsua_var.ua_cfg.cb.on_snd_dev_operation)(1);
+    }
 
     /* Create memory pool for sound device. */
@@ -3389,4 +3422,5 @@
 
     pjsua_var.no_snd = PJ_FALSE;
+    pjsua_var.snd_is_on = PJ_TRUE;
 
     return PJ_SUCCESS;
