// Class cVaxPhoneTransfer

function cVaxPhoneTransfer()
{
    this.OnLoadPage = function ()
    {
        m_objVaxWebPhoneLib.SetEventMainSIP(OnInitialized, OnUnInitialized, null, null, null, null);
        m_objVaxWebPhoneLib.SetEventTransferCall(OnTransferConsultCallClosed, OnTransferCallFailed, OnTransferCallAccepted);
    }

    /////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////

    function OnInitialized()
    {
        BtnTransferConsultDialCall.value = 'Dial';
    }

    function OnUnInitialized()
    {
        BtnTransferConsultDialCall.value = 'Dial';
    }

    /////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////

    this.BtnTransferBlindCall_onclick = function () 
    {
        m_objVaxWebPhoneLib.TransferCallBlind(EditTransferBlindPhoneNo.value);
    }

    this.BtnTransferConsultDialCall_onclick = function ()
    {
        if (BtnTransferConsultDialCall.value == "Hangup")
        {
            BtnTransferConsultDialCall.value = "Dial";
            m_objVaxWebPhoneLib.TransferConsultDisconnectCall();
            return;
        }

        BtnTransferConsultDialCall.value = "Hangup";
        m_objVaxWebPhoneLib.TransferConsultDialCall("", "", EditTransferConsultPhoneNo.value);
    }

    this.BtnTransferConsultJoinCall_onclick = function ()
    {
        m_objVaxWebPhoneLib.TransferConsultJoinCall();
    }

    /////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////

    function OnTransferConsultCallClosed()
    {
        BtnTransferConsultDialCall.value = 'Dial';
    }

    function OnTransferCallFailed(nStatusCode, sReasonPhrase)
    {
        m_objMainHtml.AddPhoneStatusLog("Transfer failed: " + sReasonPhrase);
    }

    function OnTransferCallAccepted()
    {
        m_objMainHtml.AddPhoneStatusLog("Transfer accepted");
    }
};