alminah / android-rcs-ims-stack

Automatically exported from code.google.com/p/android-rcs-ims-stack
0 stars 0 forks source link

PIDF+XML parsing in NOTIFY and enabling capabilities for Presence based Capability Discovery #172

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Client sends SIP SUBSCRIBE with event= presence for Capability discovery
2.Contact sends SIP NOTIFY with XML based pidf document containing tuples for 
File transfer, social presence and discovery via presence enabled. PIDF 
document in NOTIFY has the same XML format as used in SIP PUBLISH
3.PIDF document is parsed without exception

I/System.out( 1889): <<< NOTIFY sip:10.23.206.22:5060;transport=UDP SIP/2.0
I/System.out( 1889): Via: SIP/2.0/UDP 10.23.205.22:5060;branch=z9hG4bK37067516
I/System.out( 1889): Route: <sip:10.23.206.22:5060;transport=UDP>
I/System.out( 1889): From: <tel:+1234567891>;tag=4052078080
I/System.out( 1889): To: 
<sip:anonymous@ims.mnc410.mcc310.3gppnetwork.org>;tag=PWKHKHU2BA
I/System.out( 1889): Call-ID: PWKHKHU1BA@10.23.206.22
I/System.out( 1889): CSeq: 1 NOTIFY
I/System.out( 1889): Contact: <sip:10.23.205.22:5060;transport=udp;lr>
I/System.out( 1889): Content-Type: application/pidf+xml
I/System.out( 1889): Require: eventlist
I/System.out( 1889): SIP-ETag: 54386802
I/System.out( 1889): Max-Forwards: 70
I/System.out( 1889): Event: presence
I/System.out( 1889): Subscription-State: active
I/System.out( 1889): Content-Length: 1434
I/System.out( 1889): 

I/System.out( 1889): <?xml version="1.0" encoding="UTF-8"?>
I/System.out( 1889): <presence xmlns="urn:ietf:params:xml:ns:pidf"
I/System.out( 1889): xmlns:op="urn:oma:xml:prs:pidf:oma-pres"
I/System.out( 1889):  xmlns:opd="urn:oma:xml:pde:pidf:ext"
I/System.out( 1889):  xmlns:pdm="urn:ietf:params:xml:ns:pidf:data-model"
I/System.out( 1889):  xmlns:ci="urn:ietf:params:xml:ns:pidf:cipid"
I/System.out( 1889):  xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"
I/System.out( 1889):  xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10"
I/System.out( 1889):  
xmlns:gml="urn:opengis:specification:gml:schema-xsd:feature:v3.0"
I/System.out( 1889):  entity="tel:+1234567891">

<tuple id="tg016">
I/System.out( 1889): <status>
I/System.out( 1889): <basic>open</basic>
I/System.out( 1889): </status>
I/System.out( 1889): <op:service-description>
I/System.out( 1889): <op:service-id>
I/System.out( 1889): org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcse.dp
I/System.out( 1889): </op:service-id>
I/System.out( 1889): <op:version>1.0</op:version>
I/System.out( 1889): </op:service-description>
I/System.out( 1889): <contact>tel:+1234567891</contact>
I/System.out( 1889): <timestamp>2013-10-18T12:47:52Z</timestamp>
I/System.out( 1889): </tuple>

I/System.out( 1889): <tuple id="tg308">
I/System.out( 1889): <status>
I/System.out( 1889): <basic>open</basic>
I/System.out( 1889): </status>
I/System.out( 1889): <op:service-description>
I/System.out( 1889): <op:service-id>
I/System.out( 1889): org.openmobilealliance:File-Transfer
I/System.out( 1889): </op:service-id>
I/System.out( 1889): <op:version>1.0</op:version>
I/System.out( 1889): </op:service-description>
I/System.out( 1889): <contact>tel:+1234567891</contact>
I/System.out( 1889): <timestamp>2013-10-18T12:47:52Z</timestamp>
I/System.out( 1889): </tuple>

