<p>As hot fix on kamailio hosts is created script</p>
<pre><code>#!/bin/sh

DB_FILE=/etc/kazoo/kazoo-configs-kamailio/kamailio/db/kazoo.db

clean_dialogs() {
        local TIMESTAMP=$1
        sqlite3 $DB_FILE "update presentity SET expires=(received_time+900) where expires=0 and event='dialog' and instr(body, 'direction=\"recipient\"><state>early</state><local><identity display') > 0;"
}

TIMESTAMP=$(date +%s)
clean_dialogs "$TIMESTAMP"
exit 0
</code></pre>
<p>And added to <code>/etc/crontab</code> this record</p>
<pre><code>0,15,30,45  *  *  *  * kamailio /usr/local/bin/clean_blf.sh
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1489#issuecomment-388040183">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36Zf_7c1m_ASfEyvTv5MlUmwjnbUEpks5txDObgaJpZM4S7yny">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZXY0rZMFSXksj2TSikxMUDQaRbKAks5txDObgaJpZM4S7yny.gif" height="1" width="1" alt="" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/1489#issuecomment-388040183"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@sergey-safarov in #1489: As hot fix on kamailio hosts is created script\r\n```\r\n#!/bin/sh\r\n\r\nDB_FILE=/etc/kazoo/kazoo-configs-kamailio/kamailio/db/kazoo.db\r\n\r\nclean_dialogs() {\r\n\tlocal TIMESTAMP=$1\r\n\tsqlite3 $DB_FILE \"update presentity SET expires=(received_time+900) where expires=0 and event='dialog' and instr(body, 'direction=\\\"recipient\\\"\u003e\u003cstate\u003eearly\u003c/state\u003e\u003clocal\u003e\u003cidentity display') \u003e 0;\"\r\n}\r\n\r\nTIMESTAMP=$(date +%s)\r\nclean_dialogs \"$TIMESTAMP\"\r\nexit 0\r\n```\r\nAnd added to `/etc/crontab` this record\r\n```\r\n0,15,30,45  *  *  *  * kamailio /usr/local/bin/clean_blf.sh\r\n```"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1489#issuecomment-388040183"}}}</script>
<script type="application/ld+json">{"@type":"MessageCard","@context":"http://schema.org/extensions","hideOriginalBody":"false","originator":"37567f93-e2a7-4e2a-ad37-a9160fc62647","title":"Re: [kamailio/kamailio] kazoo: wrong BLF when used application/dialog-info+xml (#1489)","sections":[{"text":"","activityTitle":"**sergey-safarov**","activityImage":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","activitySubtitle":"@sergey-safarov","facts":[]}],"potentialAction":[{"name":"Add a comment","@type":"ActionCard","inputs":[{"isMultiLine":true,"@type":"TextInput","id":"IssueComment","isRequired":false}],"actions":[{"name":"Comment","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"IssueComment\",\"repositoryFullName\":\"kamailio/kamailio\",\"issueId\":1489,\"IssueComment\":\"{{IssueComment.value}}\"}"}]},{"name":"Close issue","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"IssueClose\",\"repositoryFullName\":\"kamailio/kamailio\",\"issueId\":1489}"},{"targets":[{"os":"default","uri":"https://github.com/kamailio/kamailio/issues/1489#issuecomment-388040183"}],"@type":"OpenUri","name":"View on GitHub"},{"name":"Unsubscribe","@type":"HttpPOST","target":"https://api.github.com","body":"{\"commandName\":\"MuteNotification\",\"threadId\":317663730}"}],"themeColor":"26292E"}</script>