Untested, but should work. Do the same thing for actions -- just change TEXT to ACTION at the top and duplicate the rest.

Code:
on *:text:*:*: {
  ; Check if your nick is used.
  if ($me isin $1-) {
    ; Check if the target of the text is your active window.  If not, continue.  If it is, then don't do anything.
    if ($target != $active) {
      ; Echo the result and $iif will display either the channel or else PM if it's a private message.  Play the sound after.
      echo -at $nick is calling you in $iif($chan,$chan,PM) $+ .
      .splay dingding.wav
    }
  }
}