From 616e2df75b1e82aeb5b8d47b5d0490c9e9cbc18d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Mon, 11 Nov 2019 14:52:23 -0500
Subject: [PATCH] callmanager: remove unused signals

Change-Id: Ia5659f670e4f1164afc1ac1016c9dd7fc187d0f3
---
 bin/dbus/cx.ring.Ring.CallManager.xml | 24 ------------------------
 bin/dbus/dbusclient.cpp               |  1 -
 bin/jni/callmanager.i                 |  2 --
 bin/jni/jni_interface.i               |  1 -
 bin/nodejs/callback.h                 | 16 ----------------
 bin/nodejs/callmanager.i              |  2 --
 bin/nodejs/nodejs_interface.i         |  1 -
 src/client/ring_signal.cpp            |  2 --
 src/dring/callmanager_interface.h     |  8 --------
 src/manager.cpp                       |  2 --
 10 files changed, 59 deletions(-)

diff --git a/bin/dbus/cx.ring.Ring.CallManager.xml b/bin/dbus/cx.ring.Ring.CallManager.xml
index 93c9eaab07..f86788d037 100644
--- a/bin/dbus/cx.ring.Ring.CallManager.xml
+++ b/bin/dbus/cx.ring.Ring.CallManager.xml
@@ -490,30 +490,6 @@
             <arg type="b" name="isMixed" direction="in"/>
         </method>
 
-        <signal name="newCallCreated" tp:name-for-bindings="newCallCreated">
-            <tp:docstring>
-              <p>Notify that a call has been created.</p>
-              <p>The callID generated by the daemon must be stored by the clients in order to address other actions for
-                this call. This signal is emitted when call haves been created by the daemon itself.</p>
-              <tp:rationale>The client must subscribe to this signal to handle calls created by other clients</tp:rationale>
-            </tp:docstring>
-            <arg type="s" name="accountID">
-              <tp:docstring>
-                The account ID of the call. Clients must notify the right account when receiving this signal.
-              </tp:docstring>
-            </arg>
-            <arg type="s" name="callID">
-              <tp:docstring>
-                A new call ID.
-              </tp:docstring>
-            </arg>
-            <arg type="s" name="to">
-              <tp:docstring>
-               The SIP URI this call is trying to reach.
-              </tp:docstring>
-            </arg>
-        </signal>
-
         <signal name="incomingCall" tp:name-for-bindings="incomingCall">
             <tp:docstring>
               <p>Notify an incoming call.</p>
diff --git a/bin/dbus/dbusclient.cpp b/bin/dbus/dbusclient.cpp
index d8bc7935e8..d40f2b097a 100644
--- a/bin/dbus/dbusclient.cpp
+++ b/bin/dbus/dbusclient.cpp
@@ -156,7 +156,6 @@ DBusClient::initLibrary(int flags)
         exportable_callback<CallSignal::ConferenceChanged>(bind(&DBusCallManager::conferenceChanged, callM, _1, _2)),
         exportable_callback<CallSignal::UpdatePlaybackScale>(bind(&DBusCallManager::updatePlaybackScale, callM, _1, _2, _3)),
         exportable_callback<CallSignal::ConferenceRemoved>(bind(&DBusCallManager::conferenceRemoved, callM, _1)),
-        exportable_callback<CallSignal::NewCallCreated>(bind(&DBusCallManager::newCallCreated, callM, _1, _2, _3)),
         exportable_callback<CallSignal::RecordingStateChanged>(bind(&DBusCallManager::recordingStateChanged, callM, _1, _2)),
         exportable_callback<CallSignal::SecureSdesOn>(bind(&DBusCallManager::secureSdesOn, callM, _1)),
         exportable_callback<CallSignal::SecureSdesOff>(bind(&DBusCallManager::secureSdesOff, callM, _1)),
diff --git a/bin/jni/callmanager.i b/bin/jni/callmanager.i
index 41202f0142..0a38464a2a 100644
--- a/bin/jni/callmanager.i
+++ b/bin/jni/callmanager.i
@@ -39,7 +39,6 @@ public:
     virtual void conferenceCreated(const std::string& conf_id){}
     virtual void conferenceChanged(const std::string& conf_id, const std::string& state){}
     virtual void conferenceRemoved(const std::string& conf_id){}
