Hello Daniel ,

Thank you for prompt response.

I set the dialog profile of a customer using 
set_dlg_profile("custChannels", "$avp(customer_id)");

my xhttp event block looks like below

event_route[xhttp:request] {

xlog("L_INFO","http request ");


if($hu =~ "^/endcall") {

     $avp(customer_id)=$(hu{s.select,1,?});

     dlg_set_timeout_by_profile("custChannels","$avp(customer_id)","3");

xhttp_reply("200", "OK", "text/html","<html><body>Ending Calls for $avp(customer_id) ; </body></html>");

 return;

}



The call is answered and running. After I make the http request i get the following in kamailio logs 

WARNING: dialog [dlg_handlers.c:1564]: dlg_ontimeout(): timeout for dlg with CallID '86896ZGUwYzFjY2YwN2YzNDg0NjQyZjFiMWY3ZDg3NTA2MDg' and tags 'f79f1301' 'gK07db5dbb'

CRITICAL: dialog [dlg_hash.c:933]: dlg_unref_helper(): bogus ref -1 with cnt 2 for dlg 0x7f50a5938548 [2854:177] with clid '86896ZGUwYzFjY2YwN2YzNDg0NjQyZjFiMWY3ZDg3NTA2MDg' and tags 'f79f1301' 'gK07db5dbb'

The call is not killed after 3 secs. 

the mod params for dialog are as below 

loadmodule "dialog.so"

modparam("dialog", "db_url", DBURL)

modparam("dialog", "enable_stats", 1)

modparam("dialog", "dlg_match_mode", 1)

modparam("dialog", "db_mode", 1)

modparam("dialog", "db_update_period", 45)

modparam("dialog", "profiles_with_value", "endptChannels;custChannels;sharedChannels;dedicatedChannels;carrierChannels;Ichannels;")

modparam("dialog", "dlg_flag", 4)





Thanking You,
Sunil More
Ph : 9503338275

On Wed, Sep 13, 2017 at 3:19 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,


On 13.09.17 08:42, Sunil More wrote:
Hello All,

Is there a method / command to kill calls related to one dialog profile. Right now i have to find all dialogs for a customer and loop through all the dialog hashes to run kamcmd dlg.end_dlg till i can kill all calls. Is there a easier way to do this.

if you don't want to go down the path of adding a RPC command for it (which requires C coding), then you can try some workaround leveraging the function that sets the timeout by profile:

  - https://www.kamailio.org/docs/modules/stable/modules/dialog.html#dialog.f.dlg_set_timeout_by_profile

This is a function to be executed in config, you can trigger it by sending a special sip packet with sipsak or sipp. The alternative is to send an http request that will be handled via xhttp module, which then executes an event route block from config and you call the function there.

Because the function is not terminating the calls immediately, the workaround is to use a very short time out, like few seconds.

Cheers,
Daniel
-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com