Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created July 7, 2010 17:01
Show Gist options
  • Save chrismatthieu/466950 to your computer and use it in GitHub Desktop.
Save chrismatthieu/466950 to your computer and use it in GitHub Desktop.
<html>
<head>
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/javascripts/jquery_1_4_2.js" type="text/javascript" ></script>
<script src="/javascripts/FABridge.js" type="text/javascript" ></script>
<script src="/javascripts/flashembed.min.js" type="text/javascript" ></script>
<script src="/javascripts/phono.js" type="text/javascript" ></script>
</head>
<body>
<a href="javascript:window.close()"><img src="/images/closebutton.jpg" align="right" width="35" border="0"></a>
<img alt="9f1e984e32f2357e1136c0c343d65f43" height="32" src="http://gravatar.com/avatar/9f1e984e32f2357e1136c0c343d65f43.png?r=PG" width="32" /> <img alt="2rightarrow" height="32" src="/images/2rightarrow.png?1278108764" /> <img alt="9f4580e51445f5b48eaeba23613c2393" height="32" src="http://gravatar.com/avatar/9f4580e51445f5b48eaeba23613c2393.png?r=PG" width="32" />
<div id="phone01" style="height: 1px; width: 1px"></div>
<script type="text/javascript">
var call;
var phone = $.phono({
flashElementId:"phone01",
onConnect: function(event) {
$("#sessionId").text(event.phone.sessionId);
makeCall();
},
onIncomingCall: function(event) {
call = event.call;
},
onFlashPermissionShow: function(event) {
$('#phone01').height(138);
$('#phone01').width(215);
},
onFlashPermissionHide: function(event) {
$('#phone01').height(1);
$('#phone01').width(1);
}
});
function makeCall() {
numberToDial = $("#destinationTxt").val();
call = phone.dial(numberToDial, {
headers: {
did:"14803194368",
bling:"blaz"
},
onAnswer: function(event) {
},
onHangup: function() {
}
});
}
function sendIM() {
destinationJid = $("#destinationJid").val()
phone.text(destinationJid,"Hello");
}
$(document).ready(function() {
window.setInterval(function() {
try {
$("#phoneState").text(phone.state());
if(call != null) {
$("#callState").text(call.state());
}
}
catch(e) {
}
},500);
});
</script>
<form action="bling">
Phone State <span id="phoneState"></span><br/>
Call State <span id="callState"></span><br/>
Session ID <span id="sessionId"></span><br/>
<input type="button" value="Call" onClick="makeCall()"/>
<!input type="text" id="destinationTxt" value="app:9991438833" />
<input type="text" id="destinationTxt" value="sip:9991443313@sip.tropo.com" />
<input type="button" value="Hangup" onClick="call.hangup()"/>
<input type="button" value="Talk Start" onmousedown="call.talking(true)" onmouseup="call.talking(false)"/>
<input type="button" value="Mute" onclick="call.muted(true)"/>
<input type="button" value="Unmute" onclick="call.muted(false)">
<input type="button" value="TonesOn" onclick="call.tones(true)"/>
<input type="button" value="TonesOff" onclick="call.tones(false)">
<input type="button" value="Hold" onclick="if(call.hold()){call.hold(false);this.value='Unhold'}else{call.hold(true);this.value='Hold'}"/>
<input type="text" value="1" onkeypress="call.volume(this.value)"/>
<br/>
<input type="button" value="Accept" onClick="call.accept()"/>
<input type="button" value="Answer" onClick="call.answer()"/>
<br/>
<input type="text" id="destinationJid" value="pizzademo@tropo.im"/>
<input type="button" value="Send" onClick="sendIM()"/>
<br/>
<input type="button" value="1" name="digit1Button" onClick="call.digit('1')"/>
<input type="button" value="2" name="digit2Button" onClick="call.digit('2')"/>
<input type="button" value="3" name="digit3Button" onClick="call.digit('3')"/>
<input type="button" value="4" name="digit4Button" onClick="call.digit('4')"/>
<input type="button" value="5" name="digit5Button" onClick="call.digit('5')"/>
<input type="button" value="6" name="digit6Button" onClick="call.digit('6')"/>
<input type="button" value="7" name="digit7Button" onClick="call.digit('7')"/>
<input type="button" value="8" name="digit8Button" onClick="call.digit('8')"/>
<input type="button" value="9" name="digit9Button" onClick="call.digit('9')"/>
<input type="button" value="0" name="digit0Button" onClick="call.digit('0')"/>
<input type="button" value="*" name="digit*Button" onClick="call.digit('*')"/>
<input type="button" value="#" name="digit#Button" onClick="call.digit('#')"/>
<br/>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment