Skip to content

Commit

Permalink
Fixes #1726.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghjansen committed Jan 18, 2017
1 parent c6ed525 commit 63ef982
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,13 @@ private void onCallStateChanged(Object message, ActorRef sender) throws Transiti
if (dialBranches != null && dialBranches.contains(sender)) {
removeDialBranch(message, sender);
}
checkDialBranch(message, sender, attribute);
if (dialBranches != null && !dialBranches.isEmpty()){
checkDialBranch(message, sender, attribute);
} else {
fsm.transition(message, finishDialing);
callState = CallStateChanged.State.COMPLETED;
fsm.transition(message, finished);
}
return;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ private void onCreateMediaSession(CreateMediaSession message, ActorRef self, Act
}

private void onCloseMediaSession(CloseMediaSession message, ActorRef self, ActorRef sender) throws Exception {
if (is(active) || is(initializing) || is(updatingMediaSession)) {
if (is(active) || is(initializing) || is(updatingMediaSession) || is(pending)) {
fsm.transition(message, inactive);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1420,62 +1420,19 @@ public synchronized void testDialForkEveryoneBusyExecuteRCML_ReturnedFromActionU
assertTrue(henriqueCall.sendIncomingCallResponse(Response.RINGING, "Ringing-Henrique", 3600));
assertTrue(henriqueCall.sendIncomingCallResponse(486, "Busy Here-Henrique", 3600));
assertTrue(henriqueCall.waitForAck(50 * 1000));
//No one will answer the call and RCML will move to the next verb to call Fotini

// assertTrue(georgeCall.listenForCancel());
// assertTrue(aliceCall.listenForCancel());
// assertTrue(henriqueCall.listenForCancel());
//
// Thread.sleep(1000);
//
// SipTransaction georgeCancelTransaction = georgeCall.waitForCancel(50 * 1000);
// SipTransaction henriqueCancelTransaction = henriqueCall.waitForCancel(50 * 1000);
// SipTransaction aliceCancelTransaction = aliceCall.waitForCancel(50 * 1000);
// assertNotNull(georgeCancelTransaction);
// assertNotNull(aliceCancelTransaction);
// assertNotNull(henriqueCancelTransaction);
// georgeCall.respondToCancel(georgeCancelTransaction, 200, "OK - George", 600);
// aliceCall.respondToCancel(aliceCancelTransaction, 200, "OK - Alice", 600);
// henriqueCall.respondToCancel(henriqueCancelTransaction, 200, "OK - Henrique", 600);

assertTrue(alicePhone.unregister(aliceContact, 3600));
//No one will answer the call and VoiceInterpreter will finish the call


// int liveCalls = MonitoringServiceTool.getInstance().getLiveCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
// int liveCallsArraySize = MonitoringServiceTool.getInstance().getLiveCallsArraySize(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
// //Even though no call answered the dial forking the originated call from Bob should be still live
// assertTrue(liveCalls == 1);
// assertTrue(liveCallsArraySize == 1);

//Now Fotini should receive a call
assertTrue(fotiniCall.waitForIncomingCall(30 * 1000));
assertTrue(fotiniCall.sendIncomingCallResponse(100, "Trying-Fotini", 600));
assertTrue(fotiniCall.sendIncomingCallResponse(180, "Ringing-Fotini", 600));
String receivedBody = new String(fotiniCall.getLastReceivedRequest().getRawContent());
assertTrue(fotiniCall.sendIncomingCallResponse(Response.OK, "OK-Fotini", 3600, receivedBody, "application", "sdp", null, null));
assertTrue(fotiniCall.waitForAck(5000));
fotiniCall.listenForDisconnect();

Thread.sleep(1000);
bobCall.waitForDisconnect(5*10000);
bobCall.respondToDisconnect();

int liveCalls = MonitoringServiceTool.getInstance().getLiveCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
int liveCallsArraySize = MonitoringServiceTool.getInstance().getLiveCallsArraySize(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
//Even though no call answered the dial forking the originated call from Bob should be still live
//No call should remain live
logger.info("&&&& LiveCalls: "+liveCalls);
logger.info("&&&& LiveCallsArraySize: "+liveCallsArraySize);
assertTrue(liveCalls == 2);
assertTrue(liveCallsArraySize == 2);

// assertTrue(MonitoringServiceTool.getInstance().getLiveCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken) == 2);
// assertTrue(MonitoringServiceTool.getInstance().getLiveCallsArraySize(deploymentUrl.toString(), adminAccountSid, adminAuthToken) == 2);

Thread.sleep(2000);

// hangup.
assertTrue(bobCall.disconnect());

assertTrue(fotiniCall.waitForDisconnect(50 * 1000));

Thread.sleep(10000);
assertTrue(liveCalls == 0);
assertTrue(liveCallsArraySize == 0);

logger.info("About to check the Requests");
List<LoggedRequest> requests = findAll(getRequestedFor(urlPathMatching("/1111")));
Expand Down

0 comments on commit 63ef982

Please sign in to comment.