Interaction with Mobicents XDMS

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Interaction with Mobicents XDMS

Andaleeb Roomy
I am trying to retrieve an XML document from a third party XDMS
(Mobicents). But I am getting some errors:


Jul 27 11:31:16 [14648] DBG:presence_xml:get_rules_doc: No document
found in db table for [user]=andaleeb1 [domain]=
192.168.0.133 [doc_type]= 2
* About to connect() to 192.168.0.130 port 8080 (#0)
*   Trying 192.168.0.130... * connected
* Connected to 192.168.0.130 (192.168.0.130) port 8080 (#0)
> GET /mobicents/org.openmobilealliance.pres-rules/users/sip:andaleeb1@192.168.0.133/pres-rules HTTP/1.1

Host: 192.168.0.130:8080

Accept: */*



< HTTP/1.1 200 OK

* Failed writing header
* Closing connection #0
* Failed writing received data to disk/application
Jul 27 11:31:16 [14648] ERROR:xcap_client:send_http_get: Error [23]
while performing curl operationJul 27 11:31:16 [14648]
WARNING:core:fm_free: free(0) called
Jul 27 11:31:16 [14648] DBG:xcap_client:xcapGetNewDoc: the searched
document was not found


I found a thread
(http://www.openser.org/pipermail/devel/2009-May/003211.html) which
reports a similar problem and suggests to use xcap-client from version
1.5. I tried replacing my 1.5.1 files with files from that link but it
did not work either. Can anyone please help?

Andaleeb

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Iñaki Baz Castillo
2009/7/27 Andaleeb Roomy <[hidden email]>:

> I am trying to retrieve an XML document from a third party XDMS
> (Mobicents). But I am getting some errors:
>
>
> Jul 27 11:31:16 [14648] DBG:presence_xml:get_rules_doc: No document
> found in db table for [user]=andaleeb1  [domain]=
> 192.168.0.133   [doc_type]= 2
> * About to connect() to 192.168.0.130 port 8080 (#0)
> *   Trying 192.168.0.130... * connected
> * Connected to 192.168.0.130 (192.168.0.130) port 8080 (#0)
>> GET /mobicents/org.openmobilealliance.pres-rules/users/sip:andaleeb1@192.168.0.133/pres-rules HTTP/1.1
>
> Host: 192.168.0.130:8080
>
> Accept: */*

Could you do a ngrep/wireshark capture of the HTTP traffic to see what
is going on at http level?

--
Iñaki Baz Castillo
<[hidden email]>

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Andaleeb Roomy
In reply to this post by Andaleeb Roomy
> Could you do a ngrep/wireshark capture of the HTTP traffic to see what
> is going on at http level?
>
> --
> Iñaki Baz Castillo
> <ibc at aliax.net>


Wireshark shows that Mobicents is sending the XML document embedded in
the body of a 200 OK message in reply to the GET request of OpenSIPS.

Andaleeb

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Iñaki Baz Castillo
2009/7/29 Andaleeb Roomy <[hidden email]>:
>> Could you do a ngrep/wireshark capture of the HTTP traffic to see what
>> is going on at http level?

Some example?



--
Iñaki Baz Castillo
<[hidden email]>

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Andaleeb Roomy
In reply to this post by Andaleeb Roomy
> Some example?



GET /mobicents/org.openmobilealliance.pres-rules/users/sip:andaleeb1@192.168.0.133/pres-rules
HTTP/1.1
Host: 192.168.0.130:8080
Accept: */*

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build:
SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0
ETag: e46fe7c0be72de3551608c84e5ea36b0
Content-Type: application/auth-policy+xml;charset=ISO-8859-1
Content-Length: 2683
Date: Mon, 27 Jul 2009 04:35:42 GMT

<?xml version="1.0" encoding="UTF-8"?><cr:ruleset
xmlns:cr="urn:ietf:params:xml:ns:common-policy"
xmlns="urn:ietf:params:xml:ns:pres-rules"
xmlns:ocp="urn:oma:xml:xdm:common-policy"
xmlns:op="urn:oma:xml:prs:pres-rules">
 <cr:rule id="wp_prs_allow_own">
   <cr:conditions>
     <cr:identity>
       <cr:one id="sip:andaleeb1@192.168.0.133"/>
     </cr:identity>
   </cr:conditions>
   <cr:actions>
     <sub-handling>allow</sub-handling>
   </cr:actions>
   <cr:transformations>
     <provide-services>
       <all-services/>
     </provide-services>
     <provide-persons>
       <all-persons/>
     </provide-persons>
     <provide-all-attributes/>
     <provide-devices>
       <all-devices/>
     </provide-devices>
   </cr:transformations>
 </cr:rule>
 <cr:rule id="rcs_allow_services_anonymous">
   <cr:conditions>
     <ocp:anonymous-request/>
   </cr:conditions>
   <cr:actions>
     <sub-handling>allow</sub-handling>
   </cr:actions>
   <cr:transformations>
     <provide-services>
       <all-services/>
     </provide-services>
     <provide-persons>
       <all-persons/>
     </provide-persons>
     <provide-all-attributes/>
     <provide-devices>
       <all-devices/>
     </provide-devices>
   </cr:transformations>
 </cr:rule>
 <cr:rule id="wp_prs_unlisted">
   <cr:conditions>
     <ocp:other-identity/>
   </cr:conditions>
   <cr:actions>
     <sub-handling>confirm</sub-handling>
   </cr:actions>
 </cr:rule>
 <cr:rule id="wp_prs_grantedcontacts">
   <cr:conditions>
     <ocp:external-list>
       <ocp:entry
anc="http://192.168.0.130:8080/mobicents/resource-lists/users/sip:andaleeb1@192.168.0.133/index/~~/resource-lists/list%5B@name=%22oma_grantedcontacts%22%5D"/>
     </ocp:external-list>
   </cr:conditions>
   <cr:actions>
     <sub-handling>allow</sub-handling>
   </cr:actions>
   <cr:transformations>
     <provide-services>
       <all-services/>
     </provide-services>
     <provide-persons>
       <all-persons/>
     </provide-persons>
     <provide-all-attributes/>
     <provide-devices>
       <all-devices/>
     </provide-devices>
   </cr:transformations>
 </cr:rule>
 <cr:rule id="wp_prs_blockedcontacts">
   <cr:conditions>
     <ocp:external-list>
       <ocp:entry
anc="http://192.168.0.130:8080/mobicents/resource-lists/users/sip:andaleeb1@192.168.0.133/index/~~/resource-lists/list%5B@name=%22oma_blockedcontacts%22%5D"/>
     </ocp:external-list>
   </cr:conditions>
   <cr:actions>
     <sub-handling>block</sub-handling>
   </cr:actions>
 </cr:rule>
</cr:ruleset>

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Iñaki Baz Castillo
2009/7/31 Andaleeb Roomy <[hidden email]>:

>> Some example?
>
>
>
> GET /mobicents/org.openmobilealliance.pres-rules/users/sip:andaleeb1@192.168.0.133/pres-rules
> HTTP/1.1
> Host: 192.168.0.130:8080
> Accept: */*
>
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build:
> SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0
> ETag: e46fe7c0be72de3551608c84e5ea36b0
> Content-Type: application/auth-policy+xml;charset=ISO-8859-1
> Content-Length: 2683
> Date: Mon, 27 Jul 2009 04:35:42 GMT


I don't see issues in the response. Well, I see one: "Content-Type"
includes a parameter "charset" different than UTF-8, while RFC 4825
(XCAP) requires UTF-8 for all the documents.





--
Iñaki Baz Castillo
<[hidden email]>

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Andaleeb Roomy
In reply to this post by Andaleeb Roomy
> I don't see issues in the response. Well, I see one: "Content-Type"
> includes a parameter "charset" different than UTF-8, while RFC 4825
> (XCAP) requires UTF-8 for all the documents.

I was finally able to find where the error was occurring. It was not
the charset.

libcurl doc says that if the callback function set by
CURLOPT_WRITEFUNCTION returns a value that differs from the amount of
data passed the function, it will signal an error. The same applies
for CURLOPT_HEADERFUNCTION. This was happening in my case because
get_xcap_etag in xcap_functions.c was returning a different value
because of deducting ETAG_HDR_LEN from size*nmemb.
        int len= 0;
        .
        .
        if(strncasecmp(ptr, ETAG_HDR, ETAG_HDR_LEN)== 0)
        {
                len= size* nmemb- ETAG_HDR_LEN;
               .
               .
        }
        return len;


Same thing happened with write_function returning buff->len instead of
size*nmemb. buff->len may have been right in case this callback was
called only once with all the data of the message body, but in
reality, it is called whenever libcurl thinks that some data needs to
saved, according to libcurl doc. In this case, buff->len was returning
the aggregate length of the message which differs from the size*nmemb
of a single call.



I also found issues with pointers, like passing &etag instead of just
etag, which is already a char**, as CURLOPT_WRITEHEADER. This was
causing the etag to be written in a wrong location.
        ..
        curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, &etag);
        ..



I guess OpenSIPS presence modules need to be developed and tested more
to work with third party XDMSs and clients. Currently I am facing a
difficulty because it does not follow resource-list childs under
services element in an rls-services doc. This is required to subscribe
to all the presentities of a presence list set by Mercuro IMS client.

Thanks,

Andaleeb

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Interaction with Mobicents XDMS

Iñaki Baz Castillo
El Miércoles, 5 de Agosto de 2009, Andaleeb Roomy escribió:

> > I don't see issues in the response. Well, I see one: "Content-Type"
> > includes a parameter "charset" different than UTF-8, while RFC 4825
> > (XCAP) requires UTF-8 for all the documents.
>
> I was finally able to find where the error was occurring. It was not
> the charset.
>
> libcurl doc says that if the callback function set by
> CURLOPT_WRITEFUNCTION returns a value that differs from the amount of
> data passed the function, it will signal an error. The same applies
> for CURLOPT_HEADERFUNCTION. This was happening in my case because
> get_xcap_etag in xcap_functions.c was returning a different value
> because of deducting ETAG_HDR_LEN from size*nmemb.
> int len= 0;
>         .
>         .
> if(strncasecmp(ptr, ETAG_HDR, ETAG_HDR_LEN)== 0)
> {
> len= size* nmemb- ETAG_HDR_LEN;
>                .
>                .
> }
> return len;
>
>
> Same thing happened with write_function returning buff->len instead of
> size*nmemb. buff->len may have been right in case this callback was
> called only once with all the data of the message body, but in
> reality, it is called whenever libcurl thinks that some data needs to
> saved, according to libcurl doc. In this case, buff->len was returning
> the aggregate length of the message which differs from the size*nmemb
> of a single call.
>
>
>
> I also found issues with pointers, like passing &etag instead of just
> etag, which is already a char**, as CURLOPT_WRITEHEADER. This was
> causing the etag to be written in a wrong location.
> ..
> curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, &etag);
> ..
>
>
>
> I guess OpenSIPS presence modules need to be developed and tested more
> to work with third party XDMSs and clients. Currently I am facing a
> difficulty because it does not follow resource-list childs under
> services element in an rls-services doc. This is required to subscribe
> to all the presentities of a presence list set by Mercuro IMS client.


Please, report a bug in the tracker. It's interesting.


--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel