فهرست منبع

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
Daniel-Constantin Mierla 14 سال پیش
والد
کامیت
436b9532e0
2فایلهای تغییر یافته به همراه10 افزوده شده و 8 حذف شده
  1. 5 4
      modules_k/rls/rls.c
  2. 5 4
      modules_k/rls/subscribe.c

+ 5 - 4
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)
 	{

+ 5 - 4
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)