I have been trying to use API provided by tringme to create widget to make a call. I am unable to get more information from tringme support about connecting. I assumed that the call wasn’t through due to insufficient credit. Even with sufficient credit the call doesn’t happen. Have any of you people work on it any time?
I have written the code as per the API, <uid> has been replaced with a valid uder id.
var tringMeURL:String = "rtmp://sip.tringme.com/voicemail/<uid>";
var randomstreamname = "63e457425defb24e8a5ca80de80d2e3817ea5c1b";
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
var nc:NetConnection;
call_btn.addEventListener(MouseEvent.CLICK, callHandler, false, 0, true);
close_btn.addEventListener(MouseEvent.CLICK, closeCallHandler, false, 0, true);
function callHandler(evt:MouseEvent):void{
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, connectionStatushandler, false, 0, true);
nc.connect(tringMeURL);
}
function closeCallHandler(evt:MouseEvent):void{
nc.close();
}
function connectionStatushandler(evt:NetStatusEvent):void{
var info:Object = evt.info;
trace(info.code);
status_txt.text = String(info.code);
if (info.code == "NetConnection.Connect.Success") {
var nsc:NetStream = new NetStream(nc);
var mic:Microphone = Microphone.getMicrophone();
mic.rate = 8;
mic.setSilenceLevel(0);
nsc.publish(randomstreamname, "record");
nsc.attachAudio(mic);
var nsc1:NetStream = new NetStream(nc);
nsc1.play("tring", -1);
}
}
I am not that familiar with netstream and netconnection, so unable do much.