Sorry for mangled script. Let me try again.

|#!/bin/bash||
||
||# This script will use linphone to call any sip, tel or callto uri,||
||# as long as web browser and/or address book is set up to use it.||
||# Linphone by itself will not work, as it expect a call parameter||
||# as detailed below:||
||
||# linphone must run, then||
||#    linphone "call sip-address=sip:[email protected]"||
||# will call Voip.ms echo test||
||#    linphone "call sip-address=604-555-1212"||
||# will call a (nonexistent) number in Vancouver area code||
||
||# ================================================================||
||# Check that there is only one parameter||
||if [ "$#" -ne 1 ]; then||
||    echo "    " $# " parameters, must be one only"||
||else||
||    # Input parameter must start with one of: sip:, tel:, or callto:||
||    p=$(expr $1 : "^\(sip:\|tel:\|callto:\)") ||
||    if [ $p ]; then||
||        # Protocol with telephone number or sip address||
||        pt=$1||
||        # Calculate the length of the protocol part||
||         lp=$(expr length $p)||
||        # Calculate the length of the telephone number including protocol||
||         lpt=$(expr length $pt)||
||        # Calculate length of sip address less protocol part||
||         lsa=$(expr $lpt - $lp)||
||         if [ $lsa -gt "0" ]; then||
||             # Calculate the position of first character of address less protocol||
||             fc=$(expr $lp + 1)||
||             sa=$(expr substr $pt $fc $lsa)||
||            echo "Calling" "$sa"||
||            notify-send "Calling" "$sa" --icon=dialog-information||
||            linphone "call sip-address=$sa"||
||        else||
||            echo "Phone number/sip address not provided"||
||         fi||
||    else||
||        echo "Usage: linphone-tel.sh protocol:destination"||
||        echo "       where protocol is one of: sip, tel, or callto"||
||        echo "       and destination is either a phone number, or a sip address"||
||    fi||
||fi|
_______________________________________________
Linphone-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/linphone-users

Reply via email to