Am 05.01.2011 11:26, schrieb Daniel-Constantin Mierla:
[...]

Btw, you kept me back from some commits because you said you have some
to do. Is it still valid?

Yes, you are right. Sorry - I'm currently just to busy to apply them in a clean way. (it would take me at least 1 day to get used to git again :-)

Attached is a patch with all the changes I made in my local test setup - maybe you find some time to merge them with your fixes.

The attached patch includes:

- remove purple compilation as it didn't worked for me (probably you can skip that)
- extend documentation of xhttp
- extend documentation of rls with server_adress (local contact) and presence_server (outboundproxy)
- do not start if RLs "server_address" is not set
- add presence_server (outbound proxy) support, obsolete by your patch
- fix: CSeq was reported as wrong although it correct due to wrong checking
- fix: respond with proper contact header
- fix: remove duplicate Max-Forwards header
- fix: use "Supported" instead of "Support"
- fix: xcap exported pseudo variables: "uri" is only 3 characters long, not 4 - increased table version in xcap module to 4 to write directly into opensips xcap tables (probably you can skip that)
- debian fix: remove rls from EXTRA_EXCLUDED_MODULES


Thanks
Klaus
diff -u -r kamailio-3.1.1/Makefile kamailio-3.1.1-rls/Makefile
--- kamailio-3.1.1/Makefile     2010-12-02 22:37:42.000000000 +0100
+++ kamailio-3.1.1-rls/Makefile 2011-01-05 11:44:44.000000000 +0100
@@ -249,7 +249,7 @@
 module_group_kutils=utils
 
 # K purple module
-module_group_kpurple=purple
+#module_group_kpurple=purple
 
 # K memcached module
 module_group_kmemcached=memcached
diff -u -r kamailio-3.1.1/modules/xhttp/doc/xhttp_admin.xml 
kamailio-3.1.1-rls/modules/xhttp/doc/xhttp_admin.xml
--- kamailio-3.1.1/modules/xhttp/doc/xhttp_admin.xml    2010-12-02 
22:35:29.000000000 +0100
+++ kamailio-3.1.1-rls/modules/xhttp/doc/xhttp_admin.xml        2011-01-05 
11:44:52.000000000 +0100
@@ -161,6 +161,27 @@
 </programlisting>
            </example>
        </section>
