Commit c767ec68 authored by Emmanuel Milou's avatar Emmanuel Milou

Merge branch 'master' of...

Merge branch 'master' of git+ssh://repos-sflphone-git@git.sflphone.org/var/repos/sflphone/git/sflphone
parents d2be9805 f5d7b28c
......@@ -913,12 +913,20 @@ sflphone_display_selected_codec (const gchar* codecName)
msg = g_markup_printf_escaped (_("IP call - %s"), codecName);
}
else {
msg = g_markup_printf_escaped("%s %s (%s) - %s %s" ,
if (strcmp(codecName, "") != 0) {
msg = g_markup_printf_escaped("%s %s (%s) - %s %s" ,
_("Using account"),
(gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS),
(gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE),
_("Codec"),
codecName);
} else {
msg = g_markup_printf_escaped("%s %s (%s)" ,
_("Using account"),
(gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS),
(gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE));
}
}
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg);
......
......@@ -162,73 +162,84 @@ row_activated(GtkTreeView *tree_view UNUSED,
DEBUG("double click action");
if( active_calltree == current_calls )
if(calltab_get_selected_type(active_calltree) == A_CALL)
{
if(calltab_get_selected_type(current_calls) == A_CALL)
DEBUG("Selected a call\n");
selectedCall = calltab_get_selected_call(active_calltree);
if (selectedCall)
{
selectedCall = calltab_get_selected_call(current_calls);
DEBUG("there is a selected call\n");
if (selectedCall)
// Get the right event from the right calltree
if( active_calltree == current_calls )
{
// Get the right event from the right calltree
if( active_calltree == current_calls )
DEBUG("active tree is current calls");
switch(selectedCall->_state)
{
switch(selectedCall->_state)
{
case CALL_STATE_INCOMING:
dbus_accept(selectedCall);
stop_notification();
break;
case CALL_STATE_HOLD:
dbus_unhold(selectedCall);
break;
case CALL_STATE_RINGING:
case CALL_STATE_CURRENT:
case CALL_STATE_BUSY:
case CALL_STATE_FAILURE:
break;
case CALL_STATE_DIALING:
sflphone_place_call (selectedCall);
break;
default:
WARN("Row activated - Should not happen!");
break;
}
case CALL_STATE_INCOMING:
dbus_accept(selectedCall);
stop_notification();
break;
case CALL_STATE_HOLD:
dbus_unhold(selectedCall);
break;
case CALL_STATE_RINGING:
case CALL_STATE_CURRENT:
case CALL_STATE_BUSY:
case CALL_STATE_FAILURE:
break;
case CALL_STATE_DIALING:
sflphone_place_call (selectedCall);
break;
default:
WARN("Row activated - Should not happen!");
break;
}
}
// If history or contact: double click action places a new call
else
{
account_id = g_strdup (selectedCall->_accountID);
// If history or contact: double click action places a new call
else
{
DEBUG("active tree is history or contact");
// Create a new call
create_new_call (CALL, CALL_STATE_DIALING, "", account_id, selectedCall->_peer_name, selectedCall->_peer_number, &new_call);
calllist_add(current_calls, new_call);
calltree_add_call(current_calls, new_call, NULL);
sflphone_place_call(new_call);
calltree_display(current_calls);
}
account_id = g_strdup (selectedCall->_accountID);
// Create a new call
create_new_call (CALL, CALL_STATE_DIALING, "", account_id, selectedCall->_peer_name, selectedCall->_peer_number, &new_call);
calllist_add(current_calls, new_call);
calltree_add_call(current_calls, new_call, NULL);
sflphone_place_call(new_call);
calltree_display(current_calls);
}
}
else
}
else if(calltab_get_selected_type(current_calls) == A_CONFERENCE)
{
DEBUG("Selected a conference\n");
if( active_calltree == current_calls )
{
selectedConf = calltab_get_selected_conf(current_calls);
if(selectedConf)
{
switch(selectedConf->_state)
{
case CONFERENCE_STATE_ACTIVE_ATACHED:
case CONFERENCE_STATE_ACTIVE_ATACHED:
sflphone_add_main_participant(selectedConf);
break;
case CONFERENCE_STATE_ACTIVE_DETACHED:
sflphone_add_main_participant(selectedConf);
break;
case CONFERENCE_STATE_HOLD:
sflphone_conference_off_hold(selectedConf);
break;
case CONFERENCE_STATE_ACTIVE_DETACHED:
sflphone_add_main_participant(selectedConf);
break;
case CONFERENCE_STATE_HOLD:
sflphone_conference_off_hold(selectedConf);
break;
}
}
}
......@@ -268,6 +279,12 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED)
*/
if( active_calltree == current_calls )
{
// sflphone_selected_call_codec(selectedCall);
// DEBUG("single click action: %s", dbus_get_current_codec_name(selectedCall));
sflphone_display_selected_codec(dbus_get_current_codec_name(selectedCall));
switch(selectedCall->_srtp_state)
{
case SRTP_STATE_SAS_UNCONFIRMED:
......
......@@ -81,8 +81,8 @@ namespace sfl {
inline float computeCodecFrameSize (int codecSamplePerFrame, int codecClockRate) {
return ( (float) codecSamplePerFrame * 1000.0) / (float) codecClockRate;
}
inline int computeNbByteAudioLayer (float codecFrameSize) {
return (int) ( (float) converterSamplingRate * codecFrameSize * (float) sizeof (SFLDataFormat) / 1000.0);
int computeNbByteAudioLayer (float codecFrameSize) {
return (int) ( ((float) converterSamplingRate * codecFrameSize * sizeof(SFLDataFormat))/ 1000.0);
}
void sendMicData(int timestamp);
......@@ -225,9 +225,9 @@ namespace sfl {
// initialize SampleRate converter using AudioLayer's sampling rate
// (internal buffers initialized with maximal sampling rate and frame size)
_converter = new SamplerateConverter (_layerSampleRate, _layerFrameSize);
_converter = new SamplerateConverter(_layerSampleRate, _layerFrameSize);
int nbSamplesMax = (int) (_codecSampleRate * _layerFrameSize /1000)*2;
int nbSamplesMax = (int)(_codecSampleRate * _layerFrameSize /1000)*2;
_micData = new SFLDataFormat[nbSamplesMax];
_micDataConverted = new SFLDataFormat[nbSamplesMax];
_micDataEncoded = new unsigned char[nbSamplesMax];
......@@ -309,10 +309,9 @@ namespace sfl {
{
assert(_audiocodec);
assert(_audiolayer);
int _mainBufferSampleRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
// compute codec framesize in ms
float fixed_codec_framesize = computeCodecFrameSize (_audiocodec->getFrameSize(), _audiocodec->getClockRate());
......@@ -356,6 +355,7 @@ namespace sfl {
if (_audiocodec != NULL) {
int _mainBufferSampleRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
// Return the size of data in bytes
......@@ -383,6 +383,7 @@ namespace sfl {
// Store the number of samples for recording
_nSamplesSpkr = nbSample;
// put data in audio layer, size in byte
_audiolayer->getMainBuffer()->putData (_spkrDataDecoded, expandedSize, 100, _ca->getCallId());
}
......@@ -503,6 +504,8 @@ namespace sfl {
while (!testCancel()) {
converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
// Send session
sessionWaiting = static_cast<D*>(this)->isWaiting();
......
......@@ -48,7 +48,21 @@ void AudioZrtpSession::initializeZid (void)
throw ZrtpZidException();
}
std::string zidCompleteFilename = std::string (HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR + "/" + _zidFilename;
std::string zidCompleteFilename;
// xdg_config = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".cache/sflphone";
std::string xdg_config = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".cache" + DIR_SEPARATOR_STR + PROGDIR + "/" + _zidFilename;
_debug(" xdg_config %s\n", xdg_config.c_str());
if (XDG_CACHE_HOME != NULL) {
std::string xdg_env = std::string (XDG_CACHE_HOME);
_debug(" xdg_env %s\n", xdg_env.c_str());
(xdg_env.length() > 0) ? zidCompleteFilename = xdg_env : zidCompleteFilename = xdg_config;
} else
zidCompleteFilename = xdg_config;
if (initialize (zidCompleteFilename.c_str()) >= 0) {
_debug ("Register callbacks\n");
......
......@@ -66,6 +66,8 @@ class Speex : public AudioCodec
speex_decoder_ctl (_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size);
#ifdef HAVE_SPEEXDSP_LIB
int enable = 1;
......@@ -113,7 +115,8 @@ class Speex : public AudioCodec
speex_bits_read_from (&_speex_dec_bits, (char*) src, size);
speex_decode_int (_speex_dec_state, &_speex_dec_bits, dst);
return _speex_frame_size * ratio;
// return size in bytes
return _frameSize * 2;
}
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
......
......@@ -37,7 +37,7 @@ class Speex : public AudioCodec
_speex_frame_size(),
_preprocess_state() {
_clockRate = 32000;
_frameSize = 320; // 10 ms at 32 kHz
_frameSize = 640; // 20 ms at 32 kHz
_channel = 1;
_bitrate = 0;
_bandwidth = 0;
......@@ -80,10 +80,10 @@ class Speex : public AudioCodec
speex_encoder_ctl (_speex_enc_state, SPEEX_SET_COMPLEXITY, &complex);
// Init the decoder struct
speex_decoder_ctl (_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size);
speex_decoder_ctl (_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_frameSize);
// Init the preprocess struct
_preprocess_state = speex_preprocess_state_init (_speex_frame_size,_clockRate);
_preprocess_state = speex_preprocess_state_init (_frameSize,_clockRate);
speex_preprocess_ctl (_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &enable);
speex_preprocess_ctl (_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &attenuation);
speex_preprocess_ctl (_preprocess_state, SPEEX_PREPROCESS_SET_VAD, &enable);
......@@ -115,7 +115,7 @@ class Speex : public AudioCodec
speex_decode_int (_speex_dec_state, &_speex_dec_bits, dst);
// return the nuber of byte, not the number of sample
return _speex_frame_size * 2;
return _frameSize * 2;
}
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
......
......@@ -114,7 +114,8 @@ class Speex : public AudioCodec
speex_bits_read_from (&_speex_dec_bits, (char*) src, size);
speex_decode_int (_speex_dec_state, &_speex_dec_bits, dst);
return 2 * _speex_frame_size * ratio;
// return size in bytes
return _frameSize * 2;
}
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
......
......@@ -495,6 +495,7 @@ ManagerImpl::hangupConference (const ConfID& id)
AccountID currentAccountId;
// Call* call = NULL;
if(iter_conf != _conferencemap.end())
{
......@@ -697,38 +698,58 @@ ManagerImpl::offHoldCall (const CallID& call_id)
//THREAD=Main
bool
ManagerImpl::transferCall (const CallID& id, const std::string& to)
ManagerImpl::transferCall (const CallID& call_id, const std::string& to)
{
AccountID accountid;
bool returnValue;
stopTone (true);
CallID current_call_id = getCurrentCallId();
/* Direct IP to IP call */
if (getConfigFromCall (id) == Call::IPtoIP) {
returnValue = SIPVoIPLink::instance (AccountNULL)-> transfer (id, to);
if (getConfigFromCall (call_id) == Call::IPtoIP) {
returnValue = SIPVoIPLink::instance (AccountNULL)-> transfer (call_id, to);
}
/* Classic call, attached to an account */
else {
accountid = getAccountFromCall (id);
accountid = getAccountFromCall (call_id);
if (accountid == AccountNULL) {
_debug ("! Manager Transfer Call: Call doesn't exists\n");
return false;
}
returnValue = getAccountLink (accountid)->transfer (id, to);
returnValue = getAccountLink (accountid)->transfer (call_id, to);
removeCallAccount (id);
removeCallAccount (call_id);
}
removeWaitingCall (id);
removeWaitingCall (call_id);
switchCall ("");
if(participToConference(call_id))
{
if (_dbus) _dbus->getCallManager()->callStateChanged (id, "HUNGUP");
Conference *conf = getConferenceFromCallID(call_id);
if(conf != NULL)
{
// remove this participant
removeParticipant(call_id);
processRemainingParticipant(current_call_id, conf);
}
}
else
{
// we are not participating to a conference, current call switched to ""
if (!isConference(current_call_id))
switchCall("");
}
if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "HUNGUP");
return returnValue;
}
......@@ -2481,10 +2502,15 @@ ManagerImpl::getCodecDetails (const int32_t& payload)
std::string
ManagerImpl::getCurrentCodecName (const CallID& id)
{
// _debug("ManagerImpl::getCurrentCodecName method called \n");
AccountID accountid = getAccountFromCall (id);
// _debug("ManagerImpl::getCurrentCodecName : %s \n",getAccountLink(accountid)->getCurrentCodecName().c_str());
return getAccountLink (accountid)->getCurrentCodecName();
AccountID accountid = getAccountFromCall(id);
VoIPLink* link = getAccountLink (accountid);
Call* call = link->getCall(id);
if(call->getState() != Call::Active)
return "";
else
return link->getCurrentCodecName();
}
/**
......
......@@ -773,9 +773,11 @@ SIPVoIPLink::answer (const CallID& id)
// Terminate the call
_debug ("SIPVoIPLink::answer: fail terminate call %s \n",call->getCallId().c_str());
if(call->getAudioRtp())
call->getAudioRtp()->stop ();
terminateOneCall (call->getCallId());
removeCall (call->getCallId());
call->getAudioRtp()->stop ();
return false;
}
}
......@@ -1342,8 +1344,8 @@ SIPVoIPLink::SIPCallServerFailure (SIPCall *call)
Manager::instance().callFailure (id);
terminateOneCall (id);
removeCall (id);
if (call->getAudioRtp ())
call->getAudioRtp()->stop();
if (call->getAudioRtp ())
call->getAudioRtp()->stop();
}
}
......
Markdown is supported
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