| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> Delphi之三汇模拟语音卡(SHT-8B/PCI/FAX)可复用源码
 

Delphi之三汇模拟语音卡(SHT-8B/PCI/FAX)可复用源码

2007-09-15 05:02:24 编辑來源:互联网 繁體版 评论
 
 
  Delphi之三汇模拟语音卡(SHT-8B/PCI/FAX)可复用源码

  作者:成晓旭

  设计简介:

  1、 设计思路请参考本站Blog的另一篇文章:“Delphi之东进模拟语音卡(D160A)可复用源码”;链接http://blog.csdn.net/CXXSoft/archive/2006/08/23/1108211.aspx

  2、 其实,仔细对比,你会发现这两种卡的代码类方法签名几乎99%是一样的,也就是说,这两都之间,还需要更进一步的抽象,以解决“重复代码”或者“相似代码”的问题。

  3、 更高层次的抽象,请参考我的设计文档。

  4、 类图(以后补上):

  5、 卡类源码:

  
王朝网络
//------------------------------------------------------------------------------

  
王朝网络
//

  
王朝网络
// 产品名称: 成晓旭的个人软件Delphi源码库

  
王朝网络
// 产品版本: CXXSoft delphi code source lib 2.0

  
王朝网络
// 模块名称: Delphi之三汇模拟语音卡类

  
王朝网络
// 模块描述:

  
王朝网络
// 单元文件: unSHCard8B.pas

  
王朝网络
// 开发作者: 成晓旭

  
王朝网络
// 备注: 任何人使用此文件时,请保留此段自述文件,谢谢!

  
王朝网络
// 开发时间: 2003-12-03

  
王朝网络
// 修改历史:

  
王朝网络
// 修改描述:

  
王朝网络
//------------------------------------------------------------------------------

  
王朝网络
unit unSHCard8B;

  
王朝网络


  
王朝网络
interface

  
王朝网络
uses

  
王朝网络
Windows,

  
王朝网络
//unDJTC08a32,unDJNewSig,

  
王朝网络
unBaseDefine,

  
王朝网络
//unDJ160ADefine,unDJChanne160A,

  
王朝网络
unShpa3api,unSHChanne18B,unSH8BDefine;

  
王朝网络
type

  
王朝网络
TCXXCommCard8B = class(TObject)

  
王朝网络
private

  
王朝网络


  
王朝网络
ChannelNumber:Word;

  
王朝网络
channelObject:array of TCXXSHChannel8B;

  
王朝网络
OnCardChannelState:TTrunkStatusEvent;

  
王朝网络


  
王朝网络
procedure ReleaseCommDevice();

  
王朝网络
function GetChannelObjectOrder(const aChannelID:Word):Word;

  
王朝网络
function InitChannel():boolean;

  
王朝网络
public

  
王朝网络


  
王朝网络
constructor Create(const trunkEvent:TTrunkStatusEvent);

  
王朝网络
destructor Destroy(); override;

  
王朝网络


  
王朝网络
function LoadCommDevice(const loadAll:boolean=false):boolean;

  
王朝网络
function Startup():boolean;

  
王朝网络
function GetAFreeChannel():Word;

  
王朝网络
function GetChannelNumber():Word;

  
王朝网络
function DialPhone(const aChannelID:Word;const DialPhoneNumber:PChar):boolean;

  
王朝网络
function HangUp(const aChannelID:Word):boolean;

  
王朝网络


  
王朝网络
end;

  
王朝网络


  
王朝网络


  
王朝网络
implementation

  
王朝网络


  
王朝网络
const

  
王朝网络
SH_ConfigFile = 'C:ShCtiShConfig.ini';

  
王朝网络
SH_IndexFile = 'C:ShCtiShIndex.ini';

  
王朝网络


  
王朝网络
王朝网络
...{ TCXXCommCard8B }

  
王朝网络
constructor TCXXCommCard8B.Create(const trunkEvent:TTrunkStatusEvent);

  
王朝网络
begin

  
王朝网络
ChannelNumber := 0;

  
王朝网络
Self.OnCardChannelState := trunkEvent;

  
王朝网络
end;

  
王朝网络


  
王朝网络
destructor TCXXCommCard8B.Destroy;

  
王朝网络
var

  
王朝网络
Loop:Word;

  
王朝网络
begin

  
王朝网络
if (Length(channelObject) > 0) and (channelNumber > 0) then

  
王朝网络
begin

  
王朝网络
for Loop := 0 to ChannelNumber - 1 do

  
王朝网络
begin

  
王朝网络
if Assigned(channelObject[Loop]) then

  
王朝网络
begin

  
王朝网络
channelObject[Loop].Free();

  
王朝网络
channelObject[Loop] := nil;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
ReleaseCommDevice();

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.DialPhone(const aChannelID: Word;

  
王朝网络
const DialPhoneNumber: PChar): boolean;

  
王朝网络
var

  
王朝网络
K:Word;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
K := GetChannelObjectOrder(aChannelID);

  
王朝网络
if (K <> ErrorTrunkNumber) and (Assigned(channelObject[K])) then

  
王朝网络
begin

  
王朝网络
Result := channelObject[K].DialPhone(DialPhoneNumber);

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXCommCard8B.ReleaseCommDevice();

  
王朝网络
begin

  
王朝网络
SsmCloseCti() ;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.GetAFreeChannel(): Word;

  
王朝网络
var

  
王朝网络
Loop:Word;

  
王朝网络
begin

  
王朝网络
Result := ErrorTrunkNumber;

  
王朝网络
for Loop := Low(channelObject) to High(channelObject) do

  
王朝网络
begin

  
王朝网络
if NOT channelObject[Loop].CheckDialOutEnabled() then continue;

  
王朝网络
if (channelObject[Loop].GetChannelStatus() = atsFree) then

  
王朝网络
begin

  
王朝网络
Result := channelObject[Loop].GetChannelID();

  
王朝网络


  break;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.GetChannelNumber(): Word;

  
王朝网络
begin

  
王朝网络
Result := channelNumber;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.GetChannelObjectOrder(

  
王朝网络
const aChannelID: Word): Word;

  
王朝网络
var

  
王朝网络
Loop:Word;

  
王朝网络
begin

  
王朝网络
Result := ErrorTrunkNumber;

  
王朝网络
for Loop := Low(channelObject) to High(channelObject) do

  
王朝网络
begin

  
王朝网络
if (channelObject[Loop].GetChannelID = aChannelID) then

  
王朝网络
begin

  
王朝网络
Result := Loop;

  
王朝网络


  break;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.HangUp(const aChannelID: Word): boolean;

  