+
+        <section>
+                <title>Exported pseudo-variables</title>
+                <itemizedlist>
+                        <listitem><para>
+                                <emphasis>$hu</emphasis>: request URI of the 
HTTP 
+                                                       request (everything 
after http(s)://host:port)
+                        </para></listitem>
+                </itemizedlist>
+                <example>
+                <title>$hu PV</title>
+                <programlisting format="linespecific">
+...
+event_route[xhttp:request] {
+    xdbg("incoming HTTP(s) request for $hu\n");
+...
+</programlisting>
+            </example>
+        </section>
+
+
        </section>
 </chapter>
 
diff -u -r kamailio-3.1.1/modules_k/rls/doc/rls_admin.xml 
kamailio-3.1.1-rls/modules_k/rls/doc/rls_admin.xml
--- kamailio-3.1.1/modules_k/rls/doc/rls_admin.xml      2010-12-02 
22:35:30.000000000 +0100
+++ kamailio-3.1.1-rls/modules_k/rls/doc/rls_admin.xml  2011-01-05 
11:44:48.000000000 +0100
@@ -343,6 +343,42 @@
 
 </section>
 
+        <section>
+                <title><varname>presence_server</varname> (str)</title>
+                <para>
+                The address of the presence server. It will be used as 
outbound proxy for
+                Subscribe requests sent by the RLS server to bouncing on and 
off the
+                proxy and having to include special processing for this 
messages
+                in the proxy's configuration file.
+                </para>
+                <example>
+                <title>Set <varname>presence_server</varname> parameter</title>
+                <programlisting format="linespecific">
+...
+modparam("rls", "presence_server", "sip:example.com:5060")
+...
+                </programlisting>
+                </example>
+        </section>
+
+
+        <section>
+                <title><varname>server_address</varname> (str)</title>
+                <para>
+                The address of the server that will be used as a contact in 
sent
+                Subscribe requests and 200 OK replies for Subscribe messages 
for RLS.
+                It is compulsory.
+                </para>
+                <example>
+                <title>Set <varname>server_address</varname> parameter</title>
+                <programlisting format="linespecific">
+...
+modparam("rls", "server_address", "sip:r...@ip.address.ofyour.proxy:5060")
+...
+                </programlisting>
+                </example>
+        </section>
+
 <section>
        <title>Exported Functions</title>
        <section>
diff -u -r kamailio-3.1.1/modules_k/rls/notify.c 
kamailio-3.1.1-rls/modules_k/rls/notify.c
--- kamailio-3.1.1/modules_k/rls/notify.c       2010-12-02 22:35:30.000000000 
+0100
+++ kamailio-3.1.1-rls/modules_k/rls/notify.c   2011-01-05 11:44:48.000000000 
+0100
@@ -595,7 +595,7 @@
                        "Subscription-State: active;expires=%d\r\n", expires);
        else
                str_hdr->len+= sprintf(str_hdr->s+str_hdr->len,
-                       "Subscription-State: terminated;reason=timeout");
+                       "Subscription-State: terminated;reason=timeout\r\n");
 
        str_hdr->len+= sprintf(str_hdr->s+str_hdr->len, "Require: 
eventlist\r\n");
 
diff -u -r kamailio-3.1.1/modules_k/rls/rls.c 
kamailio-3.1.1-rls/modules_k/rls/rls.c
--- kamailio-3.1.1/modules_k/rls/rls.c  2010-12-02 22:35:30.000000000 +0100
+++ kamailio-3.1.1-rls/modules_k/rls/rls.c      2011-01-05 11:44:48.000000000 
+0100
@@ -66,6 +66,7 @@
 
 /** modules variables */
 str server_address= {0, 0};
+str presence_server= {0, 0};
 int waitn_time= 10;
 str rlsubs_table= str_init("rls_watchers");
 str rlpres_table= str_init("rls_presentity");
@@ -170,6 +171,7 @@
 
 static param_export_t params[]={
        { "server_address",         STR_PARAM,   &server_address.s              
             },
+       { "presence_server",        STR_PARAM,   &presence_server.s },
        { "db_url",                                     STR_PARAM,   &db_url.s  
                                     },
        { "rlsubs_table",               STR_PARAM,   &rlsubs_table.s            
             },
        { "rlpres_table",                       STR_PARAM,   &rlpres_table.s    
                     },
@@ -222,10 +224,14 @@
        if(!server_address.s)
        {
                LM_DBG("server_address parameter not set in configuration 
file\n");
-       }       
+               return -1;
+       }
        else
                server_address.len= strlen(server_address.s);
-       
+
+       if(presence_server.s)
+               presence_server.len= strlen(presence_server.s);
+
        if(!rls_integrated_xcap_server && xcap_root== NULL)
        {
                LM_ERR("xcap_root parameter not set\n");
diff -u -r kamailio-3.1.1/modules_k/rls/rls.h 
kamailio-3.1.1-rls/modules_k/rls/rls.h
--- kamailio-3.1.1/modules_k/rls/rls.h  2010-12-02 22:35:30.000000000 +0100
+++ kamailio-3.1.1-rls/modules_k/rls/rls.h      2011-01-05 11:44:48.000000000 
+0100
@@ -83,6 +83,7 @@
 extern char* xcap_root;
 extern unsigned int xcap_port;
 extern str server_address; 
+extern str presence_server;
 extern int waitn_time; 
 extern str rlsubs_table;
 extern str rlpres_table;
diff -u -r kamailio-3.1.1/modules_k/rls/subscribe.c 
kamailio-3.1.1-rls/modules_k/rls/subscribe.c
--- kamailio-3.1.1/modules_k/rls/subscribe.c    2010-12-02 22:35:30.000000000 
+0100
+++ kamailio-3.1.1-rls/modules_k/rls/subscribe.c        2011-01-05 
11:44:48.000000000 +0100
@@ -232,12 +232,12 @@
 
 }
 
-int reply_200(struct sip_msg* msg, str* contact, int expires)
+int reply_200(struct sip_msg* msg, str* local_contact, int expires)
 {
        str hdr_append;
        int len;
        
-       hdr_append.s = (char *)pkg_malloc( sizeof(char)*(contact->len+ 70));
+       hdr_append.s = (char *)pkg_malloc( sizeof(char)*(local_contact->len+ 
70));
        if(hdr_append.s == NULL)
        {
                LM_ERR("no more pkg memory\n");
@@ -251,8 +251,8 @@
        }
        strncpy(hdr_append.s+hdr_append.len ,"Contact: <", 10);
        hdr_append.len += 10;
-       strncpy(hdr_append.s+hdr_append.len, contact->s, contact->len);
-       hdr_append.len+= contact->len;
+       strncpy(hdr_append.s+hdr_append.len, local_contact->s, 
local_contact->len);
+       hdr_append.len+= local_contact->len;
        strncpy(hdr_append.s+hdr_append.len, ">", 1);
        hdr_append.len += 1;
        strncpy(hdr_append.s+hdr_append.len, CRLF, CRLF_LEN);
@@ -598,7 +598,7 @@
        }
 
 /*** if correct reply with 200 OK*/
-       if(reply_200(msg, &subs.contact, subs.expires)< 0)
+       if(reply_200(msg, &subs.local_contact, subs.expires)< 0)
                goto error;
 
        /* call sending Notify with full state */
@@ -669,7 +669,6 @@
        }
 
        s->expires= subs->expires+ (int)time(NULL);
-       s->remote_cseq= subs->remote_cseq;
        
        if(s->db_flag & NO_UPDATEDB_FLAG)
                s->db_flag= UPDATEDB_FLAG;
@@ -680,6 +679,7 @@
                LM_DBG("stored cseq= %d\n", s->remote_cseq);
                return Stale_cseq_code;
        }
