Package org.cipango.kaleo.location.event.ContactDocument

Examples of org.cipango.kaleo.location.event.ContactDocument.Contact


    regInfo = getRegInfo(notify);
    registration = regInfo.getRegistrationArray(0);
    assertEquals(1, registration.getContactArray().length);
    assertEquals(version + 1, regInfo.getVersion().intValue());
    assertEquals(State.ACTIVE, registration.getState());
    Contact contact = registration.getContactArray(0);
    assertBetween(1795, 1800, contact.getExpires().intValue());
    assertEquals(Event.REGISTERED, contact.getEvent());
   
    registerSession.register(null, 0); // 9 and  10
    tx = session.waitForNotify();
    notify = tx.getRequest(); // 11
    //System.out.println(notify);
    session.sendResponse(Response.OK, tx); // 12
    regInfo = getRegInfo(notify);
    registration = regInfo.getRegistrationArray(0);
    assertEquals(1, registration.getContactArray().length);
    assertEquals(version + 2, regInfo.getVersion().intValue());
    assertEquals(State.TERMINATED, registration.getState());
    contact = registration.getContactArray(0);
    assertEquals(0, contact.getExpires().intValue());
    assertEquals(Event.UNREGISTERED, contact.getEvent());
   
    subscribe = session.newSubsequentSubscribe(0); // 13
    session.sendRequest(subscribe, Response.OK); // 14
   
    tx = session.waitForNotify();
View Full Code Here


    regInfo = getRegInfo(notify);
    registration = regInfo.getRegistrationArray(0);
    assertEquals(1, registration.getContactArray().length);
    assertEquals(1, regInfo.getVersion().intValue());
    assertEquals(State.TERMINATED, registration.getState());
    Contact contact = registration.getContactArray(0);
    assertEquals(0, contact.getExpires().intValue());
    assertEquals(Event.UNREGISTERED, contact.getEvent());
       
    subscribe = session.newSubsequentSubscribe(0);
    session.sendRequest(subscribe, Response.OK);
   
    tx = session.waitForNotify();
View Full Code Here

    Registration registration = doc.addNewReginfo().addNewRegistration();
    registration.setAor("sip:test@cipango.org");
    registration.setState(Registration.State.ACTIVE);
    registration.setId("lkd4");
   
    Contact contact = registration.addNewContact();
    contact.setId("hdg0");
    contact.setState(Contact.State.ACTIVE);
    contact.setUri("sip:127.0.0.1");
   
    byte[] b = handler.getBytes(doc);
   
    ReginfoDocument doc2 = ReginfoDocument.Factory.parse(new ByteArrayInputStream(b));
   
View Full Code Here

    registration.addBinding(binding1);
   
    //System.out.println(regResource.getState().getContent());
    assertEquals(1, reginfo.getRegistrationArray(0).getContactArray().length);
    assertEquals(State.ACTIVE, reginfo.getRegistrationArray(0).getState());
    Contact contact = reginfo.getRegistrationArray(0).getContactArray(0);
    assertEquals(Event.REGISTERED, contact.getEvent());
    assertEquals("sip:alice@localhost", contact.getUri());
    //assertTrue(contact.getExpires().intValue() > 98 && contact.getExpires().intValue() <= 100);
   
    registration.addBinding(new Binding(new UriImpl("sip:alice@localhost:5070"), "567@localhost", 1, now + 200000));
    assertEquals(2, reginfo.getRegistrationArray(0).getContactArray().length);
    assertEquals(State.ACTIVE, reginfo.getRegistrationArray(0).getState());
    assertEquals(Event.REGISTERED, reginfo.getRegistrationArray(0).getContactArray(1).getEvent());
    assertEquals("sip:alice@localhost", reginfo.getRegistrationArray(0).getContactArray(0).getUri());
    assertEquals("sip:alice@localhost:5070", reginfo.getRegistrationArray(0).getContactArray(1).getUri());
   
    registration.updateBinding(binding1, new UriImpl("sip:alice@newContact"), "123@localhost", 1, now + 200000);
    assertEquals(2, reginfo.getRegistrationArray(0).getContactArray().length);
    assertEquals(State.ACTIVE, reginfo.getRegistrationArray(0).getState());
    assertEquals(Event.REFRESHED, reginfo.getRegistrationArray(0).getContactArray(0).getEvent());
    assertEquals(contact.getId(), reginfo.getRegistrationArray(0).getContactArray(0).getId());
    assertEquals("sip:alice@newContact", reginfo.getRegistrationArray(0).getContactArray(0).getUri());
   
    registration.removeBinding(binding1);
    assertEquals(1, reginfo.getRegistrationArray(0).getContactArray().length);
    assertEquals(State.ACTIVE, reginfo.getRegistrationArray(0).getState());
View Full Code Here

    if (registration != null && !registration.getBindings().isEmpty())
    {
      reg.setState(org.cipango.kaleo.location.event.RegistrationDocument.Registration.State.ACTIVE);
      for (Binding binding : registration.getBindings())
      {
        Contact contact = reg.addNewContact();
        contact.setUri(binding.getContact().toString());
        contact.setEvent(Event.REGISTERED);
        contact.setId(String.valueOf(binding.getId()));
        contact.setCallid(binding.getCallId());
        contact.setCseq(BigInteger.valueOf(binding.getCSeq()));
        contact.setExpires(BigInteger.valueOf(binding.getExpires()));
      }
    }
    else
      reg.setState(org.cipango.kaleo.location.event.RegistrationDocument.Registration.State.INIT);
   
View Full Code Here

  public void bindingChanged(String aor, Binding binding, Event.Enum event,
      org.cipango.kaleo.location.event.RegistrationDocument.Registration.State.Enum state)
  {
   
    Contact contactModified = null;
    Registration registration = _content.getReginfo().getRegistrationArray(0);
    registration.setState(state);
    for (Contact contact : registration.getContactArray())
    {
      if (contact.getId().equals(String.valueOf(binding.getId())))
      {
        contactModified = contact;
      }
    }
    if (contactModified == null)
    {
      contactModified = registration.addNewContact();
    }
    contactModified.setUri(binding.getContact().toString());
    contactModified.setEvent(event);
    contactModified.setId(String.valueOf(binding.getId()));
    contactModified.setCallid(binding.getCallId());
    contactModified.setCseq(BigInteger.valueOf(binding.getCSeq()));
    contactModified.setExpires(BigInteger.valueOf(binding.getExpires()));

    fireStateChanged();
   
   
    if (event == Event.DEACTIVATED || event == Event.EXPIRED
View Full Code Here

TOP

Related Classes of org.cipango.kaleo.location.event.ContactDocument.Contact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.