王朝网络
var

  
王朝网络
K:Word;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
K := GetChannelObjectOrder(aChannelID);

  
王朝网络
if (K <> ErrorTrunkNumber) and (Assigned(channelObject[K])) then

  
王朝网络
begin

  
王朝网络
channelObject[K].ChannelHangUp();

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.LoadCommDevice(const loadAll:boolean): boolean;

  
王朝网络
const

  
王朝网络
loadEmpty = true;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
if SsmStartCti(SH_ConfigFile,SH_IndexFile) <> 0 then

  
王朝网络
begin

  
王朝网络
TCXXSHChannel8B.InformInvodeError();

  
王朝网络
Exit;

  
王朝网络
end;

  
王朝网络
if(SsmGetMaxUsableBoard() <> SsmGetMaxCfgBoard()) then

  
王朝网络
begin //部分板卡初始化失败,取出失败原因

  
王朝网络
TCXXSHChannel8B.InformInvodeError();

  
王朝网络
Exit;

  
王朝网络
end;

  
王朝网络
Result := InitChannel();

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.Startup(): boolean;

  
王朝网络
var

  
王朝网络
Loop:integer;

  
王朝网络
begin

  
王朝网络
for Loop := 0 to channelNumber - 1 do

  
王朝网络
begin

  
王朝网络
channelObject[Loop].Startup();

  
王朝网络
end;

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXCommCard8B.InitChannel():boolean;

  
王朝网络
var

  
王朝网络
number,Loop:integer;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
number := SsmGetMaxCh();

  
王朝网络
if (number < 0) then Exit;

  
王朝网络
ChannelNumber := number;

  
王朝网络
SetLength(channelObject,channelNumber);

  
王朝网络
for Loop := 0 to channelNumber - 1 do

  
王朝网络
begin

  
王朝网络
channelObject[Loop] := TCXXSHChannel8B.Create(OnCardChannelState);

  
王朝网络
channelObject[Loop].CreateCommChannel(Loop);

  
王朝网络
end;

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络


  
王朝网络
end.

  
王朝网络


  6、 通道类源码:

  
王朝网络
//------------------------------------------------------------------------------

  
王朝网络
//

  
王朝网络
// 产品名称: 成晓旭的个人软件Delphi源码库

  
王朝网络
// 产品版本: CXXSoft delphi code source lib 2.0

  
王朝网络
// 模块名称: Delphi之三汇模拟语音卡通道类

  
王朝网络
// 模块描述:

  
王朝网络
// 单元文件: unSHChanne18B.pas

  
王朝网络
// 开发作者: 成晓旭

  
王朝网络
// 备注: 任何人使用此文件时,请保留此段自述文件,谢谢!

  
王朝网络
// 开发时间: 2003-12-01

  
王朝网络
// 修改历史:

  
王朝网络
// 修改描述:

  
王朝网络
//------------------------------------------------------------------------------

  
王朝网络
unit unSHChanne18B;

  
王朝网络


  
王朝网络
王朝网络
...{$DEFINE ThreadChannel}

  
王朝网络


  
王朝网络
interface

  
王朝网络


  
王朝网络
uses

  
王朝网络
Windows,Classes,SysUtils,

  
王朝网络


  
王朝网络
unBaseDefine,unShpa3api,unSH8BDefine,

  
王朝网络
//unDJ160ADefine,

  
王朝网络
unDJTC08a32,unDJNewSig;

  
王朝网络


  
王朝网络
Type

  
王朝网络


  
王朝网络


  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
TCXXSHChannel8B = class(TThread)

  
王朝网络
王朝网络
...{$ELSE}

  
王朝网络
TCXXSHChannel8B = class(TObject)

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
private

  
王朝网络
channelType:TChannelType;

  
王朝网络
oldChannelState,channelState:TTrunkState;

  
王朝网络
channelID:Word;

  
王朝网络
phoneNumber:string;

  
王朝网络
dtmfString:string;

  
王朝网络
aCallerId:PAnsiChar;

  
王朝网络


  
王朝网络
isConntectd:boolean;

  
王朝网络


  
王朝网络
isDialOut:boolean;

  
王朝网络
aTrunkState:TTrunkStatus;

  
王朝网络


  
王朝网络
procedure ChannelProcessor();

  
王朝网络
procedure InformTrunkStatus(const aMsgFlag: TLVOperateFlag);

  
王朝网络


  
王朝网络
procedure ClearTrunkStatus();

  
王朝网络
procedure ClearChannelBuffer();

  
王朝网络
function CheckSigHangup():boolean;

  
王朝网络
function CheckCallIn():boolean;

  
王朝网络
function SwitchOnCallIn():boolean;

  
王朝网络


  
王朝网络
procedure ProcessCallInSuccess();

  
王朝网络
procedure ProcessDialSuccess();

  
王朝网络


  
王朝网络
procedure ProcessCheckDialSend();

  
王朝网络
procedure ProcessDialOut();

  
王朝网络


  
王朝网络
procedure Stop();

  
王朝网络


  
王朝网络
//三汇卡专用方法

  
王朝网络
function GetTrunkStateBySsm(const ssmState: integer): TTrunkState;

  
王朝网络
protected

  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
procedure Execute(); override;

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
public

  
王朝网络
strMessage:string;

  
王朝网络
OnChannelState:TTrunkStatusEvent;

  
王朝网络


  
王朝网络
constructor Create(const trunkEvent:TTrunkStatusEvent);

  
王朝网络
destructor Destroy();override;

  
王朝网络


  
王朝网络
procedure CreateCommChannel(const aChennelID: Word);

  
王朝网络
procedure Startup();

  
王朝网络


  
王朝网络
function GetChannelID():Word;

  
王朝网络
function GetChannelStatus():TTrunkState;

  
王朝网络
function GetChannelType():TChannelType;

  
王朝网络
function DialPhone(const DialPhoneNumber:PChar):boolean;overload;

  
王朝网络
function DialPhone(const DialPhoneNumber:PChar;const PreDialNumber:PChar):boolean;overload;

  
王朝网络
procedure ChannelHangUp();

  
王朝网络


  
王朝网络
function GetDialOut():boolean;

  
王朝网络


  
王朝网络
//三汇卡特性方法

  
王朝网络
function CheckDialOutEnabled():boolean;

  
王朝网络
class procedure InformInvodeError();

  
王朝网络
end;

  
王朝网络
implementation

  
王朝网络


  
王朝网络
王朝网络
...{ TCXXSHChannel8B }

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ChannelHangUp();

  
王朝网络
begin

  
王朝网络
isDialOut := false;

  
王朝网络
SsmHangUp(channelID);

  
王朝网络
ClearChannelBuffer();

  
王朝网络
ClearTrunkStatus();

  
王朝网络
InformTrunkStatus(lvofUpdate);

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ChannelProcessor();

  
王朝网络
var

  
王朝网络
ssmState:integer;

  
王朝网络
begin

  
王朝网络
// ssmState := SsmGetChState(channelID);

  
王朝网络
// channelState := GetTrunkStateBySsm(ssmState);

  
王朝网络
CheckCallIn();

  
王朝网络
case channelState of

  
王朝网络
atsFree:

  
王朝网络
begin

  
王朝网络
//

  
王朝网络
end;

  
王朝网络
atsCallIning:

  
王朝网络
begin

  
王朝网络
SwitchOnCallIn();

  
王朝网络
end;

  
王朝网络
atsCallInSuccess:

  
王朝网络
begin

  
王朝网络
if CheckSigHangup() then Exit;

  
王朝网络
ProcessCallInSuccess();

  
王朝网络
end;

  
王朝网络
atsCheckSendDial:

  
王朝网络
begin

  
王朝网络
ProcessCheckDialSend();

  
王朝网络
end;

  
王朝网络
atsDialing:

  
王朝网络
begin

  
王朝网络
ProcessDialOut();

  
王朝网络
end;

  
王朝网络
atsDialSuccess:

  
王朝网络
begin

  
王朝网络
if CheckSigHangup() then Exit;

  
王朝网络
ProcessDialSuccess();

  
王朝网络
strMessage := '拨号成功';

  
王朝网络
end;

  
王朝网络
atsHangOff:

  
王朝网络
begin

  
王朝网络
ChannelHangUp();

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
if (oldChannelState <> channelState) then

  
王朝网络
begin

  
王朝网络
oldChannelState := channelState;

  
王朝网络
InformTrunkStatus(lvofUpdate);

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.CheckCallIn(): boolean;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
if(SsmGetChState(channelID)=2) then //检测到振铃信号

  
王朝网络
begin

  
王朝网络
SsmGetCallerId(channelID, aCallerId); //取出CALLERID信息

  
王朝网络
channelState := atsCallIning;

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络
王朝网络
...{

  
王朝网络
Result := RingDetect(channelID);

  
王朝网络
if Result then

  
王朝网络
begin

  
王朝网络
OffHook(channelID);

  
王朝网络
if isDialOut then

  
王朝网络
channelState := atsDialSuccess

  
王朝网络
else

  
王朝网络
channelState := atsCallIning;

  
王朝网络
end;

  
王朝网络
}

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.CheckSigHangup(): boolean;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
if (SsmGetChState(channelID) = S_CALL_PENDING) then

  
王朝网络
begin

  
王朝网络
strMessage := '对方已挂机';

  
王朝网络
InformTrunkStatus(lvofUpdate);

  
王朝网络
SsmStopPlay(channelID);

  
王朝网络
channelState := atsHangOff;

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ClearTrunkStatus();

  
王朝网络
begin

  
王朝网络
channelState := atsFree;

  
王朝网络
oldChannelState := channelState;

  
王朝网络
phoneNumber := '';

  
王朝网络
dtmfString := '';

  
王朝网络
strMessage := '';

  
王朝网络
isConntectd := false;

  
王朝网络
end;

  
王朝网络


  
王朝网络
constructor TCXXSHChannel8B.Create(const trunkEvent:TTrunkStatusEvent);

  
王朝网络
begin

  
王朝网络
GetMem(aCallerId,50);

  
王朝网络
Self.OnChannelState := trunkEvent;

  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
Self.FreeOnTerminate := true;

  
王朝网络
inherited Create(true);

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
end;

  
王朝网络


  
王朝网络


  
王朝网络
destructor TCXXSHChannel8B.Destroy;

  
王朝网络
begin

  
王朝网络
ChannelHangUp();

  
王朝网络
Stop();

  
王朝网络
王朝网络
...{$IFNDEF ThreadChannel}

  
王朝网络
inherited Destroy();

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
InformTrunkStatus(lvofDelete);

  
王朝网络
FreeMem(aCallerId);

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.DialPhone(const DialPhoneNumber:PChar;

  
王朝网络
const PreDialNumber:PChar): boolean;

  
王朝网络
begin

  
王朝网络
Result := false;

  
王朝网络
if (channelState <> atsFree) then Exit;

  
王朝网络
phoneNumber := DialPhoneNumber;

  
王朝网络
Result := (SsmPickup(channelID) = 0);

  
王朝网络
if NOT Result then Exit;

  
王朝网络
Result := (SsmAutoDial(channelID,DialPhoneNumber)=0);

  
王朝网络
if Result then

  
王朝网络
begin

  
王朝网络
isDialOut := true;

  
王朝网络
channelState := atsCheckSendDial;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.DialPhone(

  
王朝网络
const DialPhoneNumber: PChar): boolean;

  
王朝网络
begin

  
王朝网络
Result := DialPhone(DialPhoneNumber,'');

  
王朝网络
end;

  
王朝网络


  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
