From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Strey Subject: Re: sip: links Date: Sun, 21 Jun 2015 12:37:20 +0200 Message-ID: <87y4jdjqjj.fsf@strey.biz> References: <20150620172345.5ec7bd92@jupiter.pipapo.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6cd6-0007Uy-JM for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 06:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6cd2-00066Q-CC for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 06:37:36 -0400 Received: from plane.gmane.org ([80.91.229.3]:36116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6cd2-00066F-5T for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 06:37:32 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z6cd0-0000ra-M8 for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 12:37:30 +0200 Received: from xd9ba8b07.dyn.telefonica.de ([217.186.139.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jun 2015 12:37:30 +0200 Received: from mstrey by xd9ba8b07.dyn.telefonica.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jun 2015 12:37:30 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Christian, On Sa, 2015-06-20, Christian Thaeter wrote: > anyone of you happen to have a url handler for 'sip:' links invoking a > telephony app (eg. linphone) when clicked? The attached org-dial.el provides support for a link type `tel:' as well as for dialing from properties in org-contacts. Enjoy. -- Michael Strey http://www.strey.biz * https://twitter.com/michaelstrey --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-dial.el Content-Transfer-Encoding: quoted-printable ;;; org-dial.el --- Provide org links to dial with the softphone ;;; application linphone ;; Copyright (C) 2011-2014 Michael Strey ;; Author: Michael Strey ;; Keywords: dial, phone, softphone, contacts, hypermedia ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; `org-dial.el' defines the new link type `dial' for telephone ;; numbers in contacts (refer to org-contacts). Calling this link type ;; leads to the execution of a linphone command dialing this number. ;;; Code: (require 'org) ;; org link functions ;; dial link (org-add-link-type "tel" 'org-dial) (defcustom org-dial-program "linphonecsh dial " "Name of the softphone executable used to dial a phone number in a `tel:'= link." :type '(string) :group 'org) (defcustom org-dial-phone-key "\\(Phone.*Value\\)" "Regular expression for the key of a property containing a phone number. The default is following the Google Contacts scheme of key naming, where we= have for instance: :Phone 1 - Type: Work :Phone 1 - Value: +49 1234 5678 :Phone 2 - Type: Home :Phone 2 - Value: +49 56781234=20 Another common scheme :MOBILE: 0043/664/123456789 :HOMEPHONE: 0043/664/123456789 :WORKPHONE: 0043/664/123456789 :PHONE: 0043/664/123456789 would be matched by the expression ':\\(MOBILE\\|.*PHONE\\):'" :type '(string) :group 'org) (defun org-dial (phonenumber) "Dial the phone number. The variable phonenumber should contain only numb= ers, whitespaces, backslash and maybe a `+' at the beginning." ;; remove whitespaces from phonenumber (shell-command (concat org-dial-program (trim-phone-number phonenumber)))) (defun trim-phone-number (phonenumber) "Remove whitespaces from a telephone number" (mapconcat 'identity (split-string (mapconcat 'identity (split-string phonenumber "(0)") "") "[()/ -]") "")) ;; (defun org-dial-from-property () ;; "Read a property name of the Form :Phone 1 - Value: and dial its value= with org-dial. Point must be within the property line containing the phon= e number." ;; (interactive) ;; (let ((propline (thing-at-point 'line))) ;; (if (string-match org-dial-phone-key propline) ;; (org-dial=20 ;; (org-entry-get (point)=20 ;; (match-string-no-properties 0 propline)))))) (defun org-dial-from-property (&optional prop) "Dial a property value with org-dial. Asks for the appropriate property = key. If point is within the property line containing the phone number, it = dials immediately." (interactive) (let* ((props (org-entry-properties)) (prop (or prop (when (org-at-property-p) (org-match-string-no-properties 2)) (org-completing-read "Get property: " props t))) (val (org-entry-get-with-inheritance prop))) (if val (progn (org-dial val)) (message "No valid value for %s" prop)))) (provide 'org-dial) ;;; org-dial.el ends here --=-=-=--