-    virtual void newCallCreated(const std::string& call_id, const std::string&, const std::string&){}
     virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){}
     virtual void conferenceRemove(const std::string& conf_id){}
     virtual void newCall(const std::string& account_id, const std::string& call_id, const std::string& to){}
@@ -125,7 +124,6 @@ public:
     virtual void conferenceCreated(const std::string& conf_id){}
     virtual void conferenceChanged(const std::string& conf_id, const std::string& state){}
     virtual void conferenceRemoved(const std::string& conf_id){}
-    virtual void newCallCreated(const std::string& call_id, const std::string&, const std::string&){}
     virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){}
     virtual void conferenceRemove(const std::string& conf_id){}
     virtual void newCall(const std::string& account_id, const std::string& call_id, const std::string& to){}
diff --git a/bin/jni/jni_interface.i b/bin/jni/jni_interface.i
index c0e8c0e72f..463a8b4bd5 100644
--- a/bin/jni/jni_interface.i
+++ b/bin/jni/jni_interface.i
@@ -235,7 +235,6 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
         exportable_callback<CallSignal::ConferenceChanged>(bind(&Callback::conferenceChanged, callM, _1, _2)),
         exportable_callback<CallSignal::UpdatePlaybackScale>(bind(&Callback::updatePlaybackScale, callM, _1, _2, _3)),
         exportable_callback<CallSignal::ConferenceRemoved>(bind(&Callback::conferenceRemoved, callM, _1)),
-        exportable_callback<CallSignal::NewCallCreated>(bind(&Callback::newCallCreated, callM, _1, _2, _3)),
         exportable_callback<CallSignal::RecordingStateChanged>(bind(&Callback::recordingStateChanged, callM, _1, _2)),
         exportable_callback<CallSignal::RtcpReportReceived>(bind(&Callback::onRtcpReportReceived, callM, _1, _2)),
         exportable_callback<CallSignal::PeerHold>(bind(&Callback::peerHold, callM, _1, _2))
diff --git a/bin/nodejs/callback.h b/bin/nodejs/callback.h
index 823f908ab3..1cfb238505 100755
--- a/bin/nodejs/callback.h
+++ b/bin/nodejs/callback.h
@@ -24,7 +24,6 @@ Persistent<Function> registeredNameFoundCb;
 Persistent<Function> callStateChangedCb;
 Persistent<Function> incomingMessageCb;
 Persistent<Function> incomingCallCb;
-Persistent<Function> newCallCreatedCb;
 
 std::queue<std::function<void() >> pendingSignals;
 std::mutex pendingSignalsLock;
@@ -62,8 +61,6 @@ Persistent<Function>* getPresistentCb(const std::string &signal) {
         return &incomingMessageCb;
     else if (signal == "IncomingCall")
         return &incomingCallCb;
-    else if (signal == "NewCallCreated")
-        return &newCallCreatedCb;
     else return nullptr;
 }
 
@@ -329,16 +326,3 @@ void incomingCall(const std::string& account_id, const std::string& call_id, con
 
     uv_async_send(&signalAsync);
 }
-void newCallCreated(const std::string& account_id, const std::string& call_id, const std::string& to_uri) {
-
-    std::lock_guard<std::mutex> lock(pendingSignalsLock);
-    pendingSignals.emplace([account_id, call_id, to_uri]() {
-        Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), newCallCreatedCb);
-        if (!func.IsEmpty()) {
-            Local<Value> callback_args[] = {V8_STRING_NEW(account_id), V8_STRING_NEW(call_id), V8_STRING_NEW(to_uri)};
-            func->Call(SWIGV8_CURRENT_CONTEXT()->Global(), 3, callback_args);
-        }
-    });
-
-    uv_async_send(&signalAsync);
-}
\ No newline at end of file
diff --git a/bin/nodejs/callmanager.i b/bin/nodejs/callmanager.i
index 3e6aeb297a..b06f78499d 100644
--- a/bin/nodejs/callmanager.i
+++ b/bin/nodejs/callmanager.i
@@ -39,7 +39,6 @@ public:
     virtual void conferenceCreated(const std::string& conf_id){}
     virtual void conferenceChanged(const std::string& conf_id, const std::string& state){}
     virtual void conferenceRemoved(const std::string& conf_id){}
