1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Runtime.InteropServices;
5
6namespace DJVoiceCard.Lib
7{
8 public struct TC_INI_TYPE
9 {
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 {
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 {
24 /**//// <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
37 /**//// <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
47
48
49 /**//// <summary>
50 /// 本函数在程序退出时调用,用以释放调用初始化函数DJISUP_InitSystem时所分配的内存。
51 /// </summary>
52 [DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
53 public static extern void DJISUP_ExitSystem();
54
55
56 /**//// <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
79 /**//// <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
89 /**//// <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
100
101 /**//// <summary>
102 /// 处理中继通道的事件,改变中继通道的状态。
103 /// 此函数要在主流程的大循环中调用,一般同函数DJSys_PushPlay放在一起。
104 /// 通过本函数,系统的状态才能发生变迁。
105 /// </summary>
106 [DllImport("TCISUP.dll", CharSet = CharSet.Auto)]
107 public static extern void DJISUP_GetEvent();
108
109 /**//// <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
118
119 /**//// <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
127
128 /**//// <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 /**//// <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 /**//// <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 /**//// <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 /**//// <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 /**//// <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
201
202 /**//// <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
215
216 /**//// <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
228 /**//// <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
240 /**//// <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
249 /**//// <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
258 }
259}
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using DJVoiceCard.Lib;
namespace DJVoiceCard.DL
{
class DataInc
{
}
public enum RelaySet : int
{
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,
//锁闭通道证实
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,
}
/**//// <summary>
/// 信道状态
/// </summary>
public enum RelayStates : int
{
/**//// <summary>
/// // 空闲状态
/// </summary>
ISUP_CH_FREE=1,
/**//// <summary>
/// // DLL等待应用程序同步释放资源
/// </summary>
ISUP_CH_WAIT_RELEASE=2 ,
/**//// <summary>
/// // 本地闭塞状态
/// </summary>
ISUP_CH_LOCAL_BLOCK=3 ,
/**//// <summary>
/// // 远端闭塞状态
/// </summary>
ISUP_CH_REMOTE_BLOCK=4 ,
/**//// <summary>
/// //本地和远端锁闭状态
/// </summary>
ISUP_CH_LOCAL_AND_REMOTE_BLOCK=5 ,
/**//// <summary>
/// // 不可用态(网络不通等原因导致)
/// </summary>
ISUP_CH_UNAVIABLE=6 ,
/**//// <summary>
/// //被叫闲,等待被叫应答
/// </summary>
ISUP_CALLER_WAIT_ANM=7 ,
/**//// <summary>
/// // 去话连通状态
/// </summary>
ISUP_CALLER_CONNECT=8 ,
/**//// <summary>
/// // 呼叫到达,接收全地址
/// </summary>
ISUP_CALLEE_RECV_IAM=9 ,
/**//// <summary>
/// // 摘机,来话连通
/// </summary>
ISUP_CALLEE_CONNECT=10 ,
/**//// <summary>
/// // 本地暂停
/// </summary>
ISUP_CH_LOCAL_SUSPEND=11,
/**//// <summary>
/// // 远端暂停
/// </summary>
ISUP_CH_REMOTE_SUSPEND=12,
/**//// <summary>
/// IAM消息到达
/// </summary>
CALLEE_IAM_REACHED=0xf0,
/**//// <summary>
/// SAM消息到达提示
/// </summary>
CALLEE_SAM_REACHED=0xf1,
}
/**//// <summary>
/// 语音资源类型
/// </summary>
public enum VoiceResourcesType:int
{
/**//// <summary>
/// 没有语音资源
/// </summary>
Res_NoRes = 0,
/**//// <summary>
/// 文件型语音资源
/// </summary>
Res_File = 1,
/**//// <summary>
/// 系统内存型语音资源
/// </summary>
Res_Xms = 2,
};