JSON-P is added to the document using an element script, so a function call inside it must reference a function that exists in the global scope.
turnLongURLlimited to the area restoreURL, as it is defined inside it.
Moving a function declaration to a global scope or changing it to a function statement in this way:
window.turnLongURL = function (data) {
... should make it work.
Do not forget to consider the race conditions if several JSON-P requests must be sent before the first return.