コード例 #1
0
ファイル: voicePromptMcc2.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void MyCallEventHandler
(
    le_mcc_CallRef_t  callRef,
    le_mcc_Event_t    callEvent,
    void*             contextPtr
)
{
    le_result_t         res;

    if (callEvent == LE_MCC_EVENT_ALERTING)
    {
        LE_INFO("Call event is LE_MCC_EVENT_ALERTING.");

        StopFilePlayback();
        PlayFile(RINGTONE, true);
    }
    else if (callEvent == LE_MCC_EVENT_CONNECTED)
    {
        LE_INFO("Call event is LE_MCC_EVENT_CONNECTED.");

        StopFilePlayback();

        // Connect voice call to audio
        res = le_audio_Connect(AudioInputConnectorRef, MdmTxAudioRef);
        LE_ERROR_IF((res!=LE_OK), "Failed to connect mdmTx on Input connector!");
        res = le_audio_Connect(AudioOutputConnectorRef, MdmRxAudioRef);
        LE_ERROR_IF((res!=LE_OK), "Failed to connect mdmRx on Output connector!");
    }
    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_LOCAL_ENDED:
            case LE_MCC_TERM_REMOTE_ENDED:
                LE_INFO("Termination reason is LE_MCC_TERM_REMOTE_ENDED or LE_MCC_TERM_LOCAL_ENDED");
                break;

            case LE_MCC_TERM_NETWORK_FAIL:
            case LE_MCC_TERM_UNASSIGNED_NUMBER:
            case LE_MCC_TERM_USER_BUSY:
            case LE_MCC_TERM_UNDEFINED:
            default:
                LE_INFO("Termination reason is %d", term);
                StopFilePlayback();
                break;
        }

        PlayFile(VOICE_PROMPT_END, false);

        le_mcc_Delete(callRef);
        if (callRef == TestCallRef)
        {
            TestCallRef = NULL;
        }
    }
    else if (callEvent == LE_MCC_EVENT_INCOMING)
    {
        LE_INFO("Call event is LE_MCC_EVENT_INCOMING.");
    }
    else
    {
        LE_INFO("Unknowm Call event.");
    }
}
コード例 #2
0
ファイル: le_mccTest.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void MyCallEventHandler
(
    le_mcc_CallRef_t  callRef,
    le_mcc_Event_t callEvent,
    void* contextPtr
)
{
    le_result_t         res;
    static bool firstConnectCall = true;

    LE_INFO("MCC TEST: New Call event: %d for Call %p", callEvent, callRef);

    if (callEvent == LE_MCC_EVENT_ALERTING)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_ALERTING.");
        if (firstConnectCall)
        {
            LE_INFO("---!!!! PLEASE CHECK ON THE REMOTE SIDE IF THE PHONE NUMBER IS %s !!!!---",
                            ((ClirStatus == LE_ON) ? "HIDED" : "DISPLAYED"));
            LE_INFO("---!!!! PLEASE HANG UP ON THE REMOTE SIDE !!!!---");
        }
    }
    else if (callEvent == LE_MCC_EVENT_CONNECTED)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_CONNECTED.");
        if (firstConnectCall)
        {
            LE_INFO("---!!!! PLEASE TERMINATE THE CALL on THE REMOTE SIDE !!!!---");
            firstConnectCall = false;
        }
    }
    else if (callEvent == LE_MCC_EVENT_TERMINATED)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_TERMINATED.");
        le_mcc_TerminationReason_t term = le_mcc_GetTerminationReason(callRef);
        int32_t code = le_mcc_GetPlatformSpecificTerminationCode(callRef);
        switch(term)
        {
            case LE_MCC_TERM_NETWORK_FAIL:
                LE_ERROR("Termination reason is LE_MCC_TERM_NETWORK_FAIL");
                exit(EXIT_FAILURE);
                break;

            case LE_MCC_TERM_UNASSIGNED_NUMBER:
                LE_ERROR("Termination reason is LE_MCC_TERM_UNASSIGNED_NUMBER");
                exit(EXIT_FAILURE);
                break;

            case LE_MCC_TERM_USER_BUSY:
                LE_ERROR("Termination reason is LE_MCC_TERM_USER_BUSY");
                exit(EXIT_FAILURE);
                break;

            case LE_MCC_TERM_LOCAL_ENDED:
                LE_INFO("Termination reason is LE_MCC_TERM_LOCAL_ENDED");
                LE_INFO("mccTest Sequence SUCCESS");
                LE_INFO("mccTest test exit");
                le_mcc_Delete(callRef);
                exit(EXIT_SUCCESS);
                break;

            case LE_MCC_TERM_REMOTE_ENDED:
                LE_INFO("Termination reason is LE_MCC_TERM_REMOTE_ENDED");
                LE_INFO("---!!!! PLEASE CREATE AN INCOMING CALL !!!!---");
                break;

            case LE_MCC_TERM_UNDEFINED:
                LE_ERROR("Termination reason is LE_MCC_TERM_UNDEFINED");
                LE_ERROR("---!!!! PLEASE CREATE AN INCOMING CALL !!!!---");
                break;

            default:
                LE_ERROR("Termination reason is %d", term);
                exit(EXIT_FAILURE);
                break;
        }
        LE_INFO("Termination code is 0x%X", code);

        if (HangUpTimer)
        {
            le_timer_Stop(HangUpTimer);
        }
    }
    else if (callEvent == LE_MCC_EVENT_INCOMING)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_INCOMING.");
        res = le_mcc_Answer(callRef);
        if (res == LE_OK)
        {
            LE_INFO("Check MyCallEventHandler passed, I answered the call");
            LE_INFO("All calls will be hung-up in 10 seconds");
            LE_ASSERT(le_timer_Start(HangUpTimer) == LE_OK);
        }
        else
        {
            LE_ERROR("Check MyCallEventHandler failed to answer the call.");
        }
    }
    else if (callEvent == LE_MCC_EVENT_ORIGINATING)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_ORIGINATING.");
    }
    else if (callEvent == LE_MCC_EVENT_SETUP)
    {
        LE_INFO("Check MyCallEventHandler passed, event is LE_MCC_EVENT_SETUP.");
    }
    else
    {
        LE_ERROR("Check MyCallEventHandler failed, unknowm event %d.", callEvent);
    }
}
コード例 #3
0
ファイル: audioCallPbRecApp.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
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);
    }
}