/// <summary> /// Sets all the parameters and sends CONNECT_RESP message to CAPI message queue /// </summary> /// <param name="CAPImsg">Message to send</param> /// <param name="controller">Number of controller</param> /// <param name="PLCI">Physical Link Connection Identifier</param> /// <param name="accept">Set true to accept connection, otherwise set false</param> /// <param name="B1">B1 protocol configuration</param> /// <param name="B2">B2 protocol configuration</param> /// <param name="B3">B3 protocol configuration</param> /// <param name="info">Result code</param> /// <returns>True if success, otherwise false</returns> public static bool Send_msg_connect_resp(ref CAPI_Message CAPImsg, byte controller, byte PLCI, bool accept, IB1_Proto B1, IB2_Proto B2, IB3_Proto B3, out uint info) { CAPImsg.reset_offset(); CAPImsg.appID = (short)app_ID; CAPImsg.sub_com = comsub.CONNECT_RESP; CAPImsg.controller = controller; CAPImsg.plci = PLCI; CAPImsg.ncci = 0; if (accept) { CAPImsg.WriteInt16(0); } else { CAPImsg.WriteInt16(2); } ushort len_pos = CAPImsg.offset; CAPImsg.offset++; CAPImsg.WriteInt16((short)B1.B1); CAPImsg.WriteInt16((short)B2.B2); CAPImsg.WriteInt16((short)B3.B3); CAPImsg.WriteByte(0); //b1 conf default CAPImsg.WriteByte(0); //b2 conf default CAPImsg.WriteByte(0); //b3 conf defautl ushort act_pos = CAPImsg.offset; CAPImsg.offset = len_pos; CAPImsg.WriteByte((byte)(act_pos - len_pos)); CAPImsg.offset = act_pos; CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.length = 28; TInterfaceError ret = CAPI_PUT_MESSAGE(app_ID, CAPImsg.uMessagePtr); info = (uint)ret; return(ret == TInterfaceError.SUCCESS); }
/// <summary> /// Sets all the parameters and sends CONNECT_B3_REQ message to CAPI message queue /// </summary> /// <param name="CAPImsg">Message to send</param> /// <param name="controller">Number of controller</param> /// <param name="PLCI">Physical Link Connection Identifier</param> /// <param name="info">Result code</param> /// <returns>True if success, otherwise false</returns> public static bool Send_msg_connect_b3_req(ref CAPI_Message CAPImsg, byte controller, byte PLCI, out uint info) { CAPImsg.reset_offset(); CAPImsg.appID = (short)app_ID; CAPImsg.sub_com = comsub.CONNECT_B3_REQ; CAPImsg.controller = controller; CAPImsg.plci = PLCI; CAPImsg.ncci = 0; CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.WriteByte(0); CAPImsg.length = 13; TInterfaceError ret = CAPI_PUT_MESSAGE(app_ID, CAPImsg.uMessagePtr); info = (uint)ret; return(ret == TInterfaceError.SUCCESS); }
/// <summary> /// Sets all the parameters and sends CONNECT_REQ message to CAPI message queue /// </summary> /// <param name="CAPImsg">Message to send</param> /// <param name="tel">Called party number</param> /// <param name="controller">Number of controller</param> /// <param name="CIP">Compatibilty Information Profile</param> /// <param name="B1">B1 protocol configuration</param> /// <param name="B2">B2 protocol configuration</param> /// <param name="B3">B3 protocol configuration</param> /// <param name="connect_ident">Any number to distinguish from connections</param> /// <param name="info">Result code</param> /// <returns>True if success, otherwise false</returns> public static bool Send_msg_connect_req(ref CAPI_Message CAPImsg, string tel, byte controller, CIP_Value CIP, IB1_Proto B1, IB2_Proto B2, IB3_Proto B3, short connect_ident, out uint info) { CAPImsg.reset_offset(); CAPImsg.appID = (short)app_ID; CAPImsg.sub_com = comsub.CONNECT_REQ; CAPImsg.controller = controller; CAPImsg.number = connect_ident; CAPImsg.plci = 0; CAPImsg.ncci = 0; CAPImsg.WriteInt16((short)CIP); CAPImsg.WriteTelNum(tel); CAPImsg.WriteByte(0); //calling part no CAPImsg.WriteByte(0); //called party subadd CAPImsg.WriteByte(0); //calling party subadd CAPImsg.Start_block(); CAPImsg.WriteInt16((short)B1.B1); CAPImsg.WriteInt16((short)B2.B2); CAPImsg.WriteInt16((short)B3.B3); B1.Set_param(CAPImsg); B2.Set_param(CAPImsg); B3.Set_param(CAPImsg); CAPImsg.End_block(); //BC CAPImsg.WriteByte(0); //LLC CAPImsg.WriteByte(0); //HLC CAPImsg.WriteByte(0); CAPImsg.Start_block(); CAPImsg.Start_block(); //B channel info CAPImsg.WriteInt16(0); CAPImsg.End_block(); CAPImsg.WriteInt16(0); CAPImsg.WriteByte(0); CAPImsg.End_block(); CAPImsg.length = (short)((CAPImsg.offset)); TInterfaceError ret = CAPI_PUT_MESSAGE(app_ID, CAPImsg.uMessagePtr); info = (uint)ret; return(ret == TInterfaceError.SUCCESS); }