Index: pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
===================================================================
--- pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp	(revision 2497)
+++ pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp	(revision 2498)
@@ -1131,5 +1131,5 @@
     af->dev_info.default_samples_per_sec = 8000;
     af->dev_info.caps = PJMEDIA_AUD_DEV_CAP_EXT_FORMAT |
-			PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING |
+			//PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING |
 			PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING |
 			PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE |
@@ -1141,11 +1141,25 @@
     af->dev_info.output_count = 1;
 
-    af->dev_info.ext_fmt_cnt = 6;
+    af->dev_info.ext_fmt_cnt = 5;
+
     af->dev_info.ext_fmt[0].id = PJMEDIA_FORMAT_AMR;
+    af->dev_info.ext_fmt[0].bitrate = 7400;
+    af->dev_info.ext_fmt[0].vad = PJ_TRUE;
+
     af->dev_info.ext_fmt[1].id = PJMEDIA_FORMAT_G729;
+    af->dev_info.ext_fmt[1].bitrate = 8000;
+    af->dev_info.ext_fmt[1].vad = PJ_FALSE;
+
     af->dev_info.ext_fmt[2].id = PJMEDIA_FORMAT_ILBC;
+    af->dev_info.ext_fmt[2].bitrate = 13333;
+    af->dev_info.ext_fmt[2].vad = PJ_TRUE;
+
     af->dev_info.ext_fmt[3].id = PJMEDIA_FORMAT_PCMU;
+    af->dev_info.ext_fmt[3].bitrate = 64000;
+    af->dev_info.ext_fmt[3].vad = PJ_FALSE;
+
     af->dev_info.ext_fmt[4].id = PJMEDIA_FORMAT_PCMA;
-    af->dev_info.ext_fmt[5].id = PJMEDIA_FORMAT_L16;
+    af->dev_info.ext_fmt[4].bitrate = 64000;
+    af->dev_info.ext_fmt[4].vad = PJ_FALSE;
     
     PJ_LOG(4, (THIS_FILE, "APS initialized"));
@@ -1207,5 +1221,4 @@
     param->bits_per_sample = BITS_PER_SAMPLE;
     param->flags = PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE;
-    param->ext_fmt.id = PJMEDIA_FORMAT_L16;
     param->output_route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE;
 
@@ -1359,4 +1372,11 @@
 
     pj_memcpy(pi, &strm->param, sizeof(*pi));
+
+    /* Update the output volume setting */
+    if (stream_get_cap(s, PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING,
+		       &pi->output_vol) == PJ_SUCCESS)
+    {
+	pi->flags |= PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING;
+    }
     
     return PJ_SUCCESS;
@@ -1380,4 +1400,7 @@
 	}
 	break;
+    
+    /* There is a case that GetMaxGain() stucks, e.g: in N95. */ 
+    /*
     case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING:
 	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
@@ -1395,4 +1418,6 @@
 	}
 	break;
+    */
+
     case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING:
 	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
@@ -1453,4 +1478,7 @@
 	}
 	break;
+
+    /* There is a case that GetMaxGain() stucks, e.g: in N95. */ 
+    /*
     case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING:
 	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
@@ -1467,8 +1495,12 @@
 		status = PJMEDIA_EAUD_NOTREADY;
 	    }
-	}
-	break;
+	    if (status == PJ_SUCCESS)
+		strm->param.input_vol = *(unsigned*)pval;
+	}
+	break;
+    */
+
     case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING:
-	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
 	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
 	    
@@ -1483,4 +1515,6 @@
 		status = PJMEDIA_EAUD_NOTREADY;
 	    }
+	    if (status == PJ_SUCCESS)
+		strm->param.output_vol = *(unsigned*)pval;
 	}
 	break;
Index: pjproject/branches/projects/aps-direct/pjsip-apps/src/symbian_ua/ua.cpp
===================================================================
--- pjproject/branches/projects/aps-direct/pjsip-apps/src/symbian_ua/ua.cpp	(revision 2497)
+++ pjproject/branches/projects/aps-direct/pjsip-apps/src/symbian_ua/ua.cpp	(revision 2498)
@@ -535,31 +535,23 @@
     case 't':
 	{
-	    pjmedia_aud_stream *aud_stream = pjsua_get_aud_stream();
-
-	    if (aud_stream) {
-		pjmedia_aud_dev_route route;
-		pj_status_t status;
-		
-		status = pjmedia_aud_stream_get_cap(
-					    aud_stream,
-					    PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,
-					    &route);
-		if (status == PJ_SUCCESS) {
-		    if (route == PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER)
-			route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE;
-		    else
-			route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
-
-		    status = pjmedia_aud_stream_set_cap(
-					aud_stream,
-					PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,
-					&route);
-		}
-
-		if (status != PJ_SUCCESS)
-		    pjsua_perror(THIS_FILE, "Error switch audio route", status);
-	    } else {
-		PJ_LOG(3,(THIS_FILE, "No active sound device."));
+	    pjmedia_aud_dev_route route;
+	    pj_status_t status;
+	    
+	    status = pjsua_snd_get_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, 
+					   &route);
+	    
+	    if (status == PJ_SUCCESS) {
+		if (route == PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER)
+		    route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE;
+		else
+		    route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
+
+		status = pjsua_snd_set_setting(
+				    PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,
+				    &route, PJ_TRUE);
 	    }
+
+	    if (status != PJ_SUCCESS)
+		pjsua_perror(THIS_FILE, "Error switch audio route", status);
 	}
 	break;
