[SR-Users] Terminate dialog from another dialog

Joel Serrano joel at gogii.net
Tue Mar 27 17:23:37 CEST 2018


I have been testing and I think the way to go is taking advantage of the
events generated by the dialog module (start/end/failed)...

I don't know if this is a bug, but shouldn't the $dlg(to_tag) be available
in the event_route[dialog:start] ??

I can access $dlg(callid), $dlg(from_tag) but not the $dlg(to_tag) and all
3 are needed to search and terminate an existing dialog. For now i'm using
$tt, but I'm wondering if this is correct or not? Let me know if I should
move this topic to github...


On Sun, Mar 25, 2018 at 4:57 PM, Joel Serrano <joel at gogii.net> wrote:

> Hi guys,
> I'm trying to set kamailio to not allow simultaneous calls from the same
> user, but if a second call comes in, the behavior desired is to process
> that second call and terminate the previous (already active) one.
> Say you have call A that creates dialog A.
> Then you have call B come in, creates dialog B.
> Can I save some info from dialog (call) A in a htable for example, then
> check that htable for the needed info from dialog (call) B and terminate
> dialog (call) A if it exists?
> I think using dlg_get() and dlg_bye() would do the trick but not 100% sure
> how they work..
> The example in the docs seems exactly the case:
> dlg_get --> "Search and set current dialog based on Call-ID, From-Tag and
> To-Tag parameters"
> if(dlg_get("abcdef", "123", "456"))
> {
> dlg_bye("all");
> }
> After the dlg_get() and dlg_bye() what happens to call B? Does the route
> continue running or does it end? Will it automatically switch back to the
> current dialog or do you have to manually switch back running dlg_get()
> again? (Sorry if I'm not explaining myself correctly, let me know if it
> sounds confusing)
> Does anyone have experience with these two functions?
> Thanks,
> Joel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180327/9ea39d2a/attachment.html>

More information about the sr-users mailing list