</example>
</section>
+ <section id="presence.p.startup_mode">
+ <title><varname>startup_mode</varname> (int)</title>
+ <para>
+ Setting this parameter to 0 will provide startup related backward compatibility for some modules. Setting to 0 fixes presentity requests with low expires (e.g. time() + 1)
+ </para>
+ <para>
+ Set this parameter to <quote>0</quote> to enable backward compatibility.
+ </para>
+ <para>
+ <emphasis>Default value is <quote>1</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>startup_mode</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("presence", "startup_mode", 0)
+...
+</programlisting>
+ </example>
+ </section>
+
<section id="presence.p.to_tag_pref">
<title><varname>to_tag_pref</varname> (str)</title>
<para>
query_ops[n_query_cols] = OP_EQ;
n_query_cols++;
- query_cols[n_query_cols] = &str_expires_col;
- query_vals[n_query_cols].type = DB1_INT;
- query_vals[n_query_cols].nul = 0;
- query_vals[n_query_cols].val.int_val= (int)time(NULL);
- query_ops[n_query_cols] = OP_GT;
- n_query_cols++;
+ if (pres_fix_startup) {
+ query_cols[n_query_cols] = &str_expires_col;
+ query_vals[n_query_cols].type = DB1_INT;
+ query_vals[n_query_cols].nul = 0;
+ query_vals[n_query_cols].val.int_val= (int)time(NULL);
+ query_ops[n_query_cols] = OP_GT;
+ n_query_cols++;
+ }
result_cols[body_col=n_result_cols++] = &str_body_col;
result_cols[etag_col=n_result_cols++] = &str_etag_col;
} else {
query_str = str_received_time_col;
}
- if (pa_dbf.query (pa_db, query_cols, query_ops, query_vals,
- result_cols, n_query_cols, n_result_cols, &query_str , &result) < 0)
- {
- LM_ERR("failed to query %.*s table\n", presentity_table.len, presentity_table.s);
- if(result)
- pa_dbf.free_result(pa_db, result);
- return NULL;
+ if (pres_fix_startup) {
+ if (pa_dbf.query (pa_db, query_cols, query_ops, query_vals,
+ result_cols, n_query_cols, n_result_cols, &query_str , &result) < 0)
+ {
+ LM_ERR("failed to query %.*s table\n", presentity_table.len, presentity_table.s);
+ if(result)
+ pa_dbf.free_result(pa_db, result);
+ return NULL;
+ }
+ } else {
+ if (pa_dbf.query (pa_db, query_cols, 0, query_vals,
+ result_cols, n_query_cols, n_result_cols, &query_str , &result) < 0)
+ {
+ LM_ERR("failed to query %.*s table\n", presentity_table.len, presentity_table.s);
+ if(result)
+ pa_dbf.free_result(pa_db, result);
+ return NULL;
+ }
}
if(result== NULL)
int pres_notifier_poll_rate = 10;
int pres_notifier_processes = 1;
int pres_force_delete = 0;
+int startup_mode = 1; // enable by default
+int pres_fix_startup = 0;
str pres_xavp_cfg = {0};
int pres_retrieve_order = 0;
str pres_retrieve_order_by = str_init("priority");
{ "notifier_poll_rate", INT_PARAM, &pres_notifier_poll_rate },
{ "notifier_processes", INT_PARAM, &pres_notifier_processes },
{ "force_delete", INT_PARAM, &pres_force_delete },
+ { "startup_mode", INT_PARAM, &startup_mode },
{ "to_tag_pref", PARAM_STRING, &to_tag_pref },
{ "expires_offset", INT_PARAM, &expires_offset },
{ "max_expires", INT_PARAM, &max_expires },
if (pres_force_delete > 0)
pres_force_delete = 1;
+ if (startup_mode > 0) {
+ pres_fix_startup = 1; // startup_mode fixes presence on startup (commit: 1dceaa24ded727aba5870f28fb63e26ed98464f3)
+ }
+
if (pres_log_facility_str) {
int tmp = str2facility(pres_log_facility_str);
extern int pres_notifier_poll_rate;
extern int pres_notifier_processes;
extern int pres_force_delete;
+extern int pres_fix_startup;
extern str pres_xavp_cfg;
extern int pres_retrieve_order;
extern str pres_retrieve_order_by;
row = &result->rows[i];
row_vals = ROW_VALUES(row);
+ if (!pres_fix_startup && (row_vals[expires_col].val.int_val< (int)time(NULL)))
+ continue;
+
sphere= NULL;
user.s= (char*)row_vals[user_col].val.string_val;
user.len= strlen(user.s);