📄 evt.java
字号:
// EVT: Model Dialogic event
// $Id: EVT.java,v 1.6 2003/11/13 11:43:53 cgm8 Exp $
/*
* Copyright (c) 1999 Carlos G Mendioroz.
*
* This file is part of D4J.
*
* D4J is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* D4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Report problems and direct all questions to:
*
* tron@acm.org
*/
package local.dialogic;
public class EVT extends java.lang.Object implements Cloneable
{
// This is what we model:
// struct evt {
// int dev;
// unsigned long type;
// char data[len];
// }
// Also, we handle GC events via gc_GetMetaEvent() and get line.
protected int dev = 0;
public int type = 0;
public int termmsk = 0;
public int cstevt = 0;
public int cstdata = 0;
public int data = 0;
public int line = 0;
public long crn = 0;
public int conf = 0;
// We have a Bitset to track ISDN devices, because events types
// clash with GC events... even though they seem to be equivalent.
private static java.util.BitSet isISDN;
// Event types
public static final int DT_USER = 0x1000; /* USER event */
public static final int TDX_PLAY = 0x81; /* Play Completed */
public static final int TDX_RECORD = 0x82; /* Record Completed */
public static final int TDX_GETDIG = 0x83; /* Get Digits Completed */
public static final int TDX_DIAL = 0x84; /* Dial Completed */
public static final int TDX_CALLP = 0x85; /* Call Progress Completed */
public static final int TDX_CST = 0x86; /* CST Event Received */
public static final int TDX_SETHOOK = 0x87; /* SetHook Completed */
public static final int TDX_WINK = 0x88; /* Wink Completed */
public static final int TDX_PLAYTONE = 0x8A; /* Play Tone Completed */
public static final int TDX_GETR2MF = 0x8B; /* Get R2MF completed */
public static final int TDX_BARGEIN = 0x8C; /* Barge in completed */
public static final int TDX_NOSTOP = 0x8D; /* No Stop needed to be Issued */
public static final int TDX_ERROR = 0x89; /* Error Event */
/*
* Unsolicited DTI event types
*/
public static final int DT_DTI= 0x00002000; /* DTI device class */
public static final int DTEV_RCVPDG =(DT_DTI | 0x48); /* Received a pulse digit */
public static final int DTEV_T1ERRC =(DT_DTI | 0x49); /* T1 error condition event */
public static final int DTEV_E1ERRC = DTEV_T1ERRC ; /* E1 error condition event == T1 error */
public static final int DTEV_COMRSP =(DT_DTI | 0x4A); /* Successful com test */
public static final int DTEV_DATRSP =(DT_DTI | 0x4B); /* Response to data test */
public static final int DTEV_PDDONE =(DT_DTI | 0x4C); /* Pulse dial complete */
public static final int DTEV_SIG =(DT_DTI | 0x4D); /* Signalling event */
public static final int DTEV_RETDIAG =(DT_DTI | 0x4E); /* Diagnostic complete */
public static final int DTEV_WINKCPLT =(DT_DTI | 0x4F); /* Wink complete */
public static final int DTEV_MTFCNCPT =(DT_DTI | 0x50); /* Multi-tasking func complete */
public static final int DTEV_CLKFAIL =(DT_DTI | 0x51); /* Clock FallBack Event */
public static final int DTEV_ERREVT =(DT_DTI | 0xF0); /* Error condition event */
public static final int DTEV_OUTSERVICE=(DT_DTI | 0xF1); /* Device out of Service event */
/*
* Unsolicited DCB event types
*/
public static final int DT_DCB = 0x00008000; /* DCB device class */
public static final int DCBEV_DIGIT = (DT_DCB| 0x96); /* Digit detection event */
public static final int DCBEV_CTU = (DT_DCB| 0x97); /* Resourcee Tbl Update event */
// our related defines
public static final int DCBEV_NEW = (DT_DCB| 0x9a); /* new channel in conf */
public static final int DCBEV_GONE = (DT_DCB| 0x9b); /* channel left conf */
public static final int DCBEV_CLOSED= (DT_DCB| 0x9c); /* conference closed */
/*
* Unsolicited MSI event types
*/
public static final int DT_MSI = 0x00004000; /* MSI device class */
public static final int MSEV_RING = (DT_MSI | 0x4D);/* MSI Ring successful event */
public static final int MSEV_NORING = (DT_MSI | 0x4e);/* MSI ring unsuccessful event */
// Termination masks
public static final int TM_NORMTERM = 0x00000; /* Normal Termination */
public static final int TM_MAXDTMF = 0x00001; /* Max Number of Digits Recd */
public static final int TM_MAXSIL = 0x00002; /* Max Silence */
public static final int TM_MAXNOSIL = 0x00004; /* Max Non-Silence */
public static final int TM_LCOFF = 0x00008; /* Loop Current Off */
public static final int TM_IDDTIME = 0x00010; /* Inter Digit Delay */
public static final int TM_MAXTIME = 0x00020; /* Max Function Time Exceeded */
public static final int TM_DIGIT = 0x00040; /* Digit Mask or Digit Type Term. */
public static final int TM_PATTERN = 0x00080; /* Pattern Match Silence Off */
public static final int TM_USRSTOP = 0x00100; /* Function Stopped by User */
public static final int TM_EOD = 0x00200; /* End of Data Reached on Playback */
public static final int TM_TONE = 0x02000; /* Tone On/Off Termination */
public static final int TM_BARGEIN = 0x80000; /* Play terminated due to Barge-in */
public static final int TM_ERROR = 0x80000; /* I/O Device Error */
// CST events
public static final int DE_RINGS = 1 ; /* Rings received */
public static final int DE_SILON = 2 ; /* Silence on */
public static final int DE_SILOF = 3 ; /* Silenec off */
public static final int DE_LCON = 4 ; /* Loop current on */
public static final int DE_LCOF = 5 ; /* Loop current off */
public static final int DE_WINK = 6 ; /* Wink received */
public static final int DE_RNGOFF = 7 ; /* Ring off event */
public static final int DE_DIGITS = 8 ; /* Digit Received */
public static final int DE_DIGOFF = 9 ; /* Digit tone off event */
public static final int DE_LCREV = 13; /* Loop current reversal */
public static final int DE_TONEON = 17; /* Tone ON Event Received */
public static final int DE_TONEOFF = 18; /* Tone OFF Event Received */
public static final int DE_STOPRINGS= 19; /* Stop ring detect state */
// CallP stati
public static final int CR_BUSY = 7; /* Line busy */
public static final int CR_NOANS = 8; /* No answer */
public static final int CR_NORB = 9; /* No ringback */
public static final int CR_CNCT = 10; /* Call connected */
public static final int CR_CEPT = 11; /* Operator intercept */
public static final int CR_STOPD = 12; /* Call analysis stopped */
public static final int CR_NODIALTONE= 17; /* No dialtone detected */
public static final int CR_FAXTONE = 18; /* Fax tone detected */
public static final int CR_ERROR = 0x100;/* Call analysis error */
// ISDN Call Control events
public static final int DT_CC = 0x800;
public static final int CCEV_TASKFAIL = (DT_CC | 0x01); /* abnormal condition state
unchanged */
public static final int CCEV_ANSWERED = (DT_CC | 0x02); /* call answered and connected */
public static final int CCEV_ACCEPT = (DT_CC | 0x04); /* call is accepted */
public static final int CCEV_DROPCALL = (DT_CC | 0x05); /* cc_DropCall is completed */
public static final int CCEV_RESTART = (DT_CC | 0x06); /* cc_Restart is completed */
public static final int CCEV_CALLINFO = (DT_CC | 0x07); /* Info message received */
public static final int CCEV_REQANI = (DT_CC | 0x08); /* cc_ReqANI() is completed */
public static final int CCEV_SETCHANSTATE = (DT_CC | 0x09); /* cc_SetChanState() is completed */
public static final int CCEV_FACILITY_ACK = (DT_CC | 0x0A); /* cc_facilityreq() is
completed and successfully */
public static final int CCEV_FACILITY_REJ = (DT_CC | 0x0B); /* cc_facilityreq() is completed
but rejected, use cc_CauseValue
to get the reason */
public static final int CCEV_MOREDIGITS = (DT_CC | 0x0C); /* cc_moredigits() is completed*/
public static final int CCEV_SETBILLING = (DT_CC | 0x0E); /* cc_SetBilling() is completed*/
public static final int CCEV_ALERTING = (DT_CC | 0x21); /* The destination telephone
terminal equipment has received
connection request (in ISDN acc-
epted the connection request. This
event is an unsolicited event) */
public static final int CCEV_CONNECTED = (DT_CC | 0x22); /* The destination answered the
request */
public static final int CCEV_ERROR = (DT_CC | 0x23); /* unexpected error event */
public static final int CCEV_OFFERED = (DT_CC | 0x24); /* a connection request has
been made */
public static final int CCEV_DISCONNECTED = (DT_CC | 0x26); /* remote disconnected*/
public static final int CCEV_PROCEEDING = (DT_CC | 0x27); /* the call state has been
changed to the proceeding state */
public static final int CCEV_PROGRESSING = (DT_CC | 0x28); /* a call progress message has
been received */
public static final int CCEV_CALLPROGRESS = (DT_CC | 0x28); /* a call progress message has
been received */
public static final int CCEV_USRINFO = (DT_CC | 0x29); /* a user to user information
event is coming */
public static final int CCEV_FACILITY = (DT_CC | 0x2A); /* a facility request is made
by CO */
public static final int CCEV_CONGESTION = (DT_CC | 0x2B); /* remote end is not ready to
accept incoming user information */
public static final int CCEV_D_CHAN_STATUS= (DT_CC | 0x2E); /* report D-channel status to
the user */
public static final int CCEV_NOUSRINFOBUF = (DT_CC | 0x30); /* User information element
buffer is not ready */
public static final int CCEV_NOFACILITYBUF= (DT_CC | 0x31); /* Facility buffer is not ready*/
public static final int CCEV_BLOCKED = (DT_CC | 0x32);
public static final int CCEV_UNBLOCKED = (DT_CC | 0x33);
public static final int CCEV_ISDNMSG = (DT_CC | 0x34); /* An "information" message or unde-
fined massage has been received */
public static final int CCEV_NOTIFY = (DT_CC | 0x35); /* A Notify message has been
received */
public static final int CCEV_L2FRAME = (DT_CC | 0x36); /* A layer 2 access message has been
received */
public static final int CCEV_L2BFFRFULL = (DT_CC | 0x37); /* reserved for future use */
public static final int CCEV_L2NOBFFR = (DT_CC | 0x38); /* Failed to get a free space for an
incoming layer 2 access message */
public static final int CCEV_SETUP_ACK = (DT_CC | 0x39); /* CALL_SETUP_ACK message has been received */
public static final int CCEV_DIVERTED = (DT_CC | 0x40);
public static final int CCEV_HOLDACK = (DT_CC | 0x41);
public static final int CCEV_HOLDCALL = (DT_CC | 0x42);
public static final int CCEV_HOLDREJ = (DT_CC | 0x43);
public static final int CCEV_RETRIEVEACK = (DT_CC | 0x44);
public static final int CCEV_RETRIEVECALL = (DT_CC | 0x45);
public static final int CCEV_RETRIEVEREJ = (DT_CC | 0x46);
public static final int CCEV_NSI = (DT_CC | 0x47);
public static final int CCEV_TRANSFERACK = (DT_CC | 0x48);
public static final int CCEV_TRANSFERREJ = (DT_CC | 0x49);
public static final int CCEV_TRANSIT = (DT_CC | 0x4A);
public static final int CCEV_RESTARTFAIL = (DT_CC | 0x4B); /* abnormal condition state */
public static final int CCEV_TERM_REGISTER= (DT_CC | 0x4C); /* BRI msg - An action is required for the
North Am. terminal initialization procedure */
public static final int CCEV_RCVTERMREG_ACK= (DT_CC | 0x4E); /* Positive acknowledgement of cc_TermRegisterResponse */
public static final int CCEV_RCVTERMREG_NACK= (DT_CC | 0x4F); /* Negative acknowledgement of cc_TermRegisterResponse */
public static final int CCEV_INFONULL = (DT_CC | 0x50); /* NULL (Dummy) CRN Information IE */
public static final int CCEV_TONEREDEFINEFAIL= (DT_CC | 0x51);
public static final int CCEV_TONEREDEFINE = (DT_CC | 0x52);
public static final int CCEV_PLAYTONEFAIL = (DT_CC | 0x53);
public static final int CCEV_PLAYTONE = (DT_CC | 0x54);
public static final int CCEV_STOPTONEFAIL = (DT_CC | 0x55);
public static final int CCEV_STOPTONE = (DT_CC | 0x56);
public static final int CCEV_NOTIFYNULL = (DT_CC | 0x57); /* NULL (Dummy) CRN Notify IE */
public static final int CCEV_REDIRECT = (DT_CC | 0x58); /* ISDN REDIRECT message */
public static final int CCEV_RELEASECALL = (DT_CC | 0x59); /* Asynchronous cc_ReleaseCall() Completion event */
public static final int CCEV_RELEASECALLFAIL= (DT_CC | 0x5A); /* Asynchronous cc_ReleaseCall() fail event */
public static final int CCEV_FACILITYNULL = (DT_CC | 0x5B); /* NULL (Dummy) CRN Facility IE */
public static final int CCEV_INFOGLOBAL = (DT_CC | 0X5C); /* GLOBAL CRN Information IE */
public static final int CCEV_NOTIFYGLOBAL = (DT_CC | 0X5D); /* GLOBAL CRN Notify IE */
public static final int CCEV_FACILITYGLOBAL = (DT_CC | 0x5E); /* GLOBAL CRN Facility IE */
public static final int CCEV_DROPACK = (DT_CC | 0x5F); /* DROP Request Acknowledgement message */
public static final int CCEV_DROPREJ = (DT_CC | 0x60); /* DROP Request Reject message */
public static final int CCEV_CONFDROP = (DT_CC | 0x61); /* Request to drop the call*/
public String toString() {
StringBuffer buf = new StringBuffer();
boolean evtmask = false; // Also in dialogic.dll!
if ((type & DT_CC) != 0 && isISDN.get(dev))
switch (type) {
// ISDN Call Control
case CCEV_TASKFAIL: buf.append("CC Task failed");
break;
case CCEV_ANSWERED: buf.append("CC call answered");
break;
case CCEV_ACCEPT: buf.append("CC call accepted");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -