diff --git a/bin/nodejs/Makefile.am b/bin/nodejs/Makefile.am index f1d5e648212aed8a5eb7233186ca0c6d9d8c248b..4e4802109b3e647cbe714a2a401d3d7a689ad35d 100644 --- a/bin/nodejs/Makefile.am +++ b/bin/nodejs/Makefile.am @@ -5,11 +5,11 @@ BUILT_SOURCES= \ build/Makefile \ build/Release/obj.target/jami.node -jami_wrapper.cpp: nodejs_interface.i configurationmanager.i managerimpl.i +jami_wrapper.cpp: nodejs_interface.i configurationmanager.i managerimpl.i callmanager.i $(SWIG) -v -c++ -javascript -node -o jami_wrapper.cpp nodejs_interface.i build/Makefile: jami_wrapper.cpp binding.gyp - node-gyp configure --target=v14.16.1 --arch=x64 + node-gyp configure --target=v16.14.2 --arch=x64 build/Release/obj.target/jami.node: build/Makefile jami_wrapper.cpp callback.h node-gyp build diff --git a/bin/nodejs/callback.h b/bin/nodejs/callback.h index 2473c36af462e04cb42b50b871694d005562be4a..632d7603a4b77752b932bdbf7ad75252435e2519 100644 --- a/bin/nodejs/callback.h +++ b/bin/nodejs/callback.h @@ -441,16 +441,22 @@ incomingTrustRequest(const std::string& accountId, } void -callStateChanged(const std::string& callId, const std::string& state, int detail_code) +callStateChanged(const std::string& accountId, + const std::string& callId, + const std::string& state, + int detail_code) { std::lock_guard<std::mutex> lock(pendingSignalsLock); - pendingSignals.emplace([callId, state, detail_code]() { + pendingSignals.emplace([accountId, callId, state, detail_code]() { Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), callStateChangedCb); if (!func.IsEmpty()) { - SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(callId), - V8_STRING_NEW_LOCAL(state), - SWIGV8_INTEGER_NEW(detail_code)}; - func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); + SWIGV8_VALUE callback_args[] = { + V8_STRING_NEW_LOCAL(accountId), + V8_STRING_NEW_LOCAL(callId), + V8_STRING_NEW_LOCAL(state), + SWIGV8_INTEGER_NEW(detail_code) + }; + func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 4, callback_args); } }); @@ -466,9 +472,11 @@ mediaChangeRequested(const std::string& accountId, pendingSignals.emplace([accountId, callId, mediaList]() { Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), mediaChangeRequestedCb); if (!func.IsEmpty()) { - SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(accountId), - V8_STRING_NEW_LOCAL(callId), - stringMapVecToJsMapArray(mediaList)}; + SWIGV8_VALUE callback_args[] = { + V8_STRING_NEW_LOCAL(accountId), + V8_STRING_NEW_LOCAL(callId), + stringMapVecToJsMapArray(mediaList) + }; func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); } }); @@ -477,15 +485,17 @@ mediaChangeRequested(const std::string& accountId, } void -incomingMessage(const std::string& id, +incomingMessage(const std::string& accountId, + const std::string& id, const std::string& from, const std::map<std::string, std::string>& messages) { std::lock_guard<std::mutex> lock(pendingSignalsLock); - pendingSignals.emplace([id, from, messages]() { + pendingSignals.emplace([accountId, id, from, messages]() { Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), incomingMessageCb); if (!func.IsEmpty()) { - SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(id), + SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(accountId), + V8_STRING_NEW_LOCAL(id), V8_STRING_NEW_LOCAL(from), stringMapToJsMap(messages)}; func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); diff --git a/bin/nodejs/callmanager.i b/bin/nodejs/callmanager.i index ff36cbe57937590ef5132fdd213ebfd3539466b3..6de91041614320b36282e69f92cd87a3fcc9da68 100644 --- a/bin/nodejs/callmanager.i +++ b/bin/nodejs/callmanager.i @@ -28,7 +28,7 @@ class Callback { public: virtual ~Callback() {} - virtual void callStateChanged(const std::string& callId, const std::string& state, int detail_code){} + virtual void callStateChanged(const std::string& accountId, const std::string& callId, const std::string& state, int detail_code){} virtual void transferFailed(void){} virtual void transferSucceeded(void){} virtual void recordPlaybackStopped(const std::string& path){} @@ -40,9 +40,9 @@ public: virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId, const std::vector<std::map<std::string, std::string>>& mediaList){} virtual void recordPlaybackFilepath(const std::string& id, const std::string& filename){} - virtual void conferenceCreated(const std::string& accountId, const std::string& conf_id){} - virtual void conferenceChanged(const std::string& accountId, const std::string& conf_id, const std::string& state){} - virtual void conferenceRemoved(const std::string& accountId, const std::string& conf_id){} + virtual void conferenceCreated(const std::string& accountId, const std::string& confId){} + virtual void conferenceChanged(const std::string& accountId, const std::string& confId, const std::string& state){} + virtual void conferenceRemoved(const std::string& accountId, const std::string& confId){} virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){} virtual void newCall(const std::string& accountId, const std::string& callId, const std::string& to){} virtual void recordingStateChanged(const std::string& callId, int code){} @@ -50,6 +50,8 @@ public: virtual void onRtcpReportReceived(const std::string& callId, const std::map<std::string, int>& stats){} virtual void onConferenceInfosUpdated(const std::string& confId, const std::vector<std::map<std::string, std::string>>& infos) {} virtual void peerHold(const std::string& callId, bool holding){} + virtual void audioMuted(const std::string& callId, bool muted){} + virtual void videoMuted(const std::string& callId, bool muted){} virtual void connectionUpdate(const std::string& id, int state){} virtual void remoteRecordingChanged(const std::string& callId, const std::string& peer_number, bool state){} virtual void mediaNegotiationStatus(const std::string& callId, const std::string& event, @@ -64,7 +66,6 @@ public: namespace DRing { /* Call related methods */ -std::string placeCall(const std::string& accountId, const std::string& to, const std::map<std::string, std::string>& volatileCallDetails); std::string placeCallWithMedia(const std::string& accountId, const std::string& to, const std::vector<std::map<std::string, std::string>>& mediaList); @@ -129,7 +130,7 @@ void sendTextMessage(const std::string& accountId, const std::string& callId, co class Callback { public: virtual ~Callback() {} - virtual void callStateChanged(const std::string& callId, const std::string& state, int detail_code){} + virtual void callStateChanged(const std::string& accountId, const std::string& callId, const std::string& state, int detail_code){} virtual void transferFailed(void){} virtual void transferSucceeded(void){} virtual void recordPlaybackStopped(const std::string& path){} @@ -141,9 +142,9 @@ public: virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId, const std::vector<std::map<std::string, std::string>>& mediaList){} virtual void recordPlaybackFilepath(const std::string& id, const std::string& filename){} - virtual void conferenceCreated(const std::string& accountId, const std::string& conf_id){} - virtual void conferenceChanged(const std::string& accountId, const std::string& conf_id, const std::string& state){} - virtual void conferenceRemoved(const std::string& accountId, const std::string& conf_id){} + virtual void conferenceCreated(const std::string& accountId, const std::string& confId){} + virtual void conferenceChanged(const std::string& accountId, const std::string& confId, const std::string& state){} + virtual void conferenceRemoved(const std::string& accountId, const std::string& confId){} virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){} virtual void newCall(const std::string& accountId, const std::string& callId, const std::string& to){} virtual void recordingStateChanged(const std::string& callId, int code){} @@ -151,6 +152,8 @@ public: virtual void onRtcpReportReceived(const std::string& callId, const std::map<std::string, int>& stats){} virtual void onConferenceInfosUpdated(const std::string& confId, const std::vector<std::map<std::string, std::string>>& infos) {} virtual void peerHold(const std::string& callId, bool holding){} + virtual void audioMuted(const std::string& callId, bool muted){} + virtual void videoMuted(const std::string& callId, bool muted){} virtual void connectionUpdate(const std::string& id, int state){} virtual void remoteRecordingChanged(const std::string& callId, const std::string& peer_number, bool state){} virtual void mediaNegotiationStatus(const std::string& callId, const std::string& event,