+       s->remote_cseq= subs->remote_cseq;
 
        subs->pres_uri.s= (char*)pkg_malloc(s->pres_uri.len* sizeof(char));
        if(subs->pres_uri.s== NULL)
@@ -771,7 +771,10 @@
        }
        s.id= did_str;
        s.watcher_uri= &wuri;
-       s.contact= &subs->local_contact;
+       s.contact= &server_address;
+       if(presence_server.s)
+               s.outbound_proxy= &presence_server;
+
        s.event= get_event_flag(&subs->event->name);
        if(s.event< 0)
        {
@@ -782,7 +785,7 @@
        s.source_flag= RLS_SUBSCRIBE;
        extra_headers.s= buf;
        extra_headers.len= sprintf(extra_headers.s,
-                       "Max-Forwards: 70\r\nSupport: eventlist\r\n");
+                       "Supported: eventlist\r\n");
        s.extra_headers= &extra_headers;
        
        if(process_list_and_exec(rl_node, send_resource_subs,(void*)(&s))< 0)
diff -u -r kamailio-3.1.1/modules_k/xcap_server/xcap_misc.c 
kamailio-3.1.1-rls/modules_k/xcap_server/xcap_misc.c
--- kamailio-3.1.1/modules_k/xcap_server/xcap_misc.c    2010-12-02 
22:35:30.000000000 +0100
+++ kamailio-3.1.1-rls/modules_k/xcap_server/xcap_misc.c        2011-01-05 
11:44:47.000000000 +0100
@@ -683,7 +683,7 @@
                        pxs->key.len, pxs->key.s);
        if(pxs->key.len==4 && strncmp(pxs->key.s, "data", 4)==0) {
                pxs->ktype = 0;
-       } else if(pxs->key.len==3 && strncmp(pxs->key.s, "uri", 4)==0) {
+       } else if(pxs->key.len==3 && strncmp(pxs->key.s, "uri", 3)==0) {
                pxs->ktype = 1;
        } else if(pxs->key.len==4 && strncmp(pxs->key.s, "root", 4)==0) {
                pxs->ktype = 2;
diff -u -r kamailio-3.1.1/modules_k/xcap_server/xcap_server.c 
kamailio-3.1.1-rls/modules_k/xcap_server/xcap_server.c
--- kamailio-3.1.1/modules_k/xcap_server/xcap_server.c  2010-12-02 
22:35:30.000000000 +0100
+++ kamailio-3.1.1-rls/modules_k/xcap_server/xcap_server.c      2011-01-05 
11:44:47.000000000 +0100
@@ -49,7 +49,7 @@
 
 MODULE_VERSION
 
-#define XCAP_TABLE_VERSION   3
+#define XCAP_TABLE_VERSION   4
 
 
 static int xcaps_put_db(str* user, str *domain, xcap_uri_t *xuri, str *etag,
diff -u -r kamailio-3.1.1/pkg/kamailio/deb/lenny/rules 
kamailio-3.1.1-rls/pkg/kamailio/deb/lenny/rules
--- kamailio-3.1.1/pkg/kamailio/deb/lenny/rules 2010-12-02 22:37:42.000000000 
+0100
+++ kamailio-3.1.1-rls/pkg/kamailio/deb/lenny/rules     2011-01-05 
11:44:43.000000000 +0100
@@ -25,7 +25,7 @@
 # extra modules to skip, because they are not compilable now
 # - regardless if they go to the main kamailio package or to some module 
package,
 # they will be excluded from compile and install of all
-EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa rls iptrtpproxy
+EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy
 #EXTRA_EXCLUDED_MODULES=
 
 # possible module directories that can appear in MODULES_SP
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to