Module: sip-router Branch: master Commit: 436b9532e0bdfd115705a6ae5300aa7b2c1729fe URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=436b9532...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Wed Jan 5 12:47:37 2011 +0100
rls(k): use server_address paramter as contact in reply
- server_address was just defined as parameter, but not used at all - server_address defines the rls server address to be set in Contact header of 200 replies. It has to be a valid SIP URI - fix cseq stale check - remove Max-Forward header because it is automatically added and use Suppoted instead of Support for header name with supported events - patch by Klaus Darilion
---
modules_k/rls/rls.c | 9 +++++---- modules_k/rls/subscribe.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules_k/rls/rls.c b/modules_k/rls/rls.c index cff2a71..b3fe8f4 100644 --- a/modules_k/rls/rls.c +++ b/modules_k/rls/rls.c @@ -222,12 +222,13 @@ static int mod_init(void)
LM_DBG("start\n");
- if(!server_address.s) + if(server_address.s==NULL) { - LM_DBG("server_address parameter not set in configuration file\n"); + LM_ERR("server_address parameter not set in configuration file\n"); + return -1; } - else - server_address.len= strlen(server_address.s); + + server_address.len= strlen(server_address.s); if(!rls_integrated_xcap_server && xcap_root== NULL) { diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c index 25c7aa1..9e6e168 100644 --- a/modules_k/rls/subscribe.c +++ b/modules_k/rls/subscribe.c @@ -598,7 +598,7 @@ found_support: }
/*** 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 @@ int update_rlsubs( subs_t* subs, unsigned int hash_code) }
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; @@ -681,6 +680,8 @@ int update_rlsubs( subs_t* subs, unsigned int hash_code) 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 +772,7 @@ int resource_subscriptions(subs_t* subs, xmlNodePtr rl_node) } s.id= did_str; s.watcher_uri= &wuri; - s.contact= &subs->local_contact; + s.contact= &server_address; s.event= get_event_flag(&subs->event->name); if(s.event< 0) { @@ -784,7 +785,7 @@ int resource_subscriptions(subs_t* subs, xmlNodePtr rl_node) s.outbound_proxy= &outbound_proxy; 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)