public boolean hasConcreteName() { return endpointID.getLocalEndpointName().indexOf("$") < 0; }
public boolean hasConcreteName() { return endpointID.getLocalEndpointName().indexOf("$") < 0; }
public static int encode(byte[] destination,int offset,EndpointIdentifier endpointIdentifier) { int usedLength=0; byte[] name=endpointIdentifier.getLocalEndpointName().getBytes(); System.arraycopy(name, 0, destination, offset, name.length); usedLength=name.length; if(endpointIdentifier.getDomainName() != null) { destination[offset+usedLength]=StringFunctions.AT_BYTE; usedLength++; name=endpointIdentifier.getDomainName().getBytes(); System.arraycopy(name, 0, destination, offset+usedLength, name.length); usedLength+=name.length; } return usedLength; }
public static int encode(byte[] destination,int offset,EndpointIdentifier endpointIdentifier) { int usedLength=0; byte[] name=endpointIdentifier.getLocalEndpointName().getBytes(); System.arraycopy(name, 0, destination, offset, name.length); usedLength=name.length; if(endpointIdentifier.getDomainName() != null) { destination[offset+usedLength]=StringFunctions.AT_BYTE; usedLength++; name=endpointIdentifier.getDomainName().getBytes(); System.arraycopy(name, 0, destination, offset+usedLength, name.length); usedLength+=name.length; } return usedLength; }
public String encodeEndpointIdentifier(EndpointIdentifier e) { String s = e.getLocalEndpointName(); if (e.getDomainName() != null) { s += "@" + e.getDomainName(); } return s; }
@Override public void execute(final Object message) throws Exception { final CreateConnectionResponse response = (CreateConnectionResponse) message; if (connId == null) { connId = response.getConnectionIdentifier(); } localDesc = response.getLocalConnectionDescriptor(); // If the end point ends with a wild card we should update it. if (endpointId.getLocalEndpointName().endsWith("$")) { endpointId = response.getSpecificEndpointIdentifier(); endpoint.tell(new UpdateEndpointId(endpointId), source); } } }
@Override public void execute(final Object message) throws Exception { final CreateConnectionResponse response = (CreateConnectionResponse) message; if (connId == null) { connId = response.getConnectionIdentifier(); } localDesc = response.getLocalConnectionDescriptor(); // If the end point ends with a wild card we should update it. if (endpointId.getLocalEndpointName().endsWith("$")) { endpointId = response.getSpecificEndpointIdentifier(); endpoint.tell(new UpdateEndpointId(endpointId), source); } } }
protected void onDestroyEndpoint(DestroyEndpoint message, ActorRef self, ActorRef sender) { if (!id.getLocalEndpointName().contains("$")) { if (!this.destroying.get()) { if (logger.isInfoEnabled()) { String msg = String.format("About to destroy endoint %s", id); logger.info(msg); } this.destroying.set(true); DeleteConnection dlcx = new DeleteConnection(self, this.id); this.gateway.tell(dlcx, self); // Make sure we don't wait forever getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } } else { this.pendingDestroy.set(true); this.pendingDestroyEndpointSender = sender; this.pendingDestroyEndpointMessage = message; if (logger.isInfoEnabled()) { String msg = String.format("DestroyEndoint %s will be set to pending until previous transaction completes", id); logger.info(msg); } } }
String endpointName = endpointId.getLocalEndpointName(); if (endpointName.endsWith("$")) { final String[] tokens = endpointName.split("/"); connId = new ConnectionIdentifier(buffer.toString()); response.setSecondConnectionIdentifier(connId); endpointName = secondaryEndpointId.getLocalEndpointName(); if (endpointName.endsWith("$")) { final String[] tokens = endpointName.split("/");
String endpointName = endpointId.getLocalEndpointName(); if (endpointName.endsWith("$")) { final String[] tokens = endpointName.split("/"); connEndpointMap.put(connId.toString(), endpointId.getLocalEndpointName()); if (logger.isInfoEnabled()) { String msg = String.format("About to add connId %s for endpoint %s", connId.toString(), endpointId.getLocalEndpointName()); logger.info(msg); monitoringService.tell(new MgcpEndpointAdded(connId.toString(), endpointId.getLocalEndpointName()), self()); monitoringService.tell(new MgcpConnectionAdded(connId.toString(), endpointId.getLocalEndpointName()), self()); response.setSpecificEndpointIdentifier(endpointId); ConnectionIdentifier secondayConnId = new ConnectionIdentifier(buffer.toString()); response.setSecondConnectionIdentifier(secondayConnId); endpointName = secondaryEndpointId.getLocalEndpointName(); if (endpointName.endsWith("$")) { final String[] tokens = endpointName.split("/"); connEndpointMap.put(secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName()); if (logger.isInfoEnabled()) { String msg = String.format("About to add connId %s for secondary endpoint %s associated with endpont %s", secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName(), endpointId.getLocalEndpointName()); logger.info(msg); monitoringService.tell(new MgcpEndpointAdded(connId.toString(), secondaryEndpointId.getLocalEndpointName()), self()); monitoringService.tell(new MgcpConnectionAdded(secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName())); response.setSecondEndpointIdentifier(secondaryEndpointId);
final DeleteConnection dlcx = (DeleteConnection) message; if (dlcx.getConnectionIdentifier() == null) { connEndpointMap.values().removeAll(Collections.singleton(dlcx.getEndpointIdentifier().getLocalEndpointName())); monitoringService.tell(new MgcpConnectionDeleted(null, dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); monitoringService.tell(new MgcpEndpointDeleted(dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); if (logger.isInfoEnabled()) { String msg = String.format("Endpoint deleted %s", dlcx.getEndpointIdentifier().getLocalEndpointName()); logger.info(msg); if (!connEndpointMap.values().contains(dlcx.getEndpointIdentifier().getLocalEndpointName())) { monitoringService.tell(new MgcpEndpointDeleted(dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); if (logger.isInfoEnabled()) { String msg = String.format("Endpoint deleted %s since because there are no more connections related to this endpoint", dlcx.getEndpointIdentifier().getLocalEndpointName()); logger.info(msg);
@Override protected void createConnection (final Object message, final ActorRef sender) { final jain.protocol.ip.mgcp.message.CreateConnection crcx = (jain.protocol.ip.mgcp.message.CreateConnection) message; if(logger.isInfoEnabled()) logger.info("createConnection: " +crcx.toString()); // check if its a conference and call link request if(crcx.getSecondEndpointIdentifier() != null && crcx.getSecondEndpointIdentifier().getLocalEndpointName() != null && crcx.getSecondEndpointIdentifier().getLocalEndpointName().contains("cnf")){ // if yes then fail this connection request if(logger.isInfoEnabled()) logger.info("got conference and call link request, will fail it! with error code Endpoint_Unknown"); StringBuilder buffer = new StringBuilder(); buffer.append(connectionIdPool.get()); ConnectionIdentifier connId = new ConnectionIdentifier(buffer.toString()); sender.tell(new CreateConnectionResponse(self(), ReturnCode.Endpoint_Unknown, connId), self()); }else { // if not then let daddy proceed with existing mocked mechanism. super.createConnection(message, sender); } } }
primaryConnId = response.getConnectionIdentifier(); if (primaryEndpointId.getLocalEndpointName().endsWith("$")) { primaryEndpointId = response.getSpecificEndpointIdentifier(); primaryEndpoint.tell(new UpdateEndpointId(primaryEndpointId), source); secondaryConnId = response.getSecondConnectionIdentifier(); if (secondaryEndpointId.getLocalEndpointName().endsWith("$")) { secondaryEndpointId = response.getSecondEndpointIdentifier(); secondaryEndpoint.tell(new UpdateEndpointId(secondaryEndpointId), source);
@Override public void execute(final Object message) throws Exception { /* Stop the timer. */ final UntypedActorContext context = getContext(); context.setReceiveTimeout(Duration.Undefined()); // Notify the observers. final ConnectionStateChanged event = new ConnectionStateChanged(ConnectionStateChanged.State.CLOSED, connId); for (final ActorRef observer : observers) { observer.tell(event, source); } // Log the state change. log(ConnectionStateChanged.State.CLOSED); // If we timed out log it. if (message instanceof ReceiveTimeout) { String err = String.format( "The media gateway failed to respond in the requested timout period. session: %s | endpointId: %s | requestedConnId: %s | connId: %s", session.id() + "", endpointId == null ? "null" : endpointId.getLocalEndpointName(), requestedConnId, connId); logger.error(err); } } }
String err = String.format( "MGCP Transaction did not executed normally: session: %s | endpointId: %s | requestedConnId: %s | connId: %s", session.id() + "", endpointId == null ? "null" : endpointId.getLocalEndpointName(), requestedConnId, connId); logger.error(err);
System.out.println("MDCX: \n" + mdcx.toString()); if (logger.isInfoEnabled()) { String msg = String.format("Got MDCX for endpoint %s connId %s, mdcx: \n%s", mdcx.getEndpointIdentifier().getLocalEndpointName(), mdcx.getConnectionIdentifier(), mdcx); logger.info(msg);
case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: this.setEndpointName(event.getSpecificEndpointIdentifier().getLocalEndpointName());
case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: this.setEndpointName(event.getSpecificEndpointIdentifier().getLocalEndpointName()); logger.info("***&& " + this.getEndpointName());