Esempio n. 1
0
        protected override void ProcessResponse(Diacom.AltiGen.AltiLinkPlus.ALPResponse altiResponse)
        {
            switch ((ALPCmdID)(altiResponse.CommandId))
            {
            case ALPCmdID.GET_EXTRACALLINFO:
                CallInfo rInfo = (CallInfo)RingInfo[altiResponse.SequenceId];
                RingInfo.Remove(altiResponse.SequenceId);
                Diacom.ExtensionManager.CallInfoEventArgs RingData =
                    new Diacom.ExtensionManager.CallInfoEventArgs(
                        rInfo.callerName, rInfo.callerID, rInfo.callerPAD, rInfo.callerIPAddress,
                        rInfo.calleeName, rInfo.calleeID, rInfo.calleePAD,
                        rInfo.ANIName, rInfo.ANIID, rInfo.DNISName, rInfo.DNISID,
                        rInfo.StartTime, rInfo.HoldTime, rInfo.CurrentTime,
                        rInfo.WorkGroupNumber, rInfo.OutBoundWorkGroupNumber, rInfo.SessionHandle, rInfo.CallHandle);

                if (altiResponse.ResponseCode == 0)
                {
                    int SessionID = altiResponse[0].ReadInt32();
                    Diacom.ExtensionManager.ExtraCallInfo xci =
                        new Diacom.ExtensionManager.ExtraCallInfo(altiResponse[1].ReadString(),
                                                                  altiResponse[2].ReadString(), altiResponse[3].ReadString(),
                                                                  altiResponse[4].ReadString(), altiResponse[5].ReadString(),
                                                                  altiResponse[6].ReadString());

                    RingData.ExtraInfo = xci;
                }

                Diacom.ExtensionManager.CallEventHandler ehr = this.Ring;
                if (ehr != null)
                {
                    SPLine _line = GetLine(rInfo.lineID);
                    _line.CalledNumber = rInfo.callerID;
                    _line.CalledName   = rInfo.callerName;
                    _line.DNISNumber   = rInfo.DNISID;
                    _line.DNISName     = rInfo.DNISName;
                    _line.CIDNumber    = rInfo.ANIID;
                    _line.CIDName      = rInfo.ANIName;
                    _line.DIDNumber    = rInfo.calleeID;
                    _line.DIDName      = rInfo.calleeName;

                    ehr(_line, RingData);
                }
                break;
            }
            base.ProcessResponse(altiResponse);
        }
 /// <summary>
 /// Implements <see cref="Diacom.ISP.GetLines"/> method of <see cref="Diacom.ISP"/> interface.
 /// Provides an access to all the lines available.
 /// </summary>
 /// <returns>Pointer to array of <see cref="Diacom.SPLine"/> type (null if error).</returns>
 /// <remarks>
 /// <seealso cref="Diacom.ISP"/>
 /// </remarks>
 public SPLine [] GetLines()
 {
     SPLine [] _result;
     if (lines == null)
     {
         return(null);
     }
     lock (lines)
     {
         _result = new SPLine[lines.Count];
         int _index = 0;
         foreach (ALPLine line in lines.Values)
         {
             // Fill the resulting array.
             _result[_index++] = (SPLine)line.SPLineInfo.Clone();
         }
     }
     Array.Reverse(_result);
     return(_result);
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes new instance of class with specified parameters.
 /// </summary>
 /// <param name="line">Object that identifies the line on which ringback came.</param>
 /// <param name="lineInfo">Parameter of type <see cref="Diacom.SPLine"/> that contains all info about the call.</param>
 public RingBack(object line, SPLine lineInfo) : base(line, Ev.EventID.RING_BACK)
 {
     ringInfo = (SPLine)lineInfo.Clone();
 }
Esempio n. 4
0
            /// <summary>
            /// Based on line information constructor.
            /// </summary>
            /// <param name="lineInfo">Line information.</param>
            public ALPLine(LineInfo lineInfo)
            {
                // Creating SPLine class.
                SPLineInfo = new SPLine();
                // Creating LastCommand class.
                LastCommand = new LastCommandStruct();
                // Fill SPLine properties.
                SPLineInfo.CalledName   = "";
                SPLineInfo.CalledNumber = "";
                SPLineInfo.CIDName      = "";
                SPLineInfo.CIDNumber    = "";
                SPLineInfo.DIDName      = "";
                SPLineInfo.DIDNumber    = "";
                SPLineInfo.DNISName     = "";
                SPLineInfo.DNISNumber   = "";
                SPLineInfo.Name         = String.Concat(((lineInfo.firstName == null) ? "" : lineInfo.firstName), " ", ((lineInfo.lastName == null) ? "" : lineInfo.lastName));
                SPLineInfo.Number       = ((lineInfo.lineNumber == null) ? "" : lineInfo.lineNumber);
                SPLineInfo.ID           = lineInfo.lineHandle;
                SPLineInfo.State        = SPLineState.IDLE;
                SPLineInfo.Port         = ((lineInfo.physPort == null) ? "" : lineInfo.physPort);
                SPLineInfo.UserName     = "";
                SPLineInfo.UserNumber   = "";
                switch (lineInfo.lineType)
                {
                case 6:                                 // Application control
                    SPLineInfo.Type       = "C";
                    SPLineInfo.AccessCode = lineInfo.lineNumber;
                    break;

                case 4:                                 // Virtual
                    SPLineInfo.Type       = "V";
                    SPLineInfo.AccessCode = lineInfo.lineNumber;
                    break;

                case 3:                                 // Workgroup or hunt group
                    SPLineInfo.Type       = (lineInfo.lineSubType & 0x10) == 0x10 ? "W" : "H";
                    SPLineInfo.AccessCode = lineInfo.lineNumber;
                    break;

                case 2:                                 // Trunk
                    if (lineInfo.direction == 0x03)     // Paging trunk
                    {
                        SPLineInfo.Type       = "P";
                        SPLineInfo.AccessCode = "";
                    }
                    else if (lineInfo.direction == 0x00)                                // Incoming only trunk
                    {
                        SPLineInfo.Type       = "T";
                        SPLineInfo.AccessCode = "";
                    }
                    else
                    {
                        SPLineInfo.Type = "T";
                        if ((lineInfo.accessDigit <= 0x09) && (lineInfo.accessDigit >= 0x00))
                        {
                            SPLineInfo.AccessCode = lineInfo.accessDigit.ToString("D");
                        }
                        else
                        {
                            SPLineInfo.AccessCode = "";
                        }
                    }
                    break;

                case 1:                                 // Extension
                    SPLineInfo.Type       = (lineInfo.lineSubType & 0x04) == 0x04 ? "I" : "E";
                    SPLineInfo.AccessCode = lineInfo.lineNumber;
                    break;

                default:
                    SPLineInfo.AccessCode = "";
                    SPLineInfo.Type       = "";
                    break;
                }
            }