📄 main.pas
字号:
else if Trim(tmpStr) = '七号信令' then
begin
result := CHTYPE_DTNO7;
end
else if Trim(tmpStr) = 'ISDN' then
begin
result := CHTYPE_DTDSS1;
end
else if Trim(tmpStr) = '七号ISUP' then
begin
result := CHTYPE_DTNO7ISUP;
end;
end;
procedure TfrmExchange.PCICARD1L1Release(ASender: TObject; ChType, ChIndex, //相关通道释放
Reason, Err: Smallint);
var
i : Integer;
dgCH : TDigitState;
agCH : TAgentState;
begin
{ Memo.Lines.Add('Release : ChType->' + inttostr(ChType) +
' ChIndex->' + inttostr(ChIndex) +
' Reason->' + inttostr(Reason) +
' Err->' + inttostr(Err)
);
}
PCICARD1.L1Router(ChType, ChIndex, F_R_SILENCE, 0, ChType, ChIndex); //释放交换的通道
case ChType of
CHTYPE_AGENT:
begin
AgentLamp.SetLampGreen(ChIndex); //改变灯的颜色
agCH := AgentLamp.DataList.GetChPointer(ChIndex); //清除通道相关参数
agCH.State := 0; //状态置为0
agCH.Data := ''; //清空数据
agCH.AcmOk := False; //收局完为否
agCH.SimilarCount := SGRouter.RowCount - 1; //相似行数为路由总数
for i := 1 to agCH.SimilarCount do //相似对应行重置
begin
agCH.SimilarRow[i - 1] := i;
end;
if agCH.CalledType <> 0 then //释放对应呼出通道
begin
if agCH.CalledType = CHTYPE_AGENT then
begin
PCICARD1.L1Release(agCH.CalledType, agCH.CalledIndex, 0, 0);
end
else
begin
dgCH := DigitLamp.DataList.GetChPointer(agCH.CalledIndex div 32);
if dgCH.CallInLine[ChIndex] <> 0 then
begin
dgCH.CallInLine[ChIndex] := 0;
PCICARD1.L1Release(agCH.CalledType, agCH.CalledIndex, 0, 0);
end;
end;
end;
agCH.CalledType := 0;
agCH.CalledIndex := 0;
if agCH.CallerType <> 0 then //释放对应呼入通道
begin
if agCH.CallerType = CHTYPE_AGENT then
begin
PCICARD1.L1Release(agCH.CallerType, agCH.CallerIndex, 0, 0);
end
else
begin
dgCH := DigitLamp.DataList.GetChPointer(agCH.CallerIndex div 32);
if dgCH.CallInLine[ChIndex] <> 0 then
begin
dgCH.CallInLine[ChIndex] := 0;
PCICARD1.L1Release(agCH.CallerType, agCH.CallerIndex, 0, 0);
end;
end;
end;
agCH.CallerType := 0;
agCH.CallerIndex := 0;
end;
CHTYPE_DTNO1, CHTYPE_DTNO7, CHTYPE_DTDSS1, CHTYPE_DTNO7ISUP:
begin
dgCH := DigitLamp.DataList.GetChPointer(ChIndex div 32);
if dgCH.UsedCount = 1 then
begin
DigitLamp.SetLampGreen( ChIndex div 32);
end
else if dgCH.UsedCount > 1 then
begin
end;
for i := 0 to 23 do
begin
if dgCH.CallInLine[i] = 2 then
begin
agCH := AgentLamp.DataList.GetChPointer(i);
if (agCH.CallerType = ChType) and (agCH.CallerIndex = ChIndex) then
begin
PCICARD1.L1Release(CHTYPE_AGENT, i, 0, 0);
dgCH.CallInLine[i] := 0;
break;
end;
end
else if dgCH.CallInLine[i] = 1 then
begin
agCH := AgentLamp.DataList.GetChPointer(i);
if (agCH.CalledType = ChType) and (agCH.CalledIndex = ChIndex) then
begin
PCICARD1.L1Release(CHTYPE_AGENT, i, 0, 0);
dgCH.CallInLine[i] := 0;
break;
end;
end;
end;
dgCH.UsedCount := dgCH.UsedCount - 1;
end;
end; //end of case
frmExchange.Refresh; //刷新屏幕
end;
procedure TfrmExchange.PCICARD1L1Ack(ASender: TObject; ChType, ChIndex, //通道摘机应答
Func: Smallint);
var
i : Integer;
agCH : TAgentState;
dgCH : TDigitState;
begin
{ Memo.Lines.Add('Ack : ChType->' + inttostr(ChType) +
' ChIndex->' + inttostr(ChIndex) +
' Func->' + inttostr(Func)
);
}
case ChType of
CHTYPE_AGENT:
begin
agCH := AgentLamp.DataList.GetChPointer(ChIndex);
agCH.State := 3; //通道为通话状态
if agCH.CallerType = CHTYPE_AGENT then
begin
AgentLamp.SetLampRed(ChIndex, agCH.CallerIndex, '通话 ');
AgentLamp.SetLampRed(agCH.CallerIndex, ChIndex, '通话 ');
PCICARD1.L1Ack(agCH.CallerType, agCH.CallerIndex, 0);
PCICARD1.L1Router(agCH.CallerType, agCH.CallerIndex , F_R_TALK, 0,ChType, ChIndex);
agCH := AgentLamp.DataList.GetChPointer(agCH.CallerIndex);
agCH.State := 3;
end
else if agCH.CalledType <> CHTYPE_AGENT then
begin
PCICARD1.L1Ack(agCH.CallerType, agCH.CallerIndex, 0);
PCICARD1.L1Router(agCH.CallerType, agCH.CallerIndex, F_R_TALK, 0 ,ChType, ChIndex);
AgentLamp.SetLampRed(ChIndex, ChIndex, '通话 ');
end;
end;
CHTYPE_DTNO1, CHTYPE_DTNO7, CHTYPE_DTDSS1, CHTYPE_DTNO7ISUP:
begin
dgCH := DigitLamp.DataList.GetChPointer(ChIndex div 32);
for i := 0 to 23 do
begin
if dgCH.CallInLine[i] = 1 then
begin
agCH := AgentLamp.DataList.GetChPointer(i);
if (agCH.CalledType = ChType) and (agCH.CalledIndex = ChIndex) then
begin
PCICARD1.L1Ack(CHTYPE_AGENT, i, 0);
PCICARD1.L1Router(CHTYPE_AGENT, i, F_R_TALK, 0,ChType, ChIndex);//注意agent通道放在数字通道之前,
//因为l1ack对通道执行了静音操作,需要与l1router同步,即交给同一块卡执行
// PCICARD1.L1Router(ChType, ChIndex, F_R_TALK, 0, CHTYPE_AGENT, i);
agCH.State := 3;
AgentLamp.SetLampComment(i, '通话 ');
break;
end;
end;
end;
end;
end;
end;
procedure TfrmExchange.PCICARD1L1ACM(ASender: TObject; ChType, ChIndex,
Func: Smallint);
var
i : Integer;
agCH : TAgentState;
dgCH : TDigitState;
begin
{ Memo.Lines.Add('ACM : ChType->' + inttostr(ChType) +
' ChIndex->' + inttostr(ChIndex) +
' Func->' + inttostr(Func)
);
}
case ChType of
CHTYPE_AGENT:
begin
agCH := AgentLamp.DataList.GetChPointer(ChIndex);
// dgCH := DigitLamp.DataList.GetChPointer(agCH.CallerIndex div 32);
PCICARD1.L1ACM(agCH.CallerType, agCH.CallerIndex, 0);
end;
CHTYPE_DTNO1, CHTYPE_DTNO7, CHTYPE_DTDSS1, CHTYPE_DTNO7ISUP:
begin
dgCH := DigitLamp.DataList.GetChPointer(ChIndex div 32);
for i := 0 to 23 do
begin
if dgCH.CallInLine[i] = 1 then
begin
agCH := AgentLamp.DataList.GetChPointer(i);
if (agCH.CalledType = ChType) and (agCH.CalledIndex = ChIndex) then
begin
if(CBRing.Checked) then
PCICARD1.L1Acm(CHTYPE_AGENT, i, 0 ) //给对应内线送ACM
else //connect directly
// PCICARD1.L1Ack(CHTYPE_AGENT, i, 0);
PCICARD1.L1Router(CHTYPE_AGENT, i, F_R_TALK, 0,ChType, ChIndex);//注意agent通道放在数字通道之前,
//因为l1ack对通道执行了静音操作,需要与l1router同步,即交给同一块卡执行
end;
end;
end;
end;
end;
end;
procedure TfrmExchange.PCICARD1L1CalloutChannel(ASender: TObject; ChType,
ChIndex, Func, Err, MainRef, SubRef: Smallint);
var
tmpPCM : Integer;
dgCH : TDigitState;
agCH : TAgentState;
begin
{ Memo.Lines.Add('Callout : ChType->' + inttostr(ChType) +
' ChIndex->' + inttostr(ChIndex) +
' Func->' + inttostr(Func) +
' Err->' + inttostr(Err) +
' MainRef->' + inttostr(MainRef) +
' SubRef->' + inttostr(SubRef)
);
}
if Func = F_CC_NORMAL then //分配到呼出通道
begin
case ChType of
CHTYPE_AGENT: //内线
begin
if MainRef = CHTYPE_AGENT then
begin
agCH := AgentLamp.DataList.GetChPointer( ChIndex );
agCH.CallerType := MainRef;
agCH.CallerIndex := SubRef;
agCH := AgentLamp.DataList.GetChPointer( SubRef );
agCH.CalledType := ChType;
agCH.CalledIndex := ChIndex;
// PCICARD1.L1Router(ChType, ChIndex, F_R_TALK, 0, MainRef, SubRef);
end
else if ((MainRef = CHTYPE_DTNO7) or (MainRef = CHTYPE_DTNO1) or (MainRef = CHTYPE_DTDSS1) or (MainRef = CHTYPE_DTNO7ISUP)) then //一号呼出
begin
dgCH := DigitLamp.DataList.GetChPointer( subRef div 32);
dgCH.CallInLine[ChIndex] := 2;
dgCH.UsedCount := dgCH.UsedCount + 1;
agCH := AgentLamp.DataList.GetChPointer( ChIndex );
agCH.CallerType := MainRef;
agCH.CallerIndex := SubRef;
// PCICARD1.L1Router(ChType, ChIndex, F_R_TALK, 0, MainRef, SubRef);
end;
end;
CHTYPE_DTNO1, CHTYPE_DTNO7, CHTYPE_DTDSS1, CHTYPE_DTNO7ISUP: //一号信令
begin
tmpPCM := ChIndex div 32; //通道所在的PCM
dgCH := DigitLamp.DataList.GetChPointer( tmpPCM ); //数字状态指针
agCH := AgentLamp.DataList.GetChPointer( SubRef ); //内线状态指针
dgCH.CallInLine[SubRef] := 1;
dgCH.UsedCount := dgCH.UsedCount + 1;
DigitLamp.SetLampRed(tmpPCM, tmpPCM, ' 呼出');
// PCICARD1.L1Router(ChType, ChIndex, F_R_TALK, 0, MainRef, SubRef); //通道交换
agCH.CalledType := ChType;
agCH.CalledIndex := ChIndex;
end;
end;
end
else if Func = F_CC_NOCHANNEL then
begin
case ChType of
CHTYPE_AGENT:
begin
// AgentLamp.SetLampComment(ChIndex, CalloutErrReason(Err));
PCICARD1.L1Media(MainRef, SubRef, F_MEDIA_Tx_TTStr, RESPAR_PFIRSTMSG, RESTYPE_VOCPCM, 0, CalloutErrReason(Err), 0, 0);
PCICARD1.L1Media(MainRef, SubRef, F_MEDIA_Tx_CPSign, RESPAR_PLOOPMSG, RESTYPE_VOCPCM, 0, '', 3, 0);
end;
CHTYPE_DTNO1, CHTYPE_DTNO7, CHTYPE_DTDSS1, CHTYPE_DTNO7ISUP:
begin
PCICARD1.L1Media(MainRef, SubRef, F_MEDIA_Tx_TTStr, RESPAR_PFIRSTMSG, RESTYPE_VOCPCM, 0, CalloutErrReason(Err), 0, 0);
PCICARD1.L1Media(MainRef, SubRef, F_MEDIA_Tx_CPSign, RESPAR_PLOOPMSG, RESTYPE_VOCPCM, 0, '', 3, 0);
// DigitLamp.SetLampRed(ChIndex div 32, ChIndex div 32, '');
// DigitLamp.SetLampComment(ChIndex div 32, CalloutErrReason(Err));
end;
end;
end;
frmExchange.Refresh; //刷新屏幕
end;
procedure TfrmExchange.btnCalloutClick(Sender: TObject);
begin
PCICARD1.L1Call(CHTYPE_DTNO7ISUP, 33, 0, 0, 0, 0, '26994823', '12345678')
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -