Skip to content

Commit ec72ff3

Browse files
author
maria-farooq
authored
Merge pull request #2736 from RestComm/revert-2726-restcomm-1444
Revert "Restcomm 1444 - Fixes for TestDialVerb* test cases"
2 parents cc8cca1 + 7fe9cd0 commit ec72ff3

8 files changed

Lines changed: 47 additions & 55 deletions

File tree

restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/BaseVoiceInterpreter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,6 @@ private Notification notification(final int log, final int error, final String m
669669
}
670670

671671
ActorRef parser(final String xml) {
672-
if(logger.isDebugEnabled()) {
673-
logger.debug("About to create Parser for RCML "+xml);
674-
}
675672
final Props props = new Props(new UntypedActorFactory() {
676673
private static final long serialVersionUID = 1L;
677674

restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/VoiceInterpreter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@ private void executeDialAction(final Object message, final ActorRef outboundCall
25622562
}
25632563
if (attribute != null && !dialActionExecuted) {
25642564
if(logger.isInfoEnabled()){
2565-
logger.info("Proceeding to execute Dial Action attribute, dial verb : "+verb.toString());
2565+
logger.info("Proceeding to execute Dial Action attribute");
25662566
}
25672567
this.dialActionExecuted = true;
25682568

@@ -3417,7 +3417,6 @@ public void postStop() {
34173417
call = null;
34183418
}
34193419

3420-
getContext().stop(parser);
34213420
getContext().stop(self());
34223421
postCleanup();
34233422
}

restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/rcml/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
/**
4545
* @author quintana.thomas@gmail.com (Thomas Quintana)
4646
*/
47-
public class Parser extends RestcommUntypedActor {
47+
public final class Parser extends RestcommUntypedActor {
4848
private static Logger logger = Logger.getLogger(Parser.class);
4949
private Tag document;
5050
private Iterator<Tag> iterator;

restcomm/restcomm.mgcp/src/main/java/org/restcomm/connect/mgcp/MockMediaGateway.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,10 @@ public void onReceive (final Object message) throws Exception {
365365

366366
private void onReceiveTimeout (Object message) {
367367
if (logger.isInfoEnabled()) {
368-
logger.info("MockMediaGatewat - Max recording length reached");
368+
logger.info("Max recording length reached");
369369
}
370370
stopRecording();
371371
notify(recordingRqnt, recordingRqntSender);
372-
getContext().setReceiveTimeout(Duration.Undefined());
373-
374372
}
375373

376374
private void writeRecording (File srcWaveFile, File outWaveFile, int duration) {

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/telephony/TestDialVerbPartThree.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
import static org.junit.Assert.assertTrue;
4545
import org.junit.experimental.categories.Category;
4646
import org.restcomm.connect.commons.annotations.ParallelClassTests;
47+
import org.restcomm.connect.commons.annotations.WithInMinsTests;
4748
import org.restcomm.connect.testsuite.NetworkPortAssigner;
49+
import org.restcomm.connect.commons.annotations.UnstableTests;
4850
import org.restcomm.connect.testsuite.WebArchiveUtil;
4951

5052
/**
@@ -166,9 +168,8 @@ public void after() throws Exception {
166168

167169

168170
//Non regression test for https://github.com/Mobicents/RestComm/issues/612
169-
private final String actionUrlRcmlWithTimeLimit = "<Dial timeout=\"50\" timeLimit=\"5\"><Uri>sip:alice@127.0.0.1:" + alicePort + "</Uri></Dial>";
170171
@Test
171-
@Category({FeatureAltTests.class})
172+
@Category({UnstableTests.class, FeatureAltTests.class})
172173
public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURL() throws InterruptedException, ParseException {
173174

174175
stubFor(get(urlPathEqualTo("/1111"))
@@ -181,11 +182,9 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURL() throws I
181182
.willReturn(aResponse()
182183
.withStatus(200)
183184
.withHeader("Content-Type", "text/xml")
184-
.withBody(actionUrlRcmlWithTimeLimit)));
185-
186-
SipURI uri = aliceSipStack.getAddressFactory().createSipURI(null, restcommContact);
187-
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 3600, 3600));
185+
.withBody(actionUrlRcml)));
188186

187+
//Prepare Fotini phone to receive a call
189188
final SipCall aliceCall = alicePhone.createSipCall();
190189
aliceCall.listenForIncomingCall();
191190

@@ -232,7 +231,7 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURL() throws I
232231

233232
//Non regression test for https://github.com/Mobicents/RestComm/issues/612
234233
@Test
235-
@Category({FeatureAltTests.class})
234+
@Category({UnstableTests.class, FeatureAltTests.class})
236235
public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURLWithNullFinishOnKey() throws InterruptedException, ParseException {
237236

238237
stubFor(get(urlPathEqualTo("/1111"))
@@ -245,8 +244,9 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURLWithNullFin
245244
.willReturn(aResponse()
246245
.withStatus(200)
247246
.withHeader("Content-Type", "text/xml")
248-
.withBody(actionUrlRcmlWithTimeLimit)));
247+
.withBody(actionUrlRcml)));
249248

249+
//Prepare Fotini phone to receive a call
250250
final SipCall aliceCall = alicePhone.createSipCall();
251251
aliceCall.listenForIncomingCall();
252252

@@ -272,20 +272,22 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURLWithNullFin
272272

273273
//At this point bob leaves a voicemail
274274

275+
//Now Fotini should receive a call
275276
assertTrue(aliceCall.waitForIncomingCall(30 * 1000));
276277
assertTrue(aliceCall.sendIncomingCallResponse(100, "Trying-Fotini", 600));
277278
assertTrue(aliceCall.sendIncomingCallResponse(180, "Ringing-Fotini", 600));
278279
String receivedBody = new String(aliceCall.getLastReceivedRequest().getRawContent());
279280
assertTrue(aliceCall.sendIncomingCallResponse(Response.OK, "OK-Fotini", 3600, receivedBody, "application", "sdp", null, null));
280281
assertTrue(aliceCall.waitForAck(5000));
281-
282282
aliceCall.listenForDisconnect();
283283

284284
Thread.sleep(2000);
285285

286+
// hangup.
287+
286288
assertTrue(bobCall.disconnect());
287289

288-
assertTrue(aliceCall.waitForDisconnect(125 * 1000));
290+
assertTrue(aliceCall.waitForDisconnect(50 * 1000));
289291
assertTrue(aliceCall.respondToDisconnect());
290292
}
291293

@@ -337,6 +339,7 @@ public synchronized void testDialWithCustomHeaders() throws InterruptedException
337339
}
338340

339341
@Test
342+
@Category(UnstableTests.class)
340343
// Non regression test for https://bitbucket.org/telestax/telscale-restcomm/issue/132/implement-twilio-sip-out
341344
public synchronized void testDialSip() throws InterruptedException, ParseException {
342345
stubFor(get(urlPathEqualTo("/1111"))

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/telephony/TestDialVerbPartThreeAnswerDelay.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.junit.Test;
1919
import org.junit.runner.RunWith;
2020
import org.restcomm.connect.commons.Version;
21+
import org.restcomm.connect.commons.annotations.UnstableTests;
2122
import org.restcomm.connect.testsuite.telephony.security.DigestServerAuthenticationMethod;
2223

2324
import javax.sip.address.SipURI;
@@ -160,6 +161,7 @@ public void after() throws Exception {
160161

161162
@Test
162163
// Non regression test for https://bitbucket.org/telestax/telscale-restcomm/issue/132/implement-twilio-sip-out
164+
@Category(UnstableTests.class)
163165
public synchronized void testDialSip() throws InterruptedException, ParseException {
164166
stubFor(get(urlPathEqualTo("/1111"))
165167
.willReturn(aResponse()

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/telephony/TestDialVerbPartTwo.java

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.restcomm.connect.testsuite.http.RestcommCallsTool;
2929

3030
import javax.sip.Dialog;
31-
import javax.sip.DialogState;
3231
import javax.sip.SipException;
3332
import javax.sip.address.SipURI;
3433
import javax.sip.header.FromHeader;
@@ -56,8 +55,9 @@
5655
import static org.junit.Assert.assertTrue;
5756
import org.junit.experimental.categories.Category;
5857
import org.restcomm.connect.commons.annotations.ParallelClassTests;
59-
import org.restcomm.connect.commons.annotations.UnstableTests;
58+
import org.restcomm.connect.commons.annotations.WithInMinsTests;
6059
import org.restcomm.connect.testsuite.NetworkPortAssigner;
60+
import org.restcomm.connect.commons.annotations.UnstableTests;
6161
import org.restcomm.connect.testsuite.WebArchiveUtil;
6262

6363
/**
@@ -91,7 +91,7 @@ public class TestDialVerbPartTwo {
9191
@Rule
9292
public WireMockRule wireMockRule = new WireMockRule(mockPort); // No-args constructor defaults to port 8080
9393
private String dialClientWithRecordingRcml = "<Response><Dial timeLimit=\"10\" timeout=\"10\" record=\"true\" action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Client>alice</Client></Dial></Response>";
94-
private String dialConferenceWithDialActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Conference>test9876</Conference></Dial></Response>";
94+
private String dialConferenceWithDialActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Conference>test</Conference></Dial></Response>";
9595
private String dialClientWithRecordingRcml2 = "<Response><Dial timeLimit=\"10\" timeout=\"10\" record=\"true\" action=\"http://127.0.0.1:" + mockPort + "/action&sticky_numToDial=00306986971731\" method=\"GET\"><Client>alice</Client></Dial></Response>";
9696
private String dialRecordWithActionRcml = "<Response><Record action=\"http://127.0.0.1:" + mockPort + "/recordAction\" method=\"GET\" finishOnKey=\"*\" maxLength=\"10\" playBeep=\"true\"/></Response>";
9797
private String dialClientWithActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Client>alice</Client></Dial></Response>";
@@ -166,23 +166,20 @@ public void before() throws Exception {
166166
@After
167167
public void after() throws Exception {
168168
if (bobPhone != null) {
169-
bobPhone.unregister(bobContact, 3600);
170169
bobPhone.dispose();
171170
}
172171
if (bobSipStack != null) {
173172
bobSipStack.dispose();
174173
}
175174

176-
if (alicePhone != null) {
177-
alicePhone.unregister(aliceContact, 3600);
178-
alicePhone.dispose();
179-
}
180175
if (aliceSipStack != null) {
181176
aliceSipStack.dispose();
182177
}
178+
if (alicePhone != null) {
179+
alicePhone.dispose();
180+
}
183181

184182
if (georgePhone != null) {
185-
georgePhone.unregister(georgeContact, 3600);
186183
georgePhone.dispose();
187184
}
188185
if (georgeSipStack != null) {
@@ -506,20 +503,17 @@ public synchronized void testDialConferenceWithDialActionNoRcml() throws Interru
506503
assertTrue(bobCall.waitForAnswer(5000));
507504
}
508505

509-
private String dialConferenceNoDialActionSendSMSRcml = "<Response><Dial><Conference>test12345</Conference></Dial>" +
506+
private String dialConferenceNoDialActionSendSMSRcml = "<Response><Dial><Conference>test</Conference></Dial>" +
510507
"<Sms to=\"bob\" from=\"+12223334499\">Hello World!</Sms></Response>";
511508
private String dialConferenceNoDialActionRcml = "<Response><Dial><Conference>test</Conference></Dial></Response>";
512509
@Test
513-
@Category({FeatureAltTests.class})
510+
@Category({UnstableTests.class, FeatureAltTests.class})
514511
public synchronized void testDialConferenceNoDialAction_SendSms() throws InterruptedException, ParseException {
515-
// wireMockRule.resetMappings();
516512
stubFor(get(urlPathEqualTo("/1111"))
517513
.willReturn(aResponse()
518514
.withStatus(200)
519515
.withHeader("Content-Type", "text/xml")
520-
// .withBody(dialConferenceNoDialActionSendSMSRcml)));
521-
.withBody("<Response><Dial><Conference>test12345</Conference></Dial>" +
522-
"<Sms to=\"bob\" from=\"+12223334499\">Hello World!</Sms></Response>")));
516+
.withBody(dialConferenceNoDialActionSendSMSRcml)));
523517

524518
// Phone2 register as alice
525519
SipURI uri = aliceSipStack.getAddressFactory().createSipURI(null, restcommContact);
@@ -549,16 +543,15 @@ public synchronized void testDialConferenceNoDialAction_SendSms() throws Interru
549543
assertTrue(!(bobCall.getLastReceivedResponse().getStatusCode() >= 400));
550544

551545
//Now bob is connected to the conference room
552-
bobCall.listenForMessage();
553546

554547
Thread.sleep(7000);
555548

556549
// hangup.
557550
bobCall.disconnect();
558551
assertTrue(bobCall.waitForAnswer(5000));
559552

560-
561-
assertTrue(bobCall.waitForMessage(90 * 1000));
553+
bobCall.listenForMessage();
554+
assertTrue(bobCall.waitForMessage(60 * 1000));
562555
assertTrue(bobCall.sendMessageResponse(200, "OK-Message Received", 3600));
563556
Request messageReceived = bobCall.getLastReceivedMessageRequest();
564557
assertTrue(new String(messageReceived.getRawContent()).equalsIgnoreCase("Hello World!"));
@@ -713,7 +706,7 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForApp()
713706
}
714707

715708
@Test //Test case for issue 320
716-
@Category({FeatureAltTests.class})
709+
@Category({UnstableTests.class,FeatureAltTests.class})
717710
public synchronized void testDialClientAliceWithRecordAndStatusCallbackForAppForThreeCalls() throws InterruptedException, ParseException, MalformedURLException {
718711
stubFor(get(urlPathEqualTo("/1111"))
719712
.willReturn(aResponse()
@@ -733,14 +726,12 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForAppFor
733726

734727
// Phone2 register as alice
735728
SipURI uri = aliceSipStack.getAddressFactory().createSipURI(null, restcommContact);
736-
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 600, 600));
729+
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 3600, 3600));
737730

738731
// Prepare second phone to receive call
739732
SipCall aliceCall = alicePhone.createSipCall();
740-
alicePhone.setLoopback(true);
741733
aliceCall.listenForIncomingCall();
742734

743-
744735
// Create outgoing call with first phone
745736
final SipCall bobCall = bobPhone.createSipCall();
746737
bobCall.initiateOutgoingCall(bobContact, dialRestcommWithStatusCallback, null, body, "application", "sdp", null, null);
@@ -847,13 +838,11 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForAppFor
847838

848839
Thread.sleep(3000);
849840

850-
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 600, 600));
851-
852841
recordings = RestcommCallsTool.getInstance().getRecordings(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
853842
assertNotNull(recordings);
854843
assertTrue(recordings.size() >= 2);
855844
double duration = recordings.get(1).getAsJsonObject().get("duration").getAsDouble();
856-
assertEquals(7.0, duration, 1.0);
845+
assertEquals(3.0, duration, 0.5);
857846
assertNotNull(((JsonObject)recordings.get(1)).get("uri").getAsString());
858847

859848
/*
@@ -911,7 +900,7 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForAppFor
911900
recordings = RestcommCallsTool.getInstance().getRecordings(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
912901
assertNotNull(recordings);
913902
assertTrue(recordings.size() >= 3);
914-
assertEquals(7.0, ((JsonObject)recordings.get(2)).get("duration").getAsDouble(), 1.0);
903+
assertTrue("7.0".equalsIgnoreCase(((JsonObject)recordings.get(2)).get("duration").getAsString()));
915904
assertNotNull(((JsonObject)recordings.get(2)).get("uri").getAsString());
916905

917906
logger.info("About to check the Status Callback Requests");
@@ -1013,6 +1002,7 @@ public synchronized void testRecordWithActionAndStatusCallbackForAppWithDisconne
10131002
}
10141003

10151004
@Test
1005+
@Category(UnstableTests.class)
10161006
//Test case for github issue 859
10171007
public synchronized void testRecordWithActionAndStatusCallbackForAppWithBobSendsFinishKey() throws InterruptedException, ParseException {
10181008
stubFor(get(urlPathEqualTo("/1111"))
@@ -1058,14 +1048,10 @@ public synchronized void testRecordWithActionAndStatusCallbackForAppWithBobSends
10581048
bobCall.sendInviteOkAck();
10591049
assertTrue(!(bobCall.getLastReceivedResponse().getStatusCode() >= 400));
10601050

1061-
bobCall.listenForDisconnect();
1062-
10631051
//Here we have Restcomm voice mail app for 10 sec
10641052
Thread.sleep(5000);
10651053

10661054
Dialog dialog = bobCall.getDialog();
1067-
assertNotNull(dialog);
1068-
assertEquals(DialogState.CONFIRMED, dialog.getState());
10691055
String infoBody = "\n" +
10701056
"Signal=*\n" +
10711057
"Duration=28";
@@ -1084,7 +1070,7 @@ public synchronized void testRecordWithActionAndStatusCallbackForAppWithBobSends
10841070
SipTransaction infoTransaction = bobPhone.sendRequestWithTransaction(info, false, dialog);
10851071
assertNotNull(infoTransaction);
10861072

1087-
1073+
bobCall.listenForDisconnect();
10881074
assertTrue(bobCall.waitForDisconnect(5000));
10891075
assertTrue(bobCall.respondToDisconnect());
10901076

@@ -1551,6 +1537,7 @@ public synchronized void testDialNumberRejectBusyRcml() throws InterruptedExcept
15511537

15521538
private String hangupActionRcml = "<Response><Hangup /></Response>";
15531539

1540+
@Category(UnstableTests.class)
15541541
@Test // (customised from testDialClientAliceWithRecordAndStatusCallbackForApp)
15551542
public synchronized void testDialClientAliceWithActionAndStatusCallbackForApp() throws InterruptedException, ParseException {
15561543
stubFor(get(urlPathEqualTo("/1111"))

0 commit comments

Comments
 (0)