Module: sems
Branch: master
Commit: b72c4226a6e5708936f5b07f5fa12c32b6e218f9
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=b72c4226a6e5708936f5b07f5fa12c32b6e218f9

Author: Juha Heinanen <[email protected]>
Committer: Juha Heinanen <[email protected]>
Date:   Mon Dec 12 11:35:21 2011 +0200

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

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

---

 apps/conference/Conference.cpp |   23 ++++++++++++++++++-----
 apps/conference/Conference.h   |    2 ++
 doc/Readme.conference.txt      |    6 ++++++
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp
index 17722b9..afabe99 100644
--- a/apps/conference/Conference.cpp
+++ b/apps/conference/Conference.cpp
@@ -415,11 +415,13 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
   string lonely_user_file;
 
   string app_param_hdr = getHeader(req.hdrs, PARAM_HDR, true);
+  string listen_only_str = "";
   if (app_param_hdr.length()) {
     from_header = get_header_keyvalue(app_param_hdr, "Dialout-From");
     extra_headers = get_header_keyvalue(app_param_hdr, "Dialout-Extra");
     dialout_suffix = get_header_keyvalue(app_param_hdr, "Dialout-Suffix");     
 
-    language = get_header_keyvalue(app_param_hdr, "Language");      
+    language = get_header_keyvalue(app_param_hdr, "Language");
+    listen_only_str = get_header_keyvalue(app_param_hdr, "Listen-Only");
   } else {
     from_header = getHeader(req.hdrs, "P-Dialout-From", true);
     extra_headers = getHeader(req.hdrs, "P-Dialout-Extra", true);
@@ -454,6 +456,8 @@ void ConferenceDialog::onInvite(const AmSipRequest& req)
     
   allow_dialout = dialout_suffix.length() > 0;
 
+  listen_only = listen_only_str.length() > 0;
+
   if (!language.empty()) {
 
 #ifdef USE_MYSQL
@@ -530,15 +534,24 @@ void ConferenceDialog::setupAudio()
   if(dialout_channel.get()){
 
     DBG("adding dialout_channel to the playlist (dialedout = %i)\n",dialedout);
-    play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
-                                              dialout_channel.get()));
+    if (listen_only)
+       play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
+                                                  (AmAudio*)NULL));
+    else
+       play_list.addToPlaylist(new AmPlaylistItem(dialout_channel.get(),
+                                                  dialout_channel.get()));
   }
   else {
 
     channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
 
-    play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
-                                              channel.get()));
+    if (listen_only) {
+       play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
+                                                  (AmAudio*)NULL));
+    }
+    else
+       play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
+                                                  channel.get()));
   }
 
   setInOut(&play_list,&play_list);
diff --git a/apps/conference/Conference.h b/apps/conference/Conference.h
index e9396fb..d48982c 100644
--- a/apps/conference/Conference.h
+++ b/apps/conference/Conference.h
@@ -127,6 +127,8 @@ class ConferenceDialog : public AmSession
   string                        extra_headers;
   string                        language;
 
+  bool                          listen_only;
+
   auto_ptr<AmSipRequest>        transfer_req;
 
 
diff --git a/doc/Readme.conference.txt b/doc/Readme.conference.txt
index 07c92ba..963046a 100644
--- a/doc/Readme.conference.txt
+++ b/doc/Readme.conference.txt
@@ -136,3 +136,9 @@ Adding participants with "Transfer" REFER:
  here is in no way standard conform and should only be used between two SEMS 
instances
  placed behind the same last record-routing proxy.
 
+"Listen only" participant:
+--------------------------
+If INVITE request to conference has P-App-Param header parameter
+Listen-Only with any value, audio from this participant is not mixed into
+the conference.
+

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to