public void TerminateCall(LinphoneCall linphoneCall) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_core_terminate_call(LinphoneCore, linphoneCall.LinphoneCallPtr); } }
public void PauseRecording(LinphoneCall linphoneCall) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero() && !string.IsNullOrWhiteSpace(linphoneCall.RecordFile)) { GenericModules.linphone_call_stop_recording(linphoneCall.LinphoneCallPtr); } }
public void ResumeCall(LinphoneCall linphoneCall) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_core_resume_call(LinphoneCore, linphoneCall.LinphoneCallPtr); } }
public void SetIncomingRingSound(string file) { if (LinphoneCore.IsNonZero()) { MediaModule.linphone_core_set_ring(LinphoneCore, file); } }
public void HoldCall(LinphoneCall linphoneCall) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_core_pause_call(LinphoneCore, linphoneCall.LinphoneCallPtr); } }
private bool IsAccountConfigured() { LinphoneCore lc = LinphoneManager.Instance.LinphoneCore; LinphoneProxyConfig cfg = lc.DefaultProxyConfig; return(cfg != null); }
public void SetRingbackSound(string file) { if (LinphoneCore.IsNonZero()) { MediaModule.linphone_core_set_ringback(LinphoneCore, file); } }
public void OnRegistrationChanged(IntPtr lc, IntPtr cfg, LinphoneRegistrationState cstate, string message) { if (LinphoneCore.IsNonZero()) { RegistrationStateChangedEvent?.Invoke(cstate); } }
public void MakeCallAndRecord(string uri, string filename, bool startRecordInstantly) { if (LinphoneCore.IsNonZero()) { var callParams = CreateCallParameters(); if (!string.IsNullOrWhiteSpace(filename)) { CallModule.linphone_call_params_set_record_file(callParams, filename); } IntPtr call = CallModule.linphone_core_invite_with_params(LinphoneCore, uri, callParams); if (call.IsZero()) { #if (DEBUG) ErrorEvent?.Invoke(null, "Can't call!"); #endif return; } CallModule.linphone_call_ref(call); if (startRecordInstantly) { GenericModules.linphone_call_start_recording(call); } } }
public void RedirectCall(LinphoneCall linphoneCall, string redirect_uri) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_call_redirect(LinphoneCore, linphoneCall.LinphoneCallPtr, redirect_uri); } }
public void SendDTMFs(LinphoneCall linphoneCall, string dtmfs) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero() && !string.IsNullOrWhiteSpace(dtmfs)) { CallModule.linphone_call_send_dtmfs(linphoneCall.LinphoneCallPtr, dtmfs); } }
private void InitLinphoneCore() { //Globals.Instance.LinphoneCoreFactory.CreateLinphoneCore(listener); Globals.Instance.LinphoneCoreFactory.CreateLinphoneCore(this); lc = Globals.Instance.LinphoneCore; lc.NativeVideoWindowId = this.videoViewerPanel.Handle.ToInt64(); listener.Lc = lc; }
/// <summary> /// Pauses the current call if any and if it's running. /// </summary> public void PauseCurrentCall() { if (LinphoneCore.CallsNb > 0) { LinphoneCall call = LinphoneCore.CurrentCall; LinphoneCore.PauseCall(call); } }
public void SendMessage(string to, string message) { if (LinphoneCore.IsNonZero()) { IntPtr chat_room = ChatModule.linphone_core_get_chat_room_from_uri(LinphoneCore, to); IntPtr chat_message = ChatModule.linphone_chat_room_create_message(chat_room, message); ChatModule.linphone_chat_room_send_chat_message(chat_room, chat_message); } }
/// <summary> /// Remove one or many entries from the calls' history. /// </summary> /// <param name="logsToRemove">A list of CallLog to remove from history</param> /// <returns>A list of CallLogs, without the removed entries</returns> public void RemoveCallLogs(IEnumerable <CallLog> logsToRemove) { // When removing log from history, it will be removed from logsToRemove list too. // Using foreach causing the app to crash on a InvalidOperationException, so we are using while for (int i = 0; i < logsToRemove.Count(); i++) { CallLog logToRemove = logsToRemove.ElementAt(i); LinphoneCore.RemoveCallLog(logToRemove.NativeLog as LinphoneCallLog); } }
public MainPage() { InitializeComponent(); Listener = Factory.Instance.CreateCoreListener(); Listener.OnRegistrationStateChanged = OnRegistration; Listener.OnCallStateChanged = OnCall; Listener.OnCallStatsUpdated = OnStats; LinphoneCore.AddListener(Listener); }
/// <summary> /// Resume the current call if any and if it's paused. /// </summary> public void ResumeCurrentCall() { foreach (LinphoneCall call in LinphoneCore.Calls) { if (call.State == LinphoneCallState.Paused) { LinphoneCore.ResumeCall(call); } } }
private bool IsRegisterEnabled() { LinphoneCore lc = LinphoneManager.Instance.LinphoneCore; LinphoneProxyConfig cfg = lc.DefaultProxyConfig; if (cfg != null) { return(cfg.RegisterEnabled); } return(true); }
public void ReceiveCall(LinphoneCall linphoneCall) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_call_ref(linphoneCall.LinphoneCallPtr); IntPtr callParams = CreateCallParameters(); CallModule.linphone_core_accept_call_with_params(LinphoneCore, linphoneCall.LinphoneCallPtr, callParams); } }
private void EnableRegister(bool enable) { LinphoneCore lc = LinphoneManager.Instance.LinphoneCore; LinphoneProxyConfig cfg = lc.DefaultProxyConfig; if (cfg != null) { cfg.Edit(); cfg.RegisterEnabled = enable; cfg.Done(); } }
public void ReceiveCallAndRecord(LinphoneCall linphoneCall, string filename, bool startRecordInstantly = true) { if (linphoneCall.IsExist() && LinphoneCore.IsNonZero()) { CallModule.linphone_call_ref(linphoneCall.LinphoneCallPtr); IntPtr callParams = CreateCallParameters(); CallModule.linphone_call_params_set_record_file(callParams, filename); CallModule.linphone_core_accept_call_with_params(LinphoneCore, linphoneCall.LinphoneCallPtr, callParams); if (startRecordInstantly) { GenericModules.linphone_call_start_recording(linphoneCall.LinphoneCallPtr); } } }
public void OnCallStateChanged(IntPtr lc, IntPtr call, LinphoneCallState callState, string message) { if (LinphoneCore.IsNonZero() && IsRunning) { var newCallState = CallState.None; var newCallType = CallType.None; string from, to, recordFile; from = to = recordFile = null; IntPtr callParams = CallModule.linphone_call_get_params(call); bool recordEnable = MarshalingExtensions.TryConvert(CallModule.linphone_call_params_get_record_file(callParams), out recordFile); newCallState = GetNewCallState(call, callState, ref newCallType, ref from, ref to, recordEnable); UpdateCallReferences(call, newCallState, newCallType, callState, from, to, recordFile); } }
/// <summary> /// Stops the current call if any. /// </summary> public void EndCurrentCall() { LinphoneCall call = LinphoneCore.CurrentCall; if (call != null) { LinphoneCore.TerminateCall(call); } else { foreach (LinphoneCall lCall in LinphoneCore.Calls) { if (lCall.State == LinphoneCallState.Paused) { LinphoneCore.TerminateCall(lCall); } } } }
/// <summary> /// Enables disables video. /// </summary> /// <param name="enable">Wether to enable or disable video</param> /// <returns>true if the operation has been successful, false otherwise</returns> public bool EnableVideo(bool enable) { if (LinphoneCore.InCall) { LinphoneCall call = LinphoneCore.CurrentCall; LinphoneCallParams parameters = call.GetCurrentParamsCopy(); if (enable != parameters.VideoEnabled) { parameters.VideoEnabled = enable; if (enable) { // TODO: Handle bandwidth limitation } LinphoneCore.UpdateCall(call, parameters); return(true); } } return(false); }
/// <summary> /// Toggles the camera used for video capture. /// </summary> public void ToggleCameras() { if (NumberOfCameras >= 2) { String currentDevice = LinphoneCore.VideoDevice; if (currentDevice == frontCamera) { LinphoneCore.VideoDevice = backCamera; } else if (currentDevice == backCamera) { LinphoneCore.VideoDevice = frontCamera; } if (LinphoneCore.InCall) { LinphoneCall call = LinphoneCore.CurrentCall; LinphoneCore.UpdateCall(call, null); } } }
public bool AcceptCall() { bool result = false; var call = LinphoneCore.CurrentCall; if (call != null && (call.State == CallState.IncomingReceived || call.State == CallState.IncomingEarlyMedia)) { LinphoneCore.AcceptCall(call); result = true; } else { try { linphoneCore.AcceptCall(LastCall); } catch { } } return(result); }
private void LinphoneCoreIterate(ThreadPoolTimer timer) { while (true) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => LinphoneCore.Iterate()); } }
/// <summary> /// Remove all calls' history from LinphoneCore. /// </summary> /// <returns>An empty list</returns> public void ClearCallLogs() { LinphoneCore.ClearCallLogs(); }
static void Main(string[] args) { var listener = new LinphoneManager(); Globals.Instance.LinphoneCoreFactory.CreateLinphoneCore(listener); LinphoneCore lc = Globals.Instance.LinphoneCore; listener.Lc = lc; var proxyCfg = new LinphoneProxyConfig(); proxyCfg.SetIdentity("test 1000 <sip:[email protected]>"); proxyCfg.ServerAddr = "192.168.6.241"; proxyCfg.RegisterEnabled = true; proxyCfg.Expires = 60000; lc.ClearProxyConfigs(); lc.AddProxyConfig(proxyCfg); lc.DefaultProxyConfig = proxyCfg; var authInfo = new LinphoneAuthInfo("1000", string.Empty, "12345", string.Empty, string.Empty, string.Empty); lc.AddAuthInfo(authInfo); lc.IterateEnabled = true; while (lc.DefaultProxyConfig.State != RegistrationState.RegistrationOk) { Console.WriteLine("Registering..."); System.Threading.Thread.Sleep(1000); if (lc.DefaultProxyConfig.State == RegistrationState.RegistrationFailed) { Console.WriteLine("Reason: {0}", lc.DefaultProxyConfig.Error); lc.IterateEnabled = false; Console.ReadKey(); return; } } Console.WriteLine("Registered"); Console.ReadKey(); #if CALL Console.WriteLine("Calling to sip:[email protected] ..."); var callParams = lc.CreateDefaultCallParameters(); callParams.VideoEnabled = false; //var callAddr = Globals.Instance.LinphoneCoreFactory.CreateLinphoneAddress("sip:[email protected]"); //var call = lc.InviteAddressWithParams(callAddr, callParams); var call = lc.InviteWithParams("sip:[email protected]", callParams); if (call.State != LinphoneCallState.Connected) { Console.WriteLine("Waiting accept call..."); System.Threading.Thread.Sleep(2000); } Console.ReadKey(); lc.TerminateAllCalls(); #endif // De-activate registering var defaultCfg = lc.DefaultProxyConfig; defaultCfg.Edit(); defaultCfg.RegisterEnabled = false; defaultCfg.Done(); while (lc.DefaultProxyConfig.State != RegistrationState.RegistrationCleared) { Console.WriteLine("UnRegistering..."); System.Threading.Thread.Sleep(1000); } Console.WriteLine("UnRegistered"); lc.IterateEnabled = false; Console.ReadKey(); }
/// <summary> /// Start a new call to a sip address. /// </summary> /// <param name="sipAddress">SIP address to call</param> public void NewOutgoingCall(String sipAddress) { LinphoneCall LCall = LinphoneCore.Invite(sipAddress); }