[macro-trilug] ; Get a response from the server exten => s,1,Set(triurl=${CURL(http://trilug.org/~kjotte/tarp/lookup.php?num=${ARG1})}) ; Check if it's a URL we can call exten => s,2,GotoIf($[$["${triurl:0:4}" = "SIP/"] | $["${triurl:0:5}" = "IAX2/"]]?10:3) ; If it's not, check for a simple not found in directory ; Failing that, something's broken exten => s,3,GotoIF($["${triurl}" = "NOTFOUND"]?20:30) ; Dial exten => s,10,Dial(${triurl}) exten => s,11,Hangup() ; Server returned a NOTFOUND exten => s,20,Playback(num-not-in-db) exten => s,21,Congestion() ; "Oops, you bwoke it." exten => s,30,Playback(an-error-has-occured) exten => s,31,Congestion()