From 6a1bdaceb83b3489a769de3d2dcccfd3111c4ce4 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 25 Aug 2007 19:05:49 +0000 Subject: [PATCH] * Added forgotten OpenSER version of AmSipDialog::cancel(). git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@427 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmSipDialog.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index b4ad060f..a1405281 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -675,6 +675,37 @@ int AmSipDialog::transfer(const string& target) return 0; } +#ifdef OpenSER + +int AmSipDialog::cancel() +{ + int cancel_cseq = -1; + TransMap::reverse_iterator t; + + for(t = uac_trans.rbegin(); + t != uac_trans.rend(); t++) { + + if(t->second.method == "INVITE"){ + cancel_cseq = t->second.cseq; + break; + } + } + + if(t == uac_trans.rend()){ + ERROR("could not find INVITE transaction to cancel\n"); + return -1; + } + + string reply_sock = "/tmp/" + AmSession::getNewId(); + string msg = ":t_uac_cancel:\n" + + callid + "\n" + + int2str(cancel_cseq) + "\n"; + + return AmServer::send_msg(msg, reply_sock, 50000); +} + +#else /* Ser */ + int AmSipDialog::cancel() { int cancel_cseq = -1; @@ -702,6 +733,8 @@ int AmSipDialog::cancel() return AmServer::send_msg(msg, reply_sock, 50000); } +#endif + #ifdef OpenSER int AmSipDialog::sendRequest(const string& method,