亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? voipcall.cpp

?? 一個WinCE6。0下的IP phone的源代碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#include "VoIPCall.hpp"
#include "CommonFunctions.hpp"
#include <auto_xxx.hxx>         //for auto_bstr etc.
#include <rtcerr.h>             //for RTC error codes
#include "DialEngine.hpp"
#include "Debug.hpp"
#include "VoIPApp.hpp"
#include "SettingsApi.hpp"

bool
IsValidTime(
    const SYSTEMTIME* pTime 
    )
{
    if (pTime == NULL)
    {
        return false; 
    }

    FILETIME FileTime = {0}; 

    if (!SystemTimeToFileTime(pTime, &FileTime))
    {
        return false; 
    }

    if (FileTime.dwHighDateTime == 0 && FileTime.dwLowDateTime == 0)
    {
        return false; 
    }

    return true; 
}

/*------------------------------------------------------------------------------
    GetULLAsSystemTime

    Utility function that gets the current system time as an unsigned long long
------------------------------------------------------------------------------*/
HRESULT 
GetULLAsSystemTime(
    ULONGLONG           ull, 
    __out SYSTEMTIME*   pSystemTime
    )
{
    if (pSystemTime == NULL)
    {
        return E_INVALIDARG;
    }

    ull /= 10000; // convert to ms -- 1 ns is 10^6 ms so 100 ns is 10^4 ms
    
    pSystemTime->wMilliseconds = (WORD)(ull % 1000);
    ull /= 1000;

    pSystemTime->wSecond       = (WORD)(ull % 60);
    ull /= 60;

    pSystemTime->wMinute       = (WORD)(ull % 60);
    ull /= 60;

    pSystemTime->wHour         = (WORD)(ull % 24);
    ull /= 24;

    pSystemTime->wDay          = (WORD)ull;

    pSystemTime->wYear         = 0; 
    pSystemTime->wDayOfWeek    = 0; 
    pSystemTime->wMonth        = 0;
    
    return S_OK;        
}
/*------------------------------------------------------------------------------
    GetSystemTimeAsULL

    Utility function that gets the current system time as an unsigned long long
------------------------------------------------------------------------------*/
HRESULT 
GetSystemTimeAsULL(
    const SYSTEMTIME*   pSystemTime, 
    __out ULONGLONG*    pDest
    )
{
    if (pDest == NULL || pSystemTime == NULL)
    {
        ASSERT(FALSE);
        return E_POINTER;
    }

    FILETIME   FileTime = {0};

    if (! SystemTimeToFileTime(pSystemTime, &FileTime))
    {
        ASSERT(FALSE);
        return CommonUtilities_t::GetErrorFromWin32();
    }

    //shift the high time over to the upper 32 bits and OR in the lower bits
   *pDest = (static_cast<ULONGLONG>(FileTime.dwHighDateTime) << 32) | FileTime.dwLowDateTime;
    return S_OK;
}

const UINT VoIPCall_t::sc_RingbackStartTimeout  = 150;
const UINT VoIPCall_t::sc_TransferDoneTimeout   = 10 * 1000; 

/*------------------------------------------------------------------------------
    VoIPCall_t::CreateNewCall

    Static method used for creating and initializing a new call object

    Parameters:
        IsOutgoingCall: Is this an outgoing call?
        pFriendlyNumber: (optional) Friendly number string if it is already known before we create the call. e.g outgoing call 
        pFriendlyName: (optional) Friendly name string if it is already known before we create the call. e.g. PHMakePhoneCall is called
        pRTCSession: pointer to a valid RTC Session object
        ppCall:  OUT - the returned call

    Returns (HRESULT): indicating success or failure
------------------------------------------------------------------------------*/
/* static */ HRESULT VoIPCall_t::CreateNewCall(
    bool            IsOutgoingCall, 
    const WCHAR*    pFriendlyNumber, 
    const WCHAR*    pFriendlyName, 
    IRTCSession*    pRTCSession,
    Call_t**        ppCall
    )
{
    //validate parameters
    if (ppCall == NULL || pRTCSession == NULL)
    {
        ASSERT(FALSE);
        return E_POINTER;
    }


    VoIPCall_t* pOutCall = new VoIPCall_t();
    if (! pOutCall)
    {
        return E_OUTOFMEMORY;
    }

    HRESULT hr = pOutCall->Initialize(
                            IsOutgoingCall, 
                            pFriendlyNumber, 
                            pFriendlyName, 
                            pRTCSession
                            );
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed to initialize the call - error: 0x%x", hr));

        //cleanup
        //
        pOutCall->Release();
       *ppCall = NULL;

        return hr;
    }

    *ppCall = static_cast<Call_t*>(pOutCall);
    return S_OK;
}


