[OpenSIPS-Users] opposite of {s.int} ?

Ovidiu Sas osas at voipembedded.com
Thu May 13 20:24:10 EST 2021


Try the other way around:
$dlg_val(dstSeq) = "" + $var(tmp);

-ovidiu

On Thu, May 13, 2021 at 4:22 PM Kingsley Tart <kingsley at dns99.co.uk> wrote:
>
> Hi.
>
> Is there a transformation or something else that can convert an integer
> to a string? ie do the opposite of {s.int} ?
>
> I wanted to maintain a leg sequence number (with multi-leg accounting)
> with a dialog variable, but dialog variables can only contain strings.
>
> So I did
>
>   $dlg_val(dstSeq) = "1";
>
> at the start. But in the failure route for next endpoint, I wanted to
> do this:
>
>   $var(tmp) = $(dlg_val(dstSeq){s.int}) + 1;
>   $dlg_val(dstSeq) = $var(tmp);
>
> but it doesn't like assigning an integer, so I tried
>
>   $dlg_val(dstSeq) = "$var(tmp)";
>
> but that then assigned that literal string to the dialog variable. So
> then I tried
>
>   $dlg_val(dstSeq) = $var(tmp) + "";
>
> but that complained about type mismatching, so in the end O had to do
>
>   $avp(tmp) = $var(tmp);
>   $dlg_val(dstSeq) = $avp(tmp);
>   $avp(tmp) = NULL;
>
> which feels messy.
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



-- 
VoIP Embedded, Inc.
http://www.voipembedded.com



More information about the Users mailing list