procedure TCXXSHChannel8B.Execute;

  
王朝网络
begin

  
王朝网络
while NOT Terminated do

  
王朝网络
begin

  
王朝网络
Synchronize(ChannelProcessor);

  
王朝网络
Sleep(10);

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.GetChannelID(): Word;

  
王朝网络
begin

  
王朝网络
Result := channelID;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.GetChannelStatus(): TTrunkState;

  
王朝网络
begin

  
王朝网络
Result := channelState;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.InformTrunkStatus(const aMsgFlag: TLVOperateFlag);

  
王朝网络
begin

  
王朝网络
if NOT Assigned(OnChannelState) then Exit;

  
王朝网络
aTrunkState.lvFlag := aMsgFlag;

  
王朝网络
aTrunkState.TrunkID := IntToStr(channelID);

  
王朝网络
aTrunkState.TrunkType := Ord(channelType);

  
王朝网络
aTrunkState.TrunkTypeStr := ChannelTypeString[channelType];

  
王朝网络
aTrunkState.TrunkStep := Ord(channelState);

  
王朝网络
aTrunkState.TrunkStepStr := TrunkStateString[channelState];

  
王朝网络
aTrunkState.TrunkPhone := phoneNumber;

  
王朝网络
aTrunkState.TrunkData := dtmfString;

  
王朝网络
OnChannelState(aTrunkState);

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ProcessCallInSuccess();

  
王朝网络
begin

  
王朝网络


  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.SwitchOnCallIn(): boolean;

  
王朝网络
begin

  
王朝网络
SsmPickup(channelID); //摘机

  
王朝网络
ClearChannelBuffer();

  
王朝网络
channelState := atsCallInSuccess;

  
王朝网络
Result := true;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ProcessDialSuccess();

  
王朝网络
begin

  
王朝网络


  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.CreateCommChannel(const aChennelID: Word);

  
王朝网络
var

  
王朝网络
ct:integer;

  
王朝网络
begin

  
王朝网络
channelID := aChennelID;

  
王朝网络
ct := SsmGetChType(channelID);

  
王朝网络
if (ct < 0) then Exit;

  
王朝网络
channelType := TChannelType(ct);

  
王朝网络
ClearTrunkStatus();

  
王朝网络
InformTrunkStatus(lvofAdd);

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.GetChannelType(): TChannelType;

  
王朝网络
begin

  
王朝网络
Result := channelType;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.GetDialOut(): boolean;

  
王朝网络
begin

  
王朝网络
Result := isDialOut;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ProcessCheckDialSend();

  
王朝网络
begin

  
王朝网络
//三汇卡直接转换状态

  
王朝网络
channelState := atsDialing;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.Startup();

  
王朝网络
begin

  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
Resume();

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.Stop();

  
王朝网络
begin

  
王朝网络
王朝网络
...{$IFDEF ThreadChannel}

  
王朝网络
Suspend();

  
王朝网络
Terminate();

  
王朝网络
王朝网络
...{$ENDIF}

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.CheckDialOutEnabled(): boolean;

  
王朝网络
begin

  
王朝网络
//内线通道、坐席通道、磁石通道和录音通道不支持本SsmPicuup操作

  
王朝网络
Result := NOT((channelType = ct1) or

  
王朝网络
(channelType = ct2) or

  
王朝网络
(channelType = ct3) or

  
王朝网络
(channelType = ct10));

  
王朝网络
end;

  
王朝网络


  
王朝网络
class procedure TCXXSHChannel8B.InformInvodeError;

  
王朝网络
var

  
王朝网络
msgBuffer:PAnsiChar;

  
王朝网络
begin

  
王朝网络
GetMem(msgBuffer,255);

  
王朝网络
try

  
王朝网络
SsmGetLastErrMsg(msgBuffer);

  
王朝网络
//记录异常日志,或者通知用户

  
王朝网络
//Showmessage(msgBuffer);

  
王朝网络
finally

  
王朝网络
FreeMem(msgBuffer);

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
function TCXXSHChannel8B.GetTrunkStateBySsm(

  
王朝网络
const ssmState: integer): TTrunkState;

  
王朝网络
begin

  
王朝网络
Result := atsFree;

  
王朝网络
case ssmState of

  
王朝网络
0: Result := atsFree;

  
王朝网络
4,5,6,9: Result := atsCallIning;

  
王朝网络
7: Result := atsHangOff;

  
王朝网络
//8:“断线”状态。只有录音通道才会进入本状态。暂时不处理

  
王朝网络
//8: Result := atsHangOff;

  
王朝网络
//3: Result := atsCallInSuccess;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ProcessDialOut();

  
王朝网络
var

  
王朝网络
dState:integer;

  
王朝网络
begin

  
王朝网络
dState := SsmChkAutoDial(channelID);

  
王朝网络
case dState of

  
王朝网络
DIAL_VOICE,

  
王朝网络
DIAL_VOICEF1,

  
王朝网络
DIAL_VOICEF2:

  
王朝网络
begin

  
王朝网络
channelState := atsDialSuccess;

  
王朝网络
isConntectd := true;

  
王朝网络
end;

  
王朝网络
DIAL_STANDBY,

  
王朝网络
DIAL_NO_DIALTONE,

  
王朝网络
DIAL_ECHO_NOVOICE,

  
王朝网络
DIAL_NOVOICE,

  
王朝网络
DIAL_NOANSWER,

  
王朝网络
DIAL_FAILURE,

  
王朝网络
DIAL_INVALID_PHONUM:

  
王朝网络
begin

  
王朝网络
channelState := atsHangOff;

  
王朝网络
end;

  
王朝网络
end;

  
王朝网络
strMessage := '拨号中...';

  
王朝网络
end;

  
王朝网络


  
王朝网络
procedure TCXXSHChannel8B.ClearChannelBuffer();

  
王朝网络
begin

  
王朝网络
SsmClearRxDTMFBuf(channelID); //清空驱动程序内部的DTMF按键号码接收缓冲区

  
王朝网络
SsmClearRxBuf(channelID); //清除指定通道ch上MODEM模块的接收缓冲区中的所有数据

  
王朝网络
//“抢拨” 开关是指当在放音过程中收到对方的DTMF按键字符时,由驱动程序程序立即停止正在进行的放音操作。

  
王朝网络
//SsmSetDtmfStopPlay(channelID,true); //打开抢拨开关

  
王朝网络
end;

  
王朝网络


  
王朝网络
end.

  
王朝网络
 
 
 
上一篇《Delphi之东进模拟语音卡(D160A)可复用源码》
下一篇《用DELPHI实现文件加密压缩》
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
 
