Re: [asterisk-users] How to make the sum of a ${VARIABLE} + 1 ??

2010-11-03 Thread Paul Belanger
On Wed, Nov 3, 2010 at 9:18 AM, Jonas Kellens jonas.kell...@telenet.be wrote:
 exten = s,n,Set(vgLabel=vg(${number}+1))

exten = s,n,Set(vgLabel=vg$[${number} + 1])

untested

-- 
Paul Belanger | dCAP
Polybeacon | Consultant
Jabber: paul.belan...@polybeacon.com | IRC: pabelanger (Freenode) |
Blog: http://blog.polybeacon.com | Twitter: http://twitter.com/pabelanger

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] How to make the sum of a ${VARIABLE} + 1 ??

2010-11-03 Thread Danny Nicholas
  _  

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jonas Kellens
Sent: Wednesday, November 03, 2010 8:19 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] How to make the sum of a ${VARIABLE} + 1 ??

 

Hello,

I have this in my dialplan :

exten = s,n,Set(vgLabel=vg(${number}+1))
exten = s,n,GoTo(${vgLabel})

But in stead of vgLabel becoming the SUM of 2 numbers, it is just a string :

[Nov  3 16:17:27] -- Executing [...@macro-f:43] Set(SIP/test-0002,
vgLabel=vg(1+1)) in new stack
[Nov  3 16:17:27] -- Executing [...@macro-f:44] Goto(SIP/test-0002,
vg(1+1)) in new stack
[Nov  3 16:17:27] NOTICE[23048]: pbx.c:3744 pbx_extension_helper: No such
label 'vg(1+1)' in extension 's' in context 'macro-f'
[Nov  3 16:17:27] WARNING[23048]: pbx.c:9625 pbx_parseable_goto: Priority
'vg(1+1)' must be a number  0, or valid label


How to overcome this ?!
Asterisk 1.6.2.10


Kind regards,
Jonas.

Don't know about 1.6, but in 1.4 you would do it like this

exten = s,n,Set(vgLabel=$[${number} +1]) 

This assumes that {number} is a variable and that your not trying to use an
array vg(${number}) or function vg.

 

For this purpose, I'd use Gotoif instead, although I use a similar concept
in my dialplan, like this

 

Exten = 1234,1,Goto(foo,${value},1)

 

[foo]

Exten = s,1,verbose(goto label)

Exten = 1,1,saydigit(1)

Exten = 2,1,saydigit(2)

Exten = 3,1,saydigit(3)

Exten = I,1,playback(invalid-value)

 

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] How to make the sum of a ${VARIABLE} + 1 ??

2010-11-03 Thread Philipp von Klitzing
 exten = s,n,Set(vgLabel=vg(${number}+1))
 exten = s,n,GoTo(${vgLabel})
 
 But in stead of vgLabel becoming the SUM of 2 numbers, it is just a 
 string :

Use the MATH function.

Philipp


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] How to make the sum of a ${VARIABLE} + 1 ??

2010-11-03 Thread Zeeshan Zakaria
Its good to know the MATH function because it can do much more and also deal
with floating point numbers. However in your case a simple addition would be
suffice as other posters posted, or try Danny's GotoIf if it fits your
scenario.

Set(vgLabel=vg${MATH(${vg}+1,i)})

Zeeshan A Zakaria

--
www.ilovetovoip.com
www.pbxforall.com

On 2010-11-03 9:39 AM, Philipp von Klitzing 
klitz...@pool.informatik.rwth-aachen.de wrote:

 exten = s,n,Set(vgLabel=vg(${number}+1))
 exten = s,n,GoTo(${vgLabel})

 But in stead of vgL...
Use the MATH function.

Philipp



-- 
_
-- Bandwidth and Colocat...
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users