Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Inbound Screen Pops for inbound calls using Google Talk


Veteran Member

Status: Offline
Posts: 59
Date: Feb 27, 2009
Inbound Screen Pops for inbound calls using Google Talk
Permalink   
 


Per my other post on this topic (Inbound screen pops using Twitter), I needed a way to be notified of inbound calls *before* I actually got them.  The way I did this is to have inbound calls to my IBP number route to a Survo that then automatically forwared the call to my Virtual Receptionist. The Survo does a GET to my web page before it transfers the call.  Inbound callers won't really notice any difference, but I had a minute before the call came in.

For this version, I made a few changes.  First, I swapped out Twitter for GTalk.  Twitter is great, but it was not always fast enough and there were many times when the service was just down (I should note that it has been pretty reliable for a while now). 

Second, I wanted the IM to tell me WHO was calling (name & company).  Finally, if I didn't already have them stored in the database I wanted it to send me a link to a simple HTML page where I could add the record.  Now note - this is NOT the most elegant solution.  Ideally, I would have a centralized contact database (i.e. Google or a CRM solution).  But this was a quick and dirty implementation, so I just threw together a simple MySQL database.

First thing to note - I used XMPPHP (http://code.google.com/p/xmpphp/) to send the IMs. Hat tip to Mark Headd for pointing me in that direction: http://www.voiceingov.org/blog/?p=326.

Code:
$callerid = $_GET["callerid"];
$user = $_GET["user"];
$database_host = 'mysql.mydomain.com';
$database_name = 'databasename';
$database_username = 'user';
$database_password = 'password';

if ($user == "user")   $user = "user@gmail.com";


-- So I have this set up so it will send an IM to different addresses based on a URL parameter.  So you can point multiple inbound numbers to this code and it will send the IMs to the appropriate person.--


my_db_connect($database_host,$database_name,$database_username,$database_password) or die("can not open database");

$query="select contact, company, phonenum from contacts where " .
"phonenum = " . $callerid;

$result = mysql_query($query) or die ("Cannot execute query : $query" . mysql_error()) ;

$row =mysql_fetch_assoc($result) ;

// creating a tiny URL to the page in case there is no record for that contact

$teststring = 'http://tinyurl.com/api-create.php?url=http://www.mydomain.com/SimpleForm.php?PhoneNum=' . $callerid;

$tiny = file_get_contents($teststring);
$ch = curl_init();
$msg= "You have a call from " . $row['contact'] . " of " . $row['company'];
if ($msg == "You have a call from  of ") {
$msg = "You have a call from caller ID: " . $callerid . ". You can add the record here: " . $tiny;
};

-- Probably could be more efficient.  But I'm setting the value of the IM text to be sent in the case where there is a record or is not a record for that Caller ID. --


$conn = new XMPPHP_XMPP('talk.google.com', 5222, 'SENDERADDRESS', 'PASSWORD', 'xmpphp', 'gmail.com');
try {
$conn->connect();
$conn->processUntil('session_start');
$conn->presence();
$conn->message($user, $tweet);
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}

--And that's it.  Simple enough.  Since my Virtual Receptionist plays a message before they transfer to me, I have a minute or two to bring up their records in our CRM before I even get the call.

-- Edited by KhyleK at 11:40, 2009-02-27

__________________


Newbie

Status: Offline
Posts: 1
Date: Nov 20, 2011
Permalink   
 

are you professional web developer, Isn't it ? I guess, you must be professional or might have experience, thanks for decent stuff !



__________________

Posted By Brian Colton
light relief | muscle warfare

Page 1 of 1  sorted by
Quick Reply

Please log in to post quick replies.

Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard