上一年在公司做了一个小小的IVR项目.觉得这是一个和硬件驱动交互编程的不错例子.
共享一下.也讨论一下.
代码:(这个是调用系统驱动的DLL)
using System;
using System.Text;
using DJVoiceCard.Lib;
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
namespace DJVoiceCard.DL
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
public class SysFunction
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
系统操作#region 系统操作
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 初始化系统
/// </summary>
/// <returns></returns>
public static bool SysInit(ref string sErr)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
try
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
StringBuilder sSys_INC = new StringBuilder("");
StringBuilder sPrompt_INC = new StringBuilder("Prompt.ini");
int iSysInit = ISUP_Lib.DJISUP_InitSystem();
int iCardInit = DJFunction.DJSys_EnableCard(sSys_INC, sPrompt_INC);
bool iPromptInit = DJFunction.DJSys_EnableDtmfSend();
if (iSysInit == 1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (iCardInit == 0)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (iPromptInit)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return true;
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sErr = "未能加载声音文件" + iPromptInit.ToString();
return false;
}
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sErr = iCardInit.ToString();
return false;
}
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sErr = iSysInit.ToString();
return false;
}
}
catch (Exception ex)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sErr = ex.Message;
}
return false;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 退出系统
/// </summary>
public static void SysExit()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DJFunction.DJSys_DisableCard();
ISUP_Lib.DJISUP_ExitSystem();
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
#endregion
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
中继通道操作#region 中继通道操作
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取中继通道总数
/// </summary>
/// <returns></returns>
public static int iTrkTotal()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJTrk_GetTotalTrunkNum();
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 信道状态;
/// </summary>
/// <param name="PCM_NO"></param>
/// <param name="Relay_NO"></param>
/// <returns></returns>
public static int iRaleyStetes(byte PCM_NO, byte Relay_NO)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_GetChnState(PCM_NO, Relay_NO);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 循环刷新缓存;
/// </summary>
public static void Push_GerEvent()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
try
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
ISUP_Lib.DJISUP_GetEvent();
DJFunction.DJSys_PushPlay();
}
catch(Exception Ex)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获得中继号
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int iPCMID(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJTrk_GetPcmID(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 被叫号码
/// </summary>
/// <param name="PCM_NO"></param>
/// <param name="Relay_NO"></param>
/// <returns></returns>
public static TC_INI_TYPE GetCallNum(int PCM_NO, int Relay_NO)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
TC_INI_TYPE sReVal = new TC_INI_TYPE();
ISUP_Lib.DJISUP_GetCalleeNum((byte)PCM_NO, (byte)Relay_NO, ref sReVal);
return sReVal;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 主叫号码
/// </summary>
/// <param name="PCM_NO"></param>
/// <param name="Relay_NO"></param>
/// <returns></returns>
public static TC_INI_TYPE GetCallerNum(int PCM_NO, int Relay_NO)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
TC_INI_TYPE sReVal = new TC_INI_TYPE();
ISUP_Lib.DJISUP_GetCallerNum((byte)PCM_NO, (byte)Relay_NO, ref sReVal);
return sReVal;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取用户按键
/// </summary>
/// <param name="Relay_NO"></param>
/// <returns></returns>
public static StringBuilder GetUserKeyPress(int Relay_NO)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJTrk_GetDtmfCode(Relay_NO);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 设置中继信道的状态;
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="States"></param>
public static void SetRelayStates(int iTrunkID, int States)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
ISUP_Lib.DJISUP_SetChnState(((byte)(iTrunkID / 30)), ((byte)(iTrunkID % 30)), (byte)States);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 呼出
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="CalleeNum"></param>
/// <param name="CallerNum"></param>
/// <returns></returns>
public static bool bCallOut(int iTrunkID, string CalleeNum, string CallerNum, ref string sErr)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
StringBuilder Callee = new StringBuilder(CallerNum);
StringBuilder Caller = new StringBuilder(CalleeNum);
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
bool bRel = ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, ref Callee, ref Caller);
//sErr = Callee.ToString() + "||" + Caller.ToString()+"||"+iTrunkID.ToString();
return bRel;
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
sErr = "NaN";
return false;
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// string
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="CalleeNum"></param>
/// <param name="CallerNum"></param>
/// <returns></returns>
public static bool bCallOut(int iTrunkID, string CalleeNum, string CallerNum)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
char[] telNum = new char[120];
PR p = new PR();
p.TelarrChar = telNum;
telNum = CalleeNum.ToCharArray();
byte[] _telNum = new byte[120];
_telNum = Encoding.ASCII.GetBytes(telNum);
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
char[] CallNum = new char[120];
CallNum = CallerNum.ToCharArray();
byte[] _CallNum = new byte[120];
p.CallarrChar = CallNum;
_CallNum = Encoding.ASCII.GetBytes(CallerNum);
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, ref CalleeNum, ref CallerNum);
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// byte][
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="CalleeNum"></param>
/// <param name="CallerNum"></param>
/// <returns></returns>
public static bool bCallOut(int iTrunkID, byte[] CalleeNum, byte[] CallerNum)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
unsafe
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, CalleeNum, CallerNum);
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// char *
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="calleeNum"></param>
/// <param name="callerNum"></param>
/// <returns></returns>
public static unsafe bool bCallOut(int iTrunkID, StringBuilder calleeNum, StringBuilder callerNum)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
unsafe
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, calleeNum, callerNum);
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// char *
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="CalleeNum"></param>
/// <param name="CallerNum"></param>
/// <returns></returns>
public static unsafe bool bCallOut(int iTrunkID, string sCalleeNum, string sCallerNum, bool isM, bool isMT)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
unsafe
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
char[] sCallNumarr = sCalleeNum.ToCharArray();
char[] sCallerNumarr = sCallerNum.ToCharArray();
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return
ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, sCallNumarr, out sCallerNumarr, out isM,
out isMT);
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// ulong
/// </summary>
/// <param name="iTrunkID"></param>
/// <param name="CalleeNum"></param>
/// <param name="CallerNum"></param>
/// <returns></returns>
public static bool bCallOut(int iTrunkID, ulong CalleeNum, ulong CallerNum)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
unsafe
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (iTrunkID != -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_Callout(iTrunkID / 30, iTrunkID % 30, ref CalleeNum, ref CallerNum);
}
else
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 初始化索引通道
/// </summary>
/// <param name="TrunkID"></param>
public static void PlayFileInit(int TrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DJFunction.DJVoc_InitIndexPlayFile(TrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 添加索引文件
/// </summary>
/// <param name="TrunkID"></param>
/// <param name="FileName"></param>
/// <returns></returns>
public static bool AddIndexFile(int TrunkID, byte[] FileName)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_AddIndexPlayFile(TrunkID, FileName);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 开始播放索引文件
/// </summary>
/// <param name="TrunkID"></param>
/// <returns></returns>
public static bool PlayFileStart(int TrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_StartIndexPlayFile(TrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 停止播放索引文件
/// </summary>
/// <param name="TrunkID"></param>
/// <returns></returns>
public static void PlayFileEnd(int TrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DJFunction.DJVoc_StopIndexPlayFile(TrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 检查是否索引播放结束
/// </summary>
/// <param name="TrunkID"></param>
/// <returns></returns>
public static bool PlayFileEndCHK(int TrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_CheckIndexPlayEnd(TrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
#endregion
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
获取空闲中继信道#region 获取空闲中继信道
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取空闲中继信道
/// </summary>
/// <returns></returns>
public static int iFreePCM()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
byte mo_NO = 0, dt_NO = 0;
if (ISUP_Lib.DJISUP_GetCalloutChnNew(ref mo_NO, ref dt_NO))
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return (int)(mo_NO * 30 + dt_NO);
}
return -1;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
#endregion
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
用户#region 用户
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 用户通道总数
/// </summary>
/// <returns></returns>
public static int iUserTotal()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJUser_GetTotalUserNum();
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 呼出状态
/// </summary>
/// <param name="iPCMID"></param>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int iCallOutStates(int iPCMID, int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_GetCalloutState(iPCMID, iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取路径
/// </summary>
/// <returns></returns>
//public static byte[] appDIR()
//{
// return DJFunction.DJSys_GetInstallDir();
//}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取路径
/// </summary>
/// <returns></returns>
public static StringBuilder appDIRStr()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJSys_GetInstallDir();
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 播放语音
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static bool bISplayVoice(int iTrunkID, byte[] sVoiceFile)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
int iISFree = DJFunction.DJVoc_SFVC_ForPlay_New(iTrunkID, true);
if (iISFree == -1)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
//if()
bool bISPlayFile = DJFunction.DJVoc_PlayFile(iTrunkID, sVoiceFile);
//bool bISLink =DJFunction.DJExg_SetLinkPlayVoiceToTrunk(iTrunkID, iISFree);
if (!bISPlayFile)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
}
//if (!bISLink)
//{
// return false;
//}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
return true;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
public static int iPlayVoice(int iVoiceChn)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_VoiceStart(iVoiceChn);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 断开语音通道链接
///
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static bool ClearCHN(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJExg_ClearLinkTrunkAndUserByTrunk(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 初始化用户馈电
/// </summary>
/// <param name="iUserCHNID"></param>
public static void UserPowerOn(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DJFunction.DJUser_SetPowerON(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 允许用户通道在摘机时自动送拨号音,这是系统的缺省工作方式。
/// </summary>
/// <param name="iUserCHNID"></param>
/// <returns></returns>
public static bool UserEnableDailSound(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJUser_EnableDialSound(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 对给定的语音通道循环播放系统提示音。
/// </summary>
/// <param name="voiceCHNID"></param>
/// <param name="voiceFileName"></param>
/// <returns></returns>
public static bool LoopVoiceM(int voiceCHNID, StringBuilder voiceFileName)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_LoopPlayPromptFile(voiceCHNID, voiceFileName);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 空闲语音通道
/// </summary>
/// <returns></returns>
public static int iFreeVoiceCHNID()
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_SearchFreeVoiceChannelForPlay();
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 检查是否正在对用户模块振铃
/// </summary>
/// <param name="iUserID"></param>
/// <returns></returns>
public static bool bIsRingDerctor(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJUser_RingDetect(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 停止用户通道振铃
/// </summary>
/// <param name="iUserCHNID"></param>
/// <returns></returns>
public static bool bIsStopRing(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJUser_StopRing(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 断开放音语音通道和用户通道之间的联接
/// </summary>
/// <param name="iUserCHNID"></param>
/// <returns></returns>
public static bool bClearVoiceFromUser(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJExg_ClearLinkPlayVoiceFromUser(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 复位用户DTMF拨号信息,拨号位数置 0,DTMF缓冲区清空
/// </summary>
/// <param name="iUserCHNID"></param>
/// <returns></returns>
public static bool bIsInitDailBuf(int iUserCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJUser_InitDialBuf(iUserCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 得用LINK方式联接在本通道上的用户通道号。
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int iLinkUserCHNID(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJTrk_GetConnectUserID(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 取得给本通道放音的语音通道号,如果没有放音通道与本中继通道相连,返回-1
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int iVoicePlayForTrunk(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJTrk_GetTrunkPlayID(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 断开中继通道和放音语音通道的连通。
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static bool bIsClearTrunkVoiceLink(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJExg_ClearLinkPlayVoiceFromTrunk(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 清空系统的DTMF缓冲区,如果在缓冲区中有DTMF按键的值,将会丢失
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static bool bIsInitDtmfByTrunkID(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJTrk_InitDtmfBuf(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取CPG返回
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int iCPGReval(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_GetEventInfo(iTrunkID / 30, iTrunkID % 30);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 获取ISUP返回
/// </summary>
/// <param name="iTrunkID"></param>
/// <returns></returns>
public static int ISUPReVal(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return ISUP_Lib.DJISUP_GetRecvCauseValue(iTrunkID / 30, iTrunkID % 30);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 检查该语音通道的语音操作是否结束,即录放音是否到达指定的大小。
/// </summary>
/// <param name="iVocCHNID"></param>
/// <returns></returns>
public static bool bIsVocPlayEnd(int iVocCHNID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return DJFunction.DJVoc_CheckVoiceEnd(iVocCHNID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 停止文件放音。多次调用本函数没有影响
/// </summary>
/// <param name="iTrunkID"></param>
public static void StopPlayVocInTrunk(int iTrunkID)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
DJFunction.DJVoc_StopPlayFile(iTrunkID);
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
#endregion
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Runtime.InteropServices;
5![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
6
namespace DJVoiceCard.Lib
7![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
8
public class DJFunction
9![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
10![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
11
/// 初始化东进七号信令中继语音卡的硬件
12
/// </summary>
13
/// <param name="sIncFileName">INI系统配置文件名</param>
14
/// <param name="sVoiceIncFileName">提示音对照表文件名,一般使用PROMPT.INI</param>
15
/// <returns>0,成功;其他:-12,在读取INI文件时错误;
16
/// -17,打开驱动程序的设备文件时错误[驱动程序名为:DJPCI-东进七号信令中继语音卡,NT;DJPCI2K 东进七号信令中继语音卡,2000];
17
/// -18,检查硬件失败;
18
/// -19,读取提示音文件时失败;
19
/// </returns>
20
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
21
public static extern int DJSys_EnableCard(StringBuilder sIncFileName, StringBuilder sVoiceIncFileName);
22![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
23![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
24
/// 结束所有中继语音卡的操作, 释放API所占用的资源, 复位中继语音卡的状态, 应该在程序结束前调用。
25
/// 由于同DJSys_EnableCard类似的原因,当调用本函数之后,你就不能再调用其他的有关数字中继卡的函数。
26
/// 只有DJSys_EnableCard函数成功后,才能调用本函数,并且要求成对出现。
27
/// </summary>
28
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
29
public static extern void DJSys_DisableCard();
30![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
32
/// 得到系统内中继通道总数;
33
/// </summary>
34
/// <returns></returns>
35
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
36
public static extern int DJTrk_GetTotalTrunkNum();
37![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
39![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
40
/// 维持文件录音和文件放音连续的函数。
41
/// 要求应用程序必须在小于4秒钟内调用本函数一次(允许多次)。
42
/// 在数字中继卡的底层驱动程序中,对每个语音通道开辟了64K的缓冲区。
43
/// 当进行文件方式的录音或放音时,不断的调用函数DJSys_PushPlay可以保证缓冲区的更新。
44
/// </summary>
45
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
46
public static extern void DJSys_PushPlay();
47![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
49
/// 获得PCM中继ID
50
/// </summary>
51
/// <param name="trunkID">中继通道号;</param>
52
/// <returns></returns>
53
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
54
public static extern int DJTrk_GetPcmID(int trunkID);
55![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
58
/// 根据中继通道号,来断开本中继通道与用户通道之间的双向连通,对应DJExg_SetLinkTrunkAndUser
59
/// </summary>
60
/// <param name="trunkID"></param>
61
/// <returns></returns>
62
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
63
public static extern bool DJExg_ClearLinkTrunkAndUserByTrunk(int trunkID);
64![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
65![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
66
/// 使能发送DTMF的功能。
67
/// </summary>
68
/// <returns></returns>
69
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
70
public static extern bool DJSys_EnableDtmfSend();
71![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
72![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
73
/// 取用户通道总数。如果是一片D161A/D081A卡,本函数返回16/8,依次类推。
74
/// 函数返回:● 系统内的用户通道数
75
/// </summary>
76
/// <returns> 系统内的用户通道数</returns>
77
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
78
public static extern int DJUser_GetTotalUserNum();
79![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
80![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
81
/// 搜索一个空闲的语音通道
82
/// </summary>
83
/// <param name="trunkID"></param>
84
/// <param name="IsForTrunk"></param>
85
/// <returns></returns>
86
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
87
public static extern int DJVoc_SFVC_ForPlay_New(int trunkID, bool IsForTrunk);
88![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
89![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
90
/// 播放语音文件
91
/// </summary>
92
/// <param name="voiceID"></param>
93
/// <param name="voiceName"></param>
94
/// <returns></returns>
95
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
96
public static extern bool DJVoc_PlayPromptFile(int voiceID,byte[] voiceName);
97![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
98![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
99
/// 建立放音语音通道到中继通道的连通。本函数在本质上是一个中继通道去听语音通道。
100
/// 当中继通道处于准备好状态,语音通道已经开始操作(直接或间接调用过DJVoc_VoiceStart 函数),
101
/// 则可通过此函数将语音通道中的语音放给中继通道上的电话用户听。
102
/// </summary>
103
/// <param name="trunkID"></param>
104
/// <param name="voiceID"></param>
105
/// <returns></returns>
106
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
107
public static extern bool DJExg_SetLinkPlayVoiceToTrunk(int trunkID, int voiceID);
108![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
109![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
110
/// 对用户模块馈电,这是系统的初始状态,当userID越界时,调用DJSYS_GetErrCode得到_ERR_InvalidID。
111
/// 只有在直流电源正常工作状态下,用户通道才能正常操作,系统启动后缺省为开电源。
112
/// 如果你正常的接入电源,则调用完本函数后,与该userID相连的电话机将会处于有馈电的状态,拿起话机听筒,在电话机上按键,会听到按键的声音。
113
/// 当该用户通道插入的是中继模块,用来接入模拟电话线时,调用本函数,相当于电话机摘机。
114
/// 由于这是系统的缺省状态,所以,如果是中继模块,在初始化时,需要将所有的中继模块挂机,这可以通过调用函数DJUser_SetPowerOFF来完成。
115
/// </summary>
116
/// <param name="userID">用户通道号</param>
117
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
118
public static extern void DJUser_SetPowerON(int userID);
119![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
120![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
121
/// 允许用户通道在摘机时自动送拨号音,这是系统的缺省工作方式。当userID越界时,返回 0,同时置ErrCode=_ERR_InvalidID.
122
/// 当处于使能方式时,用户通道所连接的电话机摘机后,系统自动送拨号音,如果按下电话机上的按键,会自动停止拨号音;
123
/// 电话机挂机,也自动停止拨号音。
124
/// </summary>
125
/// <param name="userID"></param>
126
/// <returns></returns>
127
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
128
public static extern bool DJUser_EnableDialSound(int userID);
129![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
130
/// 对给定的语音通道循环播放系统提示音
131
/// 函数返回:1● 操作成功;0 ● 操作失败,调用DJSys_GetErrCode函数将返回失败原因;
132
/// </summary>
133
/// <param name="voiceID">语音通道号</param>
134
/// <param name="voiceName">系统提示音名字</param>
135
/// <returns></returns>
136
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
137
public static extern bool DJVoc_LoopPlayPromptFile(int voiceID, StringBuilder voiceName);
138![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
139![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
140
/// 搜索返回一个空闲的用于放音的语音通道
141
/// </summary>
142
/// <returns></returns>
143
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
144
public static extern int DJVoc_SearchFreeVoiceChannelForPlay();
145![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
146![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
147
/// 检查是否正在对用户模块振铃。当userID越界时,返回 0,同时置ErrCode=_ERR_InvalidID
148
/// 函数返回:
149
/// 1● 正在振铃
150
/// 0● 非振铃
151
/// </summary>
152
/// <param name="userID"> 用户通道号</param>
153
/// <returns></returns>
154
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
155
public static extern bool DJUser_RingDetect(int userID);
156![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
157![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
158
/// 使用户通道开始振铃。当userID越界时,返回 0,同时置ErrCode=_ERR_InvalidID。
159
/// 调用本函数,将会对用户模块所连接的电话机振铃,该振铃是断续的振铃声,由底层驱动程序来控制振铃的时间间隔.
160
/// 函数返回
161
/// 1● 操作成功
162
/// 0● 操作失败,调用DJSys_GetErrCode()将返回失败原因
163
/// 如果要使电话机振铃,必须正确的接入外接电源和铃流源。
164
/// </summary>
165
/// <param name="userID"> 用户通道号</param>
166
/// <returns></returns>
167
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
168
public static extern bool DJUser_StartRing(int userID);
169![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
170![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
171
/// 停止用户模块的振铃。当userID越界时,返回 0,同时置ErrCode=_ERR_InvalidID。
172
/// 函数返回:
173
/// 1● 操作成功
174
/// 0● 操作失败,调用DJSys_GetErrCode()将返回失败原因
175
/// </summary>
176
/// <param name="userID">用户通道号</param>
177
/// <returns></returns>
178
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
179
public static extern bool DJUser_StopRing(int userID);
180![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
181![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
182
/// 断开放音语音通道和用户通道之间的联接
183
/// </summary>
184
/// <param name="userID"></param>
185
/// <returns></returns>
186
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
187
public static extern bool DJExg_ClearLinkPlayVoiceFromUser(int userID);
188![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
189![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
190
/// 复位用户DTMF拨号信息,拨号位数置 0,DTMF缓冲区清空。当userID越界时,返回 0,同时置ErrCode=_ERR_InvalidID。
191
/// 参考函数DJUser_GetDialCode的功能描述。
192
/// 函数返回:
193
/// 1● 操作成功
194
/// 0● 操作失败,调用DJSys_GetErrCode()将返回失败原因
195
/// </summary>
196
/// <param name="userID">用户通道号</param>
197
/// <returns></returns>
198
///
199
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
200
public static extern bool DJUser_InitDialBuf(int userID);
201![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
202![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
203![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
204
/// 得用LINK方式联接在本通道上的用户通道号。
205
/// </summary>
206
/// <param name="trunkID"></param>
207
/// <returns></returns>
208
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
209
public static extern int DJTrk_GetConnectUserID(int trunkID);
210![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
211![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
212
/// 取得给本通道放音的语音通道号,如果没有放音通道与本中继通道相连,返回-1
213
/// </summary>
214
/// <param name="trunkID"></param>
215
/// <returns></returns>
216
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
217
public static extern int DJTrk_GetTrunkPlayID(int trunkID);
218![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
219![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
220![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
221
/// 断开中继通道和放音语音通道的连通。
222
/// </summary>
223
/// <param name="trunkID"></param>
224
/// <returns></returns>
225
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
226
public static extern bool DJExg_ClearLinkPlayVoiceFromTrunk(int trunkID);
227![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
228![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
229
/// 清空系统的DTMF缓冲区,如果在缓冲区中有DTMF按键的值,将会丢失
230
/// </summary>
231
/// <param name="trunkID"></param>
232
/// <returns></returns>
233
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
234
public static extern bool DJTrk_InitDtmfBuf(int trunkID);
235![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
236![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
237
/// 检查该语音通道的语音操作是否结束,即录放音是否到达指定的大小。
238
/// </summary>
239
/// <param name="voiceChannelID"></param>
240
/// <returns></returns>
241
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
242
public static extern bool DJVoc_CheckVoiceEnd(int voiceChannelID);
243![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
244![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
245
/// 停止文件放音。多次调用本函数没有影响
246
/// </summary>
247
/// <param name="trunkID"></param>
248
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
249
public static extern void DJVoc_StopPlayFile(int trunkID);
250![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
251![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
252
/// 得到当前软件开发系统的安装目录。该目录等于INI配置文件中的InstallDir的设置。
253
/// </summary>
254
/// <returns></returns>
255
//[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
256
//public static extern byte[] DJSys_GetInstallDir();
257![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
258
/// 得到当前软件开发系统的安装目录。该目录等于INI配置文件中的InstallDir的设置。
259
/// </summary>
260
/// <returns></returns>
261
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
262
public static extern StringBuilder DJSys_GetInstallDir();
263![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
264![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
265
/// 放音
266
/// </summary>
267
/// <param name="trunkID"></param>
268
/// <param name="FileName"></param>
269
/// <returns></returns>
270
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
271
public static extern bool DJVoc_PlayFile(int trunkID, byte[] FileName);
272![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
273
/// 开始放音
274
/// </summary>
275
/// <param name="voiceChannelID"></param>
276
/// <returns></returns>
277
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
278
public static extern int DJVoc_VoiceStart(int voiceChannelID);
279![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
280
/// 初始化中继通道索引放音
281
/// </summary>
282
/// <param name="trunkID">中继通道</param>
283
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
284
public static extern void DJVoc_InitIndexPlayFile(int trunkID);
285![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
286![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
287
/// 增加索引放音文件。失败的可能原因有文件不存在,或者文件索引数组已满(最多100个)。
288
/// </summary>
289
/// <param name="trunkID">中继通道</param>
290
/// <param name="FileName">文件路径</param>
291
/// <returns></returns>
292
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
293
public static extern bool DJVoc_AddIndexPlayFile(int trunkID, byte[] FileName);
294![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
295![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
296![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
297
/// 开始一次文件索引放音。
298
/// </summary>
299
/// <param name="trunkID">中继通道</param>
300
/// <returns></returns>
301
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
302
public static extern bool DJVoc_StartIndexPlayFile(int trunkID);
303![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
304![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
305![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
306
/// 停止索引文件放音。该函数停止指定中继通道的索引文件放音,使用DJVoc_StartIndexPlayFile函数进行多文件放音结束,一定要调用该函数来停止放音
307
///
308
/// </summary>
309
/// <param name="trinkID"></param>
310
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
311
public static extern void DJVoc_StopIndexPlayFile(int trinkID);
312![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
313![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
314
/// 检查索引文件放音是否结束,并维护索引文件放音的持续。当进行索引文件放音时,必须调用该函数,以保证索引文件放音的连续性
315
/// </summary>
316
/// <param name="trunkID"></param>
317
/// <returns></returns>
318
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
319
public static extern bool DJVoc_CheckIndexPlayEnd(int trunkID);
320
}
321
}
322![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Runtime.InteropServices;
5![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
6
namespace DJVoiceCard.Lib
7![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
8
public struct TC_INI_TYPE
9![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
10
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
11
public byte[] bCallNum;
12
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
13
public byte[] bCalleeNum;
14
}
15
public struct FL_PA
16![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
17
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
18
public byte[] bFilePath;
19
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
20
public byte[] bVoiceFile;
21
}
22
public class ISUP_Lib
23![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
24![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
25
///
26
/// </summary>
27
/// <param name="mo_num">本机内的PCM逻辑编号,从0开始</param>
28
/// <param name="dt_num">PCM内的中继通道号,0-29</param>
29
/// <param name="state">本中继通道要采取的动作 </param>
30
/// <param name="Param1"></param>
31
/// <param name="Param2"></param>
32
/// <param name="Param3"></param>
33
/// <param name="Param4"></param>
34
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
35
public static extern void DJISUP_SetChnState(byte mo_num, byte dt_num, byte state);
36![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
37![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
38
/// 七号信令系统接口初始化,在应用程序初始化时调用。
39
/// 调用本函数,首先检查在本机内是否已经启动了七号信令链路的处理程序CCS7SERVER.EXE;
40
/// 如果已经运行,则初始化本程序和CCS7SERVER.EXE之间的接口,以便能够通过CCS7SERVER.EXE来收发有关七号信令的信息包。
41
/// 本函数应在DJSys_EnableCard之前调用
42
/// </summary>
43
/// <returns>1● 初始化成功;-1● 没有七号信令处理程序CCS7SERVER运行,或者在读取TC-NO7.INI时发生错误。</returns>
44
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
45
public static extern int DJISUP_InitSystem();
46![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
50
/// 本函数在程序退出时调用,用以释放调用初始化函数DJISUP_InitSystem时所分配的内存。
51
/// </summary>
52
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
53
public static extern void DJISUP_ExitSystem();
54![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
55![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
57
/// 中继通道(mo_num,dt_num)的当前状态,可能的返回值是:
58
/// #define ISUP_CH_FREE 1 // 空闲状态
59
/// #define ISUP_CH_WAIT_RELEASE 2 // DLL等待应用程序同步释放资源
60
/// #define ISUP_CH_LOCAL_BLOCK 3 // 本地闭塞状态
61
/// #define ISUP_CH_REMOTE_BLOCK 4 // 远端闭塞状态
62
/// #define ISUP_CH_LOCAL_AND_REMOTE_BLOCK 5 //本地和远端锁闭状态
63
/// #define ISUP_CH_UNAVIABLE 6 // 不可用态(网络不通等原因导致)
64
/// #define ISUP_CALLER_WAIT_ANM 7 //被叫闲,等待被叫应答
65
/// #define ISUP_CALLER_CONNECT 8 // 去话连通状态
66
/// #define ISUP_CALLEE_RECV_IAM 9 // 呼叫到达,接收全地址
67
/// #define ISUP_CALLEE_CONNECT 10 // 摘机,来话连通
68
/// #define ISUP_CH_LOCAL_SUSPEND 11 // 本地暂停
69
/// #define ISUP_CH_REMOTE_SUSPEND 12 // 远端暂停
70
/// 注意:
71
/// 应用层程序应循环调用该函数,并根据取得的状态采取相应的动作。
72
/// </summary>
73
/// <param name="mo_num">本机内的PCM逻辑编号,从0开始</param>
74
/// <param name="dt_num">PCM内的中继通道号,0-29</param>
75
/// <returns></returns>
76
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
77
public static extern int DJISUP_GetChnState(byte PCM_NO, byte Relay_NO);
78![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
79![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
80
/// 获取呼出的主叫号码
81
/// ref 参数所指的就是呼出主叫号码
82
/// </summary>
83
/// <param name="PCM_NO"></param>
84
/// <param name="Relay_NO"></param>
85
/// <param name="Call_NO"></param>
86
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
87
public static extern void DJISUP_GetCallerNum(byte PCM_NO, byte Relay_NO, ref TC_INI_TYPE Call_NO);
88![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
89![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
90
/// 呼叫到达时,用本函数来取得被叫号码。
91
/// 当函数返回后,在call_id所指向的字符串数组中,存放有已经收到的号码。
92
/// 注意,call_id所指向的字符串数组必须事先分配好空间。
93
/// </summary>
94
/// <param name="PCM_NO"></param>
95
/// <param name="Relay_NO"></param>
96
/// <param name="Callee_NO"></param>
97
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
98
public static extern void DJISUP_GetCalleeNum(byte PCM_NO, byte Relay_NO, ref TC_INI_TYPE Callee_NO);
99![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
100![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
101![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
102
/// 处理中继通道的事件,改变中继通道的状态。
103
/// 此函数要在主流程的大循环中调用,一般同函数DJSys_PushPlay放在一起。
104
/// 通过本函数,系统的状态才能发生变迁。
105
/// </summary>
106
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
107
public static extern void DJISUP_GetEvent();
108![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
109![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
110
/// 维持文件录音和文件放音连续的函数。
111
/// 要求应用程序必须在小于4秒钟内调用本函数一次(允许多次)。
112
/// 在数字中继卡的底层驱动程序中,对每个语音通道开辟了64K的缓冲区。
113
/// 当进行文件方式的录音或放音时,不断的调用函数DJSys_PushPlay可以保证缓冲区的更新。
114
/// </summary>
115
[DllImport("Tce1_32.dll", CharSet = CharSet.Auto)]
116
public static extern void DJSys_PushPlay();
117![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
118![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
119![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
120
/// 获取Dtmf号码
121
/// </summary>
122
/// <param name="trunkID"></param>
123
/// <returns></returns>
124
[DllImport("Tce1_32.dll", CharSet = CharSet.Ansi)]
125
public static extern StringBuilder DJTrk_GetDtmfCode(int trunkID);
126![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
127![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
128![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
129
/// 对某一个中继通道启动一次呼出
130
/// </summary>
131
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
132
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
133
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
134
/// <param name="szCallerNumber">呼出时的主叫号码</param>
135
/// <returns></returns>
136
///
137
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
138
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
139
public static extern bool DJISUP_Callout(int nPCM, int nCHN, char[] szCalleeNumber, out char[] szCallerNumber, out bool bCalleeSignalTerminal, out bool bCallerSignalTerminal);
140![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
141
/// 对某一个中继通道启动一次呼出
142
/// </summary>
143
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
144
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
145
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
146
/// <param name="szCallerNumber">呼出时的主叫号码</param>
147
/// <returns></returns>
148
///
149
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
150
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
151
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN,StringBuilder szCalleeNumber,StringBuilder szCallerNumber);
152![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
153
/// 对某一个中继通道启动一次呼出
154
/// </summary>
155
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
156
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
157
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
158
/// <param name="szCallerNumber">呼出时的主叫号码</param>
159
/// <returns></returns>
160
///
161
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
162
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
163
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN, ref ulong szCalleeNumber, ref ulong szCallerNumber);
164![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
165
/// 对某一个中继通道启动一次呼出
166
/// </summary>
167
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
168
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
169
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
170
/// <param name="szCallerNumber">呼出时的主叫号码</param>
171
/// <returns></returns>
172
///
173
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
174
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
175
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN, ref StringBuilder szCalleeNumber, ref StringBuilder szCallerNumber);
176![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
177
/// 对某一个中继通道启动一次呼出
178
/// </summary>
179
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
180
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
181
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
182
/// <param name="szCallerNumber">呼出时的主叫号码</param>
183
/// <returns></returns>
184
///
185
//[MarshalAs(UnmanagedType.ByValArray,SizeConst=32)]
186
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
187
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN, ref char[] szCalleeNumber, ref char[] szCallerNumber);
188![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
189
/// 对某一个中继通道启动一次呼出
190
/// </summary>
191
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
192
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
193
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
194
/// <param name="szCallerNumber">呼出时的主叫号码</param>
195
/// <returns></returns>
196
///
197
//[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)]
198
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
199
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN, ref string szCalleeNumber, ref string szCallerNumber);
200![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
201![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
202![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
203
/// 对某一个中继通道启动一次呼出
204
/// </summary>
205
/// <param name="nPCM">本机内的PCM逻辑编号,从0开始</param>
206
/// <param name="nCHN">PCM内的中继通道号,0-29</param>
207
/// <param name="szCalleeNumber">呼出时的被叫号码</param>
208
/// <param name="szCallerNumber">呼出时的主叫号码</param>
209
/// <returns></returns>
210
///
211
//[MarshalAs(UnmanagedType.ByValArray,SizeConst=32)]
212
[DllImport("TCISUP.dll", CharSet = CharSet.Ansi)]
213
public unsafe static extern bool DJISUP_Callout(int nPCM, int nCHN, byte[] szCalleeNumber, byte[] szCallerNumber);
214![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
215![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
216![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
217
/// 调用DJISUP_Callout对某通道启动一次呼出之后,
218
/// 通过调用该函数获取呼出状态,
219
/// 其返回值以如下位掩码的形式存放,
220
/// 故将返回值与下列值做与(&)运算,即可知当前呼出状态。
221
/// </summary>
222
/// <param name="nPCM"></param>
223
/// <param name="nCHN"></param>
224
/// <returns></returns>
225
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
226
public static extern int DJISUP_GetCalloutState(int nPCM, int nCHN);
227![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
228![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
229
/// 该函数用来在单信令点时选择一个用来呼出的中继通道,
230
/// 此函数较DJISUP_GetCalloutChn增加了处理同抢的功能,
231
/// 且可选的呼出通道范围为本机内的所有通道。一般情况,
232
/// 应用程序也可以自己来查找一个空闲的中继通道。
233
/// </summary>
234
/// <param name="mo_num"></param>
235
/// <param name="dt_num"></param>
236
/// <returns></returns>
237
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
238
public static extern bool DJISUP_GetCalloutChnNew( ref byte mo_num, ref byte dt_num );
239![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
240![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
241
/// 本函数用于获取CPG消息的事件信息,协议规定的事件信息
242
/// </summary>
243
/// <param name="nPCM"></param>
244
/// <param name="nCHN"></param>
245
/// <returns></returns>
246
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
247
public static extern int DJISUP_GetEventInfo(int nPCM, int nCHN);
248![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
249![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
250
/// 对收到的ISUP消息,获取其中的原因值
251
/// </summary>
252
/// <param name="nPCM"></param>
253
/// <param name="nCHN"></param>
254
/// <returns></returns>
255
[DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
256
public static extern int DJISUP_GetRecvCauseValue(int nPCM, int nCHN);
257![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
258
}
259
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using DJVoiceCard.Lib;
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
namespace DJVoiceCard.DL
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
class DataInc
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
public enum RelaySet : int
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
ISUP_CH_SET_FREE=1,
//锁闭通道
ISUP_CH_SET_BLOCK=2,
//解除锁闭
ISUP_CH_SET_UNBLOCK=3,
//来话方动作,来话到达后,送被叫闲信号,话路接通,但不送应答信号
ISUP_CALLEE_SET_ACM=4,
//被叫摘机信号
ISUP_CALLEE_SET_ANM=5,
//来话方动作,来话到达后,送被叫闲信号,话路接通,送应答信号
ISUP_CALLEE_SET_CON =6,
//送线路释放信号
ISUP_CH_SET_REL =7,
//群锁闭
ISUP_CH_SET_CGB =8,
//群解除锁闭
ISUP_CH_SET_CGU =9,
//后续地址
ISUP_CALLER_SET_SAM=10,
//暂停
ISUP_CH_SET_SUS=11,
//恢复
ISUP_CH_SET_RES=12,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
//锁闭通道证实
ISUP_CH_SET_BLA=0x81,
//解除锁闭证实
ISUP_CH_SET_UBA=0x82,
//电路复原
ISUP_CH_SET_RSC=0x83,
//信息请求
ISUP_CH_SET_INR=0x84,
//信息
ISUP_CH_SET_INF=0x85,
//群锁闭证实
ISUP_CH_SET_CGBA=0x92,
//群解除锁闭证实
ISUP_CH_SET_CGUA=0x94,
//群复原
ISUP_CH_SET_GRS=0x95,
//群复原证实
ISUP_CH_SET_GRA=0x96,
//群问讯
ISUP_CH_SET_CQM=0x97,
//群问讯响应
ISUP_CH_SET_CQR=0x98,
//释放完成
ISUP_CH_SET_RLC=0x99,
//混淆
ISUP_CH_SET_CFN=0x9a,
//呼叫进展
ISUP_CALLEE_SET_CPG=0xa2,
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 信道状态
/// </summary>
public enum RelayStates : int
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 空闲状态
/// </summary>
ISUP_CH_FREE=1,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // DLL等待应用程序同步释放资源
/// </summary>
ISUP_CH_WAIT_RELEASE=2 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 本地闭塞状态
/// </summary>
ISUP_CH_LOCAL_BLOCK=3 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 远端闭塞状态
/// </summary>
ISUP_CH_REMOTE_BLOCK=4 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //本地和远端锁闭状态
/// </summary>
ISUP_CH_LOCAL_AND_REMOTE_BLOCK=5 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 不可用态(网络不通等原因导致)
/// </summary>
ISUP_CH_UNAVIABLE=6 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //被叫闲,等待被叫应答
/// </summary>
ISUP_CALLER_WAIT_ANM=7 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 去话连通状态
/// </summary>
ISUP_CALLER_CONNECT=8 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 呼叫到达,接收全地址
/// </summary>
ISUP_CALLEE_RECV_IAM=9 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 摘机,来话连通
/// </summary>
ISUP_CALLEE_CONNECT=10 ,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 本地暂停
/// </summary>
ISUP_CH_LOCAL_SUSPEND=11,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// // 远端暂停
/// </summary>
ISUP_CH_REMOTE_SUSPEND=12,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// IAM消息到达
/// </summary>
CALLEE_IAM_REACHED=0xf0,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// SAM消息到达提示
/// </summary>
CALLEE_SAM_REACHED=0xf1,
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 语音资源类型
/// </summary>
public enum VoiceResourcesType:int
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 没有语音资源
/// </summary>
Res_NoRes = 0,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 文件型语音资源
/// </summary>
Res_File = 1,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 系统内存型语音资源
/// </summary>
Res_Xms = 2,
};
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 语音资源操作类型
/// </summary>
public enum VoiceOperatorType
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //没有语音操作
/// </summary>
OP_NoOperator = 0,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //普通放音
/// </summary>
OP_Play = 1,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //循环放音
/// </summary>
OP_LoopPlay = 2,
};
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 用户状态类型
/// </summary>
public enum USER_STATE
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 未摘机
/// </summary>
USR_OFFHOOK=0,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 等待拨号
/// </summary>
USR_WAITDIAL=1,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 拨号
/// </summary>
USR_DIAL=2,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 结束
/// </summary>
USR_ENDSESSION=3,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 等待语音
/// </summary>
USR_WAITONHOOK=4,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 振铃
/// </summary>
USR_RING=5,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 通话
/// </summary>
USR_CONNECT=6,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 摘机中
/// </summary>
USR_ONHOOK = 50,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 取消振铃
/// </summary>
USR_EXRING=51,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 退出通话
/// </summary>
USR_EXCONNECT=52
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
};
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 中继信道状态
/// </summary>
public enum TRUNK_ST
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 空闲状态
/// </summary>
TRK_FREE=0, //free state
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 准备状态
/// </summary>
TRK_READY=1, //mfc stop state
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 振铃状态
/// </summary>
TRK_RING=2, //ring user
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 拨号状态
/// </summary>
TRK_CALLOUT=3, //user dial over, callout
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 等待摘机
/// </summary>
TRK_WAITUSEROFFHOOK=4, //ring user, wait offhok
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 摘机状态
/// </summary>
TRK_WAITUSERONHOOK=5,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 结束谈话
/// </summary>
TRK_ENDSESSION=6, //end a talk
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 链接状态
/// </summary>
TRK_CONNECT=7,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 为初始化状态
/// </summary>
TRK_NULLSTATE=8,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 播放状态
/// </summary>
TRK_PLAY=9,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 呼入状态
/// </summary>
TRK_CALLIN=10,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 摘机状态
/// </summary>
TRK_ONHOOK=11,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 挂机状态
/// </summary>
TRK_HANGUP=12,
};
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 用户状态
/// </summary>
public struct UR_ST
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
public int ConnUrID;
public USER_STATE ST;
public int ConnTrID;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 对收到的ISUP消息,获取其中的原因值
/// </summary>
public enum CAUSE_VALUE:int
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 中继通道的范围越界
/// </summary>
RSN_PCMNULL_CALLER=-1,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 收到的消息中不含有原因指示码,或没有新的ISUP消息到达
/// </summary>
RSN_UNKOWNNUM_ISUP=0,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //空号
/// </summary>
RSN_UNALLOCATED_NUMBER = 0x01,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //正常的呼叫清除
/// </summary>
RSN_NORMAL_CALL_CLEARING = 0x10,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //用户忙
/// </summary>
RSN_USER_BUSY = 0x11,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //无用户响应
/// </summary>
RSN_NO_USER_RESPONDING = 0x12,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //被叫无应答,超时未摘机
/// </summary>
RSN_USER_ALERTING_NO_ANSWER = 0x13,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //呼叫拒绝
/// </summary>
RSN_CALL_REJECTED = 0x15,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //不完整的号码
/// </summary>
RSN_INCOMPLETE_NUMBER = 0x1c,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //正常,未规定
/// </summary>
RSN_NORMAL_NO_SET = 0x1f,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //无可用的电路
/// </summary>
RSN_NO_CIRCUIT_CHANNELAVAILABLE = 0x22,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //请求的电路不可用
/// </summary>
RSN_REQUESTEDCIRCUIT_CHANNEL_NOTAVAILABLE = 0x2c,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //定时器超时恢复
/// </summary>
RSN_RECOVERY_ON_TIME_EXPIRY = 0x66,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //本地释放电路
/// </summary>
RSN_LOCAL_RLC = 0x20,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// //电路复原
/// </summary>
RSN_RECEIVE_RSC = 0x21,
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
};
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
/// 信道状态
/// </summary>
public struct TRK_ST
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
public TRUNK_ST ST;
public int ConnUrID;
public int ConnTrID;
public string DialNum;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
public struct PR
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
[MarshalAs(UnmanagedType.ByValArray,SizeConst=32)]
public char[] TelarrChar;
public char[] CallarrChar;
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
public struct TelNum
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] arrTelNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] arrCallNum;
}
}
![](https://cnherman.cnblogs.com/Images/OutliningIndicators/None.gif)
这几个类是所有代码的核心内容.先贴出来,下一篇会详细说说在交互编程中遇到的问题.