[Home]

Summary:ASTERISK-01733: Variables with space do not work it uses the first word as the wole variable.
Reporter:opsys (opsys)Labels:
Date Opened:2004-06-01 02:08:07Date Closed:2011-06-07 14:10:29
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I have an AGO script that test for no CID given if it finds it sets a variable called AGICALLERIDNAME with:
echo "SET VARIABLE AGICALLERIDNAME $AGICALLERIDNAME \"\"\n"

It is set properly as an envdump shows the correct data in the variable. "NO CALLER ID" However, in the console and on the phone just "NO" gets displayed. However if I set the variable with SetVar it keeps the data untouched.


****** ADDITIONAL INFORMATION ******

console dumps and extensions.conf

With SetVar:
  -- Executing Wait("Zap/10-1", "1") in new stack
   -- Accepting call from '' to '6674422' on channel 10, span 1
   -- Executing AGI("Zap/10-1", "loadagivar.agi") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/loadagivar.agi
   -- AGI Script loadagivar.agi completed, returning 0
   -- Executing SetVar("Zap/10-1", "AGICALLERIDNAME="NO CALLER ID"") in new stack
   -- Executing SetCIDName("Zap/10-1", """NO CALLER ID""") in new stack
   -- Executing SetCIDNum("Zap/10-1", "9999999999") in new stack
exten => s,1,Wait,1
exten => s,2,AGI(loadagivar.agi)
exten => s,3,SetVAR(AGICALLERIDNAME="NO CALLER ID")
exten => s,4,SetCIDName("${AGICALLERIDNAME}")
exten => s,5,SetCIDNum(${AGICALLERIDNUM})


WITHOUT SetVar:
   -- Executing Wait("Zap/10-1", "1") in new stack
   -- Executing AGI("Zap/10-1", "loadagivar.agi") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/loadagivar.agi
   -- AGI Script loadagivar.agi completed, returning 0
   -- Executing NoOp("Zap/10-1", "") in new stack
   -- Executing SetCIDName("Zap/10-1", ""NO"") in new stack
   -- Executing SetCIDNum("Zap/10-1", "9999999999") in new stack

exten => s,1,Wait,1
exten => s,2,AGI(loadagivar.agi)
exten => s,3,NoOp
exten => s,4,SetCIDName("${AGICALLERIDNAME}")
exten => s,5,SetCIDNum(${AGICALLERIDNUM})









Comments:By: opsys (opsys) 2004-06-01 02:08:55

Asterisk CVS-HEAD-05/31/04-14:54:12

By: Mark Spencer (markster) 2004-06-01 10:57:24

Are you talking about the *name* of the variable or its contents?

By: opsys (opsys) 2004-06-01 11:13:03

The contents of the variables not the name.
ie Should be:

NAME="Mark Spencer"

but I get

NAME="Mark

By: Brian West (bkw918) 2004-06-01 12:40:26

-- Executing Answer("SIP/10-212f", "") in new stack
   -- Executing SetVar("SIP/10-212f", "FOO="This is a Test"") in new stack
   -- Executing NoOp("SIP/10-212f", ""This is a Test"") in new stack
   -- Executing Hangup("SIP/10-212f", "") in new stack

Looks like you're wrapping it in extera quotes.

By: opsys (opsys) 2004-06-01 12:55:08

Your right if I set it using SetVar all is well, but using an existing variable it no worky.

By: Mark Spencer (markster) 2004-06-01 15:35:21

You put your quotes in the wrong places.  I tested the following AGI script:

#!/bin/sh
echo "SET VARIABLE FOO \"Asterisk Rules\""

with:

exten => 102,1,AGI(testsetvar)
exten => 102,2,Noop(${FOO})

produces:
   -- Executing AGI("Zap/1-1", "testsetvar") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/testsetvar
   -- AGI Script testsetvar completed, returning 0
   -- Executing NoOp("Zap/1-1", "Asterisk Rules") in new stack