<p></p>
<h3>Description</h3>
<p>Recently I upgraded kamailio to 5.4.2 using the dlgs module. No matter how many calls I make, the dlgs_count() and dlgs_tags_count() always return 1. After viewing the source code, I found the following bugs</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>dlgs_init($fu,$tu,"data");<br>
dlgs_update();<br>
dlgs_count("any","eq","1");<br>
and then make several calls, the dlgs_count always return 1.</p>
<h4>Debugging Data</h4>
<h4>Log Messages</h4>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/26111722/100606180-033c2c80-3344-11eb-9653-ebeefbeb70a7.png"><img src="https://user-images.githubusercontent.com/26111722/100606180-033c2c80-3344-11eb-9653-ebeefbeb70a7.png" alt="image" style="max-width:100%;"></a><br>
nn<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/26111722/100606206-0c2cfe00-3344-11eb-98ba-1773046ec951.png"><img src="https://user-images.githubusercontent.com/26111722/100606206-0c2cfe00-3344-11eb-98ba-1773046ec951.png" alt="image" style="max-width:100%;"></a></p>
<h4>SIP Traffic</h4>
<h3>Possible Solutions</h3>
<p>I find the <code>ki_dlgs_count</code> functions always return  1;<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/26111722/100605735-55308280-3343-11eb-9908-aa8f55e60f63.png"><img src="https://user-images.githubusercontent.com/26111722/100605735-55308280-3343-11eb-9908-aa8f55e60f63.png" alt="image" style="max-width:100%;"></a><br>
I modified the retrun value = 10086, then the <code>dlgs_count</code> always return 10086 ! !<br>
I modified the return value = dlgs_count(msg, vfield, vop, vdata); then I found the dlgs_count always return 0; obviously there is still something wrong.<br>
then I run the dlgs_ht_dbg() in the dlgs_count (dlgs_records.c) and get some useful dbg log as above.<br>
as the picture shows,the slots[i].astats.c_init is always 0 or -1.  I think maybe c_init is not initialized to 1 when dlgs_init . and I add the c_init's initial logic in the dlgs_add_items()  then  everything is fine !</p>
<h3>Additional Information</h3>
<pre><code>Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
kamailio 
version: kamailio 5.4.2 (x86_64/linux
compiled on 20:13:39 Nov  9 2020 with gcc 4.8.5
</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/2568">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZMXTLWGDTBHVZKNKWDSSOBZDANCNFSM4UHO2K4A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZJZFB24NTTFSC4GIWLSSOBZDA5CNFSM4UHO2K4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4LHIGBEQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2568",
"url": "https://github.com/kamailio/kamailio/issues/2568",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>