Commit 3e2a4f2c authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Changed internal call id for peerNumber in filewave save name

parent 6271a039
...@@ -42,16 +42,16 @@ Call::Call(const CallID& id, Call::CallType type) ...@@ -42,16 +42,16 @@ Call::Call(const CallID& id, Call::CallType type)
SOUND_FORMAT soundFormat = INT16; SOUND_FORMAT soundFormat = INT16;
recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH),id); recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH),id);
_debug("CALL::Constructor for this clss is called \n"); // _debug("CALL::Constructor for this clss is called \n");
} }
Call::~Call() Call::~Call()
{ {
_debug("CALL::~Call(): Destructor for this clss is called \n"); // _debug("CALL::~Call(): Destructor for this clss is called \n");
if(recAudio.isOpenFile()) { if(recAudio.isOpenFile()) {
_debug("CALL::~Call(): A recording file is open, close it \n"); // _debug("CALL::~Call(): A recording file is open, close it \n");
recAudio.closeFile(); recAudio.closeFile();
} }
} }
...@@ -146,6 +146,11 @@ Call::setRecording() ...@@ -146,6 +146,11 @@ Call::setRecording()
recAudio.setRecording(); recAudio.setRecording();
} }
void
Call::initRecFileName() {
recAudio.initFileName(_peerNumber);
}
void void
Call::stopRecording() Call::stopRecording()
{ {
......
...@@ -237,6 +237,11 @@ class Call{ ...@@ -237,6 +237,11 @@ class Call{
*/ */
bool isRecording(); bool isRecording();
/**
*
*/
void initRecFileName();
protected: protected:
/** Protect every attribute that can be changed by two threads */ /** Protect every attribute that can be changed by two threads */
ost::Mutex _callMutex; ost::Mutex _callMutex;
......
...@@ -410,7 +410,8 @@ IAXVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) ...@@ -410,7 +410,8 @@ IAXVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
if (call) { if (call) {
call->setPeerNumber(toUrl); call->setPeerNumber(toUrl);
call->initRecFileName();
if ( iaxOutgoingInvite(call) ) { if ( iaxOutgoingInvite(call) ) {
call->setConnectionState(Call::Progressing); call->setConnectionState(Call::Progressing);
call->setState(Call::Active); call->setState(Call::Active);
...@@ -936,8 +937,11 @@ IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event) ...@@ -936,8 +937,11 @@ IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
if (event->ies.calling_number) if (event->ies.calling_number)
call->setPeerNumber(std::string(event->ies.calling_number)); call->setPeerNumber(std::string(event->ies.calling_number));
if (event->ies.calling_name) if (event->ies.calling_name)
call->setPeerName(std::string(event->ies.calling_name)); call->setPeerName(std::string(event->ies.calling_name));
// if peerNumber exist append it to the name string
call->initRecFileName();
if (Manager::instance().incomingCall(call, getAccountID())) { if (Manager::instance().incomingCall(call, getAccountID())) {
/** @todo Faudra considérer éventuellement le champ CODEC PREFS pour /** @todo Faudra considérer éventuellement le champ CODEC PREFS pour
......
...@@ -56,7 +56,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){ ...@@ -56,7 +56,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){
void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id){ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id){
std::string fName; // std::string fName;
fileType_ = type; fileType_ = type;
sndFormat_ = format; sndFormat_ = format;
...@@ -64,10 +64,10 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sn ...@@ -64,10 +64,10 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sn
sndSmplRate_ = sndSmplRate; sndSmplRate_ = sndSmplRate;
call_id_ = id; call_id_ = id;
fName = fileName_; // fName = fileName_;
fName.append("-"+call_id_); // fName.append("-"+call_id_);
/*
if (fileType_ == FILE_RAW){ if (fileType_ == FILE_RAW){
if ( strstr(fileName_, ".raw") == NULL){ if ( strstr(fileName_, ".raw") == NULL){
printf("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_); printf("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_);
...@@ -80,8 +80,34 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sn ...@@ -80,8 +80,34 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sn
fName.append(".wav"); fName.append(".wav");
} }
} }
*/
savePath_ = path + "/"; savePath_ = path + "/";
// savePath_.append(fName);
}
void AudioRecord::initFileName( std::string peerNumber){
std::string fName;
fName = fileName_;
fName.append("-"+peerNumber);
if (fileType_ == FILE_RAW){
if ( strstr(fileName_, ".raw") == NULL){
printf("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_);
fName.append(".raw");
}
}
else if (fileType_ == FILE_WAV){
if ( strstr(fileName_, ".wav") == NULL){
printf("AudioRecord::openFile::concatenate .wav file extension: name : %s \n", fileName_);
fName.append(".wav");
}
}
savePath_.append(fName); savePath_.append(fName);
} }
......
...@@ -45,6 +45,8 @@ public: ...@@ -45,6 +45,8 @@ public:
void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id); void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id);
void initFileName( std::string peerNumber );
/** /**
* Check if no otehr file is opened, then create a new one * Check if no otehr file is opened, then create a new one
* @param fileName A string containing teh file (with/without extension) * @param fileName A string containing teh file (with/without extension)
......
...@@ -420,6 +420,9 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) ...@@ -420,6 +420,9 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
} }
//call->setPeerNumber(toUrl); //call->setPeerNumber(toUrl);
call->setPeerNumber(getSipTo(toUrl, account->getHostname())); call->setPeerNumber(getSipTo(toUrl, account->getHostname()));
call->initRecFileName();
_debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data()); _debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data());
// we have to add the codec before using it in SIPOutgoingInvite... // we have to add the codec before using it in SIPOutgoingInvite...
call->setCodecMap(Manager::instance().getCodecDescriptorMap()); call->setCodecMap(Manager::instance().getCodecDescriptorMap());
...@@ -1838,6 +1841,8 @@ mod_on_rx_request(pjsip_rx_data *rdata) ...@@ -1838,6 +1841,8 @@ mod_on_rx_request(pjsip_rx_data *rdata)
call->setIp(link->getLocalIPAddress()); call->setIp(link->getLocalIPAddress());
call->setPeerNumber(peerNumber); call->setPeerNumber(peerNumber);
call->initRecFileName();
/* Call the SIPCallInvite function to generate the local sdp, /* Call the SIPCallInvite function to generate the local sdp,
* remote sdp and negociator. * remote sdp and negociator.
* This function is also used to set the parameters of audio RTP, including: * This function is also used to set the parameters of audio RTP, including:
......
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