/*------------------------------------------------------------------------------
    VoIPCall_t::VoIPCall_t

    Ctor
------------------------------------------------------------------------------*/
VoIPCall_t::VoIPCall_t()
{
    TRACE(ZONE_PHONEAPP_CTOR);
    m_CouldBeMissed             = true;
    m_IsLogged                  = false; 
    
    m_PlayingRingbackTone       = false;
    m_StartRingbackTimerId      = 0;

    m_cpRTCParticipant          = NULL;
    m_cpRTCSession              = NULL;
    m_cpRTCSessionReferredEvent = NULL; 
    m_cpReferringCall           = NULL; 

}

/*------------------------------------------------------------------------------
    VoIPCall_t::~VoIPCall_t

    Dtor
------------------------------------------------------------------------------*/
VoIPCall_t::~VoIPCall_t()
{
    TRACE(ZONE_PHONEAPP_CTOR);

    //terminate the session once this object is to be destroyed
    //since we are not tracking it
    if ((m_cpRTCSession) && (GetCallStatus() != RTCSS_DISCONNECTED))
    {
        m_cpRTCSession->Terminate(RTCTR_SHUTDOWN);
    }

    StopRingbackTone();

    m_cpRTCParticipant          = NULL;
    m_cpRTCSession              = NULL;
    m_cpRTCSessionReferredEvent = NULL; 
    m_cpReferringCall           = NULL; 
    
}

