From c4d393d5524327b17099b6ad9bf09e887cebe75d Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Wed, 15 Apr 2009 12:01:53 -0400 Subject: [PATCH] Add callto: handler script for browsers and al. --- tools/sflphone-callto | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 tools/sflphone-callto diff --git a/tools/sflphone-callto b/tools/sflphone-callto new file mode 100755 index 0000000000..839f963847 --- /dev/null +++ b/tools/sflphone-callto @@ -0,0 +1,50 @@ +#!/bin/sh +# +# This script can be used as a callto: (or other) protocol handler in +# Mozilla/Firefox/whatever browser. +# In Firefox use Preferences > Applications and set the callto handler +# to this script. + +# Configuration: +# All you have to do is set this to your account alias name +# (see ~/.sflphone/sflphonedrc file) +ACCOUNT_ALIAS="manu" + +################################################################################ + +# The sflphone daemon config file +RESFILE=~/.sflphone/sflphonedrc + +# Parse sflphonedrc and get account id string from defined alias +if [ -f "$RESFILE" ]; then + ACCOUNTID=`grep -B2 "Account.alias=$ACCOUNT_ALIAS" "$RESFILE" | \ + grep "Account:[0-9]" | \ + head -n 1 | \ + sed -e 's/[^a-zA-Z0-9:]//g' ` +else + echo Fatal: Cant find sflphonedrc config file. + exit 1 +fi + +# Check 1st argument (phone number) +if [ "$1" = "" ]; then + echo "Error: argument 1 (phone number) not provided." + exit 1 +fi + +# Cleanup destination removing callto: prefix +TO="`echo $1 | sed -e 's/callto://'`" + +# Generate call id. +CALLID=${RANDOM}$$ + +dbus-send \ + --type="method_call" \ + --dest="org.sflphone.SFLphone" \ + "/org/sflphone/SFLphone/CallManager" \ + "org.sflphone.SFLphone.CallManager.placeCall" \ + string:"$ACCOUNTID" \ + string:"$CALLID" \ + string:"$TO" + +# EOF -- GitLab