if (getSameUser()) {
log.debug("same user, lets play the voice mail");
System.out.println("same user, lets play the voice mail");
MsSignalGenerator generator = msProvider
.getSignalGenerator(endpointName);
try {
ActivityContextInterface generatorActivity = msActivityFactory
.getActivityContextInterface(generator);
generatorActivity.attach(this.getSbbLocalObject());
URL audioFileURL = getClass().getResource(waitingDTMF);
generator.apply(Announcement.PLAY, new String[] { audioFileURL
.toString() });
this.initDtmfDetector(evt.getConnection(), endpointName);
} catch (UnrecognizedActivityException e) {
e.printStackTrace();
}
} else {
log.debug("not the same user, start recording after announcement");
System.out
.println("not the same user, start recording after announcement");
URL audioFileURL = getClass().getResource(recordAfterTone);
ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME);
String fileName = ((SipURI) toHeader.getAddress().getURI())
.getUser()
+ WAV_EXT;
String route = null;
String recordFilePath = null;
try {
Context initCtx = new InitialContext();
Context myEnv = (Context) initCtx.lookup("java:comp/env");
route = (String) myEnv.lookup("filesRoute");
} catch (NamingException nEx) {
log.warn("Lookup of filesRoute env Variable failed", nEx);
}
if (route != null) {
recordFilePath = route + fileName;
} else {
recordFilePath = fileName;
}
String[] params = new String[2];
params[0] = audioFileURL.toString();
params[1] = recordFilePath;
MsSignalGenerator signalGenerator = msProvider
.getSignalGenerator(endpointName);
try {
ActivityContextInterface dtmfAci = msActivityFactory
.getActivityContextInterface(signalGenerator);
dtmfAci.attach(this.getSbbLocalObject());
signalGenerator.apply(AU.PLAY_RECORD, params);
} catch (UnrecognizedActivityException e) {
log.error(e.getMessage(), e);
}
}