/* * tcpdump -s 0 -A port 1337 * WTF? Seriously? * https://bugzilla.xamarin.com/show_bug.cgi?id=18278 */ private String MakeCall(String method, CallParams par) { String result = ""; using (var client = new HttpClient()) { try { SJCoinCall callData = new SJCoinCall() { JsonRPC = "2.0", Method = method, Params = par, Id = "1" }; String content = JsonConvert.SerializeObject(callData); //System.Diagnostics.Debug.WriteLine(content); HttpContent httpContent = new StringContent(content, System.Text.Encoding.UTF8, "application/json"); Task <HttpResponseMessage> responseAsync = client.PostAsync(url + path, httpContent); HttpResponseMessage response = responseAsync.Result; Task <String> bodyAsync = response.Content.ReadAsStringAsync(); result = bodyAsync.Result; //System.Diagnostics.Debug.WriteLine(result); } catch (HttpRequestException e) { // Handle exception. System.Diagnostics.Debug.WriteLine(e.Message); } } return(result); }
public async void AskVideoPopup(Call call) { MessageDialog dialog = new MessageDialog(ResourceLoader.GetForCurrentView().GetString("VideoActivationPopupContent"), ResourceLoader.GetForCurrentView().GetString("VideoActivationPopupCaption")); dialog.Commands.Clear(); dialog.Commands.Add(new UICommand { Label = ResourceLoader.GetForCurrentView().GetString("Accept"), Id = 0 }); dialog.Commands.Add(new UICommand { Label = ResourceLoader.GetForCurrentView().GetString("Dismiss"), Id = 1 }); var res = await dialog.ShowAsync(); CallParams parameters = LinphoneManager.Instance.Core.CreateCallParams(call); if ((int)res.Id == 0) { // Workaround to pop the camera permission window await openCameraPopup(); parameters.VideoEnabled = true; } LinphoneManager.Instance.Core.AcceptCallUpdate(call, parameters); }
public IActionResult Index(CallParams call) { var response = new VoiceResponse(); response.Append( new Gather(numDigits: 3, action: new Uri("/answer/gather/extension/en", UriKind.Relative), timeout: 1)); LogCall(call).Wait(); response.Append( new Gather(numDigits: 1, action: new Uri("/answer/gather/language", UriKind.Relative)) .Play(new Uri("/AudioFiles/intromerci.wav", UriKind.Relative)) .Play(new Uri("/AudioFiles/engfr.wav", UriKind.Relative))); //.Say("Thanks for calling Silico, if you know your parties extension, enter it now. If you'd like to leave a voice message, press 0 and your call will be returned shortly.")); //// If the user doesn't enter input, loop response.Redirect(new Uri("/answer", UriKind.Relative)); return(Content(response.ToString(), "text/xml")); }
private async Task LogCall(CallParams call) { string callerName = null; string callerType = null; var addOns = JObject.Parse(call.AddOns); if (addOns["status"]?.ToString() == "successful") { if (addOns["results"]?["twilio_caller_name"]?["status"].ToString() == "successful") { callerName = addOns["results"]?["twilio_caller_name"]?["result"]?["caller_name"]?["caller_name"].ToString(); callerType = addOns["results"]?["twilio_caller_name"]?["result"]?["caller_name"]?["caller_type"].ToString(); } } //NOT DOOONNNE _context.Calls.Add(new Call { SID = call.CallSid, Name = (!string.IsNullOrEmpty(callerName)) ? callerName : (!string.IsNullOrEmpty(call.CallerName)) ? call.CallerName : null, CallerType = callerType, From = call.From, To = call.To, Zipcode = call.CallerZip, City = call.CallerCity, State = call.CallerState, Country = call.CallerCountry }); await _context.SaveChangesAsync(); }
private void buttons_VideoClick(object sender, bool isVideoOn) { Call call = LinphoneManager.Instance.Core.CurrentCall; CallParams param = call.CurrentParams.Copy(); param.VideoEnabled = isVideoOn; LinphoneManager.Instance.Core.UpdateCall(call, param); }
/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain. /// </summary> public async Task <TReturn> Call(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { var callResult = await CallRaw(callParams, blockParameter); var result = ParseReturnData(callResult); return(result); }
public async Task <UInt256> EstimateGas(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; var result = await _contract.JsonRpcClient.EstimateGas(callParams, blockParameter); return(result); }
private async void buttons_VideoClick(object sender, bool isVideoOn) { // Workaround to pop the camera permission window await openCameraPopup(); Call call = LinphoneManager.Instance.Core.CurrentCall; CallParams param = call.CurrentParams.Copy(); param.VideoEnabled = isVideoOn; LinphoneManager.Instance.Core.UpdateCall(call, param); }
CallParams IContractInstanceSetup.GetCallParams(CallParams optional) { return(new CallParams { From = optional?.From ?? DefaultFromAccount, To = optional?.To ?? ContractAddress, Value = optional?.Value, Gas = optional?.Gas, GasPrice = optional?.GasPrice, Data = optional?.Data }); }
public void makeTr87Call() { var addr = LinphoneCore.InterpretUrl("1234"); CallParams cp = LinphoneCore.CreateCallParams(null); cp.AddCustomHeader("Content-Disposition", "signal;handling=required"); cp.AddCustomHeader("TR87-Mode", "true"); cp.AddCustomHeader("User-Agent", "Tadiran ATouch PC/1.0.201 (belle-sip/1.6.3)"); // cp.AddCustomHeader("User-Agent", "Tadiran ATouch Android/1.0.201 (belle-sip/1.6.3)"); //proxyConfig.SetCustomHeader("User-Agent", "Tadiran ATouch Android/1.0.201 (belle-sip/1.6.3)"); LinphoneCore.InviteAddressWithParams(addr, cp); //LinphoneCore.Subscribe(addr, "Tr87Subscription", 3600, null); }
private void OnVideoClicked(object sender, EventArgs e) { if (LinphoneCore.CallsNb > 0) { Call call = LinphoneCore.CurrentCall; if (call.State == CallState.StreamsRunning) { LinphoneCore.VideoAdaptiveJittcompEnabled = true; CallParams param = LinphoneCore.CreateCallParams(call); param.VideoEnabled = !call.CurrentParams.VideoEnabled; param.VideoDirection = MediaDirection.SendRecv; LinphoneCore.UpdateCall(call, param); } } }
BEAResponse <TResults> CallMethod <TResults>(string method, CallParams callParams) { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string url = PrepareUrl(method, callParams); using (var client = new BEAWebClient()) { var json = client.DownloadString(url); var serializer = new JavaScriptSerializer(); serializer.RegisterConverters(new JavaScriptConverter[] { new BEAParamValueItemConverter() }); BEAResponse <TResults> model = serializer.Deserialize <BEAResponse <TResults> >(json); return(model); } }
private void OnCall(Core lc, Call lcall, CallState state, string message) { try { if (state == CallState.End || state == CallState.Error) { LastCall = null; } if ((state == CallState.IncomingReceived || state == CallState.OutgoingInit) && LastCall != null) { linphoneCore.TerminateCall(LastCall); LastCall = null; } if ((state == CallState.IncomingReceived || state == CallState.OutgoingInit) && LastCall == null) { LastCall = lcall; } CallPCL call = new CallPCL { UsernameCaller = lcall.RemoteAddress.Username }; CallParams param = linphoneCore.CreateCallParams(lcall); lock (LinphoneListeners) { for (int i = 0; i < LinphoneListeners.Count; i++) { try { var listener = LinphoneListeners[i]; listener.OnCall(new CallArgs(call, (int)state, message, param.VideoEnabled)); } catch (Exception ex) { Log("error with listenner, OnCall"); } } } } catch (Exception ex) { } }
public bool EnableVideo(bool enable) { if (Core.InCall()) { Call call = Core.CurrentCall; CallParams parameters = call.CurrentParams; if (enable != parameters.VideoEnabled) { parameters.VideoEnabled = enable; if (enable) { // TODO: Handle bandwidth limitation } Core.UpdateCall(call, parameters); return(true); } } return(false); }
string PrepareUrl(string method, CallParams callParams) { string result = BaseURL + "&" + MethodParam + "=" + method + "&" + UserIDParam + "=" + _apiKey; if (callParams != null) { foreach (var k in callParams.Params.Keys) { string v = callParams.Params[k]; result += "&" + k + "=" + v; } } result += "&" + ResultFormatParam + "=" + ResultFormat; return(result); }
//POST /media/connections で渡すJSON Objectのパラメータ作成 private CallParams _CreateCallParams(string targetId) { var videoRedirect = new Redirect(); videoRedirect.ip_v4 = "127.0.0.1"; videoRedirect.port = 7000; var redirectParams = new RedirectParams(); redirectParams.video = videoRedirect; var constraints = new Constraints(); var callParams = new CallParams(); callParams.peer_id = _peerId; callParams.token = _peerToken; callParams.target_id = targetId; callParams.constraints = constraints; callParams.redirect_params = redirectParams; return(callParams); }
public IActionResult GatherExtensionEN(CallParams cp) { var response = new VoiceResponse(); // If the user entered digits, process their request if (!string.IsNullOrEmpty(cp.Digits)) { var agent = _context.Agents .Where(a => a.Extension.ToString() == cp.Digits) .FirstOrDefault(); if (agent != null) { var call = _context.Calls.Where(c => c.SID == cp.CallSid).FirstOrDefault(); if (call != null) { call.AgentCalled = agent; _context.Calls.Update(call); _context.SaveChanges(); } //response.Say($"You will be connected to {agent.Name} shortly.").Pause(); var dial = new Dial(action: new Uri($"/answer/connect/{agent.ID}", UriKind.Relative)); dial.Number(agent.PhoneNumber, url: new Uri("/answer/screenCall", UriKind.Relative)); response.Append(dial); } else { response.Say("Sorry, I don't understand that choice.").Pause(); } } else { // If no input was sent, redirect to the /voice route response.Redirect(new Uri("/answer", UriKind.Relative)); } return(TwiML(response)); }
/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain and expects a revert. /// Throws an exception if call does not revert. /// </summary> public async Task ExpectRevertCall(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; var(error, callResult) = await _contract.JsonRpcClient.TryCall(callParams, blockParameter, expectingException : true); if (error == null) { // Check if call is void (no return value) if (this is EthFunc) { throw new Exception("Expected call to revert"); } else { var result = ParseReturnData(callResult); throw new Exception($"Expected call to revert but got back result: {result}"); } } }
/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain. /// Returns the raw ABI encoded response. /// </summary> public async Task <byte[]> CallRaw(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; byte[] callResult; try { callResult = await _contract.JsonRpcClient.Call(callParams, blockParameter); } catch (JsonRpcErrorException rpcEx) when(_contract.JsonRpcClient.ErrorFormatter != null) { var formattedException = await _contract.JsonRpcClient.ErrorFormatter(_contract.JsonRpcClient, rpcEx.Error); throw formattedException; } return(callResult); }
public void SetViewCallOutgoing(CallPCL call) { if (linphoneCore.CallsNb > 0) { Call currentCall = linphoneCore.Calls.Where(lcall => lcall.RemoteAddress.Username == call.UsernameCaller).FirstOrDefault(); if (currentCall != null) { linphoneCore.VideoDisplayEnabled = true; linphoneCore.VideoAdaptiveJittcompEnabled = true; CallParams param = linphoneCore.CreateCallParams(currentCall); param.VideoEnabled = true; param.VideoDirection = MediaDirection.RecvOnly; param.AudioDirection = MediaDirection.SendRecv; linphoneCore.UpdateCall(currentCall, param); } else { Log($"SetViewCallOutgoing()_Android, call from: {call.UsernameCaller} is not call in linphoneCore"); } //lc.UpdateCall(call, param); } }
private void OnVideoCallClicked(object sender, EventArgs e) { if (Core.CallsNb == 0) { var addr = Core.InterpretUrl(address.Text); CallParams CallParams = Core.CreateCallParams(null); CallParams.VideoEnabled = true; Core.InviteAddressWithParams(addr, CallParams); } else { Call call = Core.CurrentCall; if (call.State == CallState.IncomingReceived) { CallParams CallParams = Core.CreateCallParams(call); CallParams.VideoEnabled = true; Core.AcceptCallWithParams(call, CallParams); } else { Core.TerminateAllCalls(); } } }
public Task <byte[]> Call(CallParams ethCallParam, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public BEAResponse <BEAGetParameterValues> GetParameterValues(CallParams callParams) { BEAResponse <BEAGetParameterValues> response = CallMethod <BEAGetParameterValues>("GetParameterValues", callParams); return(response); }
public void Call() { String code = "scilla_version 0\n" + "\n" + " (* HelloWorld contract *)\n" + "\n" + " import ListUtils\n" + "\n" + " (***************************************************)\n" + " (* Associated library *)\n" + " (***************************************************)\n" + " library HelloWorld\n" + "\n" + " let one_msg =\n" + " fun (msg : Message) =>\n" + " let nil_msg = Nil {Message} in\n" + " Cons {Message} msg nil_msg\n" + "\n" + " let not_owner_code = Int32 1\n" + " let set_hello_code = Int32 2\n" + "\n" + " (***************************************************)\n" + " (* The contract definition *)\n" + " (***************************************************)\n" + "\n" + " contract HelloWorld\n" + " (owner: ByStr20)\n" + "\n" + " field welcome_msg : String = \"\"\n" + "\n" + " transition setHello (msg : String)\n" + " is_owner = builtin eq owner _sender;\n" + " match is_owner with\n" + " | False =>\n" + " msg = {_tag : \"Main\"; _recipient : _sender; _amount : Uint128 0; code : not_owner_code};\n" + " msgs = one_msg msg;\n" + " send msgs\n" + " | True =>\n" + " welcome_msg := msg;\n" + " msg = {_tag : \"Main\"; _recipient : _sender; _amount : Uint128 0; code : set_hello_code};\n" + " msgs = one_msg msg;\n" + " send msgs\n" + " end\n" + " end\n" + "\n" + "\n" + " transition getHello ()\n" + " r <- welcome_msg;\n" + " e = {_eventname: \"getHello()\"; msg: r};\n" + " event e\n" + " end"; List <Values> init = new List <Values>() { new Values() { VName = "_scilla_version", Type = "Uint32", Value = "0" }, new Values() { VName = "owner", Type = "ByStr20", Value = "0x9bfec715a6bd658fcb62b0f8cc9bfa2ade71434a" }, new Values() { VName = "total_tokens", Type = "Uint128", Value = "1000000000" }, new Values() { VName = "decimals", Type = "Uint32", Value = "0" }, new Values() { VName = "name", Type = "String", Value = "BobCoin" }, new Values() { VName = "symbol", Type = "String", Value = "BOB" }, }; Wallet wallet = new Wallet(); wallet.AddByPrivateKey("e19d05c5452598e24caad4a0d85a49146f7be089515c905ae6a19e8a578a6930"); ContractFactory factory = new ContractFactory() { Provider = new HttpProvider("https://dev-api.zilliqa.com/"), Signer = wallet }; LaksaCsharp.Contract.Contract contract = factory.AtContract("zil1h4cesgy498wyyvsdkj7g2zygp0xj920jw2hyx0", code, (Values[])init.ToArray(), ""); int nonce = int.Parse(factory.Provider.GetBalance("9bfec715a6bd658fcb62b0f8cc9bfa2ade71434a").Result.Nonce); CallParams param = new CallParams() { Nonce = (nonce + 1).ToString(), Version = Wallet.Pack(333, 1).ToString(), GasPrice = "1000000000", GasLimit = "1000", SenderPubKey = "0246e7178dc8253201101e18fd6f6eb9972451d121fc57aa2a06dd5c111e58dc6a", Amount = "0" }; List <Values> values = new List <Values>() { new Values() { VName = "to", Type = "ByStr20", Value = "0x381f4008505e940ad7681ec3468a719060caf796" }, new Values() { VName = "tokens", Type = "Uint128", Value = "10" }, }; LaksaCsharp.Transaction.Transaction transaction = contract.Call("Transfer", (Values[])values.ToArray(), param, 3000, 3); }
public virtual Task <UInt256> EstimateGas(CallParams callParams, DefaultBlockParameter blockParameter) { return(_proxyClient.EstimateGas(callParams, blockParameter)); }
public virtual Task <byte[]> Call(CallParams callParams, DefaultBlockParameter blockParameter) { return(_proxyClient.Call(callParams, blockParameter)); }
public Task <byte[]> Call(CallParams callParams, DefaultBlockParameter blockParameter) { throw new NotImplementedException(); }
public Task <UInt256> EstimateGas(CallParams callParams, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
/*private void cm_ContactFound(object sender, ContactFoundEventArgs e) * { * if (e.ContactFound != null) * { * Contact.Text = e.ContactFound.DisplayName; * if (e.PhoneLabel != null) * { * Number.Text = e.PhoneLabel + " : " + e.PhoneNumber; * } * else * { * Number.Text = e.PhoneNumber; * } * } * }*/ private void timerTick(Object sender, Object e) { Call call = ((InCallModel)this.DataContext).GetCurrentCall(); if (call == null) { return; } //startTime = (DateTimeOffset)call.CallStartTimeFromContext; TimeSpan callDuration = new TimeSpan(call.Duration * TimeSpan.TicksPerSecond); var hh = callDuration.Hours; var ss = callDuration.Seconds; var mm = callDuration.Minutes; Status.Text = hh.ToString("00") + ":" + mm.ToString("00") + ":" + ss.ToString("00"); string audioPayloadType = ""; string audioDownloadBandwidth = ""; string audioUploadBandwidth = ""; string videoPayloadType = ""; string videoDownloadBandwidth = ""; string videoUploadBandwidth = ""; CallParams param = call.CurrentParams; ((InCallModel)this.DataContext).MediaEncryption = param.MediaEncryption.ToString(); CallStats audioStats = null; try { audioStats = call.GetStats(StreamType.Audio); } catch { } if (audioStats != null) { audioDownloadBandwidth = String.Format("{0:0.00}", audioStats.DownloadBandwidth); audioUploadBandwidth = String.Format("{0:0.00}", audioStats.UploadBandwidth); ((InCallModel)this.DataContext).ICE = audioStats.IceState.ToString(); } PayloadType audiopt = param.UsedAudioPayloadType; if (audiopt != null) { audioPayloadType = audiopt.MimeType + "/" + audiopt.ClockRate; } if (param.VideoEnabled) { CallStats videoStats = call.GetStats(StreamType.Video); if (videoStats != null) { videoDownloadBandwidth = String.Format("{0:0.00}", videoStats.DownloadBandwidth); videoUploadBandwidth = String.Format("{0:0.00}", videoStats.UploadBandwidth); } PayloadType videopt = param.UsedVideoPayloadType; if (videopt != null) { videoPayloadType = videopt.MimeType; } VideoDefinition receivedVideoSize = param.ReceivedVideoDefinition; String NewReceivedVideoSize = String.Format("{0}x{1}", receivedVideoSize.Width, receivedVideoSize.Height); String OldReceivedVideoSize = ((InCallModel)this.DataContext).ReceivedVideoSize; if (OldReceivedVideoSize != NewReceivedVideoSize) { ((InCallModel)this.DataContext).ReceivedVideoSize = String.Format("{0}x{1}", receivedVideoSize.Width, receivedVideoSize.Height); ((InCallModel)this.DataContext).IsVideoActive = false; if (NewReceivedVideoSize != "0x0") { ((InCallModel)this.DataContext).IsVideoActive = true; } } VideoDefinition sentVideoSize = param.SentVideoDefinition; ((InCallModel)this.DataContext).SentVideoSize = String.Format("{0}x{1}", sentVideoSize.Width, sentVideoSize.Height); ((InCallModel)this.DataContext).VideoStatsVisibility = Visibility.Visible; } else { ((InCallModel)this.DataContext).VideoStatsVisibility = Visibility.Collapsed; } string downloadBandwidth = audioDownloadBandwidth; if ((downloadBandwidth != "") && (videoDownloadBandwidth != "")) { downloadBandwidth += " - "; } if (videoDownloadBandwidth != "") { downloadBandwidth += videoDownloadBandwidth; } ((InCallModel)this.DataContext).DownBandwidth = String.Format("{0} kb/s", downloadBandwidth); string uploadBandwidth = audioUploadBandwidth; if ((uploadBandwidth != "") && (videoUploadBandwidth != "")) { uploadBandwidth += " - "; } if (videoUploadBandwidth != "") { uploadBandwidth += videoUploadBandwidth; } ((InCallModel)this.DataContext).UpBandwidth = String.Format("{0} kb/s", uploadBandwidth); string payloadType = audioPayloadType; if ((payloadType != "") && (videoPayloadType != "")) { payloadType += " - "; } if (videoPayloadType != "") { payloadType += videoPayloadType; } ((InCallModel)this.DataContext).PayloadType = payloadType; }
public void CallStateChanged(Call call, CallState state) { if (call == null) { return; } if (state == CallState.Connected && oneSecondTimer == null) { oneSecondTimer = new DispatcherTimer(); oneSecondTimer.Interval = TimeSpan.FromSeconds(1); oneSecondTimer.Tick += timerTick; oneSecondTimer.Start(); statusIcon.Visibility = Visibility.Visible; buttons.enabledVideo(false); } else if (state == CallState.Resuming) { oneSecondTimer = new DispatcherTimer(); oneSecondTimer.Interval = TimeSpan.FromSeconds(1); oneSecondTimer.Tick += timerTick; oneSecondTimer.Start(); } else if (state == CallState.StreamsRunning) { statusIcon.Glyph = "\uE768"; if (!call.MediaInProgress()) { buttons.enabledPause(true); if (LinphoneManager.Instance.IsVideoAvailable) { buttons.enabledVideo(true); } } if (call.CurrentParams.VideoEnabled) { displayVideo(true); buttons.checkedVideo(true); } else { displayVideo(false); } } else if (state == CallState.PausedByRemote) { if (call.CurrentParams.VideoEnabled) { displayVideo(false); } buttons.enabledVideo(false); statusIcon.Glyph = "\uE769"; } else if (state == CallState.Paused) { if (call.CurrentParams.VideoEnabled) { displayVideo(false); } buttons.enabledVideo(false); statusIcon.Glyph = "\uE769"; } else if (state == CallState.Error || state == CallState.End) { if (oneSecondTimer != null) { oneSecondTimer.Stop(); } } else if (state == CallState.UpdatedByRemote) { if (!LinphoneManager.Instance.IsVideoAvailable) { CallParams parameters = call.CurrentParams.Copy(); LinphoneManager.Instance.Core.AcceptCallUpdate(call, parameters); } else { bool remoteVideo = call.RemoteParams.VideoEnabled; bool localVideo = call.CurrentParams.VideoEnabled; bool autoAcceptCameraPolicy = LinphoneManager.Instance.Core.VideoActivationPolicy.AutomaticallyAccept; if (remoteVideo && !localVideo && !autoAcceptCameraPolicy) { lock (popupLock) { if (askingVideo) { return; } askingVideo = true; AskVideoPopup(call); } } } } refreshUI(); }