Skip to content
Snippets Groups Projects
Commit 8750049b authored by Adrien Béraud's avatar Adrien Béraud
Browse files

nodejs: fix binding, update to Node 16 LTS

Change-Id: Id4eaaebee19c9739334b0652e7cdf560d8f8a202
parent 222934d9
Branches
No related tags found
No related merge requests found
...@@ -5,11 +5,11 @@ BUILT_SOURCES= \ ...@@ -5,11 +5,11 @@ BUILT_SOURCES= \
build/Makefile \ build/Makefile \
build/Release/obj.target/jami.node 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 $(SWIG) -v -c++ -javascript -node -o jami_wrapper.cpp nodejs_interface.i
build/Makefile: jami_wrapper.cpp binding.gyp 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 build/Release/obj.target/jami.node: build/Makefile jami_wrapper.cpp callback.h
node-gyp build node-gyp build
......
...@@ -441,16 +441,22 @@ incomingTrustRequest(const std::string& accountId, ...@@ -441,16 +441,22 @@ incomingTrustRequest(const std::string& accountId,
} }
void 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); 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); Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), callStateChangedCb);
if (!func.IsEmpty()) { if (!func.IsEmpty()) {
SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(callId), SWIGV8_VALUE callback_args[] = {
V8_STRING_NEW_LOCAL(state), V8_STRING_NEW_LOCAL(accountId),
SWIGV8_INTEGER_NEW(detail_code)}; V8_STRING_NEW_LOCAL(callId),
func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); 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, ...@@ -466,9 +472,11 @@ mediaChangeRequested(const std::string& accountId,
pendingSignals.emplace([accountId, callId, mediaList]() { pendingSignals.emplace([accountId, callId, mediaList]() {
Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), mediaChangeRequestedCb); Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), mediaChangeRequestedCb);
if (!func.IsEmpty()) { if (!func.IsEmpty()) {
SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(accountId), SWIGV8_VALUE callback_args[] = {
V8_STRING_NEW_LOCAL(callId), V8_STRING_NEW_LOCAL(accountId),
stringMapVecToJsMapArray(mediaList)}; V8_STRING_NEW_LOCAL(callId),
stringMapVecToJsMapArray(mediaList)
};
func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args);
} }
}); });
...@@ -477,15 +485,17 @@ mediaChangeRequested(const std::string& accountId, ...@@ -477,15 +485,17 @@ mediaChangeRequested(const std::string& accountId,
} }
void void
incomingMessage(const std::string& id, incomingMessage(const std::string& accountId,
const std::string& id,
const std::string& from, const std::string& from,
const std::map<std::string, std::string>& messages) const std::map<std::string, std::string>& messages)
{ {
std::lock_guard<std::mutex> lock(pendingSignalsLock); 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); Local<Function> func = Local<Function>::New(Isolate::GetCurrent(), incomingMessageCb);
if (!func.IsEmpty()) { 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), V8_STRING_NEW_LOCAL(from),
stringMapToJsMap(messages)}; stringMapToJsMap(messages)};
func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args); func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 3, callback_args);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
class Callback { class Callback {
public: public:
virtual ~Callback() {} 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 transferFailed(void){}
virtual void transferSucceeded(void){} virtual void transferSucceeded(void){}
virtual void recordPlaybackStopped(const std::string& path){} virtual void recordPlaybackStopped(const std::string& path){}
...@@ -40,9 +40,9 @@ public: ...@@ -40,9 +40,9 @@ public:
virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId, virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId,
const std::vector<std::map<std::string, std::string>>& mediaList){} const std::vector<std::map<std::string, std::string>>& mediaList){}
virtual void recordPlaybackFilepath(const std::string& id, const std::string& filename){} 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 conferenceCreated(const std::string& accountId, const std::string& confId){}
virtual void conferenceChanged(const std::string& accountId, const std::string& conf_id, const std::string& state){} 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& conf_id){} virtual void conferenceRemoved(const std::string& accountId, const std::string& confId){}
virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){} 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 newCall(const std::string& accountId, const std::string& callId, const std::string& to){}
virtual void recordingStateChanged(const std::string& callId, int code){} virtual void recordingStateChanged(const std::string& callId, int code){}
...@@ -50,6 +50,8 @@ public: ...@@ -50,6 +50,8 @@ public:
virtual void onRtcpReportReceived(const std::string& callId, const std::map<std::string, int>& stats){} 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 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 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 connectionUpdate(const std::string& id, int state){}
virtual void remoteRecordingChanged(const std::string& callId, const std::string& peer_number, bool 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, virtual void mediaNegotiationStatus(const std::string& callId, const std::string& event,
...@@ -64,7 +66,6 @@ public: ...@@ -64,7 +66,6 @@ public:
namespace DRing { namespace DRing {
/* Call related methods */ /* 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, std::string placeCallWithMedia(const std::string& accountId,
const std::string& to, const std::string& to,
const std::vector<std::map<std::string, std::string>>& mediaList); 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 ...@@ -129,7 +130,7 @@ void sendTextMessage(const std::string& accountId, const std::string& callId, co
class Callback { class Callback {
public: public:
virtual ~Callback() {} 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 transferFailed(void){}
virtual void transferSucceeded(void){} virtual void transferSucceeded(void){}
virtual void recordPlaybackStopped(const std::string& path){} virtual void recordPlaybackStopped(const std::string& path){}
...@@ -141,9 +142,9 @@ public: ...@@ -141,9 +142,9 @@ public:
virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId, virtual void mediaChangeRequested(const std::string& accountId, const std::string& callId,
const std::vector<std::map<std::string, std::string>>& mediaList){} const std::vector<std::map<std::string, std::string>>& mediaList){}
virtual void recordPlaybackFilepath(const std::string& id, const std::string& filename){} 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 conferenceCreated(const std::string& accountId, const std::string& confId){}
virtual void conferenceChanged(const std::string& accountId, const std::string& conf_id, const std::string& state){} 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& conf_id){} virtual void conferenceRemoved(const std::string& accountId, const std::string& confId){}
virtual void updatePlaybackScale(const std::string& filepath, int position, int scale){} 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 newCall(const std::string& accountId, const std::string& callId, const std::string& to){}
virtual void recordingStateChanged(const std::string& callId, int code){} virtual void recordingStateChanged(const std::string& callId, int code){}
...@@ -151,6 +152,8 @@ public: ...@@ -151,6 +152,8 @@ public:
virtual void onRtcpReportReceived(const std::string& callId, const std::map<std::string, int>& stats){} 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 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 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 connectionUpdate(const std::string& id, int state){}
virtual void remoteRecordingChanged(const std::string& callId, const std::string& peer_number, bool 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, virtual void mediaNegotiationStatus(const std::string& callId, const std::string& event,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment