- work to fix secure calls problems

This commit is contained in:
Dmytro Bogovych 2021-12-22 16:35:33 +02:00
parent 616498e8a2
commit aeedeb0626
4 changed files with 20 additions and 7 deletions

View File

@ -171,7 +171,7 @@ void AgentImpl::processConfig(JsonCpp::Value &d, JsonCpp::Value &answer)
#endif #endif
std::string transport = d["transport"].asString(); std::string transport = d["transport"].asString();
config()[CONFIG_TRANSPORT] = (transport == "any") ? 0 : (transport == "udp" ? 1 : (transport == "tcp" ? 2 : 3)); config()[CONFIG_TRANSPORT] = (transport == "any") ? TransportType_Any : (transport == "udp" ? TransportType_Udp : (transport == "tcp" ? TransportType_Tcp : TransportType_Tls));
config()[CONFIG_IPV4] = d["ipv4"].asBool(); config()[CONFIG_IPV4] = d["ipv4"].asBool();
config()[CONFIG_IPV6] = d["ipv6"].asBool(); config()[CONFIG_IPV6] = d["ipv6"].asBool();
@ -189,10 +189,12 @@ void AgentImpl::processConfig(JsonCpp::Value &d, JsonCpp::Value &answer)
mUseNativeAudio = d["nativeaudio"].asBool(); mUseNativeAudio = d["nativeaudio"].asBool();
config()[CONFIG_OWN_DNS] = d["dns_servers"].asString(); config()[CONFIG_OWN_DNS] = d["dns_servers"].asString();
config()[CONFIG_SIPS] = d["secure"].asBool();
answer["status"] = Status_Ok; answer["status"] = Status_Ok;
} }
void AgentImpl::processStart(JsonCpp::Value& /*request*/, JsonCpp::Value &answer) void AgentImpl::processStart(JsonCpp::Value& request, JsonCpp::Value &answer)
{ {
std::unique_lock<std::recursive_mutex> l(mAgentMutex); std::unique_lock<std::recursive_mutex> l(mAgentMutex);
if (mThread) if (mThread)
@ -201,6 +203,9 @@ void AgentImpl::processStart(JsonCpp::Value& /*request*/, JsonCpp::Value &answer
return; // Started already return; // Started already
} }
// Process config (can be sent via start command as well)
// processConfig(request, answer);
// Start socket thread // Start socket thread
SocketHeap::instance().start(); SocketHeap::instance().start();

View File

@ -206,7 +206,7 @@ void DevicePair::onSpkData(const Format& f, void* buffer, int length)
} }
} }
assert(mOutputNativeData.filled() >= length); // assert(mOutputNativeData.filled() >= length);
#ifdef DUMP_NATIVEOUTPUT #ifdef DUMP_NATIVEOUTPUT
if (mNativeOutputDump) if (mNativeOutputDump)
mNativeOutputDump->write(mOutputNativeData.data(), length); mNativeOutputDump->write(mOutputNativeData.data(), length);

View File

@ -151,7 +151,7 @@ void UserAgent::start()
switch (mConfig[CONFIG_TRANSPORT].asInt()) switch (mConfig[CONFIG_TRANSPORT].asInt())
{ {
case 0: case TransportType_Any:
if (mConfig[CONFIG_IPV4].asBool()) if (mConfig[CONFIG_IPV4].asBool())
{ {
ADD_TRANSPORT4(resip::TCP) ADD_TRANSPORT4(resip::TCP)
@ -166,21 +166,21 @@ void UserAgent::start()
} }
break; break;
case 1: case TransportType_Udp:
if (mConfig[CONFIG_IPV4].asBool()) if (mConfig[CONFIG_IPV4].asBool())
ADD_TRANSPORT4(resip::UDP); ADD_TRANSPORT4(resip::UDP);
if (mConfig[CONFIG_IPV6].asBool()) if (mConfig[CONFIG_IPV6].asBool())
ADD_TRANSPORT6(resip::UDP); ADD_TRANSPORT6(resip::UDP);
break; break;
case 2: case TransportType_Tcp:
if (mConfig[CONFIG_IPV4].asBool()) if (mConfig[CONFIG_IPV4].asBool())
ADD_TRANSPORT4(resip::TCP); ADD_TRANSPORT4(resip::TCP);
if (mConfig[CONFIG_IPV6].asBool()) if (mConfig[CONFIG_IPV6].asBool())
ADD_TRANSPORT6(resip::TCP); ADD_TRANSPORT6(resip::TCP);
break; break;
case 3: case TransportType_Tls:
if (mConfig[CONFIG_IPV4].asBool()) if (mConfig[CONFIG_IPV4].asBool())
ADD_TRANSPORT4(resip::TLS); ADD_TRANSPORT4(resip::TLS);
if (mConfig[CONFIG_IPV6].asBool()) if (mConfig[CONFIG_IPV6].asBool())

View File

@ -60,6 +60,14 @@
#define RESIPROCATE_SUBSYSTEM Subsystem::TEST #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
using namespace std; using namespace std;
enum
{
TransportType_Any,
TransportType_Udp,
TransportType_Tcp,
TransportType_Tls
};
enum enum
{ {
CONFIG_IPV4 = 0, // Use IP4 CONFIG_IPV4 = 0, // Use IP4