Commit 89132674 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2926] Code cleanup

parent 4fe39b5a
......@@ -607,7 +607,7 @@ namespace sfl {
}
else {
// _debug("RTP: Received an RTP event with payload: %d", adu->getType());
ost::RTPPacket::RFC2833Payload *dtmf = (ost::RTPPacket::RFC2833Payload *)adu->getData();
// ost::RTPPacket::RFC2833Payload *dtmf = (ost::RTPPacket::RFC2833Payload *)adu->getData();
// _debug("RTP: Data received %d", dtmf->event);
}
......
......@@ -39,9 +39,14 @@ namespace sfl
AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
ost::SymmetricRTPSession (ost::InetHostAddress (sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()),
_localCryptoSuite(0),
_remoteCryptoSuite(0),
AudioRtpSession<AudioSrtpSession> (manager, sipcall)
AudioRtpSession<AudioSrtpSession> (manager, sipcall),
_localCryptoSuite(0),
_remoteCryptoSuite(0),
_localMasterKeyLength(0),
_localMasterSaltLength(0),
_remoteMasterKeyLength(0),
_remoteMasterSaltLength(0)
{
// Initialize local Crypto context
......
......@@ -69,57 +69,57 @@ namespace sfl {
AudioSrtpSession(ManagerImpl * manager, SIPCall * sipcall);
std::vector<std::string> getLocalCryptoInfo(void);
std::vector<std::string> getLocalCryptoInfo(void);
void setRemoteCryptoInfo(sfl::SdesNegotiator& nego);
void setRemoteCryptoInfo(sfl::SdesNegotiator& nego);
private:
void initializeLocalMasterKey(void);
void initializeLocalMasterSalt(void);
void initializeLocalMasterSalt(void);
void initializeRemoteCryptoContext(void);
void initializeRemoteCryptoContext(void);
void initializeLocalCryptoContext(void);
void initializeLocalCryptoContext(void);
std::string getBase64ConcatenatedKeys();
std::string getBase64ConcatenatedKeys();
void unBase64ConcatenatedKeys(std::string base64keys);
void unBase64ConcatenatedKeys(std::string base64keys);
char* encodeBase64(unsigned char *input, int length);
char* encodeBase64(unsigned char *input, int length);
char* decodeBase64(unsigned char *input, int length, int *length_out);
char* decodeBase64(unsigned char *input, int length, int *length_out);
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
int _localCryptoSuite;
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
int _localCryptoSuite;
/** Remote crypto suite is initialized at AES_CM_128_HMAC_SHA1_80*/
int _remoteCryptoSuite;
/** Remote crypto suite is initialized at AES_CM_128_HMAC_SHA1_80*/
int _remoteCryptoSuite;
uint8 _localMasterKey[16];
/** local master key length in byte */
int _localMasterKeyLength;
/** local master key length in byte */
int _localMasterKeyLength;
uint8 _localMasterSalt[14];
uint8 _localMasterSalt[14];
/** local master salt length in byte */
int _localMasterSaltLength;
/** local master salt length in byte */
int _localMasterSaltLength;
uint8 _remoteMasterKey[16];
uint8 _remoteMasterKey[16];
/** remote master key length in byte */
int _remoteMasterKeyLength;
/** remote master key length in byte */
int _remoteMasterKeyLength;
uint8 _remoteMasterSalt[14];
uint8 _remoteMasterSalt[14];
/** remote master salt length in byte */
int _remoteMasterSaltLength;
/** remote master salt length in byte */
int _remoteMasterSaltLength;
ost::CryptoContext* _remoteCryptoCtx;
ost::CryptoContext* _remoteCryptoCtx;
ost::CryptoContext* _localCryptoCtx;
ost::CryptoContext* _localCryptoCtx;
};
}
......
......@@ -469,7 +469,7 @@ void PulseLayer::writeToSpeaker (void)
out = (SFLDataFormat*) pa_xmalloc (writeableSize);
int copied = tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
int returnValue = pa_stream_write (playback->pulseStream(), out, copied * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
pa_stream_write (playback->pulseStream(), out, copied * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
pa_xfree (out);
......
......@@ -821,7 +821,7 @@ std::map<std::string, int32_t> ConfigurationManager::getShortcuts() {
std::map<std::string, int> shortcutsMap;
int shortcut;
for (int i = 0; i < shortcutsKeys.size(); i++) {
for (int i = 0; i < (int)shortcutsKeys.size(); i++) {
std::string key = shortcutsKeys.at(i);
shortcut = Manager::instance().getConfigInt("Shortcuts", key);
shortcutsMap.insert(std::pair<std::string, int>(key, shortcut));
......@@ -836,7 +836,7 @@ void ConfigurationManager::setShortcuts(
std::map<std::string, int> map_cpy = shortcutsMap;
std::map<std::string, int>::iterator it;
for (int i = 0; i < shortcutsKeys.size(); i++) {
for (int i = 0; i < (int)shortcutsKeys.size(); i++) {
std::string key = shortcutsKeys.at(i);
it = map_cpy.find(key);
if (it != shortcutsMap.end()) {
......
......@@ -97,7 +97,7 @@ class SflPhoneTests():
def test_ip2ip_send_hangup(self):
"""Make a call to a server (sipp) on port 5062"""
i = 0
while(i < 200):
while(i < 500):
callid = self.sflphone.Call("sip:test@" + REMOTEADDR_lo)
time.sleep(0.5)
......@@ -313,7 +313,7 @@ sflphone.setFirstRegisteredAccount();
# Test 1: - Send an IP2IP call
# - Hangup
testsuite.test_ip2ip_send_hangup()
# testsuite.test_ip2ip_send_hangup()
# Test 2: - Send an IP2IP call
# - Peer Hangup
......@@ -321,7 +321,7 @@ testsuite.test_ip2ip_send_hangup()
# Test 3: - Receive an IP2IP call
# - Hangup
# testsuite.test_ip2ip_recv_hangup()
testsuite.test_ip2ip_recv_hangup()
# Test 4: - Receive an IP2IP call
# - Peer Hangup
......
......@@ -2,6 +2,8 @@
#
# Copyright (C) 2009 by the Free Software Foundation, Inc.
#
# Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
......@@ -201,7 +203,8 @@ class SflPhoneCtrlSimple(Thread):
except KeyError, e:
print "This call didn't exist!: " + callid + ". Adding it to the list."
callDetails = self.getCallDetails(callid)
self.activeCalls[callid] = {'Account': callDetails['ACCOUNTID'], 'To': callDetails['PEER_NUMBER'], 'State': state }
self.activeCalls[callid] = {'Account': callDetails['ACCOUNTID'],
'To': callDetails['PEER_NUMBER'], 'State': state }
elif state in [ "BUSY", "FAILURE" ]:
try:
del self.activeCalls[callid]
......@@ -537,7 +540,9 @@ class SflPhoneCtrlSimple(Thread):
def Refuse(self, callid):
"""Refuse an incoming call identified by a CallID"""
print "Refuse call " + callid
# if not self.account:
# self.setFirstRegisteredAccount()
......@@ -608,6 +613,7 @@ class SflPhoneCtrlSimple(Thread):
return callid
def run(self):
"""Processing method for this thread"""
gobject.threads_init()
# self.loop.run()
context = self.loop.get_context()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment