示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        private void UpdateCallReferences(IntPtr call, CallState newCallState, CallType newCallType,
                                          LinphoneCallState callState, string from, string to, string recordFile)
        {
            IntPtr       callref   = CallModule.linphone_call_ref(call);
            LinphoneCall existCall = null;

            if (callref.IsNonZero())
            {
                if (Calls.TryGetValue(callref, out existCall))
                {
                    if (existCall.State != newCallState)
                    {
                        existCall.State = newCallState;
                        CallStateChangedEvent?.Invoke(existCall);
                    }
                }
                else
                {
                    existCall = new LinphoneCall()
                    {
                        State           = newCallState,
                        Type            = newCallType,
                        From            = from,
                        To              = to,
                        RecordFile      = recordFile,
                        LinphoneCallPtr = callref
                    };

                    Calls.TryAdd(callref, existCall);
                    CallStateChangedEvent?.Invoke(existCall);
                }
            }

            if (callState == LinphoneCallState.LinphoneCallReleased)
            {
                CallModule.linphone_call_unref(existCall.LinphoneCallPtr);
                Calls.TryRemove(callref, out existCall);
                return;
            }
        }