# SitePhone Object The SitePhone object controls the environment of the Voice over IP plugin. Members Table The following table lists the members provided by the SitePhone object.
Members
Properties | Description
CallCosts | Current call total costs.
CallDuration | Current call duration.
CallFailureReason | Last call failure reason.
CallRate | Current call rate.
CallStatus | Current call status.
MessageCosts | Current message costs.
MessageDeliveryFailureReason | Current message failure reason.
MessageDeliveryStatus | Current message delivery status.
PhoneCallsEnabled | Whether phone calls are enabled.
State | Current plugin state.
TextMessagingEnabled | Whether text messaging is enabled.
UserCallsEnabled | Whether user calls are enabled.
Methods | Description
IsCalleeAllowed | Returns whether a destination user name or phone number is allowed to call.
FinishCall | Finishes the current call.
GetContactAvailability | Returns the availability status of a Skype contact.
GetContactNames | Returns the names of all contacts of a Skype account.
GetFullPhoneNumber | Returns a phone number prefixed with country code.
GetVideoState | Returns the video status.
HoldCall | Places the current call on hold.
ResumeCall | Resumes hold call.
SendAuthRequest | Sends an authentication request to a Skype account.
SendTextMessage | Sends a short text message.
StartCall | Starts a phone/internet call.
Events | Description
OnAvailabilityChanged | Fires when the availability of a Skype contact changes.
OnCallDurationChanged | Fires when the call duration changes.
OnCallStateChanged | Fires when the call state changes.
OnMessageStateChanged | Fires when the message state changes.
OnOtherVideoStateChanged | Fires when the remote video state changes.
OnOwnVideoStateChanged | Fires when the local video state changes.
OnStateChanged | Fires when the plugin state changes.
Remarks This object is available through the collection Plugins. Use the SitePhone object to manage calls and short messages. Note that the path of a file using SiteKiosk objects must be allowed in the SiteKiosk configuration (Security -> Access -> URL's With Script Permission) if it is not a browser skin file. Examples The following example shows information about the core features of the Voice over IP plugin.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>SitePhone</title>
        <script type="text/javascript">
            window.external.InitScriptInterface();
            SitePhone = SiteKiosk.Plugins("SitePhone");

            //SitePhone.State flags
            var S_OFFLINE = 0;
            var S_CONNECTING = 1;
            var S_PAUSING = 2;
            var S_ONLINE = 3;

            //SitePhone.CallStatus flags
            var CS_UNPLACED = 0;
            var CS_ROUTING = 1;
            var CS_EARLY_MEDIA = 2;
            var CS_FAILED = 3;
            var CS_RINGING = 4;
            var CS_IN_PROGRESS = 5;
            var CS_ON_HOLD = 6;
            var CS_FINISHED = 7;
            var CS_MISSED = 8;
            var CS_REFUSED = 9;
            var CS_BUSY = 10;
            var CS_CANCELLED = 11;
            var CS_LOCAL_HOLD = 12;
            var CS_REMOTE_HOLD = 13;
            var CS_VOICEMAIL_BUFFERING_GREETING = 14;
            var CS_VOICEMAIL_PLAYING_GREETING = 15;
            var CS_VOICEMAIL_RECORDING = 16;
            var CS_VOICEMAIL_UPLOADING = 17;
            var CS_VOICEMAIL_SENT = 18;
            var CS_VOICEMAIL_CANCELLED = 19;
            var CS_VOICEMAIL_FAILED = 20;
            var CS_TRANSFERRING = 21;
            var CS_TRANSFERRED = 22;

            function OnBodyLoad()
            {
                //Initialize events
                SitePhone.OnStateChanged = OnStateChanged;
                SitePhone.OnCallStateChanged = OnCallStateChanged;
                SitePhone.OnCallDurationChanged = OnCallDurationChanged;
                OnStateChanged();
                OnCallStateChanged();
                OnCallDurationChanged();
            }

            function OnStateChanged()
            {
                switch (SitePhone.State)
                {
                    case S_OFFLINE:
                        StateDiv.innerHTML = "Offline";
                        break;
                    case S_CONNECTING:
                        StateDiv.innerHTML = "Connecting";
                        break;
                    case S_PAUSING:
                        StateDiv.innerHTML = "Pausing";
                        break;
                    case S_ONLINE:
                        StateDiv.innerHTML = "Online";
                        break;
                    default:
                        StateDiv.innerHTML = "Unknown";
                }

                switch (SitePhone.State)
                {
                    case S_ONLINE:
                        CallBtn.disabled = false;
                        break;
                    default:
                        CallBtn.disabled = true;
                }
            }

            function OnCallStateChanged()
            {
                switch (SitePhone.CallStatus)
                {
                    case CS_ON_HOLD:
                    case CS_LOCAL_HOLD:
                    case CS_REMOTE_HOLD:
                        CallStatusDiv.innerHTML = "Call on hold";
                        break;
                    case CS_ROUTING:
                        CallStatusDiv.innerHTML = "Connecting...";
                        break;
                    case CS_RINGING:
                        CallStatusDiv.innerHTML = "Ringing...";
                        break;
                    case CS_IN_PROGRESS:
                        CallStatusDiv.innerHTML = "Call in progress";
                    case CS_FINISHED:
                        CallStatusDiv.innerHTML = "Call finished";
                        break;
                    case CS_FAILED:
                    case CS_REFUSED:
                    case CS_MISSED:
                        CallStatusDiv.innerHTML = "Connection problem";
                        break;
                }

                switch (SitePhone.CallStatus)
                {
                    case CS_IN_PROGRESS:
                    case CS_ON_HOLD:
                    case CS_LOCAL_HOLD:
                    case CS_REMOTE_HOLD:
                        FinishCallBtn.disabled = false;
                        break;
                    default:
                        FinishCallBtn.disabled = true;
                }
            }

            function OnCallDurationChanged()
            {
                CallDurationDiv.innerHTML = SitePhone.CallDuration;
            }

            function OnCallBtnClick()
            {
                try
                {
                    destination = DestinationTb.value;
                    if (SitePhone.IsCalleeAllowed(destination))
                        SitePhone.StartCall(destination);
                }
                catch(e){}
            }

            function OnFinishCallBtnClick()
            {
                SitePhone.FinishCall();
            }
        </script>
    </head>
    <body onload="OnBodyLoad();">
        <div id="StateDiv"></div>
        <div id="CallStatusDiv"></div>
        <div id="CallDurationDiv"></div>
        <input id="DestinationTb" type="text" />
        <input id="CallBtn" type="button" value="Call"
            onclick="OnCallBtnClick();" disabled="disabled" />
        <input id="FinishCallBtn" type="button" value="Hang Up"
            onclick="OnFinishCallBtnClick();" disabled="disabled" />
    </body>
    </html>
Applies to SiteKiosk v7.0 (and later versions). Back to top