MT#59962 AmSessionContainer: refactor indentation

Make it using spaces, instead of the EMACS based
tabulation/space combination, which makes it
messy for modern IDEs.

Change-Id: I44b632a5a3a5451bee58726370d907e3634ea709
mr13.4
Donat Zenichev 9 months ago
parent db1c069cc6
commit 197c5c624f

@ -205,60 +205,60 @@ void AmSessionContainer::destroySession(AmSession* s)
} }
} }
string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_name, const AmArg* session_params) { string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_name, const AmArg* session_params)
{
unique_ptr<AmSession> session; unique_ptr<AmSession> session;
try { try {
session.reset(createSession(req, app_name, session_params)); session.reset(createSession(req, app_name, session_params));
if(session.get() != 0) {
if (session.get() != 0) {
session->dlg->initFromLocalRequest(req); session->dlg->initFromLocalRequest(req);
session->setCallgroup(req.from_tag); session->setCallgroup(req.from_tag);
switch(addSession(req.from_tag,session.get())) { switch(addSession(req.from_tag,session.get()))
{
case AmSessionContainer::Inserted:
/* successful case */
break;
case AmSessionContainer::Inserted: case AmSessionContainer::ShutDown:
// successful case throw AmSession::Exception(AmConfig::ShutdownModeErrCode, AmConfig::ShutdownModeErrReason);
break;
case AmSessionContainer::ShutDown: case AmSessionContainer::AlreadyExist:
throw AmSession::Exception(AmConfig::ShutdownModeErrCode, throw AmSession::Exception(482, SIP_REPLY_LOOP_DETECTED);
AmConfig::ShutdownModeErrReason);
default:
case AmSessionContainer::AlreadyExist: ERROR("adding session to session container\n");
throw AmSession::Exception(482, throw string(SIP_REPLY_SERVER_INTERNAL_ERROR);
SIP_REPLY_LOOP_DETECTED);
default:
ERROR("adding session to session container\n");
throw string(SIP_REPLY_SERVER_INTERNAL_ERROR);
} }
MONITORING_LOG5(req.from_tag, MONITORING_LOG5(req.from_tag,
"app", app_name.c_str(), "app", app_name.c_str(),
"dir", "out", "dir", "out",
"from", req.from.c_str(), "from", req.from.c_str(),
"to", req.to.c_str(), "to", req.to.c_str(),
"ruri", req.r_uri.c_str()); "ruri", req.r_uri.c_str());
if (int err = session->sendInvite(req.hdrs)) { if (int err = session->sendInvite(req.hdrs)) {
ERROR("INVITE could not be sent: error code = %d.\n", err); ERROR("INVITE could not be sent: error code = %d.\n", err);
AmEventDispatcher::instance()->delEventQueue(req.from_tag); AmEventDispatcher::instance()->delEventQueue(req.from_tag);
MONITORING_MARK_FINISHED(req.from_tag.c_str()); MONITORING_MARK_FINISHED(req.from_tag.c_str());
return ""; return "";
} }
if (AmConfig::LogSessions) { if (AmConfig::LogSessions) {
INFO("Starting UAC session %s app %s\n", INFO("Starting UAC session %s app %s\n", req.from_tag.c_str(), app_name.c_str());
req.from_tag.c_str(), app_name.c_str());
} }
try { try {
session->start(); session->start();
} catch (...) { } catch (...) {
AmEventDispatcher::instance()->delEventQueue(req.from_tag); AmEventDispatcher::instance()->delEventQueue(req.from_tag);
throw; throw;
} }
} }
} }
catch(const AmSession::Exception& e){ catch(const AmSession::Exception& e){
ERROR("%i %s\n",e.code,e.reason.c_str()); ERROR("%i %s\n",e.code,e.reason.c_str());
return ""; return "";
@ -279,62 +279,58 @@ string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_
void AmSessionContainer::startSessionUAS(AmSipRequest& req) void AmSessionContainer::startSessionUAS(AmSipRequest& req)
{ {
try { try {
// Call-ID and From-Tag are unknown: it's a new session /* Call-ID and From-Tag are unknown: it's a new session */
unique_ptr<AmSession> session; unique_ptr<AmSession> session;
string app_name; string app_name;
session.reset(createSession(req,app_name)); session.reset(createSession(req,app_name));
if(session.get() != 0){
if (session.get() != 0) {
// update session's local tag (ID) if not already set /* update session's local tag (ID) if not already set */
session->setLocalTag(); session->setLocalTag();
const string& local_tag = session->getLocalTag(); const string& local_tag = session->getLocalTag();
// by default each session is in its own callgroup
session->setCallgroup(local_tag); /* by default each session is in its own callgroup */
session->setCallgroup(local_tag);
if (AmConfig::LogSessions) {
INFO("Starting UAS session %s\n", if (AmConfig::LogSessions) {
local_tag.c_str()); INFO("Starting UAS session %s\n", local_tag.c_str());
} }
switch(addSession(req.callid,req.from_tag,local_tag, switch(addSession(req.callid, req.from_tag,local_tag, req.via_branch,session.get()))
req.via_branch,session.get())) { {
case AmSessionContainer::Inserted:
case AmSessionContainer::Inserted: /* successful case */
// successful case break;
break;
case AmSessionContainer::ShutDown:
throw AmSession::Exception(AmConfig::ShutdownModeErrCode,
AmConfig::ShutdownModeErrReason);
case AmSessionContainer::AlreadyExist: case AmSessionContainer::ShutDown:
throw AmSession::Exception(482, throw AmSession::Exception(AmConfig::ShutdownModeErrCode, AmConfig::ShutdownModeErrReason);
SIP_REPLY_LOOP_DETECTED);
default: case AmSessionContainer::AlreadyExist:
ERROR("adding session to session container\n"); throw AmSession::Exception(482, SIP_REPLY_LOOP_DETECTED);
throw string(SIP_REPLY_SERVER_INTERNAL_ERROR);
} default:
ERROR("adding session to session container\n");
MONITORING_LOG4(local_tag.c_str(), throw string(SIP_REPLY_SERVER_INTERNAL_ERROR);
"dir", "in",
"from", req.from.c_str(),
"to", req.to.c_str(),
"ruri", req.r_uri.c_str());
try {
session->start();
} catch (...) {
AmEventDispatcher::instance()->
delEventQueue(local_tag);
throw;
}
session->postEvent(new AmSipRequestEvent(req));
session.release();
} }
}
MONITORING_LOG4(local_tag.c_str(),
"dir", "in",
"from", req.from.c_str(),
"to", req.to.c_str(),
"ruri", req.r_uri.c_str());
try {
session->start();
} catch (...) {
AmEventDispatcher::instance()->delEventQueue(local_tag);
throw;
}
session->postEvent(new AmSipRequestEvent(req));
session.release();
}
}
catch(const AmSession::Exception& e){ catch(const AmSession::Exception& e){
ERROR("%i %s %s\n",e.code,e.reason.c_str(), e.hdrs.c_str()); ERROR("%i %s %s\n",e.code,e.reason.c_str(), e.hdrs.c_str());
AmSipDialog::reply_error(req,e.code,e.reason, e.hdrs); AmSipDialog::reply_error(req,e.code,e.reason, e.hdrs);

Loading…
Cancel
Save