Skip to content
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 @@ -669,9 +669,6 @@ private Notification notification(final int log, final int error, final String m
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ private void executeDialAction(final Object message, final ActorRef outboundCall
}
if (attribute != null && !dialActionExecuted) {
if(logger.isInfoEnabled()){
logger.info("Proceeding to execute Dial Action attribute, dial verb : "+verb.toString());
logger.info("Proceeding to execute Dial Action attribute");
}
this.dialActionExecuted = true;

Expand Down Expand Up @@ -3417,7 +3417,6 @@ public void postStop() {
call = null;
}

getContext().stop(parser);
getContext().stop(self());
postCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/**
* @author quintana.thomas@gmail.com (Thomas Quintana)
*/
public class Parser extends RestcommUntypedActor {
public final class Parser extends RestcommUntypedActor {
private static Logger logger = Logger.getLogger(Parser.class);
private Tag document;
private Iterator<Tag> iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,10 @@ public void onReceive (final Object message) throws Exception {

private void onReceiveTimeout (Object message) {
if (logger.isInfoEnabled()) {
logger.info("MockMediaGatewat - Max recording length reached");
logger.info("Max recording length reached");
}
stopRecording();
notify(recordingRqnt, recordingRqntSender);
getContext().setReceiveTimeout(Duration.Undefined());

}

private void writeRecording (File srcWaveFile, File outWaveFile, int duration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
import static org.junit.Assert.assertTrue;
import org.junit.experimental.categories.Category;
import org.restcomm.connect.commons.annotations.ParallelClassTests;
import org.restcomm.connect.commons.annotations.WithInMinsTests;
import org.restcomm.connect.testsuite.NetworkPortAssigner;
import org.restcomm.connect.commons.annotations.UnstableTests;
import org.restcomm.connect.testsuite.WebArchiveUtil;

/**
Expand Down Expand Up @@ -166,9 +168,8 @@ public void after() throws Exception {


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

stubFor(get(urlPathEqualTo("/1111"))
Expand All @@ -181,11 +182,9 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURL() throws I
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(actionUrlRcmlWithTimeLimit)));

SipURI uri = aliceSipStack.getAddressFactory().createSipURI(null, restcommContact);
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 3600, 3600));
.withBody(actionUrlRcml)));

//Prepare Fotini phone to receive a call
final SipCall aliceCall = alicePhone.createSipCall();
aliceCall.listenForIncomingCall();

Expand Down Expand Up @@ -232,7 +231,7 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURL() throws I

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

stubFor(get(urlPathEqualTo("/1111"))
Expand All @@ -245,8 +244,9 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURLWithNullFin
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(actionUrlRcmlWithTimeLimit)));
.withBody(actionUrlRcml)));

//Prepare Fotini phone to receive a call
final SipCall aliceCall = alicePhone.createSipCall();
aliceCall.listenForIncomingCall();

Expand All @@ -272,20 +272,22 @@ public synchronized void testRecord_ExecuteRCML_ReturnedFromActionURLWithNullFin

//At this point bob leaves a voicemail

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

aliceCall.listenForDisconnect();

Thread.sleep(2000);

// hangup.

assertTrue(bobCall.disconnect());

assertTrue(aliceCall.waitForDisconnect(125 * 1000));
assertTrue(aliceCall.waitForDisconnect(50 * 1000));
assertTrue(aliceCall.respondToDisconnect());
}

Expand Down Expand Up @@ -337,6 +339,7 @@ public synchronized void testDialWithCustomHeaders() throws InterruptedException
}

@Test
@Category(UnstableTests.class)
// Non regression test for https://bitbucket.org/telestax/telscale-restcomm/issue/132/implement-twilio-sip-out
public synchronized void testDialSip() throws InterruptedException, ParseException {
stubFor(get(urlPathEqualTo("/1111"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.restcomm.connect.commons.Version;
import org.restcomm.connect.commons.annotations.UnstableTests;
import org.restcomm.connect.testsuite.telephony.security.DigestServerAuthenticationMethod;

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

@Test
// Non regression test for https://bitbucket.org/telestax/telscale-restcomm/issue/132/implement-twilio-sip-out
@Category(UnstableTests.class)
public synchronized void testDialSip() throws InterruptedException, ParseException {
stubFor(get(urlPathEqualTo("/1111"))
.willReturn(aResponse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.restcomm.connect.testsuite.http.RestcommCallsTool;

import javax.sip.Dialog;
import javax.sip.DialogState;
import javax.sip.SipException;
import javax.sip.address.SipURI;
import javax.sip.header.FromHeader;
Expand Down Expand Up @@ -56,8 +55,9 @@
import static org.junit.Assert.assertTrue;
import org.junit.experimental.categories.Category;
import org.restcomm.connect.commons.annotations.ParallelClassTests;
import org.restcomm.connect.commons.annotations.UnstableTests;
import org.restcomm.connect.commons.annotations.WithInMinsTests;
import org.restcomm.connect.testsuite.NetworkPortAssigner;
import org.restcomm.connect.commons.annotations.UnstableTests;
import org.restcomm.connect.testsuite.WebArchiveUtil;

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ public class TestDialVerbPartTwo {
@Rule
public WireMockRule wireMockRule = new WireMockRule(mockPort); // No-args constructor defaults to port 8080
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>";
private String dialConferenceWithDialActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Conference>test9876</Conference></Dial></Response>";
private String dialConferenceWithDialActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Conference>test</Conference></Dial></Response>";
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>";
private String dialRecordWithActionRcml = "<Response><Record action=\"http://127.0.0.1:" + mockPort + "/recordAction\" method=\"GET\" finishOnKey=\"*\" maxLength=\"10\" playBeep=\"true\"/></Response>";
private String dialClientWithActionRcml = "<Response><Dial action=\"http://127.0.0.1:" + mockPort + "/action\" method=\"GET\"><Client>alice</Client></Dial></Response>";
Expand Down Expand Up @@ -166,23 +166,20 @@ public void before() throws Exception {
@After
public void after() throws Exception {
if (bobPhone != null) {
bobPhone.unregister(bobContact, 3600);
bobPhone.dispose();
}
if (bobSipStack != null) {
bobSipStack.dispose();
}

if (alicePhone != null) {
alicePhone.unregister(aliceContact, 3600);
alicePhone.dispose();
}
if (aliceSipStack != null) {
aliceSipStack.dispose();
}
if (alicePhone != null) {
alicePhone.dispose();
}

if (georgePhone != null) {
georgePhone.unregister(georgeContact, 3600);
georgePhone.dispose();
}
if (georgeSipStack != null) {
Expand Down Expand Up @@ -506,20 +503,17 @@ public synchronized void testDialConferenceWithDialActionNoRcml() throws Interru
assertTrue(bobCall.waitForAnswer(5000));
}

private String dialConferenceNoDialActionSendSMSRcml = "<Response><Dial><Conference>test12345</Conference></Dial>" +
private String dialConferenceNoDialActionSendSMSRcml = "<Response><Dial><Conference>test</Conference></Dial>" +
"<Sms to=\"bob\" from=\"+12223334499\">Hello World!</Sms></Response>";
private String dialConferenceNoDialActionRcml = "<Response><Dial><Conference>test</Conference></Dial></Response>";
@Test
@Category({FeatureAltTests.class})
@Category({UnstableTests.class, FeatureAltTests.class})
public synchronized void testDialConferenceNoDialAction_SendSms() throws InterruptedException, ParseException {
// wireMockRule.resetMappings();
stubFor(get(urlPathEqualTo("/1111"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
// .withBody(dialConferenceNoDialActionSendSMSRcml)));
.withBody("<Response><Dial><Conference>test12345</Conference></Dial>" +
"<Sms to=\"bob\" from=\"+12223334499\">Hello World!</Sms></Response>")));
.withBody(dialConferenceNoDialActionSendSMSRcml)));

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

//Now bob is connected to the conference room
bobCall.listenForMessage();

Thread.sleep(7000);

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


assertTrue(bobCall.waitForMessage(90 * 1000));
bobCall.listenForMessage();
assertTrue(bobCall.waitForMessage(60 * 1000));
assertTrue(bobCall.sendMessageResponse(200, "OK-Message Received", 3600));
Request messageReceived = bobCall.getLastReceivedMessageRequest();
assertTrue(new String(messageReceived.getRawContent()).equalsIgnoreCase("Hello World!"));
Expand Down Expand Up @@ -713,7 +706,7 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForApp()
}

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

// Phone2 register as alice
SipURI uri = aliceSipStack.getAddressFactory().createSipURI(null, restcommContact);
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 600, 600));
assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 3600, 3600));

// Prepare second phone to receive call
SipCall aliceCall = alicePhone.createSipCall();
alicePhone.setLoopback(true);
aliceCall.listenForIncomingCall();


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

Thread.sleep(3000);

assertTrue(alicePhone.register(uri, "alice", "1234", aliceContact, 600, 600));

recordings = RestcommCallsTool.getInstance().getRecordings(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
assertNotNull(recordings);
assertTrue(recordings.size() >= 2);
double duration = recordings.get(1).getAsJsonObject().get("duration").getAsDouble();
assertEquals(7.0, duration, 1.0);
assertEquals(3.0, duration, 0.5);
assertNotNull(((JsonObject)recordings.get(1)).get("uri").getAsString());

/*
Expand Down Expand Up @@ -911,7 +900,7 @@ public synchronized void testDialClientAliceWithRecordAndStatusCallbackForAppFor
recordings = RestcommCallsTool.getInstance().getRecordings(deploymentUrl.toString(), adminAccountSid, adminAuthToken);
assertNotNull(recordings);
assertTrue(recordings.size() >= 3);
assertEquals(7.0, ((JsonObject)recordings.get(2)).get("duration").getAsDouble(), 1.0);
assertTrue("7.0".equalsIgnoreCase(((JsonObject)recordings.get(2)).get("duration").getAsString()));
assertNotNull(((JsonObject)recordings.get(2)).get("uri").getAsString());

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

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

bobCall.listenForDisconnect();

//Here we have Restcomm voice mail app for 10 sec
Thread.sleep(5000);

Dialog dialog = bobCall.getDialog();
assertNotNull(dialog);
assertEquals(DialogState.CONFIRMED, dialog.getState());
String infoBody = "\n" +
"Signal=*\n" +
"Duration=28";
Expand All @@ -1084,7 +1070,7 @@ public synchronized void testRecordWithActionAndStatusCallbackForAppWithBobSends
SipTransaction infoTransaction = bobPhone.sendRequestWithTransaction(info, false, dialog);
assertNotNull(infoTransaction);


bobCall.listenForDisconnect();
assertTrue(bobCall.waitForDisconnect(5000));
assertTrue(bobCall.respondToDisconnect());

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

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

@Category(UnstableTests.class)
@Test // (customised from testDialClientAliceWithRecordAndStatusCallbackForApp)
public synchronized void testDialClientAliceWithActionAndStatusCallbackForApp() throws InterruptedException, ParseException {
stubFor(get(urlPathEqualTo("/1111"))
Expand Down
Loading