Commit dfe7e9a4 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Bug fix

parent 2e0588e0
......@@ -207,6 +207,7 @@ sflphone_pick_up()
printf("accountID=%s\n",selectedCall->accountID);
break;
case CALL_STATE_INCOMING:
printf("CALL ID = %s\n", selectedCall->callID);
dbus_accept (selectedCall);
break;
case CALL_STATE_HOLD:
......
......@@ -199,8 +199,8 @@ select_codec( GtkComboBox* wid)
guint item = gtk_combo_box_get_active(wid);
/* now we want this selected codec to be used as the preferred codec */
/* ie first in the list in the user config */
codec_set_prefered_order(item);
dbus_set_prefered_codec(codec_list_get_nth(0)->name);
//codec_set_prefered_order(item);
//dbus_set_prefered_codec(codec_list_get_nth(0)->name);
}
void
......
......@@ -66,7 +66,7 @@ AudioRtp::createNewSession (SIPCall *ca) {
// Start RTP Send/Receive threads
_symmetric = Manager::instance().getConfigInt(SIGNALISATION,SYMMETRIC) ? true : false;
_RTXThread = new AudioRtpRTX (ca, _symmetric);
printf("_sym=%i\n\n", _symmetric);
try {
if (_RTXThread->start() != 0) {
_debug("! ARTP Failure: unable to start RTX Thread\n");
......@@ -111,7 +111,6 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym)
// TODO: this should be the local ip not the external (router) IP
std::string localipConfig = _ca->getLocalIp(); // _ca->getLocalIp();
ost::InetHostAddress local_ip(localipConfig.c_str());
if (!_sym) {
_sessionRecv = new ost::RTPSession(local_ip, _ca->getLocalAudioPort());
_sessionSend = new ost::RTPSession(local_ip, _ca->getLocalAudioPort());
......@@ -182,7 +181,7 @@ AudioRtpRTX::initAudioRtpSession (void)
try {
if (_ca == 0) { return; }
//_debug("Init audio RTP session\n");
_debug("Init audio RTP session\n");
ost::InetHostAddress remote_ip(_ca->getRemoteIp().c_str());
if (!remote_ip) {
_debug("! ARTP Thread Error: Target IP address [%s] is not correct!\n", _ca->getRemoteIp().data());
......@@ -224,7 +223,7 @@ AudioRtpRTX::initAudioRtpSession (void)
_sessionSend->setMark(true);
} else {
//_debug("AudioRTP Thread: Added session destination %s:%d\n", remote_ip.getHostname(), (unsigned short) _ca->getRemoteSdpAudioPort());
//_debug("AudioRTP Thread: Added session destination %s\n", remote_ip.getHostname() );
if (!_session->addDestination (remote_ip, (unsigned short) _ca->getRemoteAudioPort())) {
return;
......@@ -330,13 +329,14 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
adu = _session->getData(_session->getFirstTimestamp());
}
if (adu == NULL) {
//_debug("No RTP audio stream\n");
return;
}
int payload = adu->getType(); // codec type
unsigned char* data = (unsigned char*)adu->getData(); // data in char
unsigned int size = adu->getSize(); // size in char
// Decode data with relevant codec
AudioCodec* audiocodec = _ca->getCodecMap().getCodec((CodecType)payload);
......@@ -359,7 +359,7 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
_debug("We have decoded an RTP packet larger than expected: %s VS %s. Cropping.\n", nbInt16, max);
nbInt16=max;
}
SFLDataFormat* toAudioLayer;
int nbSample = nbInt16;
......@@ -501,7 +501,6 @@ AudioRtpRTX::run () {
// Recv session
////////////////////////////
receiveSessionForSpkr(countTime);
// Let's wait for the next transmit cycle
Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms
......
......@@ -166,6 +166,7 @@ ManagerImpl::isCurrentCall(const CallID& callId) {
bool
ManagerImpl::hasCurrentCall() {
ost::MutexLock m(_currentCallMutex);
_debug("Current call ID = %s\n", _currentCallId2.c_str());
if ( _currentCallId2 != "") {
return true;
}
......@@ -220,10 +221,10 @@ bool
ManagerImpl::answerCall(const CallID& id)
{
stopTone(false);
if (hasCurrentCall())
/*if (hasCurrentCall())
{
onHoldCall(getCurrentCallId());
}
}*/
AccountID accountid = getAccountFromCall( id );
if (accountid == AccountNULL) {
_debug("Answering Call: Call doesn't exists\n");
......@@ -611,6 +612,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
associateCallToAccount(call->getCallId(), accountId);
if ( !hasCurrentCall() ) {
_debug("INCOMING CALL!!!!!!\n");
call->setConnectionState(Call::Ringing);
ringtone();
switchCall(call->getCallId());
......@@ -990,7 +992,7 @@ ManagerImpl::behindNat(const std::string& svr, int port)
{
StunAddress4 stunSvrAddr;
stunSvrAddr.addr = 0;
// Convert char* to StunAddress4 structure
bool ret = stunParseServerName ((char*)svr.data(), stunSvrAddr);
if (!ret) {
......@@ -1085,9 +1087,12 @@ void
ManagerImpl::initAudioCodec (void)
{
_debugInit("Active Codecs");
_codecDescriptorMap.setActive(getConfigString("Audio", "Codecs.codec1"));
//_codecDescriptorMap.setActive(getConfigString("Audio", "Codecs.codec1"));
//_codecDescriptorMap.setActive(getConfigString("Audio", "Codec.codec2"));
//_codecDescriptorMap.setActive(getConfigString("Audio", "Codec.codec3"));
_codecDescriptorMap.setActive("G711a");
_codecDescriptorMap.setActive("G711u");
_codecDescriptorMap.setActive("GSM");
}
void
......@@ -1102,8 +1107,10 @@ ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name)
list[0] = list[i];
list[i] = tmp;
_codecDescriptorMap.setActive(list[0]);
_codecDescriptorMap.setInactive(list[1]);
_codecDescriptorMap.setInactive(list[2]);
//_codecDescriptorMap.setInactive(list[1]);
//_codecDescriptorMap.setInactive(list[2]);
_codecDescriptorMap.setActive(list[1]);
_codecDescriptorMap.setActive(list[2]);
setConfig("Audio", "Codecs.codec1", list[0]);
setConfig("Audio", "Codecs.codec2", list[1]);
setConfig("Audio", "Codecs.codec3", list[2]);
......
......@@ -20,7 +20,7 @@
#include "sipaccount.h"
#include "sipvoiplink.h"
#include "manager.h"
#include "user_cfg.h"
SIPAccount::SIPAccount(const AccountID& accountID)
: Account(accountID)
......@@ -43,8 +43,7 @@ SIPAccount::registerVoIPLink()
int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN);
SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link);
thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER));
thislink->setStunServer(Manager::instance().getConfigString(_accountID,DFT_STUN_SERVER));
thislink->setUseStun( useStun!=0 ? true : false);
_link->init();
......
......@@ -951,7 +951,9 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject)
CodecMap::iterator iter = map.begin();
while(iter != map.end()) {
printf("codec = %s\n",iter->second->getCodecName().data());
if (iter->second!=0 && iter->second->isActive()) {
printf("codec = %s\n",iter->second->getCodecName().data());
payload = iter->first;
// add each payload in the list of payload
media_audio << payload << " ";
......
......@@ -56,8 +56,8 @@
#define PLAY_TONES "DTMF.playTones"
#define PULSE_LENGTH "DTMF.pulseLength"
#define SEND_DTMF_AS "DTMF.sendDTMFas"
//#define STUN_SERVER "STUN.STUNserver"
//#define USE_STUN "STUN.useStun"
#define STUN_SERVER "STUN.STUNserver"
#define USE_STUN "STUN.useStun"
#define DRIVER_NAME "Drivers.driverName"
#define DRIVER_NAME_IN "Drivers.driverNameIn"
#define DRIVER_NAME_OUT "Drivers.driverNameOut"
......
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