Created
April 24, 2013 14:24
-
-
Save RSully/5452522 to your computer and use it in GitHub Desktop.
This script can be used with something like `xdg` in order to add `sip:` handling to Chrome or Firefox using SFLphone. It takes a single argument, strips it to numerics and triggers a `dbus-send` to SFLphone's method to place a call. It uses the first account, which may or may not be what you want. `xdg-mime default sip-call-handler.desktop x-sc…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
// Requirements: | |
// sudo apt-get install php5-cli php-pear libyaml-dev | |
// sudo pecl install yaml | |
$file = $_SERVER['HOME'] . '/.config/sflphone/sflphoned.yml'; | |
$acct_id = get_account_id($file); | |
$call_to = preg_replace('/[^0-9]/', '', $argv[1]); | |
// From the SFLPhone git repo (tools/sflphone-callto) | |
$res = `dbus-send --type="method_call" --dest="org.sflphone.SFLphone" "/org/sflphone/SFLphone/CallManager" "org.sflphone.SFLphone.CallManager.placeCall" string:"$acct_id" string:"\${RANDOM}\$\$" string:"$call_to"`; | |
function get_account_id($file) { | |
$arr = yaml_parse(file_get_contents($file)); | |
return $arr['accounts'][0]['id']; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Encoding=UTF-8 | |
Version=1.0 | |
Type=Application | |
Terminal=false | |
Exec=/home/test/Desktop/call.php "%U" | |
Name=SIP Call Handler | |
Comment=Trigger SFL phone | |
MimeType=x-scheme-handler/sip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment