int pres_waitn_time = 5;
int pres_notifier_poll_rate = 10;
int pres_notifier_processes = 1;
+int pres_force_delete = 0;
str pres_xavp_cfg = {0};
int pres_retrieve_order = 0;
{ "waitn_time", INT_PARAM, &pres_waitn_time },
{ "notifier_poll_rate", INT_PARAM, &pres_notifier_poll_rate },
{ "notifier_processes", INT_PARAM, &pres_notifier_processes },
+ { "force_delete", INT_PARAM, &pres_force_delete },
{ "to_tag_pref", PARAM_STRING, &to_tag_pref },
{ "expires_offset", INT_PARAM, &expires_offset },
{ "max_expires", INT_PARAM, &max_expires },
register_basic_timers(pres_notifier_processes);
}
+ if (pres_force_delete > 0)
+ pres_force_delete = 1;
+
if (db_table_lock_type != 1)
db_table_lock = DB_LOCKING_NONE;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*!
* \file
* \brief Kamailio presence module :: Support for PUBLISH handling
- * \ingroup presence
+ * \ingroup presence
*/
#include "../../ut.h"
#include "../../str.h"
#include "../../parser/parse_to.h"
-#include "../../parser/parse_uri.h"
-#include "../../parser/parse_expires.h"
-#include "../../parser/parse_event.h"
-#include "../../parser/parse_content.h"
+#include "../../parser/parse_uri.h"
+#include "../../parser/parse_expires.h"
+#include "../../parser/parse_event.h"
+#include "../../parser/parse_content.h"
#include "../../lock_ops.h"
#include "../../hashes.h"
#include "../../lib/kcore/cmpapi.h"
static str query_str;
LM_DBG("cleaning expired presentity information\n");
- if (pa_dbf.use_table(pa_db, &presentity_table) < 0)
+ if (pa_dbf.use_table(pa_db, &presentity_table) < 0)
{
LM_ERR("in use_table\n");
return ;
LM_ERR("constructing uri\n");
goto error;
}
-
+
/* delete from hash table */
if(publ_cache_enabled && delete_phtable(&uri, pres.event->evp->type)< 0)
{
LM_DBG("found expired publish for [user]=%.*s [domanin]=%.*s\n",
pres.user.len,pres.user.s, pres.domain.len, pres.domain.s);
- if (pres_notifier_processes > 0)
+ if (pres_force_delete == 1)
+ {
+ if (delete_presentity(&pres) < 0)
+ {
+ LM_ERR("Deleting presentity\n");
+ goto error;
+ }
+ }
+ else if (pres_notifier_processes > 0)
{
if ((num_watchers = publ_notify_notifier(uri, pres.event)) < 0)
{
}
else
{
- if(pres.event->get_rules_doc &&
+ if(pres.event->get_rules_doc &&
pres.event->get_rules_doc(&pres.user,
&pres.domain,
&rules_doc)< 0)
if (pres_notifier_processes == 0)
{
delete_pres:
- if (pa_dbf.delete(pa_db, db_keys, db_ops, db_vals, n_db_cols) < 0)
+ if (pa_dbf.delete(pa_db, db_keys, db_ops, db_vals, n_db_cols) < 0)
LM_ERR("failed to delete expired records from DB\n");
}
goto error;
}
memset(&body, 0, sizeof(str));
-
+
/* inspecting the Event header field */
-
+
if(msg->event && msg->event->body.len > 0)
{
if (!msg->event->parsed && (parse_event(msg->event) < 0))
{
goto unsupported_event;
}
-
+
/* examine the SIP-If-Match header field */
hdr = msg->headers;
while (hdr!= NULL)
ERR_MEM(PKG_MEM_STR);
}
memcpy(etag.s, hdr->body.s, hdr->body.len );
- etag.len = hdr->body.len;
+ etag.len = hdr->body.len;
etag.s[ etag.len] = '\0';
LM_DBG("existing etag = %.*s \n", etag.len, etag.s);
}
LM_DBG("Expires header found, value= %d\n", lexpire);
}
- else
+ else
{
LM_DBG("'expires' not found; default=%d\n", event->default_expires);
lexpire = event->default_expires;
if(parse_sip_msg_uri(msg)< 0)
{
LM_ERR("parsing Request URI\n");
- reply_code= 400;
+ reply_code= 400;
reply_str= pu_400a_rpl;
goto error;
}
pres_user= msg->parsed_uri.user;
pres_domain= msg->parsed_uri.host;
- if (!msg->content_length)
+ if (!msg->content_length)
{
LM_ERR("no Content-Length header found!\n");
- reply_code= 400;
+ reply_code= 400;
reply_str= pu_400a_rpl;
goto error;
- }
+ }
/* process the body */
if ( get_content_length(msg) == 0 )
else
{
body.s=get_body(msg);
- if (body.s== NULL)
+ if (body.s== NULL)
{
LM_ERR("cannot extract body\n");
- reply_code= 400;
+ reply_code= 400;
reply_str= pu_400a_rpl;
goto error;
}
if(sphere_enable && event->evp->type == EVENT_PRESENCE &&
get_content_type(msg)== SUBTYPE_PIDFXML)
{
- sphere= extract_sphere(body);
+ sphere= extract_sphere(body);
}
- }
+ }
memset(&puri, 0, sizeof(struct sip_uri));
if(sender_uri)
{
if(sender== NULL)
{
ERR_MEM(PKG_MEM_STR);
- }
+ }
if(pv_printf(msg, (pv_elem_t*)sender_uri, buf, &buf_len)<0)
{
LM_ERR("cannot print the format\n");
if(parse_uri(buf, buf_len, &puri)!=0)
{
LM_ERR("bad sender SIP address!\n");
- reply_code= 400;
+ reply_code= 400;
reply_str= pu_400a_rpl;
goto error;
- }
- else
+ }
+ else
{
LM_DBG("using user id [%.*s]\n",buf_len,buf);
}
return 1;
unsupported_event:
-
+
LM_WARN("Missing or unsupported event header field value\n");
-
+
if(msg->event && msg->event->body.s && msg->event->body.len>0)
LM_ERR(" event=[%.*s]\n", msg->event->body.len, msg->event->body.s);
reply_code= BAD_EVENT_CODE;
- reply_str= pu_489_rpl;
+ reply_str= pu_489_rpl;
error:
if(sent_reply== 0)
LM_ERR("failed to send error reply\n");
}
}
-
+
if(presentity)
pkg_free(presentity);
if(etag.s)