summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2014-01-22 08:02:56 +0000
committerBenny Prijono <bennylp@teluu.com>2014-01-22 08:02:56 +0000
commitde8a2c971397c585abea5bbc515cd77c2008ca81 (patch)
treec60f6d7a1754a70d1831d08cac910e8d7c38bad8
parent8c5296fba455adc138bce1d8c643659db575c7b1 (diff)
More re #1655: added CLI command to toggle audio output route
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4709 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app_cli.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app_cli.c b/pjsip-apps/src/pjsua/pjsua_app_cli.c
index a7f8c4eb..e8639d3f 100644
--- a/pjsip-apps/src/pjsua/pjsua_app_cli.c
+++ b/pjsip-apps/src/pjsua/pjsua_app_cli.c
@@ -85,6 +85,7 @@
#define CMD_MEDIA_CONF_DISCONNECT ((CMD_MEDIA*10)+3)
#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 */
#define CMD_CONFIG_DUMP_STAT ((CMD_CONFIG*10)+1)
@@ -1342,6 +1343,31 @@ pj_status_t cmd_media_handler(pj_cli_cmd_val *cval)
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;
}
return status;
@@ -2830,6 +2856,7 @@ static pj_status_t add_media_command(pj_cli_t *cli)
" <ARG name='mic_level' type='int' desc='Mic Level'/>"
" <ARG name='speaker_port' type='int' desc='Speaker Level'/>"
" </CMD>"
+ " <CMD name='speakertog' id='4006' desc='Toggle audio output route' />"
" <CMD name='codec_prio' id='4005' sc='Cp' "
" desc='Arrange codec priorities'>"
" <ARG name='codec_id' type='choice' id='9904' desc='Codec Id'/>"