". If the # Vonage user answers their phone, the phone number entered by the web user # will be dialed. The Vonage user will not hear anything on their phone until # the third party's phone rings. # I decided to limit use of this site to people who are registered users of # my blog. This script will write a HTML form requesting their call back # number, name and password, which need to match their blog registered name # and password. # INPUT: 3rd party phone number, caller name and caller password # OUTPUT: Status of the phone call ie: Request Successful, or invalid number # AUTHOR: Becki True webmaster@2knuckleheads.net # User is free to use the code below as they see fit. There are no guarantees # that this code will work for you. This is meant to be an example of how you # can use the Vonage Click to Call feature. # Much of the code below is from the Vonage Third Party Call Control site at # https://secure.click2callu.com. # ************************** Function Definitions ***************************** function make_call($username, $password, $fromnumber, $tonumber) { $post_data = "username=$username&password=$password&fromnumber=$fromnumber&tonumber=$tonumber"; $ch = curl_init("https://secure.click2callu.com/tpcc/makecall"); curl_setopt($ch, CURLOPT_MUTE, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); if (strncmp($output, "000:", 4) == 0) { echo "Calling $tonumber, please answer your phone when it rings.\n"; } else { echo "Sorry, an error has occurred: $output\n"; } } # ********************** End of Function Definitions ************************** $username = urlencode(""); # Vonage user name $password = urlencode(" Call Me For Free Using Vonage's Click to Call

Call Me for Free

Thanks to Vonage's third party calling feature, you can call us for free. Just enter your phone number, name and password (same as your blog name and password) in the box below. If you don't have a blog login, you can register \">here

Be sure to enter your phone number with a 1 followed by your area code, then number

Your Phone Number Your Name Your Password

"); # check username and password if($call) { # find md5 hash of password $pass = (md5($callerpass)); # connect to blog database and verify this is a valid user $dbh = mysql_connect ('', '', '') or die ('Could not connect:: ' . mysql_error()) ; mysql_select_db('') or die ('Could not select database'); $result = mysql_query("SELECT * FROM `wp_users` WHERE `user_login`=\"$callername\" AND `user_pass`=\"$pass\"") or die ('Query failed: ' . mysql_error()); $rows = mysql_num_rows($result); if($rows > 0) { make_call($username, $password, $fromnumber, $tonumber); } else { echo "

Invalid username or password: I can't let the whole world call me!

\n"; echo "

If you forgot your password you can reset it \">here

\n"; } } echo (" "); ?>