Answers and questions are embedded below: On 09/05/2012 01:33 PM, Jitendra Singh wrote: > Hi Friends, > > I am trying to record Audio in WAV file format using the following code, > but when I don?t know how to identify in the application that recording > has finished. How can we set such a call-back which is called when > recording is over. Also when I am recording using the below code, the > recorded file is not playable in media player. > I don't understand why there should be a callback for "recording finished" since you're the one who decides when recording is finished. > Code for recording file: > > std::string fileName = > generateFileName(pCallData->cli,pCallData->msisdn); > > VEK_LOG_DEBUG("Trying to record file with Name = %s", > fileName.c_str()); > > const pj_str_t recordFile = pj_str > (const_cast<char*>(fileName.c_str())); I'd suggest to use pj_cstr() here to avoid the const_cast, but then this is only my opinion. > > pj_status_t status = pjsua_recorder_create(&recordFile, 0, > NULL, 0, 0, &pCallData->recorder_p_id); > You don't check for errors here, did the recorder creation even succeed? Maybe that's the problem why you can't play the file. > pjmedia_port *mediaPort = NULL; > > status = pjsua_recorder_get_port(pCallData->recorder_p_id, > &mediaPort); > > status = pjsua_conf_connect(pCallData->destConfPort, > pjsua_recorder_get_conf_port(pCallData->recorder_p_id)); > > My question is how to set a call-back which is called when the recording > is over and how to get the duration and size of file in this code. > I don't know whether PJ offers any facilities to determine file size and sound duration. However, this can easily be done manually (you just need a little bit knowledge about file handling and the WAV file format). Regards, Andreas -- Dipl.-Ing. (FH) Andreas Wehrmann Software Development -------------------------------------------------------------- Center Communication Systems GmbH A-1210 Wien, Ignaz-K?ck-Stra?e 19 Sitz in Wien FN 796 88p, Firmenbuchgericht Wien www.centersystems.com Tel.: +43 (0) 190 199 - 3616 Mobile: +43 (0) 664 884 75916 Fax: +43 (0) 190 199 - 2110 E-Mail: a.wehrmann at centersystems.com