Skip to content

Commit

Permalink
deviceErrorAlert
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster committed Feb 4, 2019
1 parent 6307226 commit 049f05c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"securityCode" : "D9C853F4897CF64307DB652246827FAC83111303F3E207F8FD9F5E5DC89A9EF9",
"autoUnHold" : true,
"testAudioDevice" : true,
"unregisterOnDeviceError" : true
"unregisterOnDeviceError" : true,
"deviceErrorAlert" : true
}
2 changes: 1 addition & 1 deletion tinyphone/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void SIPCall::onCallMediaState(OnCallMediaStateParam &prm)
}
catch (...) {
PJ_LOG(3, (__FILENAME__, "Call [%d] OnCallMediaState Media Connect Error", ci.id));
tp::DisplayError("ERROR Connecting Call Media Stream, Please Contact IT Support", tp::OPS::ASYNC);
tp::DisplayError(MSG_CONTACT_IT_SUPPORT, tp::OPS::ASYNC);
if (tp::ApplicationConfig.unregisterOnDeviceError) {
PJ_LOG(3, (__FILENAME__, "Call [%d] OnCallMediaState unregisterOnDeviceError Acc: [%s]", ci.id, account->Name().c_str()));
account->UnRegister();
Expand Down
4 changes: 4 additions & 0 deletions tinyphone/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ namespace tp {
bool testAudioDevice;
bool unregisterOnDeviceError;

bool deviceErrorAlert;

std::string ua(){
std::string productVersion;
GetProductVersion(productVersion);
Expand Down Expand Up @@ -74,6 +76,7 @@ namespace tp {
{"autoUnHold", p.autoUnHold },
{"testAudioDevice", p.testAudioDevice },
{"unregisterOnDeviceError", p.unregisterOnDeviceError },
{"deviceErrorAlert", p.deviceErrorAlert },

};
}
Expand All @@ -97,6 +100,7 @@ namespace tp {
j.at("autoUnHold").get_to(p.autoUnHold);
j.at("testAudioDevice").get_to(p.testAudioDevice);
j.at("unregisterOnDeviceError").get_to(p.unregisterOnDeviceError);
j.at("deviceErrorAlert").get_to(p.deviceErrorAlert);
}

extern appConfig ApplicationConfig;
Expand Down
2 changes: 2 additions & 0 deletions tinyphone/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@
#define SIP_LOG_FILE "tinyphone"
#define HTTP_LOG_FILE "tinyphone-http"

#define MSG_CONTACT_IT_SUPPORT "ERROR Connecting Audio Device, Please Contact IT Support"

#endif
3 changes: 3 additions & 0 deletions tinyphone/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ void TinyPhoneHttpServer::Start() {
return tp::response(500, DEFAULT_HTTP_SERVER_ERROR_REPONSE);
}
catch (std::domain_error& e) {
if (ApplicationConfig.deviceErrorAlert) {
tp::DisplayError(MSG_CONTACT_IT_SUPPORT, tp::OPS::ASYNC);
}
std::string response_msg = "System Error: " + string(e.what());
return tp::response(500, {
{ "message", response_msg },
Expand Down

0 comments on commit 049f05c

Please sign in to comment.