/*------------------------------------------------------------------------------
    VoIPCall_t::Initialize

    Initializes this object from an existing IRTCSession

    Parameters:
        IsOutgoingCall: Is this an outgoing call?
        pFriendlyNumber: (optional) Friendly number string if it is already known before we create the call. e.g outgoing call 
        pFriendlyName: (optional) Friendly name string if it is already known before we create the call. e.g. PHMakePhoneCall is called
        pRTCSession: pointer to a valid RTC Session object

    Returns (HRESULT): indicating success or failure
------------------------------------------------------------------------------*/
HRESULT VoIPCall_t::Initialize(
    bool            IsOutgoingCall,
    const WCHAR*    pFriendlyNumber, 
    const WCHAR*    pFriendlyName, 
    IRTCSession*    pRTCSession
    )
{
    if (pRTCSession == NULL)
    {
        return E_INVALIDARG; 
    }
    
    m_CallType = IsOutgoingCall ? e_vctOutgoing : e_vctIncoming;

    //set the new session variable
    m_cpRTCSession  = pRTCSession;

    CComPtr<IRTCEnumParticipants> cpEnumParticipants;
    HRESULT hr = m_cpRTCSession->EnumerateParticipants(
                                    &cpEnumParticipants
                                    );
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed to get participant list from the session - hr = 0x%x", hr));
        return hr;
    }

    CComPtr<IRTCParticipant>    cpParticipant;
    hr = cpEnumParticipants->Next(1, &m_cpRTCParticipant, NULL);
    if (hr != S_OK)
    {
        PHONEAPP_DEBUGMSG(hr != S_FALSE && ZONE_PHONEAPP_ERROR, (L"Failed to get the next participant from the session - hr = 0x%x", hr));
        return hr;
    }

    hr = m_cpRTCParticipant->get_UserURI(&m_bstrURI); 
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed at getting the remove URI, hr = 0x%x", hr));     
        return hr; 
    }

    //use the specified friendly number first if it exists
    if (pFriendlyNumber != NULL &&
        pFriendlyNumber[0] != L'\0')
    {
        m_bstrFriendlyNumber = SysAllocString(pFriendlyNumber); 
        if (m_bstrFriendlyNumber == NULL)
        {
            return E_OUTOFMEMORY; 
        }
    }
    else
    {
        //otherwise, get it by converting from URI
        hr = GetApp()->GetDialEngine().GetPhoneNumberToDisplay(
                                            m_bstrURI, 
                                            -1, 
                                            NULL,                   //use active profile
                                            &m_bstrFriendlyNumber
                                            ); 
    }
    
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed at formating the remote URI, hr = 0x%x", hr)); 
        return hr; 
    }

    hr = m_cpRTCParticipant->get_Name(&m_bstrName); 
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed at gettting name from network, hr = 0x%x", hr)); 
    }

    //use the specified friendly name first if it exists
    if (pFriendlyName != NULL &&
        pFriendlyName[0] != L'\0')
    {
        m_bstrFriendlyName = SysAllocString(pFriendlyName); 
        if (m_bstrFriendlyName == NULL)
        {
            return E_OUTOFMEMORY; 
        }

    }

    //get the caller information from database
    hr = GetApp()->GetDatabase().GetCallerInfo(
                                    m_bstrFriendlyNumber, 
                                    (m_bstrFriendlyName != NULL && m_bstrFriendlyName[0] != L'\0') ? NULL : &m_bstrFriendlyName, 
                                    &m_bstrRingTonePath, 
                                    &m_IsBlocked
                                    ); 
    if (FAILED(hr))
    {
        PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed at gettting information from database, hr = 0x%x", hr));         
    }


    //if we still don't have a good caller id, try the POOM
    if (m_bstrFriendlyName == NULL ||
        m_bstrFriendlyName[0] == L'\0')
    {

        hr = GetApp()->GetPoom().GetCallerName(
                                    m_bstrFriendlyNumber, 
                                    &m_bstrFriendlyName
                                    ); 
        if (FAILED(hr))
        {
            PHONEAPP_DEBUGMSG(ZONE_PHONEAPP_ERROR, (L"Failed at getting caller id from Poom, hr = 0x%x", hr)); 
        }
    }

    return S_OK;

}


/*------------------------------------------------------------------------------
    VoIPCall_t::ForceDestroy
    
    Delete this object and null out RTC pointers
------------------------------------------------------------------------------*/
void 
VoIPCall_t::ForceDestroy(
    void
    )
{
    PhoneAppUtilities_t::NullOutCOMPtr<IRTCParticipant>(&m_cpRTCParticipant);
    PhoneAppUtilities_t::NullOutCOMPtr<IRTCSession>(&m_cpRTCSession);
    delete this;
    return;
}

/*------------------------------------------------------------------------------
    VoIPCall_t::DoPhoneVerb

    Perform an action for the phone application.
------------------------------------------------------------------------------*/
HRESULT 
VoIPCall_t::DoPhoneVerb(
    PH_VERB Verb,
    VPARAM  Parameter
    )
{
    HRESULT hr = S_OK;

    switch (Verb)
    {
    case PH_VERB_HOLD:
    case PH_VERB_UNHOLD:
        hr = DoVerbHoldUnhold(Verb);
        break;

    case PH_VERB_ACCEPT_INCOMING:
    case PH_VERB_REJECT_INCOMING:
        hr = DoVerbAcceptRejectIncomingCall(Verb);
        break;

    case PH_VERB_TALK:
        hr = DoVerbTalk();
        break;

    case PH_VERB_END:
        hr = DoVerbEnd();
        break;

    case PH_VERB_TRANSFER:
        hr = DoVerbTransfer(Parameter); 
        break;

    default:
        hr = E_NOTIMPL;
        break;
    }

    return hr;
}

