2424import com .github .tomakehurst .wiremock .verification .LoggedRequest ;
2525import com .google .gson .JsonObject ;
2626import org .apache .log4j .Logger ;
27+ import org .cafesip .sipunit .Credential ;
2728import org .cafesip .sipunit .ReferSubscriber ;
2829import org .cafesip .sipunit .SipCall ;
2930import org .cafesip .sipunit .SipPhone ;
@@ -109,16 +110,19 @@ public class ReferOrganizationTest {
109110 private static SipStackTool tool1 ;
110111 private static SipStackTool tool2 ;
111112 private static SipStackTool tool3 ;
113+
114+
115+ private String dialRestcommOrg3 = "sip:1111@refertest.restcomm.com" ;
112116
113117 // Bob is a simple SIP Client. Will not register with Restcomm
114118 private SipStack bobSipStack ;
115119 private SipPhone bobPhone ;
116- private String bobContact = "sip:bob@127.0.0.1:5090 " ;
120+ private String bobContact = "sip:bob@refertest.restcomm.com " ;
117121
118122 // Alice is a Restcomm Client with VoiceURL. This Restcomm Client can register with Restcomm.
119123 private SipStack aliceSipStack ;
120124 private SipPhone alicePhone ;
121- private String aliceContact = "sip:alice@127.0.0.1:5091" ;
125+ private String aliceContact = "sip:alice@refertest.restcomm.com" ; // 127.0.0.1:5091";
122126
123127 // George is a simple SIP Client. Will not register with Restcomm
124128 private SipStack georgeSipStack ;
@@ -176,6 +180,8 @@ public void after() throws Exception {
176180
177181 private String dialGeorgeRcml = "<Response><Dial><Number>+131313</Number></Dial></Response>" ;
178182 private String dialAliceRcml = "<Response><Dial><Client>alice</Client></Dial></Response>" ;
183+
184+ private final String clientPassword = "1234" ;
179185 @ Test
180186 public void testTransfer () throws ParseException , InterruptedException , MalformedURLException , SipException {
181187
@@ -194,6 +200,8 @@ public void testTransfer() throws ParseException, InterruptedException, Malforme
194200
195201 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
196202 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
203+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
204+ alicePhone .addUpdateCredential (c );
197205
198206 SipCall georgeCall = georgePhone .createSipCall ();
199207 georgeCall .listenForIncomingCall ();
@@ -203,7 +211,7 @@ public void testTransfer() throws ParseException, InterruptedException, Malforme
203211
204212 final SipCall bobCall = bobPhone .createSipCall ();
205213
206- bobCall .initiateOutgoingCall (bobContact , "sip:1111@127.0.0.1:5080" , null , body , "application" , "sdp" , null , null );
214+ bobCall .initiateOutgoingCall (bobContact , dialRestcommOrg3 , null , body , "application" , "sdp" , null , null );
207215
208216 assertLastOperationSuccess (bobCall );
209217 assertTrue (bobCall .waitOutgoingCallResponse (5 * 1000 ));
@@ -329,6 +337,8 @@ public void testTransferToAnyNumber() throws ParseException, InterruptedExceptio
329337
330338 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
331339 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
340+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
341+ alicePhone .addUpdateCredential (c );
332342
333343 SipCall georgeCall = georgePhone .createSipCall ();
334344 georgeCall .listenForIncomingCall ();
@@ -455,6 +465,8 @@ public void testTransferToNumberWithPlusSign() throws ParseException, Interrupte
455465
456466 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
457467 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
468+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
469+ alicePhone .addUpdateCredential (c );
458470
459471 SipCall georgeCall = georgePhone .createSipCall ();
460472 georgeCall .listenForIncomingCall ();
@@ -582,6 +594,8 @@ public void testTransferHangupByBob() throws ParseException, InterruptedExceptio
582594
583595 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
584596 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
597+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
598+ alicePhone .addUpdateCredential (c );
585599
586600 SipCall georgeCall = georgePhone .createSipCall ();
587601 georgeCall .listenForIncomingCall ();
@@ -708,6 +722,8 @@ public void testTransferByBob() throws ParseException, InterruptedException, Mal
708722
709723 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
710724 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
725+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
726+ alicePhone .addUpdateCredential (c );
711727
712728 SipCall georgeCall = georgePhone .createSipCall ();
713729 georgeCall .listenForIncomingCall ();
@@ -835,6 +851,8 @@ public void testTransferWithAbsentReferUrlAndApplication() throws ParseException
835851
836852 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
837853 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
854+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
855+ alicePhone .addUpdateCredential (c );
838856
839857 SipCall georgeCall = georgePhone .createSipCall ();
840858 georgeCall .listenForIncomingCall ();
@@ -898,6 +916,8 @@ public void testTransferWithOutOfDialogRefer() throws ParseException, Interrupte
898916
899917 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
900918 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
919+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
920+ alicePhone .addUpdateCredential (c );
901921
902922 SipCall georgeCall = georgePhone .createSipCall ();
903923 georgeCall .listenForIncomingCall ();
@@ -963,6 +983,8 @@ public void testTransferIncorrectReferTarget() throws ParseException, Interrupte
963983
964984 SipURI uri = aliceSipStack .getAddressFactory ().createSipURI (null , "127.0.0.1:5080" );
965985 assertTrue (alicePhone .register (uri , "alice" , "1234" , aliceContact , 3600 , 3600 ));
986+ Credential c = new Credential ("refertest.restcomm.com" , "alice" , clientPassword );
987+ alicePhone .addUpdateCredential (c );
966988
967989 SipCall georgeCall = georgePhone .createSipCall ();
968990 georgeCall .listenForIncomingCall ();
@@ -1030,7 +1052,7 @@ public static WebArchive createWebArchiveNoGw() {
10301052 archive .addAsWebInfResource ("sip.xml" );
10311053 archive .addAsWebInfResource ("web.xml" );
10321054 archive .addAsWebInfResource ("restcomm_calllifecycle.xml" , "conf/restcomm.xml" );
1033- archive .addAsWebInfResource ("restcomm.script_ReferMessageTest " , "data/hsql/restcomm.script" );
1055+ archive .addAsWebInfResource ("restcomm.script_ReferMessageOrgTest " , "data/hsql/restcomm.script" );
10341056 archive .addAsWebInfResource ("akka_application.conf" , "classes/application.conf" );
10351057 logger .info ("Packaged Test App" );
10361058 return archive ;
0 commit comments