Friday, August 22, 2008

How to Make Calls from WMLScript?


The WTAI not only defines URL schemes for making phone calls, but it also defines public functions you can invoke in WMLScripts. WMLScript requires the WAP gateway (or precompilation), so it is not as easy to use as plain URL links. On the other hand, WMLScript allows you specific logical conditions for making calls, and it makes it easier to handle the call status return value. For more information on WMLScript programming, check out W3Schools' WMLScript tutorial at http://www.w3schools.com/wmlscript/default.asp. The following WMLScript statement makes a phone call to number 5551234 and stores the return value in the flag variable:

var flag = WTAPublic.makeCall ("5551234");

If the call is successful, the return value in flag is an empty string. If the phone number is not formatted correctly, the flag value is invalid. If the call fails, the return value is one of the error codes.

The makeCall function call blocks, and it will not return until the call is finished. Hence, your browser might freeze when you are making a call via WMLScript.

No comments: