[OpenSIPS-Users] add_diversion counter variable

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Jan 26 15:19:15 CET 2016


Hi Edwin,

Yes, the add_diversion() does not support variables in parameters.

Still, you can simply add the header via append_hf() (or insert_hf()), 
by building the whole header by hand - these functions do support 
variables. And the syntax of the Diversion hdr is trivial.

You can also open a feature request on the github tracker.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 26.01.2016 13:26, Edwin wrote:
> I'm using the latest opensips release 2.1.2 on Debian and have a problem with
> the add_diversion header.
>
> For every callforward I have to add a diversion header at top level with the
> counter increased by one. I can put the counter number in manual, but not
> use a variable:
>
> add_diversion("unknown;privacy=off;screen=yes","sip:+1234567 at sip.provider.org;user=phone","1");
> [OK]
>
> add_diversion("unknown;privacy=off;screen=yes","sip:+1234567 at sip.provider.org;user=phone","$var(dic)");
> [FAIL]
>
> This is my chunck of code:
>
> if($di)
> {
>    $var(dic) = $(hdr(Diversion){param.value,counter}{s.int});
> }
> else {
>    $var(dic) = 0;
> }
>
> add_diversion("unknown;privacy=off;screen=yes","sip:+1234567 at sip.provider.org;user=phone","$var(dic)");
>
> Jan 26 opensips[]: ERROR:core:fixup_uint: bad number <$var(dic)>
> Jan 26 opensips[]: ERROR:core:fix_actions: fixing failed (code=-6) at
> /etc/opensips/opensips.cfg:842
> Jan 26 opensips[]: ERROR:core:main: failed to fix configuration with err
> code -6
>
> I also tried other options (with and without quotes etc. It would be nice to
> use a variable for the counter or have a function that automaticly increases
> the counter with one.
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/add-diversion-counter-variable-tp7601042.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>




More information about the Users mailing list