Package org.cafesip.sipunit

Examples of org.cafesip.sipunit.PresenceDeviceInfo


        // check PRESENCE info - devices/tuples
        // -----------------------------------------------
        HashMap<String, PresenceDeviceInfo> devices = s.getPresenceDevices();
        assertEquals(1, devices.size());
        PresenceDeviceInfo dev = devices.values().iterator().next();
        assertNotNull(dev);
        assertEquals("closed", dev.getBasicStatus());
       
        Thread.sleep(200);
       
        PublishSession publishSession = new PublishSession(getBobPhone());
        Request publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
        publishSession.sendRequest(publish, SipResponse.OK);

        // get the NOTIFY
        reqevent = s.waitNotify(10000);
        assertNotNull(s.format(), reqevent);
        assertNoSubscriptionErrors(s);

        // examine the request object
        request = reqevent.getRequest();
        assertEquals(Request.NOTIFY, request.getMethod());
        assertTrue(((SubscriptionStateHeader) request
                .getHeader(SubscriptionStateHeader.NAME)).getExpires() > 0);

         // process the NOTIFY
        response = s.processNotify(reqevent);
        assertNotNull(response);

        assertTrue(s.isSubscriptionActive());

        devices = s.getPresenceDevices();
        assertEquals(1, devices.size());
        dev = devices.get("bs35r9");
        assertNotNull(dev);
        assertEquals("open", dev.getBasicStatus());
        assertEquals("sip:bob@cipango.org", dev.getContactURI());
        assertEquals(0.8, dev.getContactPriority());
        assertEquals("Don't Disturb Please!", dev.getDeviceNotes().get(0).getValue());
       
        // reply to the NOTIFY
        assertTrue(s.replyToNotify(reqevent, response));

        assertNoSubscriptionErrors(s);
View Full Code Here

TOP

Related Classes of org.cafesip.sipunit.PresenceDeviceInfo

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.