I/System.out( 1889): <tuple id="tg747">
I/System.out( 1889): <status>
I/System.out( 1889): <basic>open</basic>
I/System.out( 1889): </status>
I/System.out( 1889): <op:service-description>
I/System.out( 1889): <op:service-id>
I/System.out( 1889): org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcse.sp
I/System.out( 1889): </op:service-id>
I/System.out( 1889): <op:version>1.0</op:version>
I/System.out( 1889): </op:service-description>
I/System.out( 1889): <contact>tel:+1234567891</contact>
I/System.out( 1889): <timestamp>2013-10-18T12:47:52Z</timestamp>
I/System.out( 1889): </tuple>
I/System.out( 1889): </presence>

I/System.out( 1889): 
-----------------------------------------------------------------------------

D/libc    ( 1889): getaddrinfo called from pid =1889

E/MP-Decision( 1250): Error setting a sleep mode for secondary cores - -19

V/[RCS][AnonymousFetchManager]( 1889): Anonymous fetch notification received

V/[RCS][AnonymousFetchManager]( 1889): Anonymous fetch notification with PIDF 
document

V/[RCS][PidfParser]( 1889): Start document

V/[RCS][DateUtils]( 1889): decodeDate 2013-10-18T12:47:52Z with 1. format 
yyyy-MM-dd'T'HH:mm:ssZ

V/[RCS][DateUtils]( 1889): decodeDate converted 2013-10-18T12:47:52Z to 
1382100472000

V/[RCS][DateUtils]( 1889): decodeDate 2013-10-18T12:47:52Z with 1. format 
yyyy-MM-dd'T'HH:mm:ssZ

V/[RCS][DateUtils]( 1889): decodeDate converted 2013-10-18T12:47:52Z to 
1382100472000

V/[RCS][DateUtils]( 1889): decodeDate 2013-10-18T12:47:52Z with 1. format 
yyyy-MM-dd'T'HH:mm:ssZ

V/[RCS][DateUtils]( 1889): decodeDate converted 2013-10-18T12:47:52Z to 
1382100472000

V/[RCS][PidfParser]( 1889): Presence document complete

V/[RCS][PidfParser]( 1889): End document

D/dalvikvm( 1889): GC_CONCURRENT freed 3516K, 33% free 14276K/21251K, paused 
6ms+5ms

I/[RCS][ContactsManager]( 1889): Set contact info for +1234567891

D/TELProfiling(  725):  [getValue] --->  key  lgu_global_roaming Vale null

W/SignalStrength(  554): getoperLteLevel - datafeature:4

W/SignalStrength(  554): ATT: getLTELevel - rsrp:2147483647 snr:2147483647 
rsrpIconLevel:0 snrIconLevel:-1

W/SignalStrength(  554): [BRIGHTHY] lastEcIoIndex=1 lastEcIoValues.length=5

W/SignalStrength(  554): [BRIGHTHY] asu_Ecio=-40  , getGsmLevel=5

W/SignalStrength(  554): Report UI RSSI Level=5

D/StatusBar.NetworkController(  554): onDataActivity: direction=3

D/StatusBar.NetworkController(  554): refreshViews connected={ data } level=5 
combinedSignalIconId=0x7f02027b/com.android.systemui:drawable/stat_sys_signal_5_
fully_att combinedActivityIconId=0x0 mAirplaneMode=false mDataActivity=3 
mPhoneSignalIconId=0x7f02027b mDataDirectionIconId=0x7f02021c 
mDataSignalIconId=0x7f02027b mDataTypeIconId=0x0 mNoSimIconId=0x0 
mThirdTypeIconId=0x7f020210 mWifiIconId=0x0 mBluetoothTetherIconId=0x1080549

V/[RCS][AddressBookManager]( 1889): New address book checking scheduled in 1000 
ms

I/AAB     ( 1266): [ContentsChangeObserver] Registartion is not completed...

I/AAB     ( 1266): [ContentsChangeObserver] Registartion is not completed...

V/[RCS][RcsCoreService]( 1889): Handle capabilities update notification for 
tel:+1234567891 (Image_share=false, Video_share=false, IP_voice_call=false, 
IP_video_call=false, File_transfer=false, Chat=true, CS_video=false, 
Presence_discovery=true, Social_presence=false, FT_http=false, 
Geolocation_push=false, FT_thumbnail=false, SipAutomata=false, 
Timestamp=1382075379984)

