[Kamailio-Devel] dialog callback - locks?

Klaus Darilion klaus.mailinglists at pernau.at
Wed Oct 15 17:12:07 CEST 2008



Ovidiu Sas schrieb:
> On Mon, Oct 13, 2008 at 12:01 PM, Klaus Darilion
> <klaus.mailinglists at pernau.at> wrote:
>> Hi Ovidiu!
>>
>> Ovidiu Sas schrieb:
>>> [osas]
>>> I think you will need to lock the dialog if you want to access the
>>> content of the dialog structure during subsequent dialog callbacks.
>>> One option would be to copy all the info that you might need during
>>> the first callback from the dialog context into your module context
>>> and then use then local one.  This will avoid the necessity to lock
>>> the dialog context.  The whole purpose of passing a pointer back to
>>> the dialog module during the initial dialog callback is to create a
>>> link back into the local module context.
>> This works for most of the dlg_cell parameters, except lifetime. How can I
>> read dlg->lifetime in hte callback in a safe way?
>>
> 
> The params structure should be enhanced and the lifetime should be
> passed via the existing API (see how CURR_DLG_LIFETIME is computed
> inside dlg_handlers.c:dlg_onroute() ).
> BTW, the lifetime is available in the script via $DLG_lifetime pv.

If I got it right: accessing params is fine during callback and those 
the dialog module should copy the lifetime into the params struct for 
other modules to access it.

btw: if accessing dlg_cell in callback is not safe, why is it even 
signaled to the callback handler? (of course except DLG_CREATED handler)

regards
klaus



More information about the Devel mailing list