Revision: 3782
Author: seba.wagner
Date: Thu Jun 9 10:56:55 2011
Log: [No log message]
http://code.google.com/p/openmeetings/source/detail?r=3782
Added:
/trunk/singlewebapp/server/red5/webapps/openmeetings/sip-applet/custom.js
/trunk/singlewebapp/server/red5/webapps/openmeetings/sip-applet/uiie.js
=======================================
--- /dev/null
+++
/trunk/singlewebapp/server/red5/webapps/openmeetings/sip-applet/custom.js
Thu Jun 9 10:56:55 2011
@@ -0,0 +1,228 @@
+/*
+ * GPL 2
+ *
+ */
+
+var appletIsLoaded = false;
+
+function initialize()
+{
+ $('#noscript').hide();
+ $('#callbuttons').hide();
+ $('#toolbar').hide();
+ $('#immessagewindow').hide();
+ $('#keypadwindow').hide();
+ $('#authbox').hide();
+ $('#presencewindow').hide();
+ if (!document.PHDial){
+ alert(strings[10].item);//init failed
+ }
+}
+
+ function customOnImReceived(message, from)
+{
+ document.getElementById("immessages").innerHTML += '<div
class="receivedmessage">' + from + ':<br /><span>' + message + '<span><hr
/></div>';
+ document.getElementById("immessages").scrollTop =
document.getElementById("immessages").scrollHeight;
+}
+
+function customOnImSend(message, from)
+{
+ document.getElementById("immessages").innerHTML += '<div
class="sentmessage">' + from + ':<br /><span>' + message + '<span><hr
/></div>';
+ document.getElementById("immessages").scrollTop =
document.getElementById("immessages").scrollHeight;
+
+}
+
+function customOnCallIncoming()
+{
+ if (confirm("Incoming call. Answer?"))
+ {
+ acceptCall();
+ }
+ else
+ {
+ refuseCall();
+ }
+}
+
+function toggleIM(){
+ $('#immessagewindow').toggle();
+}
+function togglePad(){
+ $('#keypadwindow').toggle();
+}
+function togglePresence(){
+ $('#presencewindow').toggle();
+}
+
+function statusBar(msg){
+
+ var lzappRef = document.getElementById("lzapp");
+
+ if (lzappRef) {
+
+ if (document.getElementById("lzapp").sipStatusMessage){
+ //alert("Found lzapp --asipStatusMessage--");
+ document.getElementById("lzapp").sipStatusMessage(msg);
+ } else {
+ alert("Could Not Find lzapp --sipStatusMessage-- "+msg);
+ }
+
+ } else {
+ //This does happen one time on init
+ //alert("Could Not Find lzapp "+msg);
+ }
+
+}
+
+function getAppletStatus(){
+
+
document.getElementById("lzapp").callbackgetAppletStatus(appletIsLoaded);
+
+ //return appletIsLoaded;
+}
+
+function customOnRegistrationSuccess(s){
+ //statusBar(strings[15].item+":"+s);
+ statusBar("Ready. Using transport: "+s);
+ document.getElementById("lzapp").sipLoginSuccess(s);
+}
+function customOnRegistrationFailure(x){
+ //statusBar(strings[22].item);
+ statusBar("Login failed");
+ document.getElementById("lzapp").sipLoginFail(x);
+}
+function customOnRegistering(){
+ //statusBar(strings[14].item);
+ statusBar("Logging in");
+}
+
+function customOnLoaded()
+{
+ appletIsLoaded = true;
+ //At this moment the lz-App is not yet loaded
+ //statusBar("Waiting for user action");
+}
+function preCustomRegister()
+{
+ setUsername(document.getElementById("username").value);
+ setPassword(document.getElementById("password").value);
+ setAuthID(document.getElementById("authid").value);
+}
+
+function omCustomRegister(username,password,authid)
+{
+
+ setUsername(username);
+ setPassword(password);
+ setAuthID(authid);
+
+ statusBar("Call omCustomRegister");
+
+
document.getElementById("lzapp").callbackLoginSipUser("omCustomRegisterReturn");
+
+ //return "omCustomRegisterReturn";
+}
+
+function preCustomStartCall()
+{
+ setCallTo(document.getElementById("callto").value);
+
+ document.getElementById("lzapp").preCustomStartCallBack("ok");
+}
+
+function preCustomStartCallByCallTo(callto)
+{
+ setCallTo(callto);
+
+
document.getElementById("lzapp").preCustomStartCallByCallToCallBack("ok "+callto);
+
+ //return "ok "+callto;
+}
+
+function customOnBusy()
+{
+ statusBar("Busy");
+}
+function customOnTalking()
+{
+ statusBar("Call in progress");
+}
+function customOnNoAnswer()
+{
+ statusBar("No answer");
+}
+function customOnCallEnded()
+{
+ statusBar("Call ended");
+}
+function customOnNotAvailable()
+{
+ statusBar("Not available");
+}
+function customOnRinging()
+{
+ statusBar("Alerting at recipient");
+}
+function customOnCalling()
+{
+ statusBar("Calling");
+}
+function customOnWrongAddress()
+{
+ statusBar("Wrong address");
+}
+function toggleAuthbox(){
+ $('#authbox').toggle();
+}
+function customOnResponse(x)
+{
+ statusBar(x);
+}
+function preCustomEndCall()
+{
+}
+function customSubscribe(){
+ subscribe(document.getElementById("presentity").value);
+}
+function customUnSubscribe(){
+ unSubscribe(document.getElementById("presentity").value);
+}
+function customPublish()
+{
+ note = document.getElementById("presenceNote").value;
+ bo = document.getElementById("presenceState").value;
+ publish(bo, note);
+}
+function customPresence(x,y,value)
+{
+ document.getElementById("statusbar").innerHTML
+=':'+x+':'+y+':'+value+'<br/>';
+}
+function customPresence1(array)
+{
+ document.getElementById("presentityTable").innerHTML = '<table
border="1"><tr><td>Presentity</td><td>Subscription status'+
+ '</td><td>Presence</td><td>Note</td></tr>';
+ for (index in array)
+ {
+ document.getElementById("presentityTable").innerHTML +='<tr>'+
+ '<td>'+array[index][0]+'</td>'+
+ '<td>'+array[index][1]+'</td>'+
+ '<td>'+array[index][2]+'</td>'+
+ '<td>'+array[index][3]+'</td></tr>';
+ }
+ document.getElementById("presentityTable").innerHTML +='</table>';
+}
+function customPresenceTableChange(array)
+{
+ var table='<table border="1"><tr><td>Presentity</td><td>Subscription
status'+
+ '</td><td>Presence</td><td>Note</td></tr>';
+ for (index in array)
+ {
+ table +='<tr>'+
+ '<td>'+array[index][0]+'</td>'+
+ '<td>'+array[index][1]+'</td>'+
+ '<td>'+array[index][2]+'</td>'+
+ '<td>'+array[index][3]+'</td></tr>';
+ }
+ table +='</table>';
+ document.getElementById("presentityTable").innerHTML = table;
+}
=======================================
--- /dev/null
+++ /trunk/singlewebapp/server/red5/webapps/openmeetings/sip-applet/uiie.js
Thu Jun 9 10:56:55 2011
@@ -0,0 +1,139 @@
+/*
+ * GPL 2
+ *
+ */
+
+function setCallTo(callTo)
+{
+document.getElementById("PHDial").jsSetCallTo(callTo);
+}
+function setUsername(username)
+{
+document.getElementById("PHDial").jsSetUsername(username);
+}
+function setAuthID(id)
+{
+document.getElementById("PHDial").jsSetAuthID(id);
+}
+function setPassword(password)
+{
+document.getElementById("PHDial").jsSetPassword(password);
+}
+function setRealm(realm)
+{
+document.getElementById("PHDial").jsSetRealm(realm);
+}
+function setPort(port)
+{
+document.getElementById("PHDial").jsSetPort(port);
+}
+function setSipProxy(proxy)
+{
+document.getElementById("PHDial").jsSetSipProxy(port);
+}
+function setTunnel(tunnel)
+{
+document.getElementById("PHDial").jsSetTunnel(tunnel);
+}
+function setHTTPProxy(proxy)
+{
+// NYI
+}
+function getIdentityString()
+{
+var identity = document.getElementById("PHDial").jsGetIdentity();
+return identity;
+}
+function startCall()
+{
+ document.getElementById("PHDial").set_event(102);
+ //stopActive();
+
+ document.getElementById("lzapp").startCallCallBack("ok");
+}
+function endCall()
+{
+ document.getElementById("PHDial").set_event(103);
+ //startActive();
+}
+function acceptCall()
+{
+ document.getElementById("PHDial").set_event(104);
+
+}
+function refuseCall()
+{
+ document.getElementById("PHDial").set_event(105);
+
+}
+
+function register()
+{
+
//document.getElementById("PHDial").jsSetUsername(document.getElementById("username").value);
+
//document.getElementById("PHDial").jsSetPassword(document.getElementById("password").value);
+ document.getElementById("PHDial").set_event(101);
+ //startActive();
+
+ document.getElementById("lzapp").callbackregister("ok");
+}
+function onIMSend()
+{
+
document.getElementById("PHDial").jsSetCallTo(document.getElementById("callto").value);
+
+ var sender = "<font class=\"immessage_to\">" + 'Sip Applet' + "
</font>";
+ var msg = document.getElementById("immessageform").imMessageArea.value;
+
+ if(msg.length == 0 || msg.length > 400)
+ return false;
+
+ msg = removeHTMLTags(msg);
+
+ customOnImSend(msg, sender);
+
+ document.getElementById("immessageform").imMessageArea.value = "";
+ sendIMMessage(msg);
+}
+
+function sendIMMessage(message)
+{
+ document.getElementById("PHDial").set_IMMessage(message);
+ document.getElementById("PHDial").set_event(106); //sendim
+}
+
+function removeHTMLTags(message)
+{
+ var MessageWithoutHTML = message.replace(/<\/?[^>]+(>|$)/g, "");
+ return MessageWithoutHTML;
+}
+/*function startActive()
+*{
+*
$('#startbuttontext').css('background-image', "url(/index.php/module/wrapper/resource/idial/item/button_active.gif)");
+*
$('#stopbuttontext').css('background-image', "url(/index.php/module/wrapper/resource/idial/item/button_not_active.gif)");
+* $('#stopcallbutton').css('cursor', "default");
+* $('#callbutton').css('cursor', "pointer");
+*}
+*/
+function DTMFButton(number)
+{
+ document.getElementById("PHDial").handleKeyPadEvent(number);
+
+ document.getElementById("lzapp").callbackDTMFButton("ok");
+
+}
+function
dialingPageDeactivate(){document.getElementById("PHDial").set_event(999);}//Not
used but must be defined
+
+function subscribe(presentity)
+{
+ document.getElementById("PHDial").jsSubscribe(presentity);
+ document.getElementById("PHDial").set_event(121); // subscribe
+}
+function unSubscribe(presentity)
+{
+ document.getElementById("PHDial").jsUnSubscribe(presentity);
+ document.getElementById("PHDial").set_event(122); // unsubscribe
+}
+function publish(st, note)
+{
+ document.getElementById("PHDial").jsPublish(st, note);
+ document.getElementById("PHDial").set_event(123); // publish
+}
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.