Delphi之三汇模拟语音卡(SHT-8B/PCI/FAX)可复用源码 作者:成晓旭 设计简介: 1、 设计思路请参考本站Blog的另一篇文章:“Delphi之东进模拟语音卡(D160A)可复用源码”;链接[url=http://blog.csdn.net/CXXSoft/archive/2006/08/23/1108211.aspx]http://blog.csdn.net/CXXSoft/archive/2006/08/23/1108211.aspx[/url]。 2、 其实,仔细对比,你会发现这两种卡的代码类方法签名几乎99%是一样的,也就是说,这两都之间,还需要更进一步的抽象,以解决“重复代码”或者“相似代码”的问题。 3、 更高层次的抽象,请参考我的设计文档。 4、 类图(以后补上): 5、 卡类源码: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724739.png[/img]//------------------------------------------------------------------------------ [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724771.png[/img]// [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724802.png[/img]// 产品名称: 成晓旭的个人软件Delphi源码库 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724833.png[/img]// 产品版本: CXXSoft delphi code source lib 2.0 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724849.png[/img]// 模块名称: Delphi之三汇模拟语音卡类 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724911.png[/img]// 模块描述: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724942.png[/img]// 单元文件: unSHCard8B.pas [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803724974.png[/img]// 开发作者: 成晓旭 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725005.png[/img]// 备注: 任何人使用此文件时,请保留此段自述文件,谢谢! [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725036.png[/img]// 开发时间: 2003-12-03 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725067.png[/img]// 修改历史: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725099.png[/img]// 修改描述: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725130.png[/img]//------------------------------------------------------------------------------ [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725161.png[/img]unit unSHCard8B; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725192.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725271.png[/img]interface [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725317.png[/img]uses [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725349.png[/img] Windows, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725411.png[/img] //unDJTC08a32,unDJNewSig, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725442.png[/img] unBaseDefine, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725474.png[/img] //unDJ160ADefine,unDJChanne160A, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725521.png[/img] unShpa3api,unSHChanne18B,unSH8BDefine; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725552.png[/img]type [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725567.png[/img] TCXXCommCard8B = class(TObject) [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725599.png[/img] private [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725646.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725677.png[/img] ChannelNumber:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725739.png[/img] channelObject:array of TCXXSHChannel8B; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725771.png[/img] OnCardChannelState:TTrunkStatusEvent; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725786.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725817.png[/img] procedure ReleaseCommDevice(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725864.png[/img] function GetChannelObjectOrder(const aChannelID:Word):Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725942.png[/img] function InitChannel():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725974.png[/img] public [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803725989.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726021.png[/img] constructor Create(const trunkEvent:TTrunkStatusEvent); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726083.png[/img] destructor Destroy(); override; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726114.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726192.png[/img] function LoadCommDevice(const loadAll:boolean=false):boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726208.png[/img] function Startup():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726239.png[/img] function GetAFreeChannel():Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726271.png[/img] function GetChannelNumber():Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726302.png[/img] function DialPhone(const aChannelID:Word;const DialPhoneNumber:PChar):boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726333.png[/img] function HangUp(const aChannelID:Word):boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726349.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726380.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726411.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726442.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726474.png[/img]implementation [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726489.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726521.png[/img]const [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726552.png[/img] SH_ConfigFile = 'C:ShCtiShConfig.ini'; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726583.png[/img] SH_IndexFile = 'C:ShCtiShIndex.ini'; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726599.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726630.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726661.png[/img]...{ TCXXCommCard8B } [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726708.png[/img]constructor TCXXCommCard8B.Create(const trunkEvent:TTrunkStatusEvent); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726739.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726771.png[/img] ChannelNumber := 0; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726802.png[/img] Self.OnCardChannelState := trunkEvent; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726896.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726958.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803726974.png[/img]destructor TCXXCommCard8B.Destroy; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727005.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727036.png[/img] Loop:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727067.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727099.png[/img] if (Length(channelObject) > 0) and (channelNumber > 0) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727130.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803727771.png[/img] for Loop := 0 to ChannelNumber - 1 do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728067.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728099.png[/img] if Assigned(channelObject[Loop]) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728130.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728161.png[/img] channelObject[Loop].Free(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728177.png[/img] channelObject[Loop] := nil; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728271.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728286.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728427.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728458.png[/img] ReleaseCommDevice(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728474.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728505.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728536.png[/img]function TCXXCommCard8B.DialPhone(const aChannelID: Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728567.png[/img] const DialPhoneNumber: PChar): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728583.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728630.png[/img] K:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728661.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728692.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728755.png[/img] K := GetChannelObjectOrder(aChannelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728771.png[/img] if (K <> ErrorTrunkNumber) and (Assigned(channelObject[K])) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728817.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728849.png[/img] Result := channelObject[K].DialPhone(DialPhoneNumber); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728880.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728927.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728958.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803728974.png[/img]procedure TCXXCommCard8B.ReleaseCommDevice(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729005.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729052.png[/img] SsmCloseCti() ; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729067.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729099.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729130.png[/img]function TCXXCommCard8B.GetAFreeChannel(): Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729161.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729177.png[/img] Loop:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729224.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729255.png[/img] Result := ErrorTrunkNumber; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729302.png[/img] for Loop := Low(channelObject) to High(channelObject) do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729317.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729349.png[/img] if NOT channelObject[Loop].CheckDialOutEnabled() then continue; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729380.png[/img] if (channelObject[Loop].GetChannelStatus() = atsFree) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729411.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729427.png[/img] Result := channelObject[Loop].GetChannelID(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729458.png[/img] break; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729489.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729536.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729567.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729583.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729614.png[/img]function TCXXCommCard8B.GetChannelNumber(): Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729646.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729677.png[/img] Result := channelNumber; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729708.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729724.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729755.png[/img]function TCXXCommCard8B.GetChannelObjectOrder( [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729786.png[/img] const aChannelID: Word): Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729817.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729849.png[/img] Loop:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729864.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729896.png[/img] Result := ErrorTrunkNumber; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729927.png[/img] for Loop := Low(channelObject) to High(channelObject) do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729958.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803729974.png[/img] if (channelObject[Loop].GetChannelID = aChannelID) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730036.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730083.png[/img] Result := Loop; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730114.png[/img] break; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730146.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730177.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730208.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730224.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730271.png[/img]function TCXXCommCard8B.HangUp(const aChannelID: Word): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730302.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730333.png[/img] K:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730349.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730380.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730411.png[/img] K := GetChannelObjectOrder(aChannelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730442.png[/img] if (K <> ErrorTrunkNumber) and (Assigned(channelObject[K])) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730458.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730521.png[/img] channelObject[K].ChannelHangUp(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730552.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730567.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730599.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730630.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730661.png[/img]function TCXXCommCard8B.LoadCommDevice(const loadAll:boolean): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730677.png[/img]const [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730708.png[/img] loadEmpty = true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730755.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730786.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730817.png[/img] if SsmStartCti(SH_ConfigFile,SH_IndexFile) <> 0 then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730849.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730880.png[/img] TCXXSHChannel8B.InformInvodeError(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730911.png[/img] Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730942.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730974.png[/img] if(SsmGetMaxUsableBoard() <> SsmGetMaxCfgBoard()) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803730989.png[/img] begin //部分板卡初始化失败,取出失败原因 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731021.png[/img] TCXXSHChannel8B.InformInvodeError(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731052.png[/img] Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731083.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731099.png[/img] Result := InitChannel(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731146.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731177.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731192.png[/img]function TCXXCommCard8B.Startup(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731224.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731255.png[/img] Loop:integer; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731286.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731333.png[/img] for Loop := 0 to channelNumber - 1 do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731364.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731396.png[/img] channelObject[Loop].Startup(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731427.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731442.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731474.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731505.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731536.png[/img]function TCXXCommCard8B.InitChannel():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731567.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731599.png[/img] number,Loop:integer; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731630.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731661.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731677.png[/img] number := SsmGetMaxCh(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731708.png[/img] if (number < 0) then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731771.png[/img] ChannelNumber := number; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731802.png[/img] SetLength(channelObject,channelNumber); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731849.png[/img] for Loop := 0 to channelNumber - 1 do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731880.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731911.png[/img] channelObject[Loop] := TCXXSHChannel8B.Create(OnCardChannelState); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731942.png[/img] channelObject[Loop].CreateCommChannel(Loop); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731974.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803731989.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732021.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732052.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732083.png[/img]end. [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732130.png[/img] 6、 通道类源码: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732146.png[/img]//------------------------------------------------------------------------------ [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732177.png[/img]// [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732208.png[/img]// 产品名称: 成晓旭的个人软件Delphi源码库 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732239.png[/img]// 产品版本: CXXSoft delphi code source lib 2.0 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732271.png[/img]// 模块名称: Delphi之三汇模拟语音卡通道类 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732286.png[/img]// 模块描述: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732317.png[/img]// 单元文件: unSHChanne18B.pas [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732349.png[/img]// 开发作者: 成晓旭 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732396.png[/img]// 备注: 任何人使用此文件时,请保留此段自述文件,谢谢! [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732411.png[/img]// 开发时间: 2003-12-01 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732442.png[/img]// 修改历史: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732474.png[/img]// 修改描述: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732536.png[/img]//------------------------------------------------------------------------------ [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732552.png[/img]unit unSHChanne18B; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732583.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732614.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732646.png[/img]...{$DEFINE ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732661.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732692.png[/img]interface [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732724.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732755.png[/img]uses [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732786.png[/img] Windows,Classes,SysUtils, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732802.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732833.png[/img] unBaseDefine,unShpa3api,unSH8BDefine, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732864.png[/img] //unDJ160ADefine, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732896.png[/img] unDJTC08a32,unDJNewSig; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732911.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732942.png[/img]Type [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803732974.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733005.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733036.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733052.png[/img] ...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733083.png[/img] TCXXSHChannel8B = class(TThread) [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733114.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733146.png[/img] ...{$ELSE} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733161.png[/img] TCXXSHChannel8B = class(TObject) [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733192.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733224.png[/img] ...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733255.png[/img] private [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733286.png[/img] channelType:TChannelType; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733302.png[/img] oldChannelState,channelState:TTrunkState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733333.png[/img] channelID:Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733364.png[/img] phoneNumber:string; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733396.png[/img] dtmfString:string; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733411.png[/img] aCallerId:PAnsiChar; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733442.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733474.png[/img] isConntectd:boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733505.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733536.png[/img] isDialOut:boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733552.png[/img] aTrunkState:TTrunkStatus; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733583.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733614.png[/img] procedure ChannelProcessor(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733646.png[/img] procedure InformTrunkStatus(const aMsgFlag: TLVOperateFlag); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733661.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733692.png[/img] procedure ClearTrunkStatus(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733724.png[/img] procedure ClearChannelBuffer(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733755.png[/img] function CheckSigHangup():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733786.png[/img] function CheckCallIn():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733802.png[/img] function SwitchOnCallIn():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733833.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733880.png[/img] procedure ProcessCallInSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733911.png[/img] procedure ProcessDialSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733942.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803733958.png[/img] procedure ProcessCheckDialSend(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734005.png[/img] procedure ProcessDialOut(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734021.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734052.png[/img] procedure Stop(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734083.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734130.png[/img] //三汇卡专用方法 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734146.png[/img] function GetTrunkStateBySsm(const ssmState: integer): TTrunkState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734177.png[/img] protected [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734208.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734255.png[/img] ...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734286.png[/img] procedure Execute(); override; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734302.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734333.png[/img] ...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734364.png[/img] public [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734396.png[/img] strMessage:string; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734411.png[/img] OnChannelState:TTrunkStatusEvent; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734442.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734474.png[/img] constructor Create(const trunkEvent:TTrunkStatusEvent); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734505.png[/img] destructor Destroy();override; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734521.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734552.png[/img] procedure CreateCommChannel(const aChennelID: Word); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734583.png[/img] procedure Startup(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734614.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734646.png[/img] function GetChannelID():Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734677.png[/img] function GetChannelStatus():TTrunkState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734724.png[/img] function GetChannelType():TChannelType; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734755.png[/img] function DialPhone(const DialPhoneNumber:PChar):boolean;overload; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734786.png[/img] function DialPhone(const DialPhoneNumber:PChar;const PreDialNumber:PChar):boolean;overload; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734802.png[/img] procedure ChannelHangUp(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734833.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734864.png[/img] function GetDialOut():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734896.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734911.png[/img] //三汇卡特性方法 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734942.png[/img] function CheckDialOutEnabled():boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803734974.png[/img] class procedure InformInvodeError(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735005.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735021.png[/img]implementation [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735052.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735083.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735114.png[/img]...{ TCXXSHChannel8B } [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735146.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735177.png[/img]procedure TCXXSHChannel8B.ChannelHangUp(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735192.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735224.png[/img] isDialOut := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735255.png[/img] SsmHangUp(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735286.png[/img] ClearChannelBuffer(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735317.png[/img] ClearTrunkStatus(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735349.png[/img] InformTrunkStatus(lvofUpdate); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735364.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735396.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735442.png[/img]procedure TCXXSHChannel8B.ChannelProcessor(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735474.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735505.png[/img] ssmState:integer; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735536.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735552.png[/img]// ssmState := SsmGetChState(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735583.png[/img]// channelState := GetTrunkStateBySsm(ssmState); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735614.png[/img] CheckCallIn(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735646.png[/img] case channelState of [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735661.png[/img] atsFree: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735692.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735724.png[/img] // [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735755.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735786.png[/img] atsCallIning: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735817.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735833.png[/img] SwitchOnCallIn(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735864.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735896.png[/img] atsCallInSuccess: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735942.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803735974.png[/img] if CheckSigHangup() then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736005.png[/img] ProcessCallInSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736021.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736052.png[/img] atsCheckSendDial: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736083.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736114.png[/img] ProcessCheckDialSend(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736130.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736161.png[/img] atsDialing: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736192.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736224.png[/img] ProcessDialOut(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736255.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736286.png[/img] atsDialSuccess: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736317.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736349.png[/img] if CheckSigHangup() then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736364.png[/img] ProcessDialSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736396.png[/img] strMessage := '拨号成功'; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736427.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736458.png[/img] atsHangOff: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736489.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736505.png[/img] ChannelHangUp(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736536.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736567.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736599.png[/img] if (oldChannelState <> channelState) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736630.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736661.png[/img] oldChannelState := channelState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736677.png[/img] InformTrunkStatus(lvofUpdate); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736708.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736739.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736771.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736802.png[/img]function TCXXSHChannel8B.CheckCallIn(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736817.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736849.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736880.png[/img] if(SsmGetChState(channelID)=2) then //检测到振铃信号 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736911.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803736927.png[/img] SsmGetCallerId(channelID, aCallerId); //取出CALLERID信息 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737052.png[/img] channelState := atsCallIning; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737083.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737114.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737146.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737161.png[/img]...{ [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737192.png[/img] Result := RingDetect(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737224.png[/img] if Result then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737255.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737286.png[/img] OffHook(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737302.png[/img] if isDialOut then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737333.png[/img] channelState := atsDialSuccess [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737364.png[/img] else [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737396.png[/img] channelState := atsCallIning; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737411.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737442.png[/img]} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737474.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737505.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737536.png[/img]function TCXXSHChannel8B.CheckSigHangup(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737552.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737583.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737614.png[/img] if (SsmGetChState(channelID) = S_CALL_PENDING) then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737646.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737677.png[/img] strMessage := '对方已挂机'; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737708.png[/img] InformTrunkStatus(lvofUpdate); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737739.png[/img] SsmStopPlay(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737771.png[/img] channelState := atsHangOff; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737786.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737817.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737849.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737880.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737896.png[/img]procedure TCXXSHChannel8B.ClearTrunkStatus(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737927.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737958.png[/img] channelState := atsFree; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803737989.png[/img] oldChannelState := channelState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738021.png[/img] phoneNumber := ''; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738052.png[/img] dtmfString := ''; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738083.png[/img] strMessage := ''; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738099.png[/img] isConntectd := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738130.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738161.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738192.png[/img]constructor TCXXSHChannel8B.Create(const trunkEvent:TTrunkStatusEvent); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738208.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738239.png[/img] GetMem(aCallerId,50); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738271.png[/img] Self.OnChannelState := trunkEvent; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738302.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738333.png[/img]...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738349.png[/img] Self.FreeOnTerminate := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738380.png[/img] inherited Create(true); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738411.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738442.png[/img]...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738474.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738489.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738521.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738552.png[/img]destructor TCXXSHChannel8B.Destroy; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738583.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738614.png[/img] ChannelHangUp(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738630.png[/img] Stop(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738661.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738692.png[/img]...{$IFNDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738724.png[/img] inherited Destroy(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738755.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738771.png[/img]...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738817.png[/img] InformTrunkStatus(lvofDelete); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738833.png[/img] FreeMem(aCallerId); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738864.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738896.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738927.png[/img]function TCXXSHChannel8B.DialPhone(const DialPhoneNumber:PChar; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738958.png[/img] const PreDialNumber:PChar): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803738974.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739005.png[/img] Result := false; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739036.png[/img] if (channelState <> atsFree) then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739067.png[/img] phoneNumber := DialPhoneNumber; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739099.png[/img] Result := (SsmPickup(channelID) = 0); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739114.png[/img] if NOT Result then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739146.png[/img] Result := (SsmAutoDial(channelID,DialPhoneNumber)=0); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739177.png[/img] if Result then [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739208.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739239.png[/img] isDialOut := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739271.png[/img] channelState := atsCheckSendDial; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739286.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739317.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739349.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739380.png[/img]function TCXXSHChannel8B.DialPhone( [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739411.png[/img] const DialPhoneNumber: PChar): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739427.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739458.png[/img] Result := DialPhone(DialPhoneNumber,''); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739489.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739521.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739552.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739583.png[/img]...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739630.png[/img]procedure TCXXSHChannel8B.Execute; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739646.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739677.png[/img] while NOT Terminated do [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739708.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739739.png[/img] Synchronize(ChannelProcessor); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739755.png[/img] Sleep(10); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739786.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739817.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739849.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739880.png[/img]...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739896.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739927.png[/img]function TCXXSHChannel8B.GetChannelID(): Word; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739958.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803739989.png[/img] Result := channelID; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740021.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740036.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740083.png[/img]function TCXXSHChannel8B.GetChannelStatus(): TTrunkState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740114.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740146.png[/img] Result := channelState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740177.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740224.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740255.png[/img]procedure TCXXSHChannel8B.InformTrunkStatus(const aMsgFlag: TLVOperateFlag); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740286.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740317.png[/img] if NOT Assigned(OnChannelState) then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740349.png[/img] aTrunkState.lvFlag := aMsgFlag; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740380.png[/img] aTrunkState.TrunkID := IntToStr(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740411.png[/img] aTrunkState.TrunkType := Ord(channelType); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740427.png[/img] aTrunkState.TrunkTypeStr := ChannelTypeString[channelType]; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740458.png[/img] aTrunkState.TrunkStep := Ord(channelState); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740489.png[/img] aTrunkState.TrunkStepStr := TrunkStateString[channelState]; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740521.png[/img] aTrunkState.TrunkPhone := phoneNumber; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740567.png[/img] aTrunkState.TrunkData := dtmfString; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740599.png[/img] OnChannelState(aTrunkState); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740630.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740646.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740677.png[/img]procedure TCXXSHChannel8B.ProcessCallInSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740739.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740771.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740802.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740864.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740880.png[/img]function TCXXSHChannel8B.SwitchOnCallIn(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740911.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803740958.png[/img] SsmPickup(channelID); //摘机 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741005.png[/img] ClearChannelBuffer(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741036.png[/img] channelState := atsCallInSuccess; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741067.png[/img] Result := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741099.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741114.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741177.png[/img]procedure TCXXSHChannel8B.ProcessDialSuccess(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741208.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741239.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741255.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741286.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741317.png[/img]procedure TCXXSHChannel8B.CreateCommChannel(const aChennelID: Word); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741349.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741380.png[/img] ct:integer; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741411.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741442.png[/img] channelID := aChennelID; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741474.png[/img] ct := SsmGetChType(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741505.png[/img] if (ct < 0) then Exit; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741536.png[/img] channelType := TChannelType(ct); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741552.png[/img] ClearTrunkStatus(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741583.png[/img] InformTrunkStatus(lvofAdd); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741614.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741646.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741692.png[/img]function TCXXSHChannel8B.GetChannelType(): TChannelType; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741724.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741739.png[/img] Result := channelType; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741771.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741802.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741833.png[/img]function TCXXSHChannel8B.GetDialOut(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741849.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741880.png[/img] Result := isDialOut; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741911.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741942.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741974.png[/img]procedure TCXXSHChannel8B.ProcessCheckDialSend(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803741989.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742021.png[/img] //三汇卡直接转换状态 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742052.png[/img] channelState := atsDialing; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742083.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742114.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742130.png[/img]procedure TCXXSHChannel8B.Startup(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742161.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742208.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742239.png[/img] ...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742255.png[/img] Resume(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742286.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742317.png[/img] ...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742349.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742364.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742396.png[/img]procedure TCXXSHChannel8B.Stop(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742427.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742458.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742489.png[/img] ...{$IFDEF ThreadChannel} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742505.png[/img] Suspend(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742536.png[/img] Terminate(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742567.png[/img][img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742599.png[/img] ...{$ENDIF} [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742614.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742646.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742692.png[/img]function TCXXSHChannel8B.CheckDialOutEnabled(): boolean; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742724.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742739.png[/img] //内线通道、坐席通道、磁石通道和录音通道不支持本SsmPicuup操作 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742771.png[/img] Result := NOT((channelType = ct1) or [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742833.png[/img] (channelType = ct2) or [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742849.png[/img] (channelType = ct3) or [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742880.png[/img] (channelType = ct10)); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742911.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742942.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742958.png[/img]class procedure TCXXSHChannel8B.InformInvodeError; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803742989.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743021.png[/img] msgBuffer:PAnsiChar; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743052.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743083.png[/img] GetMem(msgBuffer,255); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743114.png[/img] try [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743146.png[/img] SsmGetLastErrMsg(msgBuffer); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743161.png[/img] //记录异常日志,或者通知用户 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743192.png[/img] //Showmessage(msgBuffer); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743224.png[/img] finally [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743255.png[/img] FreeMem(msgBuffer); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743271.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743317.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743333.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743364.png[/img]function TCXXSHChannel8B.GetTrunkStateBySsm( [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743396.png[/img] const ssmState: integer): TTrunkState; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743427.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743442.png[/img] Result := atsFree; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743474.png[/img] case ssmState of [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743505.png[/img] 0: Result := atsFree; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743536.png[/img] 4,5,6,9: Result := atsCallIning; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743567.png[/img] 7: Result := atsHangOff; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743599.png[/img] //8:“断线”状态。只有录音通道才会进入本状态。暂时不处理 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743630.png[/img] //8: Result := atsHangOff; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743646.png[/img] //3: Result := atsCallInSuccess; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743677.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743708.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743739.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743771.png[/img]procedure TCXXSHChannel8B.ProcessDialOut(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743786.png[/img]var [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743817.png[/img] dState:integer; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743849.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743880.png[/img] dState := SsmChkAutoDial(channelID); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743896.png[/img] case dState of [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743927.png[/img] DIAL_VOICE, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803743958.png[/img] DIAL_VOICEF1, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744005.png[/img] DIAL_VOICEF2: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744021.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744052.png[/img] channelState := atsDialSuccess; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744083.png[/img] isConntectd := true; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744114.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744130.png[/img] DIAL_STANDBY, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744161.png[/img] DIAL_NO_DIALTONE, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744192.png[/img] DIAL_ECHO_NOVOICE, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744224.png[/img] DIAL_NOVOICE, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744255.png[/img] DIAL_NOANSWER, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744271.png[/img] DIAL_FAILURE, [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744302.png[/img] DIAL_INVALID_PHONUM: [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744333.png[/img] begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744364.png[/img] channelState := atsHangOff; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744380.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744458.png[/img] end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744474.png[/img] strMessage := '拨号中...'; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744505.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744536.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744567.png[/img]procedure TCXXSHChannel8B.ClearChannelBuffer(); [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744599.png[/img]begin [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744614.png[/img] SsmClearRxDTMFBuf(channelID); //清空驱动程序内部的DTMF按键号码接收缓冲区 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744646.png[/img] SsmClearRxBuf(channelID); //清除指定通道ch上MODEM模块的接收缓冲区中的所有数据 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744677.png[/img] //“抢拨” 开关是指当在放音过程中收到对方的DTMF按键字符时,由驱动程序程序立即停止正在进行的放音操作。 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744708.png[/img] //SsmSetDtmfStopPlay(channelID,true); //打开抢拨开关 [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744724.png[/img]end; [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744755.png[/img] [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744786.png[/img]end. [img]http://images.wangchao.net.cn/images/upload/images/lsdn/1189803744817.png[/img]
󰈣󰈤
 
 
 
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
桌球宝贝_性感在蔓延(3)
桌球宝贝_性感在蔓延(2)
银杏树下清纯女孩(9)
银杏树下清纯女孩(8)
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有