Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlgs v5.4.* dlgs_count wrong number #2568

Closed
LambertHuhu opened this issue Nov 30, 2020 · 6 comments
Closed

dlgs v5.4.* dlgs_count wrong number #2568

LambertHuhu opened this issue Nov 30, 2020 · 6 comments

Comments

@LambertHuhu
Copy link

Description

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

Troubleshooting

Reproduction

dlgs_init($fu,$tu,"data");
dlgs_update();
dlgs_count("any","eq","1");
and then make several calls, the dlgs_count always return 1.

Debugging Data

Log Messages

image
nn
image

SIP Traffic

Possible Solutions

I find the ki_dlgs_count functions always return 1;
image
I modified the retrun value = 10086, then the dlgs_count always return 10086 ! !
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.
then I run the dlgs_ht_dbg() in the dlgs_count (dlgs_records.c) and get some useful dbg log as above.
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 !

Additional Information

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
miconda added a commit that referenced this issue Nov 30, 2020
- count the dialog in initial state
- GH #2568
@miconda
Copy link
Member

miconda commented Nov 30, 2020

Thanks for the report and analysis. Can you test with master branch or using the patch from the commit referenced above? If works, then I will backport to 5.4 branch.

@LambertHuhu
Copy link
Author

The dlgs_tags_count() function also has this problem.

@LambertHuhu
Copy link
Author

Ihave tested with the patch from the commit , it works.
I modified the ki_dlgs_tags_count() function into

static int ki_dlgs_tags_count(sip_msg_t *msg, str *vtags)
{
        int ret;
        ret=dlgs_tags_count(msg, vtags);
        if(ret<=0) {
                return (ret-1);
        }
        return ret;
}

and it works

@LambertHuhu
Copy link
Author

I think you may need to check this module thoroughly. I just discovered that the dlgs.get and dlgs.getall functions also have bugs.

@miconda
Copy link
Member

miconda commented Dec 1, 2020

Thanks, fixed also the dlgs_tags_count(). I will backport the patches.

If you found problems with the rpc commands, describe them to be fixed, they can be specific for your use case.

miconda added a commit that referenced this issue Dec 1, 2020
- count the dialog in initial state
- GH #2568

(cherry picked from commit 6376e24)
@miconda
Copy link
Member

miconda commented Dec 7, 2020

I am closing this one, if you find other issues in the dlgs module, open a new item in the tracker. Thanks!

@miconda miconda closed this as completed Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants