Browse Source

Use SIP connect string as Mumble comment text

Scott Hardin 7 years ago
parent
commit
18cd3cde13
5 changed files with 18 additions and 1 deletions
  1. 4 0
      MumbleCommunicator.cpp
  2. 2 0
      MumbleCommunicator.hpp
  3. 2 0
      PjsuaCommunicator.cpp
  4. 1 0
      PjsuaCommunicator.hpp
  5. 9 1
      main.cpp

+ 4 - 0
MumbleCommunicator.cpp

@@ -168,3 +168,7 @@ void mumble::MumbleCommunicator::sendUserState(mumlib::UserState field, bool val
     mum->sendUserState(field, val);
 }
 
+void mumble::MumbleCommunicator::sendUserState(mumlib::UserState field, std::string val) {
+    mum->sendUserState(field, val);
+}
+

+ 2 - 0
MumbleCommunicator.hpp

@@ -82,6 +82,8 @@ namespace mumble {
 
         void sendUserState(mumlib::UserState field, bool val);
 
+        void sendUserState(mumlib::UserState field, std::string val);
+
         MumbleUserState userState;
 
         int callId;

+ 2 - 0
PjsuaCommunicator.cpp

@@ -154,6 +154,7 @@ namespace sip {
             pj_thread_sleep(500); // sleep a moment to allow connection to stabilize
 
             communicator.logger.notice(msgText);
+            communicator.calls[ci.id].sendUserStateStr(mumlib::UserState::COMMENT, msgText);
             communicator.calls[ci.id].onStateChange(msgText);
 
             pj_thread_sleep(500); // sleep a moment to allow connection to stabilize
@@ -193,6 +194,7 @@ namespace sip {
                 communicator.calls[ci.id].mixer->clear();
 
                 communicator.logger.notice(msgText);
+                communicator.calls[ci.id].sendUserStateStr(mumlib::UserState::COMMENT, msgText);
                 communicator.calls[ci.id].onStateChange(msgText);
                 communicator.calls[ci.id].sendUserState(mumlib::UserState::SELF_DEAF, true);
                 communicator.logger.notice("MYDEBUG: call joinDefaultChannel()");

+ 1 - 0
PjsuaCommunicator.hpp

@@ -76,6 +76,7 @@ namespace sip {
         std::function<void(int16_t *, int)> onIncomingPcmSamples;
         std::function<void(int)> onMuteDeafChange;
         std::function<void(mumlib::UserState field, bool val)> sendUserState;
+        std::function<void(mumlib::UserState field, std::string val)> sendUserStateStr;
         std::function<void()> onConnect;
         std::function<void()> onDisconnect;
         std::function<void()> onCallerAuth;

+ 9 - 1
main.cpp

@@ -183,7 +183,15 @@ int main(int argc, char *argv[]) {
 
         // Send UserState to Mumble
         pjsuaCommunicator.calls[i].sendUserState = std::bind(
-                &mumble::MumbleCommunicator::sendUserState,
+                static_cast<void(mumble::MumbleCommunicator::*)(mumlib::UserState, bool)>
+                (&mumble::MumbleCommunicator::sendUserState),
+                mumcom,
+                _1, _2);
+
+        // Send UserState to Mumble
+        pjsuaCommunicator.calls[i].sendUserStateStr = std::bind(
+                static_cast<void(mumble::MumbleCommunicator::*)(mumlib::UserState, std::string)>
+                (&mumble::MumbleCommunicator::sendUserState),
                 mumcom,
                 _1, _2);