2,245
社区成员
发帖
与我相关
我的任务
分享
private CCPCall()
{
cf.onConnected = onConnected;
cf.onConnectError = onConnectError;
cf.onIncomingCallReceived = onIncomingCallReceived;
cf.onCallProceeding = onCallProceeding;
cf.onCallAlerting = onCallAlerting;
cf.onCallAnswered = onCallAnswered;
cf.onMakeCallFailed = onMakeCallFailed;
cf.onCallPaused = onCallPaused;
cf.onCallPausedByRemote = onCallPausedByRemote;
cf.onCallReleased = onCallReleased;
cf.onCallTransfered = onCallTransfered;
cf.onDtmfReceived = onDtmfReceived;
cf.onLogInfo = onLogInfo;
cf.onResumed = onResumed;
cf.onNotifyGeneralEvent = onNotifyGeneralEvent;
cf.onRecordVoiceCallStatus = onRecordVoiceCallStatus;
cf.onCallMediaUpdateRequest = onCallMediaUpdateRequest;
cf.onCallMediaUpdateResponse = onCallMediaUpdateResponse;
cf.onFirewallPolicyEnabled = onFirewallPolicyEnabled;
cf.onRemoteVideoRatio = onRemoteVideoRatio;
//即时消息
cf.onReceiveInstanceMessage = onReceiveInstanceMessage;
cf.onSendInstanceMessage = onSendInstanceMessage;
cf.onDownloadAttached = onDownloadAttached;
cf.onConfirmInstanceMessage = onConfirmInstanceMessage;
cf.onRateOfProgressAttachMsgs = onRateOfProgressAttachMsgs;
cf.onRecordingTimeOut = onRecordingTimeOut;
cf.onFinishedPlaying = onFinishedPlaying;
cf.onRecordingAmplitude = onRecordingAmplitude;
//实时对讲
cf.onReceiveInterphoneMsg = onReceiveInterphoneMsg;
cf.onInterphoneState = onInterphoneState;
cf.onInterphoneExit = onInterphoneExit;
cf.onControlMicState = onControlMicState;
cf.onReleaseMicState = onReleaseMicState;
cf.onInterphoneMembers = onInterphoneMembers;
//双向回呼
cf.onCallBack = onCallBack;
//多人聊天室
cf.onReceiveChatroomMsg = onReceiveChatroomMsg;
cf.onChatroomState = onChatroomState;
cf.onChatroomExit = onChatroomExit;
cf.onChatrooms = onChatrooms;
cf.onChatroomMembers = onChatroomMembers;
cf.onChatroomInviteMembers = onChatroomInviteMembers;
cf.onChatroomRemoveMember = onChatroomRemoveMember;
cf.onChatroomDismiss = onChatroomDismiss;
//检查版本更新
cf.onCheckVersion = onCheckVersion;
cf.onDownloadUpdateFiles = onDownloadUpdateFiles;
cf.onRateOfProgressDownloadUpdateFiles = onRateOfProgressDownloadUpdateFiles;
//检测网络状态
cf.onCheckNetStat = onCheckNetStat;
cf.onRateOfCheckNetStat = onRateOfCheckNetStat;
//发送下行短信
cf.onSendSMS = onSendSMS;
//视频会议
cf.onReceiveVideoConferenceMsg = onReceiveVideoConferenceMsg;
cf.onVideoConferenceState = onVideoConferenceState;
cf.onVideoConferenceExit = onVideoConferenceExit;
cf.onVideoConferences = onVideoConferences;
cf.onVideoConferenceMembers = onVideoConferenceMembers;
cf.onVideoConferenceRemoveMember = onVideoConferenceRemoveMember;
cf.onVideoConferenceDismiss = onVideoConferenceDismiss;
cf.onSwitchRealScreenToVoip = onSwitchRealScreenToVoip;
cf.onSendLocalPortrait = onSendLocalPortrait;
cf.onGetPortraitsFromVideoConference = onGetPortraitsFromVideoConference;
cf.onDownloadVideoConferencePortraits = onDownloadVideoConferencePortraits;
//NativeMethods.CCPsetLogLevel(5);
initCCPRet = NativeMethods.CCPinit(ref cf);
//int ret = NativeMethods.CCPsetRing(System.Windows.Forms.Application.StartupPath+@"/ring.wav");
//ret = NativeMethods.CCPsetRingback(System.Windows.Forms.Application.StartupPath+@"/ringback.wav");
configInfo.readConfigFile();
}
private void voipcall_btn_Click(object sender, EventArgs e)
{
string calledvoip = calledvoip_comboBox.Text;
if (calledvoip.Length == 0)
{
MessageBox.Show("请输入或选择要拨打的VoIP账号");
}
else
{
string callid = CCPCall.instance.makeCall(CALL_Type.VOICE_CALL, calledvoip);
Console.WriteLine("makeCall callid=" + callid);
if (callid != null)
{
VoipDialogForm voipForm = new VoipDialogForm();
voipForm.callid = callid;
voipForm.called = calledvoip;
updateStatus = new updateVoIPStatus(voipForm.updateVoIPCallStatus);
callfailed = new makecallFailed(voipForm.onMakecallFailed);
voipForm.ShowDialog();
updateStatus = null;
callfailed = null;
}
else
{
MessageBox.Show("拨打失败,callid为空");
}
}
}
public string makeCall(CALL_Type callType, string called)
{
IntPtr callid = NativeMethods.CCPmakeCall((int)callType, called);
string strCallid = Marshal.PtrToStringAnsi(callid);
callingCallid = strCallid;
return strCallid;
}
[DllImport("CCPAppClient.dll", EntryPoint = "CCPmakeCall", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CCPmakeCall(int callType, string called);