#!/bin/bash

LIB_DIR="$( dirname "$( realpath "$0" )" )/../lib"
if [[ -f "$LIB_DIR/eeadmtools/helpers" ]]; then
    # shellcheck source=/dev/null
    source "$LIB_DIR/eeadmtools/helpers"
else
    # shellcheck source=/dev/null
    source "$LIB_DIR/helpers"
fi

function usage() {
    default_usage "[number]" "  number\t\tPhone number to call (optional)"
}
handle_args "$@"

URL="$CLICK2DIAL_URL"
NUM=$( sed -e 's#^\(tel|callto\):\(//\)\?##' -e 's/[^0-9\+]//g' <<< "${ARGS[*]}" )
[[ -n "$NUM" ]] && URL="$URL?number=$(urlencode "$NUM")"

open_url "$URL"

# vim: tabstop=4 shiftwidth=4 softtabstop=4 expandtab
