class MGCPGateway
This class represents a transport connection between the agent and the gateway from the agent's perspective
Fields
int port;
MGCPGateway port
This port should be known to Call Agent
String packetString;
received datagram from the Call Agent
long randomId;
is used as a connection ID.
generated at "CRCX" command from Call Agent
and is checked at "MDCX" and "DLCX" commands whether a connection ID contained in
received packet is the same as one generated at "CRCX" command from Call Agent
ArrayList CommandHeader;
array for containing Command(i.e. "CRCX", "MDCX", "DLCX"), Transaction Id, caller Id and version info
Vector yetAckList;
List which keeps transaction ID waiting an acknowledge from Call Agent and
which is composed of Retransmission objects
Vector transactionIdList;
all transaction IDs which are not acknowledged until now
String CallId, ConnectionId, retConnectionId;
Call Id, connection Id made at "CRCX", received connection Id in "DLCX" and "MDCX" respectively
String Mode;
Communication Mode for example, recvonly for "receive only", sendrecv for "send/receive etc...
Sdp localSDPInformation, remoteSDPInformation;
Local and Remote SDP information
connectionOptions localConnectionOptions;
parameters used by the Call Agent to direct the handling of the connection by the gateway
RTPAgent agent;
JMF RTP Agent
String responseCode, transactionId, responseComment, responseSDP;
information for compose response datagram
boolean connectionEstablished, wrongCommand, received, duplicateId, sameConnId, presentSdp, receivedParameters;
when a "MDCX" or "DLCX" command is received, a connection doesn't exists (connectionEstablished value is false),
replies NOTOK to Call Agent
if wrong command is received, wrongCommand is set true
the same Transaction Id is received, duplicated is true
If Command is "MDCX" and "DLCX", sameConnId should be true
if the datagram contains SDP information, presentSdp is true
when Call Agent sends connection options, receivedParameters is set to true
Methods
public MGCPGateway(int port)
this constructor initializes the port that can receive PDUs from Call Agent.
public synchronized void retransmissionCall (String response)
checks whether the acknowledgement of response which is datagram is received. If not, it retransmit the response
protected void execute ()
this is main method of MGCPGateway
protected DatagramPacket receive (DatagramSocket socket)
receives datagram from Call Agent and returns it
protected void initializeStruct (DatagramPacket Packet)
All data structures are initialized whenever a datagram is received from Call Agent
protected void parseHeader (String packetString)
MGCP header information is parsed based on the command received from MGCP Call Agent
protected void processAck (StringTokenizer headerTokenizer)
This method processes acknowledgement received from Call Agent.
protected void parseParameterSDP()
Parameter and SDP information are parsed in this method
protected void parseParameterL()
Parsing parameters used by the Call Agent to direct the handling of the connection by the gateway
protected void parseSDP()
If SDP information exists within datagram, this is the processing method,
this method is called by parseParameterSDP() if received datagram contains SDP information
protected void callProcessRoutines()
RTP interface methods are called in this method as the command it received
protected String composeResponse()
Compose the response datagram to send to Call Agent
protected void composeHeader()
Compose response header and this method is called by composeResponse()
protected void composeSDP()
Compose the SDP information using information returned by RTP Agent
public void responseToCA (String returnString)
Send the response to Call Agent