[Kamailio-Devel] Patch: dialog module / is_known_dlg().

Alex Balashov abalashov at evaristesys.com
Thu Nov 13 18:37:42 CET 2008


Klaus Darilion wrote:

> AFAIK the dialog is created during t_relay() (of course only if the 
> dlg_flag is set) via TM callback and check with RR callback.

Of course.  But I do not think that is a significant concern;  if you 
haven't t_relay()'d an initial request, you probably didn't create a 
dialog.  And if you passed the request on statelessly, then you are 
clearly not interested in stateful transactional monitoring and thus are 
probably not going to be using the dialog module - which depends on TM 
for its knowledge of the state of dialogs and the transactions they 
consist of.

> Thus, for out-of-dialog requests (has_totag == 0) it makes no sense to 
> call is_known_dlg() at all. 

Correct.  The purpose of is_known_dlg() is to identify whether 
subsequent in-dialog requests are in any tracked dialog irrespective of 
profile.

The purpose of this function for me was to provide a way to identify 
requests within known dialogs that persists across proxy failover to 
another machine, as long as a shared persistent database storage is 
used.  Because dialogs are stored in the database but profiles are not, 
it is done this way.

A secondary and potentially useful purpose for this function may be to 
provide an additional layer of security for forwarding purportedly 
subsequent in-dialog requests to foreign domains.  After a discussion 
with Ovidiu Sas on IRC, I was informed that my initial assumptions about 
the extent of the attributes that the dialog module statefully tracks 
were incorrect;  it only tracks the call ID, CSeq and from/to tags, and 
does not provide hash digests of the endpoints or any other information 
that substantially differs from what can be obtained with a check using 
has_totag(), etc., in terms of enhancing the match to an existing dialog 
to provide greater security.

However, perhaps in the future the dialog module will store a more 
comprehensive set of attributes and is_known_dlg() can be more secure 
than existing mechanisms for determining if a request is subsequent.

> For in-dialog requests (has_totag == 1), 
> after loose_route() the dialog module is aware if a matching dialog was 
> found. Now it depends what is_known_dlg() does - does it searches for 
> the dialog just like the RR callback? 

It calls get_current_dialog() in the same way that is_dlg_in_profile() 
does, but without attempting to ascertain any profile bindings.


> and as I think about it I checked the dialog module for exported pseudo 
> variables ---> $DLG_status
> http://www.kamailio.org/docs/modules/devel/dialog.html#id2507513

I saw this, but assumed that it might be desirable to confirm the 
existence of a dialog as soon as the initial request is t_relay()'d but 
without relation to the state of final replies and ACKs.

Will it fail if the state of the dialog is pre-final response?

-- Alex

-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599



More information about the Devel mailing list