Limit call duration within AGI

I have an calling card application on Asterisk 1.4. When the user dials in, AGI script is executed, which asks for PIN and target number. Everything works fine, but I have one problem. When the script checks for credits left on the calling card (before making actual outbound call), I want to limit the outgoing call duration according to that. What I tried was:

$AGI->exec(‘Set(TIMEOUT(absolute)’,$max_duration_seconds);
$AGI->exec(‘Dial’, “SIP/$target_number@provider||g”);

But all I get is:

res_agi.c:1163 handle_exec: Could not find application (Set(TIMEOUT(absolute))

Any help would be appreciated.

Thanks,
Nikola

Put the arguments in the argument field, not the command name.