Measuring quality

Click to call button - sample HTML code

The HTML example can be used to add "click to call" button on your website, or to build your own "click to call" wordpress plugin to be used with your own softswitch instance and your VoIP route provider(s) or GSM gateway to make calls (you can save much money if you use a cheap GSM gateway and SIM cards with cheap tariffs). Furthermore, you can own all infrastructure which is related to the "click to call" button for low price.

Brief description of the example code

The sample HTML code contains 2 text fields and "Click to call" button. The button sends direct cross-domain API requests to StarTrinity SIP Tester or StarTrinity Softswitch:

  • AJAX GET request to /Login.html. Pass credentials to access the API
  • Retrieve auth. token from response header (variable starTrinityAuthCookie)
  • AJAX POST request to /API/MainViewModel/CreateCall_Post. Pass the auth. token and CallXML script to make the call

Note that setting "WebApiTrustedIPAddresses" should not contain IP address of calling browser, because javascript code in the HTML uses "StarTrinityAuthCookie" header.


download sample code (HTML + javascript)

Copyright 2011-2024 | Blog | Contact lead developer via LinkedIn |