<p>Hi,</p>

<p>In function update_dialog_dbinfo (see dlg_db_handler.c), the dlg_id is not set before issuing the UPDATE statement. The type is set to DB_BIGINT using the VAL_TYPE macro, but the value is not set.</p>

<p>} else if (cell-&gt;flags &amp; DLG_FLAG_VP_CHANGED) {<br>
        VAL_TYPE(values) = DB_BIGINT;<br>
        VAL_TYPE(values+20) = DB_INT;<br>
        VAL_TYPE(values+21) = DB_INT;<br>
        VAL_TYPE(values+18) = VAL_TYPE(values+19) = DB_STR;</p>

<pre><code>    /* lock the entry */
    entry = (d_table-&gt;entries)[cell-&gt;h_entry];
    dlg_lock( d_table, &amp;entry);

            /* THIS LINE SHOULD BE ADDED */
            SET_BIGINT_VALUE(values, (((long long)cell-&gt;h_entry &lt;&lt; 32) |
                 cell-&gt;h_id));

    set_final_update_cols(values+18, cell, 0);

    CON_PS_REFERENCE(dialog_db_handle) = &amp;my_ps_update_vp;

    if((dialog_dbf.update(dialog_db_handle, (insert_keys), 0,
                    (values), (insert_keys+18), (values+18), 1, 4)) !=0){
        LM_ERR("could not update database info\n");
        goto error;
    }

    run_dlg_callbacks( DLGCB_SAVED, cell, 0, DLG_DIR_NONE, 0);

    cell-&gt;flags &amp;= ~DLG_FLAG_VP_CHANGED;
}
</code></pre>

<p>The issue will only affect users that have set db_mode to DB_REALTIME.</p>

<p>Regards,<br>
Mickael</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/310">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyNDE0MTE2NiwiZGF0YSI6eyJpZCI6NDAxNDA2NTd9fQ==--3775b1d5c7a758978d59db58de3d68beaea28bcd.gif" width="1" /></p>