Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for DTMF from MediaServer #2418

Merged
merged 2 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,7 @@ else if (is(gathering) || is(continuousGathering) || (is(finishGathering) && !su
}
}
} else {
// Skip digits collecting if empty CollectResult received
if (!(data instanceof CollectedResult) || !StringUtils.isEmpty(((CollectedResult)data).getResult())) {
collectedDigits.append(data);
}
collectedDigits.append(((CollectedResult)data).getResult());
fsm.transition(message, finishGathering);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,24 @@ public void testIgnoreRcmlFromPartialCallback() throws Exception {
};
}

@Test
@SuppressWarnings("unchecked")
public void testDtmfFromMediaServer() throws Exception {
new JavaTestKit(system) {
{
final ActorRef observer = getRef();
final TestActorRef<VoiceInterpreter> interpreterRef = createVoiceInterpreter(observer);
VoiceInterpreter interpreter = interpreterRef.underlyingActor();
interpreter.fsm = spy(new FiniteStateMachine(interpreter.continuousGathering, interpreter.transitions));
doNothing().when(interpreter.fsm).transition(any(), eq(interpreter.finishGathering));
interpreter.collectedDigits = new StringBuffer();
interpreter.finishOnKey="#";
interpreterRef.tell(new MediaGroupResponse(new CollectedResult("5", false, false)), observer);
assertEquals("5", interpreter.collectedDigits.toString());
}
};
}

private NameValuePair findParam(final List<NameValuePair> params, final String key) {
return Iterables.find(params, new Predicate<NameValuePair>() {
public boolean apply(NameValuePair p) {
Expand Down