Browse code

apps/conference: added Listen-Only P-App-Param

- For the purpose of joining a conference in "listen only" mode.

Juha Heinanen authored on 12/12/2011 09:35:21
Showing 3 changed files
... ...
@@ -415,11 +415,13 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
415 415
   string lonely_user_file;
416 416
 
417 417
   string app_param_hdr = getHeader(req.hdrs, PARAM_HDR, true);
418
+  string listen_only_str = "";
418 419
   if (app_param_hdr.length()) {
419 420
     from_header = get_header_keyvalue(app_param_hdr, "Dialout-From");
420 421
     extra_headers = get_header_keyvalue(app_param_hdr, "Dialout-Extra");
421 422
     dialout_suffix = get_header_keyvalue(app_param_hdr, "Dialout-Suffix");      
422
-    language = get_header_keyvalue(app_param_hdr, "Language");      
423
+    language = get_header_keyvalue(app_param_hdr, "Language");
424
+    listen_only_str = get_header_keyvalue(app_param_hdr, "Listen-Only");
423 425
   } else {
424 426
     from_header = getHeader(req.hdrs, "P-Dialout-From", true);
425 427
     extra_headers = getHeader(req.hdrs, "P-Dialout-Extra", true);
... ...
@@ -454,6 +456,8 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
454 456
     
455 457
   allow_dialout = dialout_suffix.length() > 0;
456 458
 
459
+  listen_only = listen_only_str.length() > 0;
460
+
457 461
   if (!language.empty()) {
458 462
 
459 463
 #ifdef USE_MYSQL
... ...
@@ -530,15 +534,24 @@ void ConferenceDialog::setupAudio()
530 534
   if(dialout_channel.get()){
531 535
 
532 536
     DBG("adding dialout_channel to the playlist (dialedout = %i)\n",dialedout);
533
-    play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
534
-					       dialout_channel.get()));
537
+    if (listen_only)
538
+	play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
539
+						   (AmAudio*)NULL));
540
+    else
541
+	play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
542
+						   dialout_channel.get()));
535 543
   }
536 544
   else {
537 545
 
538 546
     channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
539 547
 
540
-    play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
541
-					       channel.get()));
548
+    if (listen_only) {
549
+	play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
550
+						   (AmAudio*)NULL));
551
+    }
552
+    else
553
+	play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
554
+						   channel.get()));
542 555
   }
543 556
 
544 557
   setInOut(&play_list,&play_list);
... ...
@@ -127,6 +127,8 @@ class ConferenceDialog : public AmSession
127 127
   string                        extra_headers;
128 128
   string                        language;
129 129
 
130
+  bool                          listen_only;
131
+
130 132
   auto_ptr<AmSipRequest>        transfer_req;
131 133
 
132 134
 
... ...
@@ -136,3 +136,9 @@ Adding participants with "Transfer" REFER:
136 136
  here is in no way standard conform and should only be used between two SEMS instances
137 137
  placed behind the same last record-routing proxy.
138 138
 
139
+"Listen only" participant:
140
+--------------------------
141
+If INVITE request to conference has P-App-Param header parameter
142
+Listen-Only with any value, audio from this participant is not mixed into
143
+the conference.
144
+