@Override public String encode(JainMgcpCommandEvent event) { Utils utils = utilsFactory.allocate(); NotificationRequest req = (NotificationRequest) event; StringBuffer buffer = new StringBuffer(); buffer.append("RQNT ").append(event.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( req.getEndpointIdentifier()).append(SINGLE_CHAR_SPACE).append(MGCP_VERSION).append(NEW_LINE); if (req.getNotifiedEntity() != null) { buffer.append("N:").append(req.getNotifiedEntity()).append(NEW_LINE); } buffer.append("X:").append(req.getRequestIdentifier()).append(NEW_LINE); if (req.getDigitMap() != null) { buffer.append("D:").append(req.getDigitMap()).append(NEW_LINE); } if (req.getSignalRequests() != null) { buffer.append("S:").append(utils.encodeEventNames(req.getSignalRequests())).append(NEW_LINE); } if (req.getRequestedEvents() != null) { buffer.append("R:").append(utils.encodeRequestedEvents(req.getRequestedEvents())).append(NEW_LINE); } if (req.getDetectEvents() != null) { buffer.append("T:").append(utils.encodeEventNames(req.getDetectEvents())).append(NEW_LINE); } utilsFactory.deallocate(utils); return buffer.toString(); }
@Override public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new NotificationRequest(source != null ? source : stack, endpoint, new RequestIdentifier("0")); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { e.printStackTrace(); throw new ParseException(e.getMessage(), -1); } NotifiedEntity notifiedEntity = command.getNotifiedEntity(); if (command.getNotifiedEntity() != null) this.stack.provider.setNotifiedEntity(notifiedEntity); return command; }
@Override public JainMgcpCommandEvent decodeCommand(String message) throws ParseException { Utils utils = utilsFactory.allocate(); MgcpMessageParser parser = new MgcpMessageParser(new CommandContentHandle(utils)); try { parser.parse(message); } catch (Exception e) { throw new ParseException(e.getMessage(), -1); } finally { utilsFactory.deallocate(utils); } NotifiedEntity notifiedEntity = command.getNotifiedEntity(); if (command.getNotifiedEntity() != null) { this.stack.provider.setNotifiedEntity(notifiedEntity); } return command; }
@Override public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new NotificationRequest(source != null ? source : stack, endpoint, new RequestIdentifier("0")); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { e.printStackTrace(); throw new ParseException(e.getMessage(), -1); } NotifiedEntity notifiedEntity = command.getNotifiedEntity(); if (command.getNotifiedEntity() != null) this.stack.provider.setNotifiedEntity(notifiedEntity); return command; }
array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,evt.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE;
array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,evt.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE;
if (this.endpointId.equals(nRequest.getEndpointIdentifier().toString())) { processRequestedEvents(nRequest.getNotifiedEntity(), nRequest.getRequestedEvents()); } else if (isWildCardEndpointName(nRequest.getEndpointIdentifier().toString())) {