Index: pjproject/trunk/pjmedia/include/pjmedia/audiodev.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/audiodev.h	(revision 5676)
+++ pjproject/trunk/pjmedia/include/pjmedia/audiodev.h	(revision 5677)
@@ -50,5 +50,5 @@
  * Device index constants.
  */
-enum
+typedef enum pjmedia_aud_dev_id
 {
     /** 
@@ -66,5 +66,5 @@
      */
     PJMEDIA_AUD_INVALID_DEV = -3
-};
+} pjmedia_aud_dev_id;
 
 
Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 5676)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 5677)
@@ -960,5 +960,9 @@
 static pj_status_t on_snd_dev_operation(int operation)
 {
-    PJ_LOG(3,(THIS_FILE, "Turning sound device %s", (operation? "ON":"OFF")));
+    int cap_dev, play_dev;
+
+    pjsua_get_snd_dev(&cap_dev, &play_dev);
+    PJ_LOG(3,(THIS_FILE, "Turning sound device %d %d %s", cap_dev, play_dev,
+    	      (operation? "ON":"OFF")));
     return PJ_SUCCESS;
 }
Index: pjproject/trunk/pjsip-apps/src/swig/symbols.i
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5676)
+++ pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5677)
@@ -56,4 +56,6 @@
 
 typedef enum pjmedia_vid_dev_cap {PJMEDIA_VID_DEV_CAP_FORMAT = 1, PJMEDIA_VID_DEV_CAP_INPUT_SCALE = 2, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW = 4, PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE = 8, PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION = 16, PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE = 32, PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW = 64, PJMEDIA_VID_DEV_CAP_ORIENTATION = 128, PJMEDIA_VID_DEV_CAP_SWITCH = 256, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS = 512, PJMEDIA_VID_DEV_CAP_MAX = 16384} pjmedia_vid_dev_cap;
+
+typedef enum pjmedia_aud_dev_id {PJMEDIA_AUD_DEFAULT_CAPTURE_DEV = -1, PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV = -2, PJMEDIA_AUD_INVALID_DEV = -3} pjmedia_aud_dev_id;
 
 typedef enum pjmedia_aud_dev_route {PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0, PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1, PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2, PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4, PJMEDIA_AUD_DEV_ROUTE_CUSTOM = 128} pjmedia_aud_dev_route;
@@ -174,4 +176,6 @@
 typedef enum pjsua_create_media_transport_flag {PJSUA_MED_TP_CLOSE_MEMBER = 1} pjsua_create_media_transport_flag;
 
+typedef enum pjsua_snd_dev_id {PJSUA_SND_DEFAULT_CAPTURE_DEV = PJMEDIA_AUD_DEFAULT_CAPTURE_DEV, PJSUA_SND_DEFAULT_PLAYBACK_DEV = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV, PJSUA_SND_NO_DEV = PJMEDIA_AUD_INVALID_DEV, PJSUA_SND_NULL_DEV = -99} pjsua_snd_dev_id;
+
 typedef enum pjsua_snd_dev_mode {PJSUA_SND_DEV_SPEAKER_ONLY = 1, PJSUA_SND_DEV_NO_IMMEDIATE_OPEN = 2} pjsua_snd_dev_mode;
 
Index: pjproject/trunk/pjsip-apps/src/swig/symbols.lst
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/symbols.lst	(revision 5676)
+++ pjproject/trunk/pjsip-apps/src/swig/symbols.lst	(revision 5677)
@@ -12,5 +12,5 @@
 pjmedia/vid_stream.h		pjmedia_vid_stream_rc_method
 pjmedia-videodev/videodev.h	pjmedia_vid_dev_index pjmedia_vid_dev_std_index pjmedia_vid_dev_cap
-pjmedia-audiodev/audiodev.h 	pjmedia_aud_dev_route pjmedia_aud_dev_cap
+pjmedia-audiodev/audiodev.h 	pjmedia_aud_dev_id pjmedia_aud_dev_route pjmedia_aud_dev_cap
 pjmedia/wav_port.h              pjmedia_file_writer_option pjmedia_file_player_option
 pjmedia/tonegen.h		pjmedia_tone_digit pjmedia_tone_digit_map pjmedia_tone_desc
@@ -34,3 +34,3 @@
 pjsip-ua/sip_inv.h              pjsip_inv_state
 
-pjsua-lib/pjsua.h		pjsua_invalid_id_const_ pjsua_state pjsua_stun_use pjsua_call_hold_type pjsua_acc_id pjsua_destroy_flag pjsua_100rel_use pjsua_sip_timer_use pjsua_ipv6_use pjsua_nat64_opt pjsua_buddy_status pjsua_call_media_status pjsua_vid_win_id pjsua_call_id pjsua_med_tp_st pjsua_call_vid_strm_op pjsua_vid_req_keyframe_method pjsua_call_flag pjsua_create_media_transport_flag pjsua_snd_dev_mode pjsua_ip_change_op
+pjsua-lib/pjsua.h		pjsua_invalid_id_const_ pjsua_state pjsua_stun_use pjsua_call_hold_type pjsua_acc_id pjsua_destroy_flag pjsua_100rel_use pjsua_sip_timer_use pjsua_ipv6_use pjsua_nat64_opt pjsua_buddy_status pjsua_call_media_status pjsua_vid_win_id pjsua_call_id pjsua_med_tp_st pjsua_call_vid_strm_op pjsua_vid_req_keyframe_method pjsua_call_flag pjsua_create_media_transport_flag pjsua_snd_dev_id pjsua_snd_dev_mode pjsua_ip_change_op
Index: pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 5676)
+++ pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 5677)
@@ -1447,5 +1447,8 @@
      * 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
