Problems with SET VARIABLE

hi, im working on an asterisk project. Here is what I need to do, get a date, and use in inside my extensions.

Here is an extract from my python script.

sys.stdout.write(“SET VARIABLE DT “+date+”\n”)
sys.stdout.flush()

now inside the extension I do the following;

[test1]
exten=>126,1,AGI(get_time.agi) ; calls the script above
exten=>126,2,sendText(${DT})

However, my variable ${DT} doesn’t contain anything.
Im sure that my scripts runs (i have tested it from the command line). Could anyone tell me if I have misunderstood anything, or if there is something wrong with my settings?

-k

well, i don’t know python, but i’m guessing the line

sys.stdout.write(“SET VARIABLE DT “+date+”\n”)

is supposed to set the DT variable to the date. i’m also guessing that the script, since it’s calling a stdout, is echoing this directly to the asterisk console. based on that, your syntax is totally wrong.

FYI, this is all in the wiki, so please search there first before posting.

to set a variable in asterisk, the Set command is used, like so:

Set(DT=information)

if you wanted to set the date, you’d do so like this:

Set(DT=20060920)

again, this is all covered EXTENSIVELY in the wiki…

Alao set AGI debugging on the ASterisk CLI.
You can then watch the reurn values of the AGI functions.
If 200 is returned then the statments executed properly.