OnCallStateChanged Event



 
Fires when the CallStatus Property changes.


Syntax

    SiteKiosk.Plugins("SitePhone").OnCallStateChanged = handler
Remarks
    The object that caused the event can be referenced in the event function using "this".
Examples
    The following example keeps a HTML element containing the call state up to date.

    <div id="CallState"></div>
    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    SitePhone = SiteKiosk.Plugins("SitePhone");
    SitePhone.OnCallStateChanged = OnCallStateChanged;
    
    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; 
    var CS_INCOMING = 24;
    
    function OnCallStateChanged()
    {
       switch (SitePhone.CallStatus)
       {
          case CS_ON_HOLD:
          case CS_LOCAL_HOLD:
          case CS_REMOTE_HOLD:
             CallState.innerHTML = "Call on hold";
             break;
          case CS_ROUTING:
             CallState.innerHTML = "Connecting...";
             break;
          case CS_RINGING:
             CallState.innerHTML = "Ringing...";
             break;
          case CS_IN_PROGRESS:
             CallState.innerHTML = "Call in progress";
          case CS_FINISHED:
             CallState.innerHTML = "Call finished";
             break;
          case CS_FAILED:
          case CS_REFUSED:
          case CS_MISSED:
             CallState.innerHTML = "Connection problem";
             break;
          //...
       }
    }
    </SCRIPT>
    

Applies to
    SiteKiosk v7.5 (and later versions).

Back to top