Commit 7ee3d70f authored by Alexandre Savard's avatar Alexandre Savard

Fixed second call audio codec name broadcasting to client

parent 9b32b811
......@@ -114,6 +114,7 @@ msgid "%d voice mail"
msgstr "%d mensaje de voz"
#: ../sflphone-gtk/src/actions.c:80
#, c-format
msgid "%s account- %s"
msgstr "%s cuenta: %s"
......@@ -304,6 +305,7 @@ msgid "Ringtones"
msgstr "_Permitir los ringtones"
#: ../sflphone-gtk/src/calltree.c:209
#, fuzzy, c-format
msgid "\"Voicemail\" <%s>"
msgstr "_Numero de Caja de Voz"
......@@ -625,6 +627,7 @@ msgid "_Show main window"
msgstr "Mostrar ventana principal"
#: ../sflphone-gtk/src/statusicon.c:124
#, c-format
msgid "SFLphone - %i accounts registered"
msgstr "SFLphone - %i cuenta registrada"
......
......@@ -182,15 +182,17 @@ AudioRtpRTX::initBuffers()
void
AudioRtpRTX::initAudioRtpSession (void)
{
_debug("AudioRtpRTX::initAudioRtpSession: call %s \n",_ca->getCallId().c_str());
try {
if (_ca == 0) { return; }
_audiocodec = Manager::instance().getCodecDescriptorMap().getCodec( _ca->getAudioCodec() );
_codecSampleRate = _audiocodec->getClockRate();
_codecSampleRate = _audiocodec->getClockRate();
_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());
return;
}
......@@ -249,6 +251,7 @@ AudioRtpRTX::initAudioRtpSession (void)
_debugException("! ARTP Failure: initialisation failed");
throw;
}
_debug("AudioRtpRTX::initAudioRtpSession: Init audio RTP sessionend of method\n");
}
void
......@@ -442,7 +445,7 @@ AudioRtpRTX::run () {
audiolayer->startStream();
_start.post();
_debug("- ARTP Action: Start\n");
_debug("- ARTP Action: Start call %s\n",_ca->getCallId().c_str());
while (!testCancel()) {
// printf("AudioRtpRTX::run() _session->getFirstTimestamp() %i \n",_session->getFirstTimestamp());
......@@ -452,12 +455,14 @@ AudioRtpRTX::run () {
////////////////////////////
// Send session
////////////////////////////
sendSessionFromMic(timestamp);
sendSessionFromMic(timestamp);
timestamp += step;
////////////////////////////
// Recv session
////////////////////////////
receiveSessionForSpkr(countTime);
// Let's wait for the next transmit cycle
if(_session->isWaiting())
......@@ -465,13 +470,14 @@ AudioRtpRTX::run () {
else
_ca->recAudio.recData(micData,_nSamplesMic);
Thread::sleep(TimerPort::getTimer());
Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms
}
// _debug("stop stream for audiortp loop\n");
audiolayer->stopStream();
_debug("- ARTP Action: Stop\n");
_debug("- ARTP Action: Stop call %s\n",_ca->getCallId().c_str());
//} catch(std::exception &e) {
//_start.post();
//_debug("! ARTP: Stop %s\n", e.what());
......
......@@ -122,7 +122,6 @@ Call::getRemoteIp()
AudioCodecType
Call::getAudioCodec()
{
ost::MutexLock m(_callMutex);
return _audioCodec;
}
......
......@@ -43,6 +43,7 @@
IAXVoIPLink::IAXVoIPLink(const AccountID& accountID)
: VoIPLink(accountID)
{
// _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread \n ");
_evThread = new EventThread(this);
_regSession = NULL;
_nextRefreshStamp = 0;
......@@ -88,6 +89,7 @@ IAXVoIPLink::init()
if (initDone())
return false;
bool returnValue = false;
// _localAddress = "127.0.0.1";
// port 0 is default
......
......@@ -110,6 +110,7 @@ main (int argc, char **argv) {
}
bool initOK = false;
try {
_debug("Initialize manager in main \n");
Manager::instance().initConfigFile();
Manager::instance().init();
initOK = true;
......
......@@ -221,6 +221,7 @@ ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const
bool
ManagerImpl::answerCall(const CallID& id)
{
stopTone(false);
_debug("Try to answer call: %s\n", id.data());
AccountID accountid = getAccountFromCall( id );
......@@ -240,14 +241,15 @@ ManagerImpl::answerCall(const CallID& id)
return false;
}
std::string codecName = getCurrentCodecName(id);
_debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str());
// if it was waiting, it's waiting no more
if (_dbus) _dbus->getCallManager()->callStateChanged(id, "CURRENT");
removeWaitingCall(id);
switchCall(id);
std::string codecName = getCurrentCodecName(id);
_debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str());
return true;
}
......@@ -367,6 +369,10 @@ ManagerImpl::offHoldCall(const CallID& id)
}
switchCall(id);
std::string codecName = getCurrentCodecName(id);
_debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str());
return returnValue;
}
......@@ -748,7 +754,7 @@ bool ManagerImpl::playATone(Tone::TONEID toneId)
return false;
audiolayer = getAudioDriver();
if (_telephoneTone != 0) {
_toneMutex.enterMutex();
_telephoneTone->setCurrentTone(toneId);
......
......@@ -446,7 +446,7 @@ SIPVoIPLink::answer(const CallID& id)
pj_status_t status;
pjsip_tx_data *tdata;
_debug("- SIP Action: start answering\n");
_debug("SIPVoIPLink::answer: start answering \n");
call = getSIPCall(id);
......@@ -458,22 +458,23 @@ SIPVoIPLink::answer(const CallID& id)
// User answered the incoming call, tell peer this news
if (call->startNegociation(_pool)) {
// Create and send a 200(OK) response
_debug("UserAgent: Negociation success!\n");
_debug("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str());
status = pjsip_inv_answer(call->getInvSession(), PJSIP_SC_OK, NULL, NULL, &tdata);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
status = pjsip_inv_send_msg(call->getInvSession(), tdata);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
_debug("* SIP Info: Starting AudioRTP when answering\n");
_debug("SIPVoIPLink::answer: Starting AudioRTP when answering : call %s \n", call->getCallId().c_str());
if (_audiortp->createNewSession(call) >= 0) {
call->setAudioStart(true);
call->setConnectionState(Call::Connected);
call->setState(Call::Active);
return true;
} else {
_debug("! SIP Failure: Unable to start sound when answering %s/%d\n", __FILE__, __LINE__);
_debug("SIPVoIPLink::answer: Unable to start sound when answering %s/%d\n", __FILE__, __LINE__);
}
}
_debug("SIPVoIPLink::answer: fail terminate call %s \n",call->getCallId().c_str());
terminateOneCall(call->getCallId());
removeCall(call->getCallId());
return false;
......@@ -804,10 +805,16 @@ std::string
SIPVoIPLink::getCurrentCodecName()
{
// _debug("SIPVoIPLink::getCurrentCodecName : \n");
_debug("SIPVoIPLink::getCurrentCodecName Ok 1 : \n");
printf("AAAAAAAAAAAAAHHHHHHH!!!!!!:: %s \n",Manager::instance().getCurrentCallId().c_str());
SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId());
_debug("SIPVoIPLink::getCurrentCodecName Ok 2 : \n");
printf("OOOOOOOUUUUUUPPPPPPPPPPSSSSSSSSSSS!!!!!!:: %s \n",call->getCallId().c_str());
AudioCodec *ac = call->getCodecMap().getCodec(call->getAudioCodec());
return ac->getCodecName();
......
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