Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c (revision 4708)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c (revision 4709)
@@ -86,4 +86,5 @@
#define CMD_MEDIA_ADJUST_VOL ((CMD_MEDIA*10)+4)
#define CMD_MEDIA_CODEC_PRIO ((CMD_MEDIA*10)+5)
+#define CMD_MEDIA_SPEAKER_TOGGLE ((CMD_MEDIA*10)+6)
/* status & config level 2 command */
@@ -1342,4 +1343,29 @@
case CMD_MEDIA_CODEC_PRIO:
status = cmd_set_codec_prio(cval);
+ break;
+ case CMD_MEDIA_SPEAKER_TOGGLE:
+ {
+ static int route = PJMEDIA_AUD_DEV_ROUTE_DEFAULT;
+ status = pjsua_snd_get_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,
+ &route);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(2, (THIS_FILE, status,
+ "Warning: unable to retrieve route setting"));
+ }
+
+ if (route == PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER)
+ route = PJMEDIA_AUD_DEV_ROUTE_DEFAULT;
+ else
+ route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
+
+ PJ_LOG(4,(THIS_FILE, "Setting output route to %s %s",
+ (route==PJMEDIA_AUD_DEV_ROUTE_DEFAULT?
+ "default" : "loudspeaker"),
+ (status? "anyway" : "")));
+
+ status = pjsua_snd_set_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,
+ &route, PJ_TRUE);
+ PJ_PERROR(4,(THIS_FILE, status, "Result"));
+ }
break;
}
@@ -2831,4 +2857,5 @@
" "
" "
+ " "
" "