-    virtual void newCallCreated(const std::string& call_id, const std::string&, const std::string&){}
     virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){}
     virtual void conferenceRemove(const std::string& conf_id){}
     virtual void newCall(const std::string& account_id, const std::string& call_id, const std::string& to){}
@@ -125,7 +124,6 @@ public:
     virtual void conferenceCreated(const std::string& conf_id){}
     virtual void conferenceChanged(const std::string& conf_id, const std::string& state){}
     virtual void conferenceRemoved(const std::string& conf_id){}
-    virtual void newCallCreated(const std::string& call_id, const std::string&, const std::string&){}
     virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){}
     virtual void conferenceRemove(const std::string& conf_id){}
     virtual void newCall(const std::string& account_id, const std::string& call_id, const std::string& to){}
diff --git a/bin/nodejs/nodejs_interface.i b/bin/nodejs/nodejs_interface.i
index 2b46a2c438..246d77032f 100644
--- a/bin/nodejs/nodejs_interface.i
+++ b/bin/nodejs/nodejs_interface.i
@@ -136,7 +136,6 @@ void init(const v8::Handle<v8::Value> &funcMap){
         exportable_callback<CallSignal::IncomingMessage>(bind(&incomingMessage, _1, _2, _3)),
         exportable_callback<CallSignal::VoiceMailNotify>(bind(&voiceMailNotify, _1, _2, _3, _4)),
         exportable_callback<CallSignal::IncomingCall>(bind(&incomingCall, _1, _2, _3)),
-        exportable_callback<CallSignal::NewCallCreated>(bind(&newCallCreated, _1, _2, _3))
     };
 
     const std::map<std::string, SharedCallback> configEvHandlers = {
diff --git a/src/client/ring_signal.cpp b/src/client/ring_signal.cpp
index 90a75c5321..8e11d6c677 100644
--- a/src/client/ring_signal.cpp
+++ b/src/client/ring_signal.cpp
@@ -39,8 +39,6 @@ getSignalHandlers()
         exported_callback<DRing::CallSignal::ConferenceChanged>(),
         exported_callback<DRing::CallSignal::UpdatePlaybackScale>(),
         exported_callback<DRing::CallSignal::ConferenceRemoved>(),
-        exported_callback<DRing::CallSignal::NewCallCreated>(),
-        exported_callback<DRing::CallSignal::SipCallStateChanged>(),
         exported_callback<DRing::CallSignal::RecordingStateChanged>(),
         exported_callback<DRing::CallSignal::SecureSdesOn>(),
         exported_callback<DRing::CallSignal::SecureSdesOff>(),
diff --git a/src/dring/callmanager_interface.h b/src/dring/callmanager_interface.h
index 4a50f2b5c7..19c1b5a544 100644
--- a/src/dring/callmanager_interface.h
+++ b/src/dring/callmanager_interface.h
@@ -153,14 +153,6 @@ struct DRING_PUBLIC CallSignal {
                 constexpr static const char* name = "ConferenceRemoved";
                 using cb_type = void(const std::string&);
         };
-        struct DRING_PUBLIC NewCallCreated {
-                constexpr static const char* name = "NewCallCreated";
-                using cb_type = void(const std::string&, const std::string&, const std::string&);
-        };
-        struct DRING_PUBLIC SipCallStateChanged {
-                constexpr static const char* name = "SipCallStateChanged";
-                using cb_type = void(const std::string&, const std::string&, int);
-        };
         struct DRING_PUBLIC RecordingStateChanged {
                 constexpr static const char* name = "RecordingStateChanged";
                 using cb_type = void(const std::string&, int);
diff --git a/src/manager.cpp b/src/manager.cpp
index 2ed1d8b6dd..208deb6174 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -1435,8 +1435,6 @@ Manager::createConfFromParticipantList(const std::vector< std::string > &partici
 
         // Manager methods may behave differently if the call id participates in a conference
         conf->add(call_id);
-
-        emitSignal<DRing::CallSignal::NewCallCreated>(account, call_id, tostr);
         successCounter++;
     }
 
-- 
GitLab