Dial plan configuration

I am new to asterisk. I have PRI line with number like 61811200-61811299.

I have a dial plan configured as below,
exten => 1200,1,Ringing()
exten => 1200,2,Agi(agi://localhost:2143/missed.agi?prefix=6181)

For getting the prefix on my java app, i use [quote]prefix[/quote] argument passed from dialplan. However, i want to pass complete number in dialplan rather then specifying last 4 digits. When i do below config,

exten => 61811200,1,Ringing()
exten => 61811200,2,Agi(agi://localhost:2143/missed.agi?prefix=6171)

It gives error like

How to resolve this. Please help

exten => _XXXX,1,Goto(6181${EXTEN},1)