[OpenSIPS-Devel] Using dialog module functions from LOCAL_ROUTE
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Sun Sep 27 22:08:42 CEST 2009
Hi Alex,
Alex Massover wrote:
>> It fails in dialog.c in w_fetch_dlg_value () here:
>>
>> if ( (dlg=get_current_dialog())==NULL ) {
>> return -1;
>>
>> get_current_dialog() doesn't return a dialog :(
>>
> [Alex]
>
> get_current_dialog() looks to work either for initial requests or for established transactions.
> I switched to get_dlg() that receives sip_msg.
> The following works for me:
>
> unsigned int dir;
> if ( ((dlg=get_current_dialog())==NULL) && ((dlg=get_dlg(&(msg->callid->body),&(get_from(msg)->tag_value),&(get_to(msg)->tag_value),&dir))==NULL) ) {
> return -1;
> }
>
> Why not to enable something like this in the version?
> The only obstacle I can think of is a race condition (dialog can be destroyed) - but the same can happen in any other type or route as well.
>
There is no race as the dialog module is based on a mechanism of
referencing the dialog - as time the dialog is refed, it cannot be
deleted ... as said, let me have a look into this...
Regards,
Bogdan
>
>
>> --
>> Sincerely yours,
>> Alex Massover
>> VoIP R&D TL
>> Jajah Inc.
>>
>>
>>
>>> -----Original Message-----
>>> From: devel-bounces at lists.opensips.org [mailto:devel-
>>> bounces at lists.opensips.org] On Behalf Of Alex Massover
>>> Sent: Sunday, September 27, 2009 1:10 PM
>>> To: OpenSIPS devel mailling list
>>> Subject: Re: [OpenSIPS-Devel] Using dialog module functions from
>>> LOCAL_ROUTE
>>>
>>> Hi!
>>>
>>> It's a BYE request generated by dlg_end_dlg(). I need to
>>> fetch_dlg_value() to get variables stored on the dialog to send them
>>> with accounting extra headers.
>>>
>>> This is what I have in opensips.cfg:
>>>
>>> modparam("acc", "radius_extra", "Connect-Info=$avp(s:info);....... ")
>>> ...
>>> ...
>>> ...
>>> local_route
>>> {
>>> if(is_method("BYE"))
>>> {
>>> fetch_dlg_value("internal_callid","$avp(s:info)");
>>> acc_rad_request("200");
>>> }
>>> }
>>>
>>> This works for me for regular BYEs, but not with locally generated
>>> BYEs, even with the hack below.
>>>
>>>
>>> --
>>> Sincerely yours,
>>> Alex Massover
>>> VoIP R&D TL
>>> Jajah Inc.
>>>
>>>
>>>> -----Original Message-----
>>>> From: devel-bounces at lists.opensips.org [mailto:devel-
>>>> bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
>>>> Sent: Sunday, September 27, 2009 1:32 PM
>>>> To: OpenSIPS devel mailling list
>>>> Subject: Re: [OpenSIPS-Devel] Using dialog module functions from
>>>> LOCAL_ROUTE
>>>>
>>>> Hi Alex,
>>>>
>>>> for what kind of requests (from LOCAL route) you try to use the dlg
>>>> stuff?
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Alex Massover wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> I'm looking for a way to use fetch_dlg_value() inside
>>>>>
>> LOCAL_ROUTE.
>>
>>> I
>>>
>>>>> edited dialog.c to to enable it:
>>>>>
>>>>> {"fetch_dlg_value",(cmd_function)w_fetch_dlg_value,
>>>>>
>>> 2,fixup_dlg_fval,
>>>
>>>>> 0, REQUEST_ROUTE| FAILURE_ROUTE | ONREPLY_ROUTE | BRANCH_ROUTE |
>>>>> LOCAL_ROUTE },
>>>>>
>>>>> Now I can write fetch_dlg_value() inside the LOCAL_ROUTE, but I'm
>>>>> getting NULLs always.
>>>>>
>>>>> Can anybody point me what else do I need to hack to have access
>>>>>
>> to
>>
>>>>> dialog variables from LOCAL_ROUTE?
>>>>>
>>>>> Also what is the reason not to enable all dialog functions from
>>>>> LOCAL_ROUTE?
>>>>>
>>>>>
More information about the Devel
mailing list