From b93bc9d3fdb94f5e3480eec6153375de2f46c788 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Tue, 10 Jul 2007 18:08:19 +0000 Subject: [PATCH] * Added OpenSER version of AmSipDialog::reply_error. git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@399 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmSipDialog.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 18ccb767..b4ad060f 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -449,6 +449,50 @@ int AmSipDialog::reply(const AmSipRequest& req, #endif +#ifdef OpenSER + +/* static */ +int AmSipDialog::reply_error(const AmSipRequest& req, unsigned int code, + const string& reason, const string& hdrs) +{ + string reply_sock = "/tmp/" + AmSession::getNewId(); + string code_str = int2str(code); + int headers; + + string msg = + ":t_reply:\n" + + code_str + "\n" + + reason + "\n" + + req.key + "\n" + + AmSession::getNewId() + "\n"; + + headers = 0; + + if(!hdrs.empty()) { + msg += "\"" + lf2crlf(escape(hdrs)); + headers = 1; + } + + if (AmConfig::Signature.length()) { + if (headers == 1) { + msg += "Server: " + AmConfig::Signature + "\r\n"; + } else { + msg += "\"Server: " + AmConfig::Signature + "\r\n"; + headers = 1; + } + } + + if (headers == 1) { + msg += "\"\n"; + } else { + msg += ".\n"; + } + + return AmServer::send_msg(msg,reply_sock, 500); +} + +#else /* Ser */ + /* static */ int AmSipDialog::reply_error(const AmSipRequest& req, unsigned int code, const string& reason, const string& hdrs) @@ -473,6 +517,8 @@ int AmSipDialog::reply_error(const AmSipRequest& req, unsigned int code, return AmServer::send_msg(msg,reply_sock, 500); } +#endif + int AmSipDialog::bye() { switch(status){