Commit 7c11d095 authored by Asad Salman's avatar Asad Salman

added correct newCallCreated callback

Change-Id: Id05c1f9198b80bc459fa0e2250b37ecb93a52060
parent 2038837b
......@@ -25,7 +25,6 @@ Persistent<Function> callStateChangedCb;
Persistent<Function> incomingMessageCb;
Persistent<Function> incomingCallCb;
Persistent<Function> newCallCreatedCb;
Persistent<Function> sipCallStateChangedCb;
std::queue<std::function<void() >> pendingSignals;
std::mutex pendingSignalsLock;
......@@ -65,8 +64,6 @@ Persistent<Function>* getPresistentCb(const std::string &signal) {
return &incomingCallCb;
else if (signal == "NewCallCreated")
return &newCallCreatedCb;
else if (signal == "SipCallStateChanged")
return &sipCallStateChangedCb;
else return nullptr;
}
......@@ -330,5 +327,18 @@ 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
......@@ -135,7 +135,7 @@ void init(const v8::Handle<v8::Value> &funcMap){
exportable_callback<CallSignal::StateChange>(bind(&callStateChanged, _1, _2, _3)),
exportable_callback<CallSignal::IncomingMessage>(bind(&incomingMessage, _1, _2, _3)),
exportable_callback<CallSignal::IncomingCall>(bind(&incomingCall, _1, _2, _3)),
//exportable_callback<CallSignal::NewCallCreated>(bind(&newCallCreated, _1, _2, _3))
exportable_callback<CallSignal::NewCallCreated>(bind(&newCallCreated, _1, _2, _3))
};
const std::map<std::string, SharedCallback> configEvHandlers = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment