Send SMS/Place Call

Integrating Tera-WURFL in your applications.

Send SMS/Place Call

Postby surya » Mon Jul 19, 2010 2:40 pm

Hi,

Pardon if this is too basic to question, I am trying to integrate a feature on the mobile version of my website where beside the contact number, I want links which say "Call", "Send SMS" and "Save to Contacts".

I created a vCard (vCard.vcf) with the contact details and made the third link a simple hyperlink and it seems to work ok for now (please let me know if there is a better way of doing this!)

Now, in order to enable calling and sms features, I went by the tutorial at
http://pointbeing.net/weblog/2010/01/making-phone-calls-and-sending-sms-with-html.html

But this is generating a simple url for the href (this was tested on android) and the resultant link when clicked, says URL not found and returns Error 404.

Here is my code -

Code: Select all
<?php
require_once('Tera-WURFL/TeraWurfl.php');
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();

// see if this client is on a wireless device
if($wurflObj->getDeviceCapability("is_wireless_device")){
   echo "I see you are accessing my site from a wireless device :)<br>";
}
else{
   echo "I see you are accessing my site from a desktop device!<br>";
}

// get the capabilities from the object
if ( $wurflObj->GetDeviceCapabilitiesFromAgent($agent) ) {
    $caps      = $wurflObj->capabilities;
    $smsstring = $caps['xhtml_ui']['xhtml_make_phone_call_string'];
}

?>

<!-- some HTML here -->

<?php if ( $smsstring != 'none' ) : ?>

<p><a href="<?php echo $smsstring; ?>0000000000">Call</a>.</p>

<?php endif; ?>
<?php

$smsstring = $caps['xhtml_ui']['xhtml_send_sms_string'];

?>

<?php if ( $smsstring != 'none' ) : ?>

<p><a href="<?php echo $smsstring; ?>0000000000?body=Hi">Send SMS</a>.</p>

<?php endif; ?>


Of course, the 0000000000 is my actual cell phone number. And the first if/else statement was just to verify if the script detected the wireless device properly, which is working perfectly fine!

I am totally new to all this, so please guide me :(

Thanks in advance for your time and thoughts!
surya
 
Posts: 3
Joined: Mon Jul 19, 2010 2:30 pm

Re: Send SMS/Place Call

Postby kamermans » Mon Jul 19, 2010 5:49 pm

The code sample you posted looks incomplete to me - can you repost it please?
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Send SMS/Place Call

Postby surya » Tue Jul 20, 2010 6:17 am

Er, this is all the code I am using :(
The output I am getting on the webpage is something like this -

I see you are accessing my site from a wireless device :)

Call.

Send SMS.


Where Call and Send SMS are hyperlinks. The functionality I am looking for is, when the user clicks on Call, it must place a call to my mobile from his device and likewise, when he clicks on Send SMS, he should be led to the SMS screen on his device with the number field populated with my number and, if possible, some pre-defined content in the body of the sms, like "Hi, I am looking for the service you are providing, can we meet up sometime?" or something.

Once this functionality works on the dummy page, I will integrate the working code into the design which is not complete at the moment.

This page is located in my base folder and Tera-WURFL files are under the folder name Tera-WURFL/

From your comment, I presume the mistake in my code is pretty basic, but I am completely new to this, and hence any guidance I can get will help me a great deal. Thanks so much for your time :)
surya
 
Posts: 3
Joined: Mon Jul 19, 2010 2:30 pm

Re: Send SMS/Place Call

Postby kamermans » Tue Jul 20, 2010 1:17 pm

Sorry, I was looking at your post on my iPhone and I guess I just can't scroll the code window :). You code is pretty good, although you should know that the xhtml_send_sms_string and xhtml_make_phone_call_string can be set to none which would indicate that there is no specific string that needs to be used, in which case you wouldn't want to use the phone number as the href in a link, but just print it to the screen and the browser will pick it up (like webkit does with any number that looks like a phone number).
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Send SMS/Place Call

Postby surya » Wed Jul 21, 2010 8:13 am

Yes, there is a line of code to check if the values have NOT been set to 'none', and only then, to print the href code. However, despite that, the linking is not happening. The href link getting generated is - http://www.myurl.com/0000000000 rather than sms:000000000 or smsto:0000000000 or any respective code. What might be the problem? Could you direct me to any resource which I can follow to get this working correctly?
surya
 
Posts: 3
Joined: Mon Jul 19, 2010 2:30 pm

Re: Send SMS/Place Call

Postby drewdoms11 » Tue Sep 21, 2010 9:29 pm

I found some bugs on the codes you had posted. I am doing the same experiment on my website but I am using different procedure. Please keep me posted if it is already fixed so I can look into it again.
Last edited by drewdoms11 on Wed Oct 20, 2010 6:26 am, edited 1 time in total.
drewdoms11
 
Posts: 1
Joined: Tue Sep 21, 2010 1:15 am

Re: Send SMS/Place Call

Postby kamermans » Tue Sep 21, 2010 9:46 pm

Sorry, I'm not quite understanding you drewdoms11
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX


Return to Using Tera-WURFL

Who is online

Users browsing this forum: No registered users and 1 guest

cron