Hi - thanks for the question
The context variables is a generic string,object dictionary
So long as the value was an integer in the first place (e.g. as a result of an expression which returned an integer) you can read it as such
context.Variables.GetValueOrDefault<int>("duration")
Or if the value was added as a string literal
int.Parse(context.Variables.GetValueOrDefault<string>("duration"))
Example , note i need the tostring because the value is an int
<set-variable name="durationseconds" value="@(60)" />
<set-header name="demo" exists-action="override">
<value>@(context.Variables.GetValueOrDefault<int>("durationseconds").ToString())</value>
</set-header>