28
28
* as that of the covered work.
30
30
#include "zrtp_session_callback.h"
32
32
#include "sip/sipcall.h"
33
33
#include "dbus/dbusmanager.h"
34
34
#include "dbus/callmanager.h"
35
35
#include "manager.h"
40
#include <utility> // for std::pair
42
40
using namespace GnuZrtpCodes;
48
ZrtpSessionCallback::ZrtpSessionCallback(SIPCall *sipcall) :
46
ZrtpSessionCallback::ZrtpSessionCallback(SIPCall &call) : call_(call)
54
48
// we've already initialized the maps, we only need to check one
55
49
if (not infoMap_.empty())
58
DEBUG("Zrtp: Initialize callbacks");
61
53
infoMap_[InfoHelloReceived] = "Hello received, preparing a Commit";
62
54
infoMap_[InfoCommitDHGenerated] = "Commit: Generated a public DH key";
112
104
ZrtpSessionCallback::secureOn(std::string cipher)
114
DEBUG("Zrtp: Secure mode is on with cipher %s", cipher.c_str());
115
Manager::instance().getDbusManager()->getCallManager()->secureZrtpOn(sipcall_->getCallId(), cipher);
106
DEBUG("Secure mode is on with cipher %s", cipher.c_str());
107
Manager::instance().getDbusManager()->getCallManager()->secureZrtpOn(call_.getCallId(), cipher);
119
111
ZrtpSessionCallback::secureOff()
121
DEBUG("Zrtp: Secure mode is off");
122
Manager::instance().getDbusManager()->getCallManager()->secureZrtpOff(sipcall_->getCallId());
113
DEBUG("Secure mode is off");
114
Manager::instance().getDbusManager()->getCallManager()->secureZrtpOff(call_.getCallId());
126
118
ZrtpSessionCallback::showSAS(std::string sas, bool verified)
128
DEBUG("Zrtp: SAS is: %s", sas.c_str());
129
Manager::instance().getDbusManager()->getCallManager()->showSAS(sipcall_->getCallId(), sas, verified);
120
DEBUG("SAS is: %s", sas.c_str());
121
Manager::instance().getDbusManager()->getCallManager()->showSAS(call_.getCallId(), sas, verified);
134
125
ZrtpSessionCallback::zrtpNotSuppOther()
136
DEBUG("Zrtp: Callee does not support ZRTP");
137
Manager::instance().getDbusManager()->getCallManager()->zrtpNotSuppOther(sipcall_->getCallId());
127
DEBUG("Callee does not support ZRTP");
128
Manager::instance().getDbusManager()->getCallManager()->zrtpNotSuppOther(call_.getCallId());
142
132
ZrtpSessionCallback::showMessage(GnuZrtpCodes::MessageSeverity sev, int32_t subCode)
156
146
if (severity == ZrtpError) {
157
147
if (subCode < 0) { // received an error packet from peer
159
DEBUG("Zrtp: Received error packet: ");
149
DEBUG("Received error packet: ");
161
DEBUG("Zrtp: Sent error packet: ");
151
DEBUG("Sent error packet: ");
163
153
std::map<int32, std::string>::const_iterator iter = zrtpMap_.find(subCode);
164
154
if (iter != zrtpMap_.end()) {
165
155
DEBUG("%s", iter->second.c_str());
166
Manager::instance().getDbusManager()->getCallManager()->zrtpNegotiationFailed(sipcall_->getCallId(), iter->second, "ZRTP");
156
Manager::instance().getDbusManager()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "ZRTP");
169
159
std::map<int32, std::string>::const_iterator iter = severeMap_.find(subCode);
170
160
if (iter != severeMap_.end()) {
171
161
DEBUG("%s", iter->second.c_str());
172
Manager::instance().getDbusManager()->getCallManager()->zrtpNegotiationFailed(sipcall_->getCallId(), iter->second, "severe");
162
Manager::instance().getDbusManager()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "severe");
178
168
ZrtpSessionCallback::confirmGoClear()
180
DEBUG("Zrtp: Received go clear message. Until confirmation, ZRTP won't send any data");
181
Manager::instance().getDbusManager()->getCallManager()->zrtpNotSuppOther(sipcall_->getCallId());
170
DEBUG("Received go clear message. Until confirmation, ZRTP won't send any data");
171
Manager::instance().getDbusManager()->getCallManager()->zrtpNotSuppOther(call_.getCallId());
184
174
std::map<int32, std::string> ZrtpSessionCallback::infoMap_;