Skip to content
Snippets Groups Projects
Commit a37827de authored by trilene's avatar trilene
Browse files

Change voip version type to string

parent 16dc1f49
No related branches found
No related tags found
No related merge requests found
Pipeline #790 passed
......@@ -22,7 +22,7 @@ struct CallInvite
//! The SDP text of the session description.
std::string sdp;
//! The version of the VoIP specification this message adheres to.
uint16_t version;
std::string version;
//! The time in milliseconds that the invite is valid for.
uint32_t lifetime;
};
......@@ -51,7 +51,7 @@ struct CallCandidates
//! Array of objects describing the candidates.
std::vector<Candidate> candidates;
//! The version of the VoIP specification this message adheres to.
uint16_t version;
std::string version;
};
void
......@@ -68,7 +68,7 @@ struct CallAnswer
//! The SDP text of the session description.
std::string sdp;
//! The version of the VoIP specification this message adheres to.
uint16_t version;
std::string version;
};
void
......@@ -90,7 +90,7 @@ struct CallHangUp
//! The ID of the call this event relates to.
std::string call_id;
//! The version of the VoIP specification this message adheres to.
uint16_t version;
std::string version;
//! The reason for the call hang up.
Reason reason = Reason::User;
};
......
#include <cstdlib>
#include <string>
#include "mtx/events/voip.hpp"
......@@ -8,17 +7,12 @@
using json = nlohmann::json;
namespace {
uint16_t
std::string
version(const json &obj)
{
auto v = obj.at("version");
try {
return v.get<uint16_t>();
} catch (const json::type_error &) {
return std::atoi(v.get<std::string>().c_str());
}
return v.is_number() ? "0" : v.get<std::string>();
}
}
namespace mtx::events::msg {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment