Revision: 16340
Author: [email protected]
Date: Wed Jan 12 05:10:30 2011
Log: Remove unused code
http://code.google.com/p/mobicents/source/detail?r=16340
Modified:
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/AuditEndpointAction.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/ConnectionActivity.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/EndpointActivity.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/MgcpController.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/NotificationRequestAction1.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/Play.java
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/PlayCollect.java
/trunk/servers/media/core/controllers/mgcp/src/test/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/OptionsTest.java
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/AuditEndpointAction.java
Thu Dec 30 23:53:06 2010
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/AuditEndpointAction.java
Wed Jan 12 05:10:30 2011
@@ -3,14 +3,10 @@
import jain.protocol.ip.mgcp.JainMgcpResponseEvent;
import jain.protocol.ip.mgcp.message.AuditEndpoint;
import jain.protocol.ip.mgcp.message.AuditEndpointResponse;
-import jain.protocol.ip.mgcp.message.parms.ConnectionIdentifier;
import jain.protocol.ip.mgcp.message.parms.EndpointIdentifier;
import jain.protocol.ip.mgcp.message.parms.InfoCode;
-import jain.protocol.ip.mgcp.message.parms.ReasonCode;
-import jain.protocol.ip.mgcp.message.parms.RestartMethod;
import jain.protocol.ip.mgcp.message.parms.ReturnCode;
-import java.util.Collection;
import java.util.concurrent.Callable;
import org.apache.log4j.Level;
@@ -25,168 +21,162 @@
*/
public class AuditEndpointAction implements Callable {
- private AuditEndpoint auep;
- private MgcpController controller;
-
- private String domainName = null;
-
- private static Logger logger = Logger
- .getLogger(AuditConnectionAction.class);
-
- protected AuditEndpointAction(MgcpController controller, AuditEndpoint
req) {
- this.controller = controller;
- this.auep = req;
-
- this.domainName = controller.getBindAddress() + ":"
- + controller.getPort();
- }
-
- public JainMgcpResponseEvent call() throws Exception {
- InfoCode[] infCodes = auep.getRequestedInfo();
- int txID = auep.getTransactionHandle();
- String localName =
auep.getEndpointIdentifier().getLocalEndpointName();
-
- if (logger.isDebugEnabled()) {
- logger.debug("AUEP Request TX= " + txID + ", endpt ="
- + auep.getEndpointIdentifier());
- StringBuffer s = new StringBuffer();
- for (InfoCode infCd : infCodes) {
- s.append(infCd.toString());
- s.append(",");
- }
- logger.debug("InfoCode[] = " + s.toString());
- }
-
- if (localName.contains("$")) {
- if (logger.isEnabledFor(Level.WARN)) {
- logger
- .warn("TX = "
- + txID
- + ", The endpoint name is underspecified with 'any' wildcard,
Response code: "
- +
ReturnCode.ENDPOINT_UNKNOWN);
- }
- return new AuditEndpointResponse(auep.getSource(),
- ReturnCode.Endpoint_Unknown);
- }
-
- Endpoint[] endpoints = null;
- if (localName.contains("*")) {
- // retrieve all Endpoints that match this localName and return back the
AUEP Response. Ignore the InfoCode[]
- // if any passed.
- // lookup endpoints
- try {
- endpoints =
controller.getServer().lookupall(localName);
- } catch (ResourceUnavailableException e) {
- if (logger.isEnabledFor(Level.ERROR)) {
- logger.error("TX = " + txID
- + ", There is no free
endpoint: " + localName
- + ", ResponseCode: " +
ReturnCode.ENDPOINT_UNKNOWN);
- }
- return new
AuditEndpointResponse(auep.getSource(),
- ReturnCode.Endpoint_Unknown);
- }
-
- if (endpoints == null) {
- return new
AuditEndpointResponse(auep.getSource(),
- ReturnCode.Endpoint_Unknown);
- }
-
- EndpointIdentifier[] endpointIdentifierList = new
EndpointIdentifier[endpoints.length];
- for (int i = 0; i < endpoints.length; i++) {
- endpointIdentifierList[i] = new
EndpointIdentifier(endpoints[i]
- .getLocalName(),
this.domainName);
- }
-
- return new AuditEndpointResponse(auep.getSource(),
-
ReturnCode.Transaction_Executed_Normally,
- endpointIdentifierList);
- }
-
- Endpoint endpoint = null;
- // Audit specific endpoint.
- try {
- endpoint = controller.getServer().lookup(localName,
true);
- } catch (ResourceUnavailableException e) {
- if (logger.isEnabledFor(Level.ERROR)) {
- logger.error("TX = " + txID + ", There is no free
endpoint: "
- + localName + ", ResponseCode: "
- + ReturnCode.ENDPOINT_UNKNOWN);
- }
- return new AuditEndpointResponse(auep.getSource(),
- ReturnCode.Endpoint_Unknown);
- }
- AuditEndpointResponse auepResp = new
AuditEndpointResponse(auep.getSource(),
- ReturnCode.Transaction_Executed_Normally);
- if (infCodes != null) {
-
- Request request =
controller.requests.get(endpoint.getLocalName());
-
- for (InfoCode infoCode : infCodes) {
- switch (infoCode.getInfoCode()) {
- case InfoCode.REQUESTED_EVENTS:
- if(request!=null){
-
auepResp.setRequestedEvents(request.getRequestedEvents());
- }
- break;
- case InfoCode.DIGIT_MAP :
- //TODO : Digit Map is not yet
implemented
- break;
- case InfoCode.SIGNAL_REQUESTS :
- if(request!=null){
-
auepResp.setSignalRequests(request.getSignalRequests());
- }
- break;
- case InfoCode.REQUEST_IDENTIFIER:
- if(request!=null){
-
auepResp.setRequestIdentifier(request.getRequestIdentifier());
- }
- break;
- case InfoCode.QUARANTINE_HANDLING :
- //Not implemented
- break;
- case InfoCode.DETECT_EVENTS :
- //TODO : Need to have reference to
Detected Events
- break;
- case InfoCode.NOTIFIED_ENTITY :
-
auepResp.setNotifiedEntity(this.controller.getNotifiedEntity());
- break;
- case InfoCode.CONNECTION_IDENTIFIER :
-/* Collection<ConnectionActivity> connActivities =
this.controller.getActivities(endpoint.getLocalName());
- if(connActivities.size() > 0 ){
- ConnectionIdentifier[] connIdArr = new
ConnectionIdentifier[connActivities.size()];
- int count=0;
- for(ConnectionActivity connAct
: connActivities){
- connIdArr[count++] =
new ConnectionIdentifier(connAct.getID());
- }
-
auepResp.setConnectionIdentifiers(connIdArr);
- }
- */
- break;
- case InfoCode.OBSERVED_EVENTS :
- //TODO : Need to have reference to
Observed Events for an Endpoint
- break;
- case InfoCode.EVENT_STATES :
- //TODO : Events don't maintain states.
- break;
- case InfoCode.BEARER_INFORMATION :
- //TODO : Bearer Information is not
implemented
- break;
- case InfoCode.RESTART_METHOD :
-
auepResp.setRestartMethod(RestartMethod.Restart);
- break;
- case InfoCode.RESTART_DELAY :
- auepResp.setRestartDelay(0);
- break;
- case InfoCode.REASON_CODE :
-
auepResp.setReasonCode(ReasonCode.Endpoint_State_Is_Nominal);
- break;
- case InfoCode.CAPABILITIES :
- //TODO:
- break;
- }
- }
- }
- return auepResp;
- }
-
-}
+ private AuditEndpoint auep;
+ private MgcpController controller;
+ private String domainName = null;
+ private static Logger logger =
Logger.getLogger(AuditConnectionAction.class);
+
+ protected AuditEndpointAction(MgcpController controller, AuditEndpoint
req) {
+ this.controller = controller;
+ this.auep = req;
+
+ this.domainName = controller.getBindAddress() + ":"
+ + controller.getPort();
+ }
+
+ public JainMgcpResponseEvent call() throws Exception {
+ InfoCode[] infCodes = auep.getRequestedInfo();
+ int txID = auep.getTransactionHandle();
+ String localName =
auep.getEndpointIdentifier().getLocalEndpointName();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("AUEP Request TX= " + txID + ", endpt ="
+ + auep.getEndpointIdentifier());
+ StringBuffer s = new StringBuffer();
+ for (InfoCode infCd : infCodes) {
+ s.append(infCd.toString());
+ s.append(",");
+ }
+ logger.debug("InfoCode[] = " + s.toString());
+ }
+
+ if (localName.contains("$")) {
+ if (logger.isEnabledFor(Level.WARN)) {
+ logger.warn("TX = "
+ + txID
+ + ", The endpoint name is underspecified
with 'any' wildcard, Response code: "
+ + ReturnCode.ENDPOINT_UNKNOWN);
+ }
+ return new AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Endpoint_Unknown);
+ }
+
+ Endpoint[] endpoints = null;
+ if (localName.contains("*")) {
+ // retrieve all Endpoints that match this localName and return
back the AUEP Response. Ignore the InfoCode[]
+ // if any passed.
+ // lookup endpoints
+ try {
+ endpoints = controller.getServer().lookupall(localName);
+ } catch (ResourceUnavailableException e) {
+ if (logger.isEnabledFor(Level.ERROR)) {
+ logger.error("TX = " + txID
+ + ", There is no free endpoint: " + localName
+ + ", ResponseCode: " +
ReturnCode.ENDPOINT_UNKNOWN);
+ }
+ return new AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Endpoint_Unknown);
+ }
+
+ if (endpoints == null) {
+ return new AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Endpoint_Unknown);
+ }
+
+ EndpointIdentifier[] endpointIdentifierList = new
EndpointIdentifier[endpoints.length];
+ for (int i = 0; i < endpoints.length; i++) {
+ endpointIdentifierList[i] = new
EndpointIdentifier(endpoints[i].getLocalName(), this.domainName);
+ }
+
+ return new AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Transaction_Executed_Normally,
+ endpointIdentifierList);
+ }
+
+ Endpoint endpoint = null;
+ // Audit specific endpoint.
+ try {
+ endpoint = controller.getServer().lookup(localName, true);
+ } catch (ResourceUnavailableException e) {
+ if (logger.isEnabledFor(Level.ERROR)) {
+ logger.error("TX = " + txID + ", There is no free
endpoint: "
+ + localName + ", ResponseCode: "
+ + ReturnCode.ENDPOINT_UNKNOWN);
+ }
+ return new AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Endpoint_Unknown);
+ }
+ AuditEndpointResponse auepResp = new
AuditEndpointResponse(auep.getSource(),
+ ReturnCode.Transaction_Executed_Normally);
+ if (infCodes != null) {
+
+/* Request request =
controller.requests.get(endpoint.getLocalName());
+
+ for (InfoCode infoCode : infCodes) {
+ switch (infoCode.getInfoCode()) {
+ case InfoCode.REQUESTED_EVENTS:
+ if (request != null) {
+
auepResp.setRequestedEvents(request.getRequestedEvents());
+ }
+ break;
+ case InfoCode.DIGIT_MAP:
+ //TODO : Digit Map is not yet implemented
+ break;
+ case InfoCode.SIGNAL_REQUESTS:
+ if (request != null) {
+
auepResp.setSignalRequests(request.getSignalRequests());
+ }
+ break;
+ case InfoCode.REQUEST_IDENTIFIER:
+ if (request != null) {
+
auepResp.setRequestIdentifier(request.getRequestIdentifier());
+ }
+ break;
+ case InfoCode.QUARANTINE_HANDLING:
+ //Not implemented
+ break;
+ case InfoCode.DETECT_EVENTS:
+ //TODO : Need to have reference to Detected Events
+ break;
+ case InfoCode.NOTIFIED_ENTITY:
+
auepResp.setNotifiedEntity(this.controller.getNotifiedEntity());
+ break;
+ case InfoCode.CONNECTION_IDENTIFIER:
+ Collection<ConnectionActivity> connActivities
= this.controller.getActivities(endpoint.getLocalName());
+ if(connActivities.size() > 0 ){
+ ConnectionIdentifier[] connIdArr = new
ConnectionIdentifier[connActivities.size()];
+ int count=0;
+ for(ConnectionActivity connAct : connActivities){
+ connIdArr[count++] = new
ConnectionIdentifier(connAct.getID());
+ }
+ auepResp.setConnectionIdentifiers(connIdArr);
+ }
+
+ break;
+ case InfoCode.OBSERVED_EVENTS:
+ //TODO : Need to have reference to Observed Events
for an Endpoint
+ break;
+ case InfoCode.EVENT_STATES:
+ //TODO : Events don't maintain states.
+ break;
+ case InfoCode.BEARER_INFORMATION:
+ //TODO : Bearer Information is not implemented
+ break;
+ case InfoCode.RESTART_METHOD:
+ auepResp.setRestartMethod(RestartMethod.Restart);
+ break;
+ case InfoCode.RESTART_DELAY:
+ auepResp.setRestartDelay(0);
+ break;
+ case InfoCode.REASON_CODE:
+
auepResp.setReasonCode(ReasonCode.Endpoint_State_Is_Nominal);
+ break;
+ case InfoCode.CAPABILITIES:
+ //TODO:
+ break;
+ }
+ } */
+ }
+ return auepResp;
+ }
+}
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/ConnectionActivity.java
Sun Jan 9 03:46:44 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/ConnectionActivity.java
Wed Jan 12 05:10:30 2011
@@ -104,7 +104,6 @@
ConnectionIdentifier connectionID = new
ConnectionIdentifier(this.getID());
DeleteConnection dlcx = new DeleteConnection(controller, callId,
endpointId, connectionID);
- dlcx.setTransactionHandle(Request.txID++);
dlcx.setConnectionParms(parms);
ExtendedJainMgcpProvider extendedMgcpProvider =
controller.getExtendedMgcpProvider();
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/EndpointActivity.java
Sun Jan 9 03:46:44 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/EndpointActivity.java
Wed Jan 12 05:10:30 2011
@@ -89,11 +89,9 @@
notify.setTransactionHandle(controller.nextID());
notify.setRequestIdentifier(requestID);
controller.getMgcpProvider().sendMgcpEvents(new JainMgcpEvent[] {
notify });
- logger.info("Notify " + notify);
}
public void completed() {
- logger.info("Recycling request executor: " +
endpoint.getLocalName());
requestExecutor.cancel();
requestExecutor.recycle();
this.requestExecutor = null;
@@ -121,7 +119,6 @@
public void terminate() {
if (requestExecutor != null) {
- logger.info("Recycling request executor: " +
endpoint.getLocalName());
requestExecutor.cancel();
requestExecutor.recycle();
}
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/MgcpController.java
Sun Jan 9 03:46:44 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/MgcpController.java
Wed Jan 12 05:10:30 2011
@@ -34,14 +34,11 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.HashMap;
import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
import javolution.util.FastMap;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.mobicents.media.server.ctrl.mgcp.evt.MgcpPackage;
import org.mobicents.media.server.ctrl.mgcp.signal.RequestExecutor;
import org.mobicents.media.server.ctrl.mgcp.signal.RequestExecutors;
import org.mobicents.media.server.spi.MediaServer;
@@ -69,9 +66,6 @@
private MediaServer server;
private FastMap<String, Call> calls = new FastMap<String, Call>();
- protected HashMap<String, MgcpPackage> packages = new HashMap();
-
- protected ConcurrentHashMap<String, Request> requests = new
ConcurrentHashMap();
private NotifiedEntity notifiedEntity;
private RequestExecutors requestExecutors;
@@ -132,19 +126,6 @@
public void create() {
logger.info("Starting MGCP Controller module for MMS");
}
-
- public void addPackage(MgcpPackage pkg) {
- pkg.setController(this);
- packages.put(pkg.getName(), pkg);
- }
-
- public void removePackage(MgcpPackage pkg) {
- packages.remove(pkg);
- }
-
- public MgcpPackage getPackage(String name) {
- return packages.get(name);
- }
/**
* Starts MGCP controller.
@@ -180,7 +161,6 @@
try {
mgcpStack.deleteProvider(mgcpProvider);
} catch (DeleteProviderException e) {
- e.printStackTrace();
}
}
@@ -210,15 +190,6 @@
return requestExecutors.poll();
}
-/* protected EndpointActivity getActivity(Endpoint endpoint,
EndpointIdentifier endpointID) throws Exception {
- if (endpoints.containsKey(endpoint.getLocalName())) {
- return endpoints.get(endpoint.getLocalName());
- }
-
- EndpointActivity activity = new EndpointActivity(this, endpoint,
endpointID);
- return activity;
- }
- */
/**
* Processes a Command Event object received from a JainMgcpProvider.
*
@@ -260,13 +231,9 @@
try {
JainMgcpResponseEvent response = action.call();
mgcpProvider.sendMgcpEvents(new JainMgcpEvent[]{response});
-// logger.info(String.format("Created %d (expected %d),
Deleted %s (expected %d)", crcxCount, crcxReqCount, dlcxCount,
dlcxReqCount));
} catch (Exception e) {
- if (logger.isEnabledFor(Level.ERROR)) {
- logger.error("Unexpected error during processing,Caused
by ", e);
- }
- }
-
+ logger.warn("Unexpected error during processing,Caused by ",
e);
+ }
}
/**
@@ -279,46 +246,6 @@
public void processMgcpResponseEvent(JainMgcpResponseEvent evt) {
}
-/* protected Call getCall(String callID) {
- return calls.get(callID);
- }
-
- protected void addCall(Call call) {
- calls.put(call.getID(), call);
- }
-
- protected void removeCall(String callID) {
- calls.remove(callID);
- }
-
- protected void removeCall(Call c) {
- calls.remove(c.getID());
- }
-
- protected Collection<ConnectionActivity> getActivities(String
endpointName) {
- ArrayList<ConnectionActivity> list = new
ArrayList<ConnectionActivity>();
- Collection<Call> l = calls.values();
- for (Call call : l) {
- Collection<ConnectionActivity> activities =
call.getActivities();
- for (ConnectionActivity a : activities) {
- if
(a.getMediaConnection().getEndpoint().getLocalName().equals(endpointName)) {
- list.add(a);
- }
- }
- }
- return list;
- }
-
- protected ConnectionActivity getActivity(String endpointName, String
connectionID) {
- Collection<ConnectionActivity> activities =
this.getActivities(endpointName);
- for (ConnectionActivity a : activities) {
- if (a.getID().equals(connectionID)) {
- return a;
- }
- }
- return null;
- }
-*/
public int nextID() {
if (GENERATOR == Integer.MAX_VALUE) GENERATOR = 0;
return ++GENERATOR;
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/NotificationRequestAction1.java
Sat Jan 8 01:33:59 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/NotificationRequestAction1.java
Wed Jan 12 05:10:30 2011
@@ -87,33 +87,32 @@
logger.warn("Request to unknown endpoint: " +
endpointID.getLocalEndpointName());
return reject(ReturnCode.Endpoint_Unknown);
}
+
+ RequestedEvent[] events = req.getRequestedEvents();
+ EventName[] signals = req.getSignalRequests();
+
+ boolean emptyRequest =
+ (events == null || events.length == 0) &&
+ (signals == null || signals.length == 0);
EndpointActivity activity = null;
try {
activity =
controller.activities.getEndpointActivity(endpointID);
activity.attach(endpoint);
+ if (emptyRequest) {
+ activity.terminate();
+ response = new NotificationRequestResponse(this,
ReturnCode.Transaction_Executed_Normally);
+ response.setTransactionHandle(req.getTransactionHandle());
+
+ logger.info("Response TX = " +
response.getTransactionHandle() + ", Response: " +
response.getReturnCode());
+ return response;
+ }
activity.setController(controller);
} catch (Exception e) {
return reject(ReturnCode.Insufficient_Resources_Now);
}
- RequestedEvent[] events = req.getRequestedEvents();
- EventName[] signals = req.getSignalRequests();
-
- boolean emptyRequest =
- (events == null || events.length == 0) &&
- (signals == null || signals.length == 0);
-
- if (emptyRequest) {
- activity.terminate();
- response = new NotificationRequestResponse(this,
ReturnCode.Transaction_Executed_Normally);
- response.setTransactionHandle(req.getTransactionHandle());
-
- logger.info("Response TX = " + response.getTransactionHandle()
+ ", Response: " + response.getReturnCode());
- return response;
- }
-
-
+
try {
activity.accept(callAgent, requestID, events, signals);
} catch (UnknownPackageException e) {
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/Play.java
Sun Jan 9 03:46:44 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/Play.java
Wed Jan 12 05:10:30 2011
@@ -30,7 +30,6 @@
import org.mobicents.media.server.spi.player.Player;
import org.mobicents.media.server.spi.player.PlayerEvent;
import org.mobicents.media.server.spi.player.PlayerListener;
-import org.mobicents.media.server.spi.events.NotifyEvent;
import org.mobicents.media.server.spi.listener.TooManyListenersException;
/**
@@ -44,7 +43,7 @@
private EventName of = new EventName(PackageName.factory("AU"),
MgcpEvent.factory("of"));
private Player player;
- private Options options;
+ private volatile Options options;
private int repeatCount;
private String uri;
@@ -88,9 +87,8 @@
//set initial offset
player.setMediaTime(options.getOffset());
-
-
- logger.info("Starting player...");
+ player.setInitialDelay(0);
+
player.start();
}
@@ -113,31 +111,6 @@
player.stop();
}
}
-
- public void update(NotifyEvent event) {
- switch (event.getEventID()) {
- case NotifyEvent.COMPLETED :
- repeatCount--;
-
- if (repeatCount > 0) {
- repeat(options.getInterval());
- return;
- }
-
- if (options.hasMoreSegments()) {
- next(options.getInterval());
- return;
- }
-
- this.sendEvent(oc);
- this.complete();
- break;
- case NotifyEvent.RX_FAILED :
- case NotifyEvent.TX_FAILED :
- this.sendEvent(of);
- this.complete();
- }
- }
private Player getPlayer() {
if (getTrigger().getConnectionIdentifier() == null) {
@@ -148,7 +121,6 @@
String connectionID =
getTrigger().getConnectionIdentifier().toString();
Connection connection = getConnection(connectionID);
- logger.info("Connection = " + connection);
if (connection == null) {
return null;
}
@@ -166,6 +138,7 @@
super.reset();
if (player != null) {
player.removeListener(this);
+ player.stop();
}
}
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/PlayCollect.java
Sun Jan 9 03:46:44 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/main/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/PlayCollect.java
Wed Jan 12 05:10:30 2011
@@ -96,7 +96,6 @@
}
//get options of the request
- logger.info("Requested options: " +
getTrigger().getEventIdentifier().getParms());
options = new
Options(getTrigger().getEventIdentifier().getParms());
if (options.getDigitPattern() != null) {
@@ -116,7 +115,6 @@
return;
}
- logger.info("Starting player...");
player.start();
}
@@ -200,7 +198,6 @@
@Override
public void reset() {
- logger.info("Deregistering all listeners");
super.reset();
if (player != null) {
player.removeListener(this);
@@ -212,14 +209,12 @@
}
public void patternMatches(int index, String s) {
- logger.info("Sending event=" + s + " pattern index=" + index);
sendEvent(new EventName(PackageName.factory("AU"),
MgcpEvent.factory("oc").withParm("rc=100 dc=" + s + " pi=" + index)));
dtmfDetector.removeListener(buffer);
complete();
}
public void countMatches(String s) {
- logger.info("Sending event=" + s);
sendEvent(new EventName(PackageName.factory("AU"),
MgcpEvent.factory("oc").withParm("rc=100 dc=" + s)));
dtmfDetector.removeListener(buffer);
complete();
=======================================
---
/trunk/servers/media/core/controllers/mgcp/src/test/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/OptionsTest.java
Sat Jan 8 01:33:59 2011
+++
/trunk/servers/media/core/controllers/mgcp/src/test/java/org/mobicents/media/server/ctrl/mgcp/pkg/au/OptionsTest.java
Wed Jan 12 05:10:30 2011
@@ -45,9 +45,21 @@
* Test of getUri method, of class Options.
*/
@Test
- public void testGetSegments() {
+ public void testGetFirstSegments() {
assertEquals("file", params.next());
}
+
+ @Test
+ public void testSegments() {
+ String s1 = "an=(file1;file2;file3)";
+ Options params = new Options(s1);
+ assertEquals("file1", params.next());
+ assertTrue("Two segments remain", params.hasMoreSegments());
+ assertEquals("file2", params.next());
+ assertTrue("One segments remain", params.hasMoreSegments());
+ assertEquals("file3", params.next());
+ assertFalse("Zero segments remain", params.hasMoreSegments());
+ }
/**
* Test of getDuration method, of class Options.