What is the expected output? What do you see instead?
Expected output is Client shows the updated capabilities (FT, Social Presence 
and Discovery via Presence) of the contact received in the SIP NOTIFY pidf 
document. But actual output is "Discovery via Presence" is default enabled and 
remaining capabilities (FT, SP) are not enabled which are sent inside pidf 
document

What version of the product are you using? On what operating system?
RCS Stack Latest Release version 2.5.11 on Android version 4.0.4

Please provide any additional information below.
In the RCS libraries,
AnonymousFetchManager.java

public void receiveNotification(SipRequest notify) {
        if (logger.isActivated()) {
                        logger.debug("Anonymous fetch notification received");
                }

                // Parse XML part
            byte[] content = notify.getContentBytes();
            if (content != null) {
                if (logger.isActivated()) {
                        logger.debug("Anonymous fetch notification with PIDF document");
                }
                try {
                        InputSource pidfInput = new InputSource(new ByteArrayInputStream(content));
                        PidfParser pidfParser = new PidfParser(pidfInput);
                        PidfDocument presence = pidfParser.getPresence();
                        if (presence != null) {
                                // Extract capabilities
                                Capabilities capabilities =  new Capabilities();

                                // We queried via anonymous fetch procedure, so set presence discovery to true
                                capabilities.setPresenceDiscoverySupport(true);

                                String contact = presence.getEntity();
                                Vector<Tuple> tuples = presence.getTuplesList();
                                for(int i=0; i < tuples.size(); i++) {
                                        Tuple tuple = (Tuple)tuples.elementAt(i);
                                        boolean state = false;
                                        if (tuple.getStatus().getBasic().getValue().equals("open")) {
                                                state = true;
                                        }
                                        String id = tuple.getService().getId();
                                        if (id.equalsIgnoreCase(PresenceUtils.FEATURE_RCS2_VIDEO_SHARE)) {
                                                capabilities.setVideoSharingSupport(state);
                                        } else
                                        if (id.equalsIgnoreCase(PresenceUtils.FEATURE_RCS2_IMAGE_SHARE)) {
                                                capabilities.setImageSharingSupport(state);
                                        } else
                                        if (id.equalsIgnoreCase(PresenceUtils.FEATURE_RCS2_FT)) {
                                                capabilities.setFileTransferSupport(state);
                                        } else
                                                if (id.equalsIgnoreCase(PresenceUtils.FEATURE_RCS2_CS_VIDEO)) {
                                                        capabilities.setCsVideoSupport(state);
                                                } else
                                                if (id.equalsIgnoreCase(PresenceUtils.FEATURE_RCS2_CHAT)) {
                                                        capabilities.setImSessionSupport(state);
                                                }
                                }

                                // Update capabilities in database
                                ContactsManager.getInstance().setContactCapabilities(contact, capabilities, ContactInfo.RCS_CAPABLE, ContactInfo.REGISTRATION_STATUS_UNKNOWN);

                                // Notify listener
                                imsModule.getCore().getListener().handleCapabilitiesNotification(contact, capabilities);
                        }
                } catch(Exception e) {
                        if (logger.isActivated()) {
                                logger.error("Can't parse XML notification", e);
                        }
                }      
            }....

Inside this function, the capability discovery via Presence is default set to 
TRUE (as seen in the traces and also shown on Client GUI). But File Transfer 
Service ID is also checked (PresenceUtils.FEATURE_RCS2_FT). PIDF Parser did not 
show any exception but still FT was not changed to TRUE (as shown in the traces 
below). Chat is shown as True because "IM always on" flag was checked in RCS 
client provisioning tab.

V/[RCS][RcsCoreService]( 1889): Handle capabilities update notification for 
tel:+1234567891 (Image_share=false, Video_share=false, IP_voice_call=false, 
IP_video_call=false, File_transfer=false, Chat=true, CS_video=false, 
Presence_discovery=true, Social_presence=false, FT_http=false, 
Geolocation_push=false, FT_thumbnail=false, SipAutomata=false, 
Timestamp=1382075379984)

Original issue reported on code.google.com by aamer.78...@gmail.com on 23 Oct 2013 at 10:00

Attachments: