Curl problem

im having a trouble making the curl function take the variables the right way this is my code below
please note that the frst curl call startCall is taking the variables perfectly but the second call the endCall is not taking the variables STARTID unless i put it as static … if i noop the STARTID directly before the second call it shows jst fine can anyone help .

exten => 588,1,Answer()
exten => 588,2,Goto(test588,s,1)

exten => s,1,Set(service=588Test)
exten => s,n,Set(shortcode=588)
exten => s,n,Set(CALLER=${CALLERID(num)})
exten => s,n,Set(STARTID=${CURL(localhost/logphp/callStart.php?CALLERID=${CALLER}&shortcode=${shortcode}&service=${service})})
exten => s,n,Goto(endtest588,s,1)
exten => s,n,Playback(/var/lib/asterisk/sounds/test)
exten => s,n,Goto(endtest588,s,1)
exten => h,1,Set(test=${STARTID})
exten => h,n,set(x=${CDR(billsec)})
exten => h,n,Set(CallEnd=${CURL(localhost/logphp/callEnd.php?ID=${test}&DURATIONS=${CDR(billsec)})})
exten => h,n,Hangup