send initial NOTIFY with non-empty body

NOTIFYs are accepted by Cisco SPA504g phones now.
pull/1/head
Andrew Pogrebennyk 13 years ago
parent 1951b42a03
commit 2921deabe0

@ -0,0 +1,57 @@
diff --git a/modules_k/presence_dialoginfo/notify_body.c b/modules_k/presence_dialoginfo/notify_body.c
index 6a63d3e..4f49998 100644
--- a/modules_k/presence_dialoginfo/notify_body.c
+++ b/modules_k/presence_dialoginfo/notify_body.c
@@ -66,8 +66,10 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n
LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n",
pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n);
- if(body_array== NULL)
- return NULL;
+ if(body_array== NULL) {
+ n = 0; /* just to be safe */
+ /* return NULL; */
+ }
n_body= agregate_xmls(pres_user, pres_domain, body_array, n);
LM_DBG("[n_body]=%p\n", n_body);
@@ -106,13 +108,17 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n",
pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n);
- xml_array = (xmlDocPtr*)pkg_malloc( n*sizeof(xmlDocPtr));
- if(xml_array== NULL)
+ if (n > 0)
{
- LM_ERR("while allocating memory");
- return NULL;
+ xml_array = (xmlDocPtr*)pkg_malloc( n*sizeof(xmlDocPtr));
+ if(xml_array== NULL)
+ {
+ LM_ERR("while allocating memory");
+ return NULL;
+ }
+ memset(xml_array, 0, n*sizeof(xmlDocPtr)) ;
}
- memset(xml_array, 0, n*sizeof(xmlDocPtr)) ;
+ else xml_array = NULL;
/* parse all the XML documents */
for(i=0; i<n; i++)
@@ -133,14 +139,14 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
j++;
}
-
+#if 0
if(j== 0) /* no body */
{
if(xml_array)
pkg_free(xml_array);
return NULL;
}
-
+#endif
/* n: number of bodies in total */
/* j: number of useful bodies; created XML structures */
/* i: loop counter */
Loading…
Cancel
Save