/*------------------------------------------------------------------------------
    VoIPCall_t::Contains

    Overloaded Comparison operator - compares internal participant to specified
    participant
------------------------------------------------------------------------------*/
bool 
VoIPCall_t::Contains(
    IRTCParticipant* pParticipant
    )
{
    return PhoneAppUtilities_t::AreCOMPointersEqual<IRTCParticipant>(
        static_cast<IRTCParticipant*>(m_cpRTCParticipant),
        pParticipant
        );
}

/*------------------------------------------------------------------------------
    VoIPCall_t::operator==

    Overloaded comparison operator - compares internal session to specified
    session
------------------------------------------------------------------------------*/
bool 
VoIPCall_t::Contains(
    IRTCSession* pSession
    )
{
    return PhoneAppUtilities_t::AreCOMPointersEqual<IRTCSession>(
        static_cast<IRTCSession*>(m_cpRTCSession),
        pSession
        );
}

/*------------------------------------------------------------------------------
    VoIPCall_t::UpdateDisconnectReason

    When the call disconnects, this retreives the reason why the call disconnects
    to help determine if the call was terminated for strange reasons (e.g. busy etc)
------------------------------------------------------------------------------*/
HRESULT 
VoIPCall_t::UpdateDisconnectReason(

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美视频在线| 久久伊人蜜桃av一区二区| 亚洲日本在线a| 99久久国产综合色|国产精品| 欧美激情在线一区二区三区| 国产成人亚洲综合a∨婷婷 | 日韩中文字幕不卡| 欧美群妇大交群中文字幕| 亚洲国产精品天堂| 91精品国产丝袜白色高跟鞋| 麻豆国产精品一区二区三区| 久久久久久久久久久久久久久99| 国产乱码精品一区二区三区五月婷| 亚洲最大成人综合| 欧美视频在线播放| 亚洲h动漫在线| 日韩欧美三级在线| 国产日产亚洲精品系列| 91丝袜美腿高跟国产极品老师 | 中国色在线观看另类| 一片黄亚洲嫩模| 日韩一级黄色大片| 国产成a人亚洲精| 亚洲国产一区在线观看| 日韩一级完整毛片| 成人av第一页| 精品久久久久久久久久久久久久久久久 | 91影院在线免费观看| 亚洲电影在线播放| 国产视频在线观看一区二区三区| 性久久久久久久久| 精品国产凹凸成av人网站| 成人免费黄色大片| 日本美女一区二区三区视频| 亚洲国产高清aⅴ视频| 欧美日韩精品福利| 国产专区综合网| 亚洲视频在线观看一区| 91色视频在线| 7777精品伊人久久久大香线蕉超级流畅| 精品国产免费一区二区三区四区 | 成人一区在线观看| 亚洲妇熟xx妇色黄| 久久精品视频一区| 色婷婷久久久久swag精品| 成人午夜在线免费| 欧美男女性生活在线直播观看| 日本一区二区不卡视频| 日韩av中文字幕一区二区| 欧美国产成人精品| 六月丁香婷婷久久| 国产成人h网站| 欧美日韩色综合| 91精品午夜视频| 韩国理伦片一区二区三区在线播放| 91丝袜高跟美女视频| 久久精子c满五个校花| 久久电影国产免费久久电影| 中文字幕欧美三区| 九九热在线视频观看这里只有精品 | 亚洲欧洲99久久| 欧美videos中文字幕| 成人黄色电影在线| 国产精品久久久久久福利一牛影视 | 欧美日韩一区在线观看| 亚洲成人一区在线| 亚洲欧洲日本在线| 欧洲国产伦久久久久久久| 香蕉av福利精品导航| 欧美日韩一区二区三区四区 | 7777精品伊人久久久大香线蕉超级流畅| 亚洲综合成人在线视频| 欧美久久免费观看| 欧美无砖砖区免费| 午夜久久久久久| 91偷拍与自偷拍精品| 亚洲精品一区二区三区香蕉| 亚洲国产美国国产综合一区二区| 欧美日韩一区精品| 国产一区二区三区日韩| 日韩精品亚洲专区| 热久久久久久久| 青青青爽久久午夜综合久久午夜| 丝瓜av网站精品一区二区| 日韩一区二区三区观看| 91精品国产入口| 日韩欧美国产一区二区三区| 欧美一区三区二区| 3atv一区二区三区| 日韩精品中文字幕一区| 久久亚洲精精品中文字幕早川悠里| 精品电影一区二区三区| 成人av小说网| 91在线丨porny丨国产| 欧美无砖专区一中文字| 欧美另类videos死尸| 日韩欧美综合在线| 久久老女人爱爱| 亚洲视频一区二区在线观看| 欧美日本不卡视频| 精品三级在线看| 亚洲电影第三页| 久久97超碰国产精品超碰| 日韩欧美中文字幕制服| 国产精品99久久久久久久女警| 国产精品久久福利| 久久久久国产免费免费| av一区二区不卡| 99久久综合99久久综合网站| 色综合久久88色综合天天免费| 91福利社在线观看| 高清不卡一区二区在线| 99精品欧美一区| 在线观看日产精品| 欧美一级理论片| 国产欧美一区二区精品秋霞影院| 91影视在线播放| 99久久亚洲一区二区三区青草| 91精品办公室少妇高潮对白| 日韩午夜激情电影| 日韩精品专区在线影院观看| 久久久不卡影院| 国产精品亚洲成人| 国产精品亚洲一区二区三区在线| 亚洲人快播电影网| 国产一级精品在线| 国产日韩欧美麻豆| 性欧美疯狂xxxxbbbb| 国产一区999| 欧美精品一二三| 91蜜桃在线观看| 欧美一区二区三区在线观看视频 | 蜜臀av性久久久久av蜜臀妖精| 丰满少妇在线播放bd日韩电影| 在线观看国产91| 国产亚洲美州欧州综合国| 午夜欧美大尺度福利影院在线看| 国产高清精品在线| 日韩一区二区三区三四区视频在线观看| 色哟哟在线观看一区二区三区| 精品久久久久久久久久久久包黑料 | 欧美精品一区二区久久婷婷 | 蜜桃av一区二区三区电影| 99久久精品国产导航| 精品88久久久久88久久久| 一区二区三区丝袜| 成人久久久精品乱码一区二区三区 | 亚洲第一激情av| 99免费精品在线| 中文无字幕一区二区三区 | 欧美日韩一区二区三区四区 | 国产成人三级在线观看| 91精品国产乱| 亚洲第一福利一区| 91黄色激情网站| 亚洲精品久久久蜜桃| 不卡一二三区首页| 国产欧美日韩另类一区| 国产v综合v亚洲欧| 亚洲国产美女搞黄色| 不卡的电视剧免费网站有什么| 六月丁香婷婷久久| 91精品国产入口在线| 日本韩国一区二区三区| 亚洲色图一区二区三区| 亚洲乱码国产乱码精品精98午夜| 91成人国产精品| 热久久免费视频| 欧美xingq一区二区| 国产凹凸在线观看一区二区| 国产一区二区美女| 91在线观看成人| 亚洲欧美日韩中文播放| 91麻豆蜜桃一区二区三区| 国产精品久久久久一区| 91一区二区在线| 精品无人区卡一卡二卡三乱码免费卡| 免费成人av资源网| 欧美电影免费观看高清完整版在线观看| 亚洲电影激情视频网站| 欧美日韩国产首页| 视频一区在线播放| 欧美成人精品1314www| www久久久久| 国产精品99久久久久久似苏梦涵| 国产亚洲一二三区| 国产91在线观看丝袜| 国产精品不卡在线| 91免费看片在线观看| 亚洲制服丝袜av| 欧美日韩久久一区| 久久精品国产一区二区| 久久影院午夜论| 风间由美一区二区av101| 亚洲免费在线观看视频| 欧美日韩国产三级| 国产情人综合久久777777| 波波电影院一区二区三区| 一区二区三区精品| 欧美一级xxx|