Page 1 of 1

Skype only announce if known caller

Posted: Mon Jul 02, 2012 8:50 am
by stevenospam
Hello,
I have a problem with Ascendis announcing incoming Skype callers who are not known in my Skype contacts or Ascendis. Example
+12246996000 1 (224) 699-6000 6/29/2012 5:06:48 PM

This call will be processed by the default script which will speak the name 12,246,996,000. I would like to only announce character names and not announce numeric names. How do I do that?

Thanks!

Re: Skype only announce if known caller

Posted: Tue Jul 03, 2012 10:22 am
by Bill Root
Hi Steve,

That's an interesting problem. The solution is to check whether the "name" is numeric before speaking it. Assuming you're using the Default action in version 3.0, the solution is to replace the advanced script with something like this:

Code: Select all

//LANGUAGE=DWS


function IsNumeric(const s: String): Boolean;
var
  i: Integer;
begin
  const
    NUMBER_CHARS = '0123456789+-.';

  Result := False;
  for i := 1 to Length(s) do
  begin
    if not Contains(NUMBER_CHARS, s[i]) then
      Exit;
  end;

  Result := True;
end;


if IsNumeric(CallInfo.SpeakName) then
  Speak('Call from ' + CallInfo.Number)
else if CallInfo.FoundCaller or 
  AnsiSameText(Trim(CallInfo.SpeakName), Trim(CallInfo.Number)) then
  Speak('Call from ' + CallInfo.SpeakName)
else
  Speak('Call from ' + CallInfo.SpeakName + ' at ' + CallInfo.Number);
If you have a different action, you'll need to to modify it to include the "IsNumeric" function above and the "IsNumeric" call:

Code: Select all

if IsNumeric(CallInfo.SpeakName) then
  Speak('Call from ' + CallInfo.Number)
If you need help modifying a different action, please post (or email to support) the action script.


Finest regards,
Bill Root
Ascendis Software LLC

Solved!

Posted: Tue Jul 03, 2012 8:11 pm
by stevenospam
The script works like a charm. Thanks!