+     * Application can use the API #pjsua_get_snd_dev() to get the info
+     * about which sound device is going to be opened/closed.
+     *
+     * This callback 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.
@@ -6407,4 +6410,32 @@
 } pjsua_media_transport;
 
+
+/**
+ * Sound device index constants.
+ */
+typedef enum pjsua_snd_dev_id
+{
+    /** 
+     * Constant to denote default capture device.
+     */
+    PJSUA_SND_DEFAULT_CAPTURE_DEV = PJMEDIA_AUD_DEFAULT_CAPTURE_DEV,
+
+    /** 
+     * Constant to denote default playback device.
+     */
+    PJSUA_SND_DEFAULT_PLAYBACK_DEV = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV,
+
+    /**
+     * Constant to denote that no sound device is being used.
+     */
+    PJSUA_SND_NO_DEV = PJMEDIA_AUD_INVALID_DEV,
+
+    /**
+     * Constant to denote null sound device.
+     */
+    PJSUA_SND_NULL_DEV = -99
+
+} pjsua_snd_dev_id;
+
 /**
  * This enumeration specifies the sound device mode.
@@ -6826,4 +6857,5 @@
  * (for example when pjsua_start() is not called), it is possible that
  * the function returns PJ_SUCCESS with -1 as device IDs.
+ * See also #pjsua_snd_dev_id constants.
  *
  * @param capture_dev   On return it will be filled with device ID of the 
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c	(revision 5676)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c	(revision 5677)
@@ -24,5 +24,4 @@
 
 #define THIS_FILE		"pjsua_aud.c"
-#define NULL_SND_DEV_ID		-99
 
 /*****************************************************************************
@@ -881,5 +880,5 @@
 
 	if (need_reopen) {
-	    if (pjsua_var.cap_dev != NULL_SND_DEV_ID) {
+	    if (pjsua_var.cap_dev != PJSUA_SND_NULL_DEV) {
 		pjmedia_snd_port_param param;
 
@@ -1728,6 +1727,6 @@
 
     /* Check if NULL sound device is used */
-    if (NULL_SND_DEV_ID==param->base.rec_id ||
-	NULL_SND_DEV_ID==param->base.play_id)
+    if (PJSUA_SND_NULL_DEV==param->base.rec_id ||
+	PJSUA_SND_NULL_DEV==param->base.play_id)
     {
 	return pjsua_set_null_snd_dev();
@@ -1736,4 +1735,8 @@
     /* Close existing sound port */
     close_snd_dev();
+
+    /* Save the device IDs */
+    pjsua_var.cap_dev = param->base.rec_id;
+    pjsua_var.play_dev = param->base.play_id;
 
     /* Notify app */
@@ -1853,8 +1856,4 @@
     }
 
-    /* Save the device IDs */
-    pjsua_var.cap_dev = param->base.rec_id;
-    pjsua_var.play_dev = param->base.play_id;
-
     /* Update sound device name. */
     {
@@ -2010,6 +2009,6 @@
     
     /* Null-sound */
-    if (snd_param->capture_dev == NULL_SND_DEV_ID && 
-	snd_param->playback_dev == NULL_SND_DEV_ID) 
+    if (snd_param->capture_dev == PJSUA_SND_NULL_DEV && 
+	snd_param->playback_dev == PJSUA_SND_NULL_DEV) 
     {
 	PJSUA_UNLOCK();
@@ -2130,4 +2129,7 @@
     close_snd_dev();
 
+    pjsua_var.cap_dev = PJSUA_SND_NULL_DEV;
+    pjsua_var.play_dev = PJSUA_SND_NULL_DEV;
+
     /* Notify app */
     if (pjsua_var.ua_cfg.cb.on_snd_dev_operation) {
@@ -2162,7 +2164,4 @@
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
 
-    pjsua_var.cap_dev = NULL_SND_DEV_ID;
-    pjsua_var.play_dev = NULL_SND_DEV_ID;
-
     pjsua_var.no_snd = PJ_FALSE;
     pjsua_var.snd_is_on = PJ_TRUE;
@@ -2185,4 +2184,6 @@
     close_snd_dev();
     pjsua_var.no_snd = PJ_TRUE;
+    pjsua_var.cap_dev = PJSUA_SND_NO_DEV;
+    pjsua_var.play_dev = PJSUA_SND_NO_DEV;
 
     PJSUA_UNLOCK();
