Commit 07eb23da authored by Bob Ham's avatar Bob Ham
Browse files

Initial import of cleaned Calls working tree

parents
((nil . ((indent-tabs-mode . nil))))
# Calls
A phone dialer and call handler.
## License
Calls is licensed under the GPLv3+.
## Dependencies
sudo apt-get install libgtk-3-dev libhandy-0.0-dev
## Building
We use the meson and thereby Ninja. The quickest way to get going is
to do the following:
meson ../calls-build
ninja -C ../calls-build
ninja -C ../calls-build install
## Running
Calls depends on oFono Modem objects being present on D-Bus. To run
oFono with useful output:
sudo OFONO_AT_DEBUG=1 ofonod -n -d
The test programs within the (oFono source
tree)[https://git.kernel.org/pub/scm/network/ofono/ofono.git] are
useful to bring up a modem to a suitable state. For example:
cd $OFONO_SOURCE/test
./list-modems
./enable-modem /sim7100
./online-modem /sim7100
Then run Calls.
### Phonesim
One can also make use of the modem simulator, phonesim (in the
ofono-phonesim package in Debian):
ofono-phonesim -p 12345 -gui /usr/local/share/phonesim/default.xml
then, ensuring /etc/ofono/phonesim.conf has appropriate contents like:
[phonesim]
Address=127.0.0.1
Port=12345
run oFono as above, then:
cd $OFONO_SOURCE/test
./enable-modem /phonesim
./online-modem /phonesim
And again run Calls.
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">
<name>Calls</name>
<shortname>Calls</shortname>
<shortdesc>A phone call dialer</shortdesc>
<description>Calls is a dialer for phone calls, initially PSTN calls
but eventually other systems like SIP in future.</description>
<homepage rdf:resource="https://gitlab.gnome.org/Community/Purism/calls" />
<license rdf:resource="http://usefulinc.com/doap/licenses/gpl" />
<programming-language>C</programming-language>
<maintainer>
<foaf:Person>
<foaf:name>Bob Ham</foaf:name>
<foaf:mbox rdf:resource="mailto:bob.ham@puri.sm" />
<foaf:mbox rdf:resource="mailto:rah@settrans.net" />
</foaf:Person>
</maintainer>
</Project>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.ofono.VoiceCall"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="Deflect"><arg name="number" type="s" direction="in"/>
</method><method name="Hangup"></method><method name="Answer"></method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="DisconnectReason"><arg name="reason" type="s"/>
</signal>
</interface></node>
#!/bin/bash
DEST="$1"
OBJ_PATH="$2"
METHOD="$3"
shift 3
dbus-send "$@" --print-reply --dest="$DEST" "$OBJ_PATH" "$METHOD" | \
grep -v '^method return' | \
sed -e 's/^[[:space:]]\+string "</</' \
-e 's_</node>"_</node>_'
#!/bin/sh
#set -x
#echo "$@"
INPUT="$1"
OUTPUT0="$2"
BASENAME="$( basename "$INPUT" .xml )"
WD="$PWD"
DIR="$( dirname "$OUTPUT0" )"
cd "$DIR"
gdbus-codegen \
--generate-c-code "gdbo-${BASENAME}" \
--c-namespace GDBO \
--interface-prefix org.ofono. \
"${WD}/${INPUT}"
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.ofono.Manager"><method name="GetModems"><arg name="modems" type="a(oa{sv})" direction="out"/>
</method><signal name="ModemAdded"><arg name="path" type="o"/>
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="ModemRemoved"><arg name="path" type="o"/>
</signal>
</interface>
</node>
gdbus_codegen = find_program('gdbus-codegen')
gen_sh = find_program('gen.sh')
gdbofono_gen = generator(gen_sh,
output : [ 'gdbo-@BASENAME@.c',
'gdbo-@BASENAME@.h' ],
arguments : [ '@INPUT@', '@OUTPUT0@' ])
#manager_src = gdbus_ofono_gen.process('manager.xml')
#modem_src = gdbus_ofono_gen.process('modem.xml')
#call_src = gdbus_ofono_gen.process('call.xml')
manager_src = custom_target('manager',
input : 'manager.xml',
output : [ 'gdbo-manager.h',
'gdbo-manager.c' ],
command : [gen_sh, '@INPUT@', '@OUTPUT0@'])
modem_src = custom_target('modem',
input : 'modem.xml',
output : [ 'gdbo-modem.h',
'gdbo-modem.c' ],
command : [gen_sh, '@INPUT@', '@OUTPUT0@'])
call_src = custom_target('call',
input : 'call.xml',
output : [ 'gdbo-call.h',
'gdbo-call.c' ],
command : [gen_sh, '@INPUT@', '@OUTPUT0@'])
deps = [ dependency('gio-2.0'),
dependency('gio-unix-2.0'),
]
gdbofono_lib = shared_library('gdbofono',
manager_src, modem_src, call_src,
dependencies : deps )
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.ofono.Modem"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.SimManager"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><method name="ChangePin"><arg name="type" type="s" direction="in"/>
<arg name="oldpin" type="s" direction="in"/>
<arg name="newpin" type="s" direction="in"/>
</method><method name="EnterPin"><arg name="type" type="s" direction="in"/>
<arg name="pin" type="s" direction="in"/>
</method><method name="ResetPin"><arg name="type" type="s" direction="in"/>
<arg name="puk" type="s" direction="in"/>
<arg name="newpin" type="s" direction="in"/>
</method><method name="LockPin"><arg name="type" type="s" direction="in"/>
<arg name="pin" type="s" direction="in"/>
</method><method name="UnlockPin"><arg name="type" type="s" direction="in"/>
<arg name="pin" type="s" direction="in"/>
</method><method name="GetIcon"><arg name="id" type="y" direction="in"/>
<arg name="icon" type="ay" direction="out"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.VoiceCallManager"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="Dial"><arg name="number" type="s" direction="in"/>
<arg name="hide_callerid" type="s" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method><method name="DialLast"></method><method name="DialMemory"><arg name="memory_location" type="u" direction="in"/>
</method><method name="Transfer"></method><method name="SwapCalls"></method><method name="ReleaseAndAnswer"></method><method name="ReleaseAndSwap"></method><method name="HoldAndAnswer"></method><method name="HangupAll"></method><method name="PrivateChat"><arg name="call" type="o" direction="in"/>
<arg name="calls" type="ao" direction="out"/>
</method><method name="CreateMultiparty"><arg name="calls" type="ao" direction="out"/>
</method><method name="HangupMultiparty"></method><method name="SendTones"><arg name="SendTones" type="s" direction="in"/>
</method><method name="GetCalls"><arg name="calls_with_properties" type="a(oa{sv})" direction="out"/>
</method><signal name="Forwarded"><arg name="type" type="s"/>
</signal>
<signal name="BarringActive"><arg name="type" type="s"/>
</signal>
<signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="CallAdded"><arg name="path" type="o"/>
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="CallRemoved"><arg name="path" type="o"/>
</signal>
</interface>
<interface name="org.ofono.AllowedAccessPoints"><method name="GetAllowedAccessPoints"><arg name="apnlist" type="as" direction="out"/>
</method></interface>
<interface name="org.ofono.SimAuthentication"><method name="GetApplications"><arg name="applications" type="a{oa{sv}}" direction="out"/>
</method><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method></interface>
<interface name="org.ofono.SimToolkit"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SelectItem"><arg name="item" type="y" direction="in"/>
<arg name="agent" type="o" direction="in"/>
</method><method name="RegisterAgent"><arg name="path" type="o" direction="in"/>
</method><method name="UnregisterAgent"><arg name="path" type="o" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.CallForwarding"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><method name="DisableAll"><arg name="type" type="s" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.RadioSettings"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.TextTelephony"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.Phonebook"><method name="Import"><arg name="entries" type="s" direction="out"/>
</method></interface>
<interface name="org.ofono.MessageManager"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><method name="SendMessage"><arg name="to" type="s" direction="in"/>
<arg name="text" type="s" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method><method name="GetMessages"><arg name="messages" type="a(oa{sv})" direction="out"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="IncomingMessage"><arg name="message" type="s"/>
<arg name="info" type="a{sv}"/>
</signal>
<signal name="ImmediateMessage"><arg name="message" type="s"/>
<arg name="info" type="a{sv}"/>
</signal>
<signal name="MessageAdded"><arg name="path" type="o"/>
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="MessageRemoved"><arg name="path" type="o"/>
</signal>
</interface>
<interface name="org.ofono.PushNotification"><method name="RegisterAgent"><arg name="path" type="o" direction="in"/>
</method><method name="UnregisterAgent"><arg name="path" type="o" direction="in"/>
</method></interface>
<interface name="org.ofono.SmartMessaging"><method name="RegisterAgent"><arg name="path" type="o" direction="in"/>
</method><method name="UnregisterAgent"><arg name="path" type="o" direction="in"/>
</method><method name="SendBusinessCard"><arg name="to" type="s" direction="in"/>
<arg name="card" type="ay" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method><method name="SendAppointment"><arg name="to" type="s" direction="in"/>
<arg name="appointment" type="ay" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method></interface>
<interface name="org.ofono.MessageWaiting"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.CallSettings"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="property" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.CallBarring"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
<arg name="pin2" type="s" direction="in"/>
</method><method name="DisableAll"><arg name="password" type="s" direction="in"/>
</method><method name="DisableAllIncoming"><arg name="password" type="s" direction="in"/>
</method><method name="DisableAllOutgoing"><arg name="password" type="s" direction="in"/>
</method><method name="ChangePassword"><arg name="old" type="s" direction="in"/>
<arg name="new" type="s" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.SupplementaryServices"><method name="Initiate"><arg name="command" type="s" direction="in"/>
<arg name="result_name" type="s" direction="out"/>
<arg name="value" type="v" direction="out"/>
</method><method name="Respond"><arg name="reply" type="s" direction="in"/>
<arg name="result" type="s" direction="out"/>
</method><method name="Cancel"></method><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><signal name="NotificationReceived"><arg name="message" type="s"/>
</signal>
<signal name="RequestReceived"><arg name="message" type="s"/>
</signal>
<signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.CallMeter"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
<arg name="password" type="s" direction="in"/>
</method><method name="Reset"><arg name="passoword" type="s" direction="in"/>
</method><signal name="PropertyChanged"><arg name="property" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="NearMaximumWarning"></signal>
</interface>
<interface name="org.ofono.CallVolume"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="property" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.NetworkRegistration"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="Register"></method><method name="GetOperators"><arg name="operators_with_properties" type="a(oa{sv})" direction="out"/>
</method><method name="Scan"><arg name="operators_with_properties" type="a(oa{sv})" direction="out"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.CellBroadcast"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="property" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="IncomingBroadcast"><arg name="message" type="s"/>
<arg name="channel" type="q"/>
</signal>
<signal name="EmergencyBroadcast"><arg name="message" type="s"/>
<arg name="dict" type="a{sv}"/>
</signal>
</interface>
<interface name="org.ofono.AssistedSatelliteNavigation"><method name="SendPositioningElement"><arg name="xml_elements" type="(null)" direction="in"/>
</method><method name="RegisterPositioningRequestAgent"><arg name="agent" type="o" direction="in"/>
</method><method name="UnregisterPositioningRequestAgent"><arg name="agent" type="o" direction="in"/>
</method></interface>
<interface name="org.ofono.ConnectionManager"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><method name="AddContext"><arg name="type" type="s" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method><method name="RemoveContext"><arg name="path" type="o" direction="in"/>
</method><method name="DeactivateAll"></method><method name="GetContexts"><arg name="contexts_with_properties" type="a(oa{sv})" direction="out"/>
</method><method name="ResetContexts"></method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="ContextAdded"><arg name="path" type="o"/>
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="ContextRemoved"><arg name="path" type="o"/>
</signal>
</interface>
</node>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.ofono.Modem"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="SetProperty"><arg name="property" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method><signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
</interface>
<interface name="org.ofono.VoiceCallManager"><method name="GetProperties"><arg name="properties" type="a{sv}" direction="out"/>
</method><method name="Dial"><arg name="number" type="s" direction="in"/>
<arg name="hide_callerid" type="s" direction="in"/>
<arg name="path" type="o" direction="out"/>
</method><method name="DialLast"></method><method name="DialMemory"><arg name="memory_location" type="u" direction="in"/>
</method><method name="Transfer"></method><method name="SwapCalls"></method><method name="ReleaseAndAnswer"></method><method name="ReleaseAndSwap"></method><method name="HoldAndAnswer"></method><method name="HangupAll"></method><method name="PrivateChat"><arg name="call" type="o" direction="in"/>
<arg name="calls" type="ao" direction="out"/>
</method><method name="CreateMultiparty"><arg name="calls" type="ao" direction="out"/>
</method><method name="HangupMultiparty"></method><method name="SendTones"><arg name="SendTones" type="s" direction="in"/>
</method><method name="GetCalls"><arg name="calls_with_properties" type="a(oa{sv})" direction="out"/>
</method><signal name="Forwarded"><arg name="type" type="s"/>
</signal>
<signal name="BarringActive"><arg name="type" type="s"/>
</signal>
<signal name="PropertyChanged"><arg name="name" type="s"/>
<arg name="value" type="v"/>
</signal>
<signal name="CallAdded"><arg name="path" type="o"/>
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="CallRemoved"><arg name="path" type="o"/>
</signal>
</interface>
</node>
#
# Copyright (C) 2018 Purism SPC
#
# This file is part of Dialer.
#
# Dialer 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.
#
# Dialer 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 Dialer. If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
project('call', 'c',
version: '0.0.0',
license: 'GPLv3+',
meson_version: '>= 0.40.1',
default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
)
topdir_includes = include_directories('.')
subdir('libgdbofono')
subdir('src')
/*
* Copyright (C) 2018 Purism SPC
*
* This file is part of Calls.
*
* Calls 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.
*
* Calls 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 Calls. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Bob Ham <bob.ham@puri.sm>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "calls-call-data.h"
#include "util.h"
#include <glib/gi18n.h>
#include <glib-object.h>
/**
* SECTION:calls-call-data
* @short_description: An object to hold both a #CallsCall object and
* the #CallsParty participating in the call
* @Title: CallsCallData
*/
struct _CallsCallData
{
GObject parent_instance;
CallsCall *call;
CallsParty *party;
};
G_DEFINE_TYPE (CallsCallData, calls_call_data, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_CALL,
PROP_PARTY,
PROP_LAST_PROP,
};
static GParamSpec *props[PROP_LAST_PROP];
CallsCallData *
calls_call_data_new (CallsCall *call, CallsParty *party)
{
return g_object_new (CALLS_TYPE_CALL_DATA,
"call", call,
"party", party,
NULL);
}
CallsCall *
calls_call_data_get_call (CallsCallData *data)
{
g_return_val_if_fail (CALLS_IS_CALL_DATA (data), NULL);
return data->call;
}
CallsParty *
calls_call_data_get_party (CallsCallData *data)
{
g_return_val_if_fail (CALLS_IS_CALL_DATA (data), NULL);
return data->party;
}
static void