summaryrefslogtreecommitdiff
path: root/pjsip-apps
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-08-07 12:11:40 +0000
committerBenny Prijono <bennylp@teluu.com>2006-08-07 12:11:40 +0000
commit0f726e6d59f037f16ec85ea37d46b45d8c381278 (patch)
tree424e5d39b8d0d17a830626dedebd3c5a1ad08646 /pjsip-apps
parentc14e6bf7c11fb28266cab45ccaa477a54fe3fd59 (diff)
Added --auto-conf options in pjsua, also enable speex/3200, and set quality 5 to use large resampling filter
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@659 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index f76aebdd..4aaa212d 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -52,6 +52,7 @@ static struct app_config
pjsua_conf_port_id wav_port;
pj_bool_t auto_play;
pj_bool_t auto_loop;
+ pj_bool_t auto_conf;
unsigned ptime;
unsigned auto_answer;
unsigned duration;
@@ -122,6 +123,7 @@ static void usage(void)
puts (" --play-file=file Play WAV file in conference bridge");
puts (" --auto-play Automatically play the file (to incoming calls only)");
puts (" --auto-loop Automatically loop incoming RTP to outgoing RTP");
+ puts (" --auto-conf Automatically put calls in conference with others");
puts (" --rtp-port=N Base port to try for RTP (default=4000)");
puts (" --quality=N Specify media quality (0-10, default=6)");
puts (" --ptime=MSEC Override codec ptime to MSEC (default=specific)");
@@ -580,6 +582,10 @@ static pj_status_t parse_args(int argc, char *argv[],
cfg->auto_loop = 1;
break;
+ case OPT_AUTO_CONF:
+ cfg->auto_conf = 1;
+ break;
+
case OPT_PLAY_FILE:
cfg->wav_file = pj_str(pj_optarg);
break;
@@ -922,6 +928,8 @@ static int write_settings(const struct app_config *config,
pj_strcat2(&cfg, "--auto-play\n");
if (config->auto_loop)
pj_strcat2(&cfg, "--auto-loop\n");
+ if (config->auto_conf)
+ pj_strcat2(&cfg, "--auto-conf\n");
if (config->wav_file.slen) {
pj_ansi_sprintf(line, "--play-file %s\n",
config->wav_file.ptr);
@@ -1248,6 +1256,33 @@ static void on_call_media_state(pjsua_call_id call_id)
connect_sound = PJ_FALSE;
}
+ /* Put call in conference with other calls, if desired */
+ if (app_config.auto_conf) {
+ pjsua_call_id call_ids[PJSUA_MAX_CALLS];
+ unsigned call_cnt=0;
+ unsigned i;
+
+ /* Get all calls, and establish media connection between
+ * this call and other calls.
+ */
+ pjsua_enum_calls(call_ids, &call_cnt);
+ for (i=0; i<call_cnt; ++i) {
+ if (call_ids[i] == call_id)
+ continue;
+
+ if (!pjsua_call_has_media(call_ids[i]))
+ continue;
+
+ pjsua_conf_connect(call_info.conf_slot,
+ pjsua_call_get_conf_port(call_ids[i]));
+ pjsua_conf_connect(pjsua_call_get_conf_port(call_ids[i]),
+ call_info.conf_slot);
+ }
+
+ /* Also connect call to local sound device */
+ connect_sound = PJ_TRUE;
+ }
+
/* Otherwise connect to sound device */
if (connect_sound) {
pjsua_conf_connect(call_info.conf_slot, 0);