Don't think that it'll help much, but yes:
property callUrl : "https://<YOUR SERVICE URL>"
on run {input, parameters}
set cleaned_number to cleanNumber(item 1 of input)
set cleaned_number to formatNumber(cleaned_number)
return callUrl & cleaned_number
end run
on cleanNumber(numToDial) -- bring the number to the right format
set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
set cleanedNumber to ""
repeat with i from 1 to length of numToDial
set j to (character i of numToDial)
if j = "+" then set cleanedNumber to cleanedNumber & "00"
if j is in theDigits then set cleanedNumber to cleanedNumber & j
end repeat
if (cleanedNumber is "") then
return cleanedNumber
end if
if (character 1 of cleanedNumber is "0") then
if (character 2 of cleanedNumber is "0") then
set cleanedNumber to "+" & substring(cleanedNumber, 3, "")
--set character 1 of test
else
set cleanedNumber to "+49" & substring(cleanedNumber, 2, "")
end if
end if
return cleanedNumber
end cleanNumber
on formatNumber(numToDial) -- bring the number to the right format
set cleanedNumber to numToDial
if (substring(cleanedNumber, 0, 3) is "+49") then
set cleanedNumber to "+49 " & substring(cleanedNumber, 4, "")
end if
set cleanedNumber to replace(cleanedNumber, "+", "%2B")
set cleanedNumber to replace(cleanedNumber, " ", "+")
return cleanedNumber
end formatNumber
--- left out some methods for substring, trim, ...
As you can see on the picture below, the script is part of an automator workflow. The script takes the first item of the input and creates an URL, which will be called by the workflow. The cleaning and formatting process is custom for my purpose, but you can adapt it to your needs. If you already have a Addressbook script, you probably can copy that over and just call it in the run method with with the given phone number.
To use the service in your context menu, you have to activate it – totally intuitive - in System Preferences > Keyboard > Shortcuts > Services as explained, e.g., at https://www.maketecheasier.com/edit-context-menu-macos/
Btw. the name of the automator workflow file corresponds to the context menu entry.