[Kamailio-Devel] dialog callback - locks?

Ovidiu Sas osas at voipembedded.com
Wed Oct 15 17:35:16 CEST 2008


On Wed, Oct 15, 2008 at 11:12 AM, Klaus Darilion
<klaus.mailinglists at pernau.at> wrote:
>
>
> 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.

That is correct.  The params are initialized just before being passed
to the calling module.


> 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)

I don't know for sure ... just to keep a unique interface for all callbacks ...



More information about the Devel mailing list