public String encodeEventName(EventName e) { StringBuffer s = new StringBuffer(""); s.append(e.getPackageName().toString()).append('/').append(e.getEventIdentifier().getName()); if (e.getConnectionIdentifier() != null) { s.append(AMPERSAND).append(e.getConnectionIdentifier().toString()); } if (e.getEventIdentifier().getParms() != null) { s.append('(').append(e.getEventIdentifier().getParms()).append(')'); } return s.toString(); }
public static int encode(byte[] destination,int offset,EventName eventName) { int totalLength=PackageNameHandler.encode(destination,offset,eventName.getPackageName()); destination[offset+totalLength]=StringFunctions.SLASH_BYTE; totalLength++; byte[] nameBytes=eventName.getEventIdentifier().getName().getBytes(); System.arraycopy(nameBytes, 0, destination, offset+totalLength, nameBytes.length); totalLength+=nameBytes.length; if(eventName.getConnectionIdentifier()!=null) { destination[offset+totalLength]=StringFunctions.AT_BYTE; totalLength++; byte[] connectionBytes=eventName.getConnectionIdentifier().toString().getBytes(); System.arraycopy(connectionBytes, 0, destination, offset+totalLength, connectionBytes.length); totalLength+=connectionBytes.length; } return totalLength; }
public static int encode(byte[] destination,int offset,EventName eventName) { int totalLength=PackageNameHandler.encode(destination,offset,eventName.getPackageName()); destination[offset+totalLength]=StringFunctions.SLASH_BYTE; totalLength++; byte[] nameBytes=eventName.getEventIdentifier().getName().getBytes(); System.arraycopy(nameBytes, 0, destination, offset+totalLength, nameBytes.length); totalLength+=nameBytes.length; if(eventName.getConnectionIdentifier()!=null) { destination[offset+totalLength]=StringFunctions.AT_BYTE; totalLength++; byte[] connectionBytes=eventName.getConnectionIdentifier().toString().getBytes(); System.arraycopy(connectionBytes, 0, destination, offset+totalLength, connectionBytes.length); totalLength+=connectionBytes.length; } return totalLength; }
public String encodeRequestedEvent(RequestedEvent evt) { StringBuffer s = new StringBuffer((evt.getEventName().getPackageName()).toString()).append("/").append( evt.getEventName().getEventIdentifier().getName()); if (evt.getEventName().getConnectionIdentifier() != null) { s.append(AMPERSAND).append(evt.getEventName().getConnectionIdentifier().toString()); } String parms = evt.getEventName().getEventIdentifier().getParms(); RequestedAction[] actions = evt.getRequestedActions(); if (actions != null) { String ac = encodeRequestedActions(actions); s.append(" (").append(ac).append(")"); } if (parms != null) { s.append(" (").append(parms).append(")"); } return s.toString(); }
public void onNotifyRequest(Notify event, ActivityContextInterface aci) { logger.info("onNotifyRequest"); NotificationRequestResponse response = new NotificationRequestResponse(event.getSource(), ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(event.getTransactionHandle()); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { response }); EventName[] observedEvents = event.getObservedEvents(); for (EventName observedEvent : observedEvents) { switch (observedEvent.getEventIdentifier().intValue()) { case MgcpEvent.REPORT_ON_COMPLETION: logger.info("Announcemnet Completed NTFY received"); break; case MgcpEvent.REPORT_FAILURE: logger.info("Announcemnet Failed received"); // TODO : Send DLCX and Send BYE to UA break; default: //MGCP RI expects D/dtmfX, but correct is D/X ... hence it fails to match on //MgcpEvent.DTMF_X .... Thus event ID is wrong.... if(observedEvent.getPackageName().toString().equals("D")) { int decodedId = decodeDTMF(observedEvent); processDTMF(decodedId); } } } }
if(observedEvent.getPackageName().toString().equals("D"))