Junction Networks

Junction Networks Click to Call - Ajax

The following is an Ajax (JavaScript) example of using the Junction Networks Web Services API to implement a Click to Call service. The JavaScript utilizes the CallSetup API Action with the JSON Response format.

The demo works by placing a call to whatever SIP address you provide as your FromAddress. When you answer, you will hear a brief message and be connected to the telelphone number entered in the demo.

Ajax Click to Call

FromAddress: Enter your Junction Networks Hosted SIP Address (ie you@yourdomain.onsip.com):

Demo

Enter the number to call: (     )   -    
 
 

Example HTML

The example HTML can be copied into any web page (make sure you change the value of jn_FromAddress).
<script src="http://www.jnctn.com/script/ClickToCall.js" type="text/javascript"></script>
      
Enter the number to call:
( &#160; <input type="text" id="jn_PhoneNumberAreaCode" size="3" maxlength="3"/> &#160; )
<input type="text" id="jn_PhoneNumberFirstThree" size="3" maxlength="3"/> &#160; - &#160;
<input type="text" id="jn_PhoneNumberLastFour" size="4" maxlength="4"/> &#160;

<!-- Required: Replace the value for jn_FromAddress in the following input tag -->
<input type="button" value="Place Call" onclick="jn_FromAddress='you@yourdomain.onsip.com'; 
                                                 doCallSetup(); return false;"/>

<!-- Optional: provide some feedback to the end user -->
<div id="jn_RequestMessage">&#160;</div>
<div id="jn_ResponseMessage">&#160;</div>
      

Example JavaScript

The JavaScript which the demo and example are based on is available here and may be modified to suit your purposes.

An example of a simple change might be to modify the scripts behavior based on the time of day.