Example #1
0
  /**
   *
   *
   * <pre>
   *  Alice        Proxy       Bob        Bob(2)       HSS
   * 1  | INVITE     |          |           |           |
   *    |----------->|          |           |           |
   * 2  |            | INVITE   |           |           |
   *    |            |--------->|           |           |
   * 3  |            |      404 |           |           |
   *    |            |<---------|           |           |
   * 4  |            | ACK      |           |           |
   *    |            |--------->|           |           |
   * 5  |            | UDR      |           |           |
   *    |            |--------------------------------->|
   * 6  |            |          |           |       UDA |
   *    |            |<---------------------------------|
   * 7  |            | INVITE   |           |           |
   *    |            |--------------------->|           |
   * 8  |            |          |       200 |           |
   *    |            |<---------------------|           |
   * 9  |        200 |          |           |           |
   *    |<-----------|          |           |           |
   * 10 | ACK        |          |           |           |
   *    |----------->|          |           |           |
   * 11 |            | ACK      |           |           |
   *    |            |--------------------->|           |
   * 12 | BYE        |          |           |           |
   *    |----------->|          |           |           |
   * 13 |            | BYE      |           |           |
   *    |            |--------------------->|           |
   * 14 |            |          |       200 |           |
   *    |            |<---------------------|           |
   * 15 |        200 |          |           |           |
   *    |<-----------|          |           |           |
   * </pre>
   */
  @Test
  public void testProxyDiameter() throws Throwable {
    Endpoint bob = createEndpoint("bob");
    UaRunnable callB = new UasScript.NotFound(bob.getUserAgent());
    Endpoint bob2 = createEndpoint("bob");
    UaRunnable callC = new UasScript.OkBye(bob2.getUserAgent());

    callB.start();
    callC.start();

    SipServletRequest request = _ua.createRequest(SipMethods.INVITE, bob.getUri());
    request.setRequestURI(bob.getContact().getURI());
    request.addHeader("proxy", bob2.getContact().toString());
    Call callA = _ua.createCall(request);

    try {
      assertThat(callA.waitForResponse(), isSuccess());
      callA.createAck().send();
      Thread.sleep(200);
      callA.createBye().send();
      assertThat(callA.waitForResponse(), isSuccess());
      callB.assertDone();
      callC.assertDone();
    } finally {
      checkForFailure();
    }
  }
Example #2
0
  /**
   * Ensure that the servlet is not invoked if session is invalidated.
   *
   * <p>See http://jira.cipango.org/browse/CIPANGO-121
   *
   * <pre>
   *  Alice        Proxy       Bob
   * 1  | INVITE     |          |
   *    |----------->|          |
   * 2  |            | INVITE   |
   *    |            |--------->|
   * 3  |            |      200 |
   *    |            |<---------|
   * 4  |        200 |          |
   *    |<-----------|          |
   * 5  | ACK        |          |
   *    |----------->|          |
   * 6  |            | ACK      |
   *    |            |--------->|
   * 7  | BYE        |          |
   *    |----------->|          |
   * 8  |            | BYE      |
   *    |            |--------->|
   * 9  |            |      200 |
   *    |            |<---------|
   * 10 |        200 |          |
   *    |<-----------|          |
   * </pre>
   */
  @Test
  public void testInvalidateBefore200() throws Exception {
    Endpoint bob = createEndpoint("bob");
    UaRunnable callB = new UasScript.OkBye(bob.getUserAgent());

    callB.start();

    SipServletRequest request = _ua.createRequest(SipMethods.INVITE, bob.getUri());
    request.setRequestURI(bob.getContact().getURI());
    Call callA = _ua.createCall(request);
    assertThat(callA.waitForResponse(), isSuccess());
    callA.createAck().send();
    callA.createBye().send();

    SipServletResponse response = callA.waitForResponse();
    assertThat(response, isSuccess());
    assertThat(response.getHeader("error"), is(nullValue()));
  }