<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.4.4">
</HEAD>
<BODY>
Hi,<BR>
<BR>
External anchors are not currently supported by the Kamailio RLS module.&nbsp; The presence of these do not explain all of the symptoms you are seeing - but you are not going to be able to get your resource-lists working properly if they are in there - at best these will be ignored, at worst they will cause errors.<BR>
<BR>
For each &lt;entry /&gt; in your resource list the RLS module will create a back-end subscription (using the PUA module) to a Presence Server.&nbsp; When using Kamailio it is often the case that this Presence Server is actually the Kamailio presence module running on the same instance of Kamailio as RLS and PUA - but even in this case Kamailio will create and send a real SUBSCRIBE request (it'll just loop to itself).<BR>
<BR>
After logging in with an RLS capable client you should end up with the following:
<UL>
    <LI>One presentity in the presentity table
    <LI>One presence.winfo dialog in the active_watchers table
    <LI>One presence dialog in the rls_watchers table
    <LI>One presence dialog for each &lt;entry /&gt; in the resource-list in the pua table
    <LI>One presence dialog for each &lt;entry /&gt; in the resource-list in the active_watchers table
    <LI>One entry in the watchers table for each watcher/presentity relationship indicating state (active, pending, terminated, etc) - these are the cached (to avoid the overhead of continually re-parsing the same XML document) results of the presence module processing pres-rules for each presence subscription
</UL>
The rls_presentity table will be empty until you have multiple clients signed in concurrently and are sharing presence between them.<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
On Fri, 2012-10-26 at 10:44 -0500, Sangeeta Shah wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hugh,
   Thanks for the response.

When the client subscribes to the presence.winfo event - it does
result in an entry in the active_watchers table.

Then it is sending a subscribe to the presence event with the
supported header set to &quot;eventlist&quot;

Also I am starting from an empty database. So as you said, the client
is getting a 404 back and then putting the pres-rules, rls-services,
and resource-lists documents. The client that is connecting has no
contacts. All 3 documents have external anchors which I unfortunately
cannot disable :(

So the resource-list XML is as follows:
&lt;resource-lists xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot;&gt;
  &lt;list name=&quot;rcs&quot;&gt;
    &lt;display-name&gt;All Contacts&lt;/display-name&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22doubango%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22doubango%22%5D</A>&quot;
/&gt;
    &lt;entry uri=&quot;<A HREF="sip:8475551001@ip">sip:8475551001@ip</A>&quot; /&gt;
  &lt;/list&gt;
  &lt;list name=&quot;rcs_blockedcontacts&quot;&gt;
    &lt;display-name&gt;Blocked Contacts&lt;/display-name&gt;
  &lt;/list&gt;
  &lt;list name=&quot;rcs_revokedcontacts&quot;&gt;
    &lt;display-name&gt;Revoked Contacts&lt;/display-name&gt;
  &lt;/list&gt;
  &lt;list name=&quot;oma_allcontacts&quot;&gt;
    &lt;display-name&gt;OMA All Contacts&lt;/display-name&gt;
  &lt;/list&gt;
  &lt;list name=&quot;oma_blockedcontacts&quot;&gt;
    &lt;display-name&gt;OMA Blocked Contacts&lt;/display-name&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs_blockedcontacts%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs_blockedcontacts%22%5D</A>&quot;
/&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs_revokedcontacts%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs_revokedcontacts%22%5D</A>&quot;
/&gt;
  &lt;/list&gt;
  &lt;list name=&quot;oma_buddylist&quot;&gt;
    &lt;display-name&gt;OMA BuddyList&lt;/display-name&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs%22%5D</A>&quot;
/&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22oma_pocbuddylist%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22oma_pocbuddylist%22%5D</A>&quot;
/&gt;
  &lt;/list&gt;
  &lt;list name=&quot;oma_grantedcontacts&quot;&gt;
    &lt;display-name&gt;OMA Granted Contacts&lt;/display-name&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22rcs%22%5D</A>&quot;
/&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22oma_buddylist%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22oma_buddylist%22%5D</A>&quot;
/&gt;
  &lt;/list&gt;
  &lt;list name=&quot;oma_pocbuddylist&quot;&gt;
    &lt;display-name&gt;OMA POC BuddyList&lt;/display-name&gt;
  &lt;/list&gt;
  &lt;list name=&quot;doubango&quot;&gt;
    &lt;display-name&gt;My Default Contacts&lt;/display-name&gt;
  &lt;/list&gt;
&lt;/resource-lists&gt;

Now when I run tcpdump on the loopback interface I see a ton of
messages generated from the server - to the server as follows
(excerpt), there are a ton of presence subscribes and corresponding
notifies that are going back to the server, only one instance of the
publish below:

PUBLISH <A HREF="sip:8475551001@ip">sip:8475551001@ip</A> SIP/2.0

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK6596.773f3d36.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-404e

CSeq: 10 PUBLISH

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1670@127.0.0.1">3a1e3ea20824a642-1670@127.0.0.1</A>

Content-Length: 499

User-Agent: kamailio (3.3.2 (x86_64/linux))

Max-Forwards: 70

Event: reg

Expires: 3601

Content-Type: application/reginfo+xml



&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;reginfo xmlns=&quot;urn:ietf:params:xml:ns:reginfo&quot; version=&quot;0&quot; state=&quot;full&quot;&gt;
  &lt;registration aor=&quot;<A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>&quot; id=&quot;0x7f62677013a0&quot;
state=&quot;active&quot;&gt;
    &lt;contact id=&quot;0x7f6267701410&quot; state=&quot;active&quot; event=&quot;created&quot;
expires=&quot;600000&quot; callid=&quot;ea899804-de89-fdff-2f22-176bd8996221&quot;
cseq=&quot;15648&quot; received=&quot;&quot; path=&quot;&quot; user_agent=&quot;IM-client/OMA1.0
Boghe/v2.0.97.687&quot;&gt;
      &lt;uri&gt;<A HREF="sip:8475551001@10.51.2.181:63311">sip:8475551001@10.51.2.181:63311</A>;transport=udp&lt;/uri&gt;
    &lt;/contact&gt;
  &lt;/registration&gt;
&lt;/reginfo&gt;
SIP/2.0 200 OK

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK6596.773f3d36.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-a070

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-404e

CSeq: 10 PUBLISH

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1670@127.0.0.1">3a1e3ea20824a642-1670@127.0.0.1</A>

Expires: 3600

SIP-ETag: a.1351264309.1668.1.0

Server: kamailio (3.3.2 (x86_64/linux))

Content-Length: 0



SUBSCRIBE <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A> SIP/2.0

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK761d.6ebf4355.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-bfdd

CSeq: 10 SUBSCRIBE

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1668@127.0.0.1">3a1e3ea20824a642-1668@127.0.0.1</A>

Content-Length: 0

User-Agent: kamailio (3.3.2 (x86_64/linux))

Max-Forwards: 70

Event: presence

Contact: &lt;<A HREF="sip:kamailio-ip:5060">sip:kamailio-ip:5060</A>&gt;

Expires: 7210

Supported: eventlist

Accept: application/pidf+xml, application/rlmi+xml,
application/watcherinfo+xml, multipart/related



SIP/2.0 200 OK

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK761d.6ebf4355.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-8fd4

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-bfdd

CSeq: 10 SUBSCRIBE

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1668@127.0.0.1">3a1e3ea20824a642-1668@127.0.0.1</A>

Expires: 7200

Contact: &lt;<A HREF="sip:kamailio-ip:5060">sip:kamailio-ip:5060</A>&gt;

Require: eventlist

Server: kamailio (3.3.2 (x86_64/linux))

Content-Length: 0



SUBSCRIBE <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A> SIP/2.0

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK25f.0e3d3f64.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-62f4

CSeq: 10 SUBSCRIBE

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1672@127.0.0.1">3a1e3ea20824a642-1672@127.0.0.1</A>

Content-Length: 0

User-Agent: kamailio (3.3.2 (x86_64/linux))

Max-Forwards: 70

Event: presence

Contact: &lt;<A HREF="sip:kamailio-ip:5060">sip:kamailio-ip:5060</A>&gt;

Expires: 7210

Supported: eventlist

Accept: application/pidf+xml, application/rlmi+xml,
application/watcherinfo+xml, multipart/related



SIP/2.0 200 OK

Via: SIP/2.0/UDP kamailio-ip;branch=z9hG4bK25f.0e3d3f64.0

To: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-ceeb

From: <A HREF="sip:8475551001@kamailio-ip">sip:8475551001@kamailio-ip</A>;tag=533cb9e91f4b999cf76861cbb9ed54ed-62f4

CSeq: 10 SUBSCRIBE

Call-ID: <A HREF="mailto:3a1e3ea20824a642-1672@127.0.0.1">3a1e3ea20824a642-1672@127.0.0.1</A>

Expires: 7200

Contact: &lt;<A HREF="sip:kamailio-ip:5060">sip:kamailio-ip:5060</A>&gt;

Require: eventlist

Server: kamailio (3.3.2 (x86_64/linux))

Content-Length: 0

I am not sure if it's the nature of the resource-list document or
something in the config file that's causing this loop. I am guessing
it might be the following entry:
  &lt;list name=&quot;rcs&quot;&gt;
    &lt;display-name&gt;All Contacts&lt;/display-name&gt;
    &lt;external anchor=&quot;<A HREF="http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22doubango%22%5D">http://10.50.251.13:5060/xcap-root/resource-lists/users/sip:8475551001@ip/index/~~/resource-lists/list%5B@name=%22doubango%22%5D</A>&quot;
/&gt;
    &lt;entry uri=&quot;<A HREF="sip:8475551001@ip">sip:8475551001@ip</A>&quot; /&gt;
  &lt;/list&gt;

But why would all these subscribes go back to the server? Should I be
handling them in the routing code in the config file. They all have
unique to tags/from tags/and call ids.

I am willing to modify the code with some direction on how to better
handle this.

Thanks,
Sangeeta

On Fri, Oct 26, 2012 at 9:36 AM, Hugh Waite
&lt;<A HREF="mailto:hugh.waite@crocodile-rcs.com">hugh.waite@crocodile-rcs.com</A>&gt; wrote:
&gt; Hi,
&gt;
&gt; I don't know what might cause exactly the issues you are seeing, but here's
&gt; what I would do to track it down.
&gt;
&gt; 1. If no xcap documents exist on the system, the client will get a 404 and
&gt; should usually PUT some new (empty) documents.
&gt;
&gt; Assuming these 'empty' documents exist, the following should happen when the
&gt; client logs in.
&gt; a. When the SUBSCRIBE to presence.winfo arrives it should create a single
&gt; entry in the 'active-watchers' table. It should show a single subscription
&gt; to presence.winfo where the watcher and presentity URI are the same user.
&gt; c. When the SUBSCRIBE to RLS arrives, it should create a single entry in
&gt; 'rls_watchers'. As there are no contacts in the resource-list doc, there are
&gt; no rls subscriptions.
&gt;
&gt; My questions to try and debug would be:
&gt; 1. Does the above happen when starting from a clean database and not having
&gt; any contacts or external links in the resource-list?
&gt;
&gt; 2. If that works, can you add contacts directly to the resource-list (like
&gt; below) and try again. Does that cause a problem? You should see entries in
&gt; 'pua' and 'active-watchers' for the added contacts.
&gt;
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&gt; &lt;resource-lists xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot;&gt;
&gt;     &lt;list name=&quot;oma_buddylist&quot;&gt;
&gt;         &lt;entry uri=&quot;<A HREF="sip:160000@example.com">sip:160000@example.com</A>&quot;&gt;
&gt;             &lt;display-name&gt;160000&lt;/display-name&gt;
&gt;         &lt;/entry&gt;
&gt;         &lt;entry uri=&quot;<A HREF="sip:160001@example.com">sip:160001@example.com</A>&quot;&gt;
&gt;             &lt;display-name&gt;160001&lt;/display-name&gt;
&gt;         &lt;/entry&gt;
&gt;     &lt;/list&gt;
&gt; &lt;/resource-lists&gt;
&gt;
&gt; 3. Finally add the external documents and external anchors and try again.
&gt;
&gt; I haven't personally used anything that uses the external anchors feature,
&gt; but if it is only the external URIs that are causing the problem, kamailio
&gt; may think it is subscribing to the same URI each time causing a recursive
&gt; loop. This may be visible on a network trace taken on the loopback
&gt; interface.
&gt;
&gt; Regards,
&gt; Hugh
&gt;
&gt;
&gt;
&gt; On 26/10/2012 13:36, Sangeeta Shah wrote:
&gt;
&gt; Did anyone get a chance to look at this post. I upgraded to Kamailio
&gt; 3.3.2 since the changelog indicated several RLS fixes. But as soon as
&gt; I bring my client up I see 4000 entries in my PUA table and about 500+
&gt; entries in the rls_watchers table for the same presentity.
&gt;
&gt; What would trigger behavior like this? Either I have an error or am
&gt; missing something in the config file or it's my XML. Any thoughts. I
&gt; have included my config params in this email chain and my
&gt; rls-services, pres-rules and resource-lists documents are from the OMA
&gt; specs with external anchors etc.
&gt;
&gt; Thanks,
&gt; Sangeeta
&gt;
&gt; On Mon, Oct 22, 2012 at 3:32 PM, Sangeeta Shah &lt;<A HREF="mailto:sangeeta.shah@gmail.com">sangeeta.shah@gmail.com</A>&gt;
&gt; wrote:
&gt;
&gt; Hello All,
&gt;    I am hoping the authors of the RLS/PUA modules can answer this
&gt; question since I am not sure what's going on. I have the rls module
&gt; enabled, with the following config spec:
&gt;
&gt; # ------rls module params ------
&gt; modparam(&quot;rls&quot;, &quot;db_url&quot;, DBURL)
&gt; modparam(&quot;rls&quot;, &quot;db_mode&quot;, 2)
&gt; modparam(&quot;rls&quot;, &quot;integrated_xcap_server&quot;, 1)
&gt; modparam(&quot;rls&quot;, &quot;to_presence_code&quot; ,10)
&gt; modparam(&quot;rls&quot;, &quot;server_address&quot;, &quot;<A HREF="sip:rls@ip:5060">sip:rls@ip:5060</A>&quot;)
&gt;
&gt;
&gt; #!endif
&gt;
&gt; and
&gt; modparam(&quot;pua_reginfo&quot;, &quot;default_domain&quot;, &quot;ip&quot;)
&gt; modparam(&quot;pua_reginfo&quot;, &quot;server_address&quot;, &quot;<A HREF="sip:reginfo@ip">sip:reginfo@ip</A>&quot;)
&gt; modparam(&quot;pua&quot;, &quot;db_mode&quot;, 2)
&gt;
&gt; So for both I have DB_MODE set to DB ONLY. For whatever reason, even
&gt; though all I am doing is bringing up my client I see over 250+ entries
&gt; in the rls_watchers table for the same watcher and over 100 entries in
&gt; the pua list table for the same presentity?
&gt;
&gt; Anyone have any idea what would be triggering this. There is
&gt; definitely not anymore more than the normal messaging going on between
&gt; the client and the server.
&gt;
&gt; Only error I see in the syslog:
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11745]: ERROR:
&gt; db_mysql [km_dbase.c:122]: driver error on query: Duplicate entry
&gt; '1350937406' for key 'expires_idx'
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11744]: DEBUG:
&gt; presence [subscribe.c:1216]: subs-&gt;contact= <A HREF="sip:rls@ip:5060">sip:rls@ip:5060</A> - len = 25
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11761]: DEBUG:
&gt; &lt;core&gt; [db_val.c:117]: converting STRING [8475551001]
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11746]: DEBUG:
&gt; &lt;core&gt; [parser/msg_parser.c:626]:  method:  &lt;SUBSCRIBE&gt;
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11745]: ERROR:
&gt; &lt;core&gt; [db_query.c:210]: error while submitting query
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11744]: DEBUG:
&gt; rls [rls.h:241]: did=
&gt; <A HREF="mailto:41826031568472f9-11752@127.0.0.1">41826031568472f9-11752@127.0.0.1</A>;533cb9e91f4b999cf76861cbb9ed54ed-93a3;a6a1c5f60faecf035a1ae5b6e96e979a-464d
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11761]: DEBUG:
&gt; &lt;core&gt; [db_val.c:117]: converting STRING [10.50.251.12]
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11746]: DEBUG:
&gt; &lt;core&gt; [parser/msg_parser.c:628]:  uri:     &lt;<A HREF="sip:8475551001@ip">sip:8475551001@ip</A>&gt;
&gt; Oct 22 15:22:22 RCS-Presence /usr/local/sbin/kamailio[11745]: ERROR:
&gt; pua [pua_db.c:1149]: DB insert failed
&gt;
&gt;
&gt;
&gt; --
&gt; Sangeeta Shah
&gt;
&gt;
&gt;
&gt;
&gt; --
&gt; Hugh Waite
&gt; Principal Design Engineer
&gt; Crocodile RCS Ltd.
&gt;
&gt;
&gt; _______________________________________________
&gt; SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
&gt; <A HREF="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</A>
&gt; <A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</A>
&gt;



</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>