Friday, 13 July 2018

Jabber Custom Tab Popup URL with Calling Number


Jabber Custom Tab Popup URL with Calling Number


This article is to explain the codes that makes Jabber pop up a window in an URL+ Caller ID format pointing your web CRM application. The codes use Javascript to monitor the state of TelephonyConversationEvent and automatically have a popup.

The custom tab is hosted in whatever a web server. And Tpop.js has a reliance on json2.js to parse data in TelephoneyConversationEvent json object. So please download it and put it to the ./js folder



index.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">

    <title>YOUR_APPLICTION_NAME</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/sticky-footer.css" rel="stylesheet">
<script type="text/javascript" src="js/tpop.js"></script>

<script type="text/javascript" src="js/json2.js"></script>
  </head>

               </head>

               <body onload="OnLoadMethods()">
<table class="table table-striped">
  <thead>
<tr>
  <th scope="col">Status</th>
  <th scope="col">Caller ID</th>                                                 
</tr>
  </thead>
  <tbody>
<tr>
  <th id="state" scope="row"> --- </th>
  <td id="callerid"> --- </td>
</tr>
  </tbody>
</table>
               </body>

</html>


Tpop.js

function OnPresenceStateChanged (jid, basicPresence, localizedPresence)
{
var cell = document.getElementById(jid)
cell.innerText = basicPresence.concat(", ",localizedPresence);
}


function OnTelephonyConversationStateChanged(json)
{
var callerid = document.getElementById("callerid");
var state = document.getElementById("state");

var conversation = JSON.parse(json);
if (conversation.acceptanceState == "Pending" && conversation.state == "Started") {
state.innerText = conversation.acceptanceState + "/" + conversation.state + "-> about to screen pop";
for (var i=0; i<conversation.remoteParticipants.length; i++) {
callerid.innerText = conversation.remoteParticipants[i].translatedNumber;
window.open("http://www.google.com/customerSearch.html?number=" + conversation.remoteParticipants[i].translatedNumber);
}
}


}



function SubscribePresence()
{
window.external.SubscribePresence('john.doe@abc.com');
}




function OnLoadMethods()
{
SubscribePresence();
OnTelephonyConversationStateChanged();
}


Demo

 pops up url as http://www.google.com/customerSearch.html?number=+15131112222, remember you can custom it in tpop.js file to make up whatever format you want.





Monday, 9 July 2018

Jabber Custom Tab Pop-up for 911 Disclaimer

Jabber Custom Tab Pop-up for 911 Disclaimer



Preparing Jabber config file 


<?xml version="1.0" encoding="utf-8" ?>
  <config version="1.0">
<Client>
  <jabber-plugin-config>
   <browser-plugin>
     <page refresh ="false" preload="true">
     <tooltip>Disclaimer</tooltip>
     <icon>https://www.cisco.com/web/fw/i/logo.gif</icon>
     <url>http://YOUR_SERVER/disclaimer</url>
    </page>
   </browser-plugin>
  </jabber-plugin-config>
</Client>

  <Options>
  <AllowUserCustomTabs>true</AllowUserCustomTabs>
</Options>

  </config>

<page refresh ="false" preload="true">  Content refreshes each time users select the tab.


Directory structure: 

./disclaimer
 - index.html
 - getback.asp
 - window.asp
 - /js
 - /css


index.html


<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">

<title>911 Disclaimer</title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="css/sticky-footer.css" rel="stylesheet">
<script src="js/tpop.js"></script>
</head>

<body>

<body onload="MyPopUp('window.asp')">
<!-- Begin page content -->
<!-- Begin page content -->
<main role="main" class="container">
<h1 class="mt-5">911 Disclaimer</h1>
<p class="lead">During an emergency, softphone technology may not provide the most timely or
accurate location data if used for a 911 emergency call. Calls may be misdirected
to the wrong emergency response center or the emergency response center may make
errors when determining your location. USE A SOFTPHONE ONLY AT YOUR OWN RISK DURING AN EMERGENCY.</p>
</main>


</body>
</html>

window.asp


<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">

    <title>911 Disclaimer</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/sticky-footer.css" rel="stylesheet">
              
  </head>

  <body>

    <!-- Begin page content -->
    <main role="main" class="container">
      <h1 class="mt-5">911 Disclaimer</h1>
      <p class="lead">During an emergency, softphone technology may not provide the most timely or 
accurate location data if used for a 911 emergency call. Calls may be misdirected 
to the wrong emergency response center or the emergency response center may make
 errors when determining your location. <b>USE A SOFTPHONE ONLY AT YOUR OWN RISK DURING AN EMERGENCY.</b></p>
    </main>

    <footer class="footer">
      <div class="container">
        <input type="button" class="btn btn-success" value="Accept" onclick="sendAck(); self.close(); "> 
      </div>
    </footer>
  </body>
</html>


Tpop.js


    // Popup window code
               function MyPopUp(url) {
                var newwindow;
                popupWindow = window.open (
                       url,'popUpWindow','height=400,width=500,left=0,top=200,titlebar=no,sresizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,copyhistory=no,status=no')
               }


Example