0

I want to record call voice during the call time on BlackBerry 10 OS. For this I used Telephony Phone and Call State Listener. I start as found Call State "Connected" and stop when call "Disconnected".

But at start time recorder records only 160Byte of data each time. and at stop time recorder shows "Already unprepared".

For this I use recorder.prepare() but it still didn't work for me. Please suggest and help me. Here is the code

void ApplicationHeadless::onCallUpdated(const Call &call)
{
    QMetaObject MetaCallTypeObject = CallType::staticMetaObject;
    QMetaEnum CallTypeEnum = MetaCallTypeObject.enumerator(
            MetaCallTypeObject.indexOfEnumerator("Type"));

    QMetaObject MetaCallStateObject = CallState::staticMetaObject;
    QMetaEnum CallStateEnum = MetaCallStateObject.enumerator(
            MetaCallStateObject.indexOfEnumerator("Type"));

    CallType::Type CurrentCallType = call.callType();
    CallState::Type CurrentCallState = call.callState();

    QString conn = "Connected";
    QString dcon = "Disconnected";
    QDateTime now = QDateTime::currentDateTime();
    bb::multimedia::AudioRecorder recorder;

    if (conn.compare(CallStateEnum.valueToKey(CurrentCallState)) == 0) {
        recorder.setOutputUrl(QUrl("/tmp/" + now.toString() + ".m4a"));
        recorder.setOutputUrl(QUrl("file://" + QDir::currentPath() + "/data/recording121.m4a"));
        recorder.record();
    }

    if (dcon.compare(CallStateEnum.valueToKey(CurrentCallState)) == 0) {
        recorder.reset();
    }
}

Thanks in advance..

0 Answers0