Summary:ASTERISK-21042: [patch] - pbx_spool: callfile variables overriding/lost in __ast_request_and_dial()
Reporter:Roman S. (rolesok)Labels:patch
Date Opened:2013-02-06 10:20:05.000-0600Date Closed:
Status:Open/NewComponents:Core/Channels PBX/pbx_spool
Versions: 13.18.4 Frequency of
Environment:Attachments:( 0) originate-vars-fix.diff
Description:{{__ast_request_and_dial()}} calls {{ast_set_variables(chan, oh->vars)}} before {{ast_channel_inherit_variables(oh->parent_channel, chan)}} and before {{ast_channel_set_connected_line(chan, &connected, NULL)}}. It causes:
1. overriding of some variables from oh struct with values from parent channel (if any)
2. overriding/ignore of {{CONNECTEDLINE()}} function job from callfile
I suppose to call {{ast_set_variables(chan, oh->vars)}} just after {{ast_channel_set_connected_line(chan, &connected, NULL)}}.
Comments:By: Roman S. (rolesok) 2013-02-06 10:22:36.098-0600

suggested fix

By: Matt Jordan (mjordan) 2013-02-13 22:06:29.143-0600

Hm. I might need to understand a bit more of the use case and where this behavior goes awry.
# The fact that the parent channel's variables override the outgoing handler's variables might be what some people expect and want. I don't feel that I know enough about the expected behavior and the places it can be used to justify changing the behavior.
# The second does feel more like an issue, but I'm not sure how the ast_set_variables call coming after the setting of the connect line information changes this. What variable are you setting in the outgoing handler that is overriding the connected line information?

By: Roman S. (rolesok) 2013-02-14 03:28:03.484-0600

Please note that this is all about call files (outgoing spool). Possibly {{__ast_request_and_dial()}} should behave differently depending on request source (call file or some other internal channel request source). But I haven't analyzed this part.

1. The idea of inheritance is enhanced by possibility of overriding. I mean if entity B/child should inherit behaviour/properties of entity A/parent but should have something unique then this (difference) should be specified explicitly. If not (only inheritance) then nothing should be specified for B/child. The same is for channels. If people expect only inheritance they omit any {{Set: <var>=<value>}} in call file. But what should they do if some A/parent variable should be definitely overridden for B/child? There is no possibility to perform this without some workaround (e.g. Local channel with additional Set() app.).
2. Call file variables to hide CallerId in SIP message (should be Anonymous):
Set: CONNECTEDLINE(num-pres)=prohib
Set: CONNECTEDLINE(name-pres)=prohib
But unfortunately these variables/functions are processed:
5430                         ast_set_variables(chan, oh->vars);
5470                 connected.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
5475                 connected.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
5477         ast_channel_set_connected_line(chan, &connected, NULL);
As result CallerID is not "Anonymous".