Пример #1
0
//--------------------------------------------------------------------------------------------------
static void StopFilePlayback
(
    void
)
{
    LE_INFO("Stop file playback on fd.%d", AudioFileFd);
    LE_FATAL_IF((le_audio_Stop(PlayerRef) != LE_OK), "Cannot stop file");

    close(AudioFileFd);
}
Пример #2
0
//--------------------------------------------------------------------------------------------------
static void MyCallEventHandler
(
    le_mcc_CallRef_t   callRef,
    le_mcc_Event_t callEvent,
    void*               contextPtr
)
{
    if (callEvent == LE_MCC_EVENT_ALERTING)
    {
        LE_INFO("Call event is LE_MCC_EVENT_ALERTING.");
    }
    else if (callEvent == LE_MCC_EVENT_CONNECTED)
    {
        LE_INFO("Call event is LE_MCC_EVENT_CONNECTED.");
        LE_INFO("Connect Remote Rec");
        ConnectAudioToFileRec();
    }
    else if (callEvent == LE_MCC_EVENT_TERMINATED)
    {
        LE_INFO("Call event is LE_MCC_EVENT_TERMINATED.");
        le_mcc_TerminationReason_t term = le_mcc_GetTerminationReason(callRef);
        switch(term)
        {
            case LE_MCC_TERM_NETWORK_FAIL:
                LE_INFO("Termination reason is LE_MCC_TERM_NETWORK_FAIL");
                break;

            case LE_MCC_TERM_UNASSIGNED_NUMBER:
                LE_INFO("Termination reason is LE_MCC_TERM_UNASSIGNED_NUMBER");
                break;

            case LE_MCC_TERM_USER_BUSY:
                LE_INFO("Termination reason is LE_MCC_TERM_USER_BUSY");
                break;

            case LE_MCC_TERM_LOCAL_ENDED:
                LE_INFO("Termination reason is LE_MCC_TERM_LOCAL_ENDED");
                break;

            case LE_MCC_TERM_REMOTE_ENDED:
                LE_INFO("Termination reason is LE_MCC_TERM_REMOTE_ENDED");
                break;

            case LE_MCC_TERM_UNDEFINED:
                LE_INFO("Termination reason is LE_MCC_TERM_UNDEFINED");
                break;

            default:
                LE_INFO("Termination reason is %d", term);
                break;
        }

        le_audio_Stop(FileAudioRef);
        le_audio_Disconnect(AudioOutputConnectorRef, FileAudioRef);
        le_audio_Disconnect(AudioInputConnectorRef, FileAudioRef);

        le_audio_Close(FileAudioRef);

        // 2-second pause: workaround to step over possible pcm_open error on AR8 platforms
        sleep(2);

        ConnectAudioToFileLocalPlay();

        le_mcc_Delete(callRef);
    }
    else if (callEvent == LE_MCC_EVENT_INCOMING)
    {
        LE_INFO("Call event is LE_MCC_EVENT_INCOMING.");
        le_mcc_Answer(callRef);
    }
    else
    {
        LE_INFO("Other Call event.%d", callEvent);
    }
}