@Test public void testParseCrcxRequestWithSdp() throws MgcpParseException { StringBuilder builder = new StringBuilder(); builder.append("CRCX 147483655 mobicents/bridge/1@127.0.0.1:2427 MGCP 1.0").append(System.lineSeparator()); builder.append("C:1").append(System.lineSeparator()); builder.append("M:sendrecv").append(System.lineSeparator()); builder.append("N:restcomm@127.0.0.1:2727").append(System.lineSeparator()); builder.append("L:webrtc:false").append(System.lineSeparator()); builder.append(System.lineSeparator()); StringBuilder builderSdp = new StringBuilder(); builderSdp.append("v=0").append(System.lineSeparator()); builderSdp.append("o=hrosa 3616 1899 IN IP4 127.0.0.1").append(System.lineSeparator()); builderSdp.append("s=Talk").append(System.lineSeparator()); builderSdp.append("c=IN IP4 127.0.0.1").append(System.lineSeparator()); builderSdp.append("t=0 0").append(System.lineSeparator()); builderSdp.append("a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics") .append(System.lineSeparator()); builderSdp.append("m=audio 7070 RTP/AVP 8 0 101").append(System.lineSeparator()); builderSdp.append("a=rtpmap:101 telephone-event/8000"); builder.append(builderSdp.toString()); MgcpMessageParser parser = new MgcpMessageParser(); MgcpRequest request = parser.parseRequest(builder.toString()); assertEquals(MgcpRequestType.CRCX, request.getRequestType()); assertEquals(147483655, request.getTransactionId()); assertEquals("mobicents/bridge/1@127.0.0.1:2427", request.getEndpointId()); assertEquals("1", request.getParameter(MgcpParameterType.CALL_ID)); assertEquals("sendrecv", request.getParameter(MgcpParameterType.MODE)); assertEquals("restcomm@127.0.0.1:2727", request.getParameter(MgcpParameterType.NOTIFIED_ENTITY)); assertEquals("webrtc:false", request.getParameter(MgcpParameterType.LOCAL_CONNECTION_OPTIONS)); assertTrue(request.isSdpDetected()); assertEquals(builderSdp.toString(), request.getParameter(MgcpParameterType.SDP)); }
public MgcpRequest parseRequest(byte[] data, int offset, int length) throws MgcpParseException { return parseRequest(new String(data, offset, length)); }
MgcpMessageParser { public MgcpRequest parseRequest(byte[] data, int offset, int length) throws MgcpParseException { return parseRequest(new String(data, offset, length)); } }
MgcpMessageParser { public MgcpRequest parseRequest(byte[] data, int offset, int length) throws MgcpParseException { return parseRequest(new String(data, offset, length)); } MgcpMessageParser(); }
MgcpMessageParser { public MgcpRequest parseRequest(byte[] data, int offset, int length) throws MgcpParseException { return parseRequest(new String(data, offset, length)); } MgcpMessageParser(); MgcpRequest parseRequest(byte[] data, int offset, int length); MgcpRequest parseRequest(String message); MgcpResponse parseResponse(byte[] data, int offset, int length); MgcpResponse parseResponse(String message); }
MgcpMessageParser { public MgcpRequest parseRequest(byte[] data, int offset, int length) throws MgcpParseException { return parseRequest(new String(data, offset, length)); } MgcpMessageParser(); MgcpRequest parseRequest(byte[] data, int offset, int length); MgcpRequest parseRequest(String message); MgcpResponse parseResponse(byte[] data, int offset, int length); MgcpResponse parseResponse(String message);  }