-vicar (0.5-1) unstable; urgency=low
+vicar (0.5-3) unstable; urgency=low
- * Fixed Dbus activation error.
+ * Fix for infrequent "No routing profile defined for this number" error.
+ * Vicar will only process phone numbers with 0-9,+,p,* and #.
- -- Sudheer K. <scifi1947 at gmail.com> Fri, 03 Sep 2010 08:10:00 +0530
+ -- Sudheer K. <scifi1947 at gmail.com> Fri, 07 Nov 2010 23:10:00 -0800
-vicar_0.5-1_armel.deb user/network extra
+vicar_0.5-3_armel.deb user/network extra
case "$1" in
configure)
+ eval $(dbus-launch --sh-syntax)
+ export DBUS_SESSION_BUS_ADDRESS
+ export DBUS_SESSION_BUS_PID
+
# Kill any running instances of the daemon (only used on Linux based systems)
killall -q vicar-daemon || true
killall -q vicar-telepathy || true
case "$1" in
remove|deconfigure)
+ eval $(dbus-launch --sh-syntax)
+ export DBUS_SESSION_BUS_ADDRESS
+ export DBUS_SESSION_BUS_PID
+
echo "Deleting Vicar Telepathy account ..."
[[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils REMOVE"
--- /dev/null
+<!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="com.Nokia.Telepathy.Channel.Interface.DialStrings">
+ <method name="GetCurrentDialStrings">
+ <arg name="Dial_Strings" type="a{us}" direction="out"/>
+ </method>
+ <method name="CancelDialString">
+ <arg name="Stream_ID" type="u" direction="in"/>
+ </method>
+ <method name="SendDialString">
+ <arg name="Stream_ID" type="u" direction="in"/>
+ <arg name="Dial_String" type="s" direction="in"/>
+ <arg name="Duration" type="u" direction="in"/>
+ <arg name="Pause" type="u" direction="in"/>
+ </method>
+ <signal name="StoppedDialString">
+ <arg type="u"/>
+ <arg type="b"/>
+ </signal>
+ <signal name="SendingDialString">
+ <arg type="u"/>
+ <arg type="s"/>
+ </signal>
+ </interface>
+</node>
</size>
</property>
<property name="inputMethodHints">
- <set>Qt::ImhDigitsOnly</set>
+ <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
</size>
</property>
<property name="inputMethodHints">
- <set>Qt::ImhDigitsOnly</set>
+ <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
</size>
</property>
<property name="inputMethodHints">
- <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers</set>
+ <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
</size>
</property>
<property name="inputMethodHints">
- <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers</set>
+ <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers</set>
</property>
</widget>
</item>
{
Q_ASSERT(0 != d);
this->registerDBusService();
- qDebug() << "Registered DBus Service " << APPLICATION_DBUS_SERVICE;
+ qDebug() << "Vicar-Daemon: Registered DBus Service " << APPLICATION_DBUS_SERVICE;
}
CallRouter::~CallRouter(){
if (!connection.interface()->isServiceRegistered(APPLICATION_DBUS_SERVICE)){
if (!connection.registerService(APPLICATION_DBUS_SERVICE)) {
- qDebug() << d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage();
exit(1);
}
}
if (!connection.registerObject(APPLICATION_DBUS_PATH, this, QDBusConnection::ExportAdaptors)) {
- qDebug() << d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage();
exit(2);
}
connection.unregisterObject(APPLICATION_DBUS_PATH,QDBusConnection::UnregisterTree);
if (!connection.unregisterService(APPLICATION_DBUS_SERVICE)) {
- qDebug() << d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage();
exit(3);
}
QString strErrorMessage;
if (!result){
- strErrorMessage = QString("Error finding VICaR profile. %1").arg(d->databaseUtility->lastError().text());
+ strErrorMessage = QString("Vicar-Daemon: Error finding VICaR profile. %1").arg(d->databaseUtility->lastError().text());
}
else if (d->currentProfile->profileID == 0){
bool routeOnDefault = d->gconfUtility->getGconfValueBoolean("route_on_default");
if (routeOnDefault){
- qDebug() << "Routing directly as per configuration";
+ qDebug() << "Vicar-Daemon: Routing directly as per configuration";
this->placeCall(strDestinationNumber);
}
else{
- qDebug() << "No profile found. Stopping..";
- strErrorMessage = "VICaR: No routing profile defined for this number.";
+ qDebug() << "Vicar-Daemon: No profile found. Stopping..";
+ strErrorMessage = "Vicar: No routing profile defined for this number.";
d->dbusUtility->displayNotification(strErrorMessage );
}
}
else{
//Now call the calling card number. This is generally a local and/or tollfree number
QString strCallingCardNumber = d->currentProfile->gatewayNumber;
- qDebug() << "Initiating call to "<< strCallingCardNumber;
+ qDebug() << "Vicar-Daemon: Initiating call to "<< strCallingCardNumber;
bool status = this->placeCall(strCallingCardNumber);
d->strLastDialedNumber = strDestinationNumber;
QString strUserMessage;
if (status){
- qDebug() << "Call initiated successfully. Connecting DBus slot for audio connection monitor";
+ qDebug() << "Vicar-Daemon: Call initiated successfully. Connecting DBus slot for audio connection monitor";
startCallStatusMonitors();
}
else {
strUserMessage = QString("Unable to initiate new call to ").append(strCallingCardNumber);
strErrorMessage = d->dbusUtility->getErrorMessage();
- qDebug() << strErrorMessage;
+ qDebug() << "Vicar-Daemon: " << strErrorMessage;
d->strLastDialedNumber.clear();
delete d->currentProfile;
d->currentProfile = 0;
SLOT(sendNumberAsDTMFCode(const QDBusMessage&)));
if (success){
- qDebug() << "Successfully connected to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
}
else{
- qDebug() << "Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
/* Declare the slot to be executed when the call is terminated (due to connection errors etc).
SLOT(stopCallStatusMonitors()));
if (success){
- qDebug() << "Successfully connected to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
}
else{
- qDebug() << "Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
/* Declare the slot to be executed when a call is received
SLOT(stopCallStatusMonitors()));
if (success){
- qDebug() << "Successfully connected to Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
}
else{
- qDebug() << "Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
}
SLOT(sendNumberAsDTMFCode(const QDBusMessage&)));
if (status){
- qDebug() << "Successfully disconnected from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
}
else{
- qDebug() << "Failed to disconnect from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
// Disconnect the slot for monitoring terminated calls
SLOT(stopCallStatusMonitors()));
if (status){
- qDebug() << "Successfully disconnected from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
}
else{
- qDebug() << "Failed to disconnect from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
// Disconnect the slot for monitoring incoming calls
SLOT(stopCallStatusMonitors()));
if (status){
- qDebug() << "Successfully disconnected from Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
+ qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
}
else{
- qDebug() << "Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
- qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
+ qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
+ qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage();
}
}
// Now that the call to Calling card number is successful. We can send the original number as DTMF tones
QString strDTMFCode = convertToDTMFCode(d->strLastDialedNumber);
- qDebug() << "Audio connection established. Sending DTMF code "<< strDTMFCode;
+ qDebug() << "Vicar-Daemon: Audio connection established. Sending DTMF code "<< strDTMFCode;
QList<QVariant> argsToSend;
argsToSend.append(strDTMFCode);
d->dbusUtility->displayNotification(strMessage);
}
else{
- qDebug() << "Unable to send DTMF code.";
+ qDebug() << "Vicar-Daemon: Unable to send DTMF code.";
}
that the DTMF codes are sent only for the calls placed by this app (i.e calls to Calling card number).
*/
- qDebug() << "Now disconnecting from call status monitors..";
+ qDebug() << "Vicar-Daemon: Now disconnecting from call status monitors..";
stopCallStatusMonitors();
d->strLastDialedNumber.clear();
d->currentProfile = 0;
}
else{
- qDebug() << "Audio not yet connected.";
+ qDebug() << "Vicar-Daemon: Audio not yet connected.";
}
}
else
{
- qDebug() << "Last dialed number is empty.";
+ qDebug() << "Vicar-Daemon: Last dialed number is empty.";
}
}
//DBus Method used by external applications to call via VICaR
QString CallRouter::callInternationalNumber(const QString& strDestinationNumber){
- qDebug() << "New call requested by external application. Destination number is " << strDestinationNumber;
- QString strErrorMessage = this->callViaCallingCard(strDestinationNumber);
+ QString strErrorMessage;
+
+ qDebug() << "Vicar-Daemon: New call requested by external application. Destination number is " << strDestinationNumber;
+
+ if (isValidPhoneNumber(strDestinationNumber)){
+
+ strErrorMessage = this->callViaCallingCard(strDestinationNumber);
+ }
+ else{
+ strErrorMessage = QString("Vicar-Daemon: %1 is not a valid number").arg(strDestinationNumber);
+ }
+
qDebug() << strErrorMessage;
if (strErrorMessage.isEmpty()){
return strErrorMessage;
}
}
+
+//Check whether a string is valid phone number
+bool CallRouter::isValidPhoneNumber(QString strPhoneNumber){
+
+
+/* Remove all dialble characters. The resulting string should be a valid number */
+ QRegExp regexp = QRegExp("[p+*#]");
+
+ strPhoneNumber = strPhoneNumber.replace(regexp,"");
+
+ qDebug() << "Vicar Daemon: Cleaned up phone number is " << strPhoneNumber;
+
+/* Now remove all digits, the resulting string should be empty, then it is a valid number */
+ regexp = QRegExp("[0-9]");
+
+ strPhoneNumber = strPhoneNumber.replace(regexp,"");
+
+ bool isNumber = strPhoneNumber.isEmpty();
+ return isNumber;
+}
~CallRouter();
void registerDBusService();
void unregisterDBusService();
+ bool isValidPhoneNumber(QString);
protected:
void startCallStatusMonitors();
--- /dev/null
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by INdT
+ * @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "connectioninterfacerequeststypes.h"
+
+using namespace org::freedesktop::Telepathy;
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ChannelDetails &val)
+{
+ argument.beginStructure();
+ argument >> val.channel >> val.properties;
+ argument.endStructure();
+ return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ChannelDetails &val)
+{
+ argument.beginStructure();
+ argument << val.channel << val.properties;
+ argument.endStructure();
+ return argument;
+}
+
+QDebug &operator<<(QDebug arg,const ChannelDetails &val)
+{
+ arg.space() << "[" << val.channel.path() << "," << val.properties <<"]";
+ return arg.space();
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, RequestableChannelClass &val)
+{
+ argument.beginStructure();
+ argument >> val.fixedProperties >> val.allowedProperties;
+ argument.endStructure();
+ return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const RequestableChannelClass &val)
+{
+ argument.beginStructure();
+ argument << val.fixedProperties << val.allowedProperties;
+ argument.endStructure();
+ return argument;
+}
+
+QDebug &operator<<(QDebug arg,const RequestableChannelClass &val)
+{
+ arg.space() << "[" << val.fixedProperties << "," << val.allowedProperties <<"]";
+ return arg.space();
+}
--- /dev/null
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ * @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef QTTELEPATHY_CONNECTIONINTERFACEREQUESTSTYPES_H
+#define QTTELEPATHY_CONNECTIONINTERFACEREQUESTSTYPES_H
+
+#include <QtCore/QList>
+#include <QtCore/QDebug>
+#include <QtCore/QVariantMap>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusObjectPath>
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+
+class ChannelDetails
+{
+public:
+ QDBusObjectPath channel;
+ QVariantMap properties;
+};
+typedef QList<ChannelDetails> ChannelDetailsList;
+
+class RequestableChannelClass
+{
+public:
+ QVariantMap fixedProperties;
+ QStringList allowedProperties;
+};
+typedef QList<RequestableChannelClass> RequestableChannelClassList;
+
+} // namespace Telepathy
+} // namespace freedesktop
+} // namespace org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelDetails)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelDetailsList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::ChannelDetails& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::ChannelDetails& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::ChannelDetails& val);
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::RequestableChannelClass)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::RequestableChannelClassList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::RequestableChannelClass& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::RequestableChannelClass& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::RequestableChannelClass& val);
+
+#endif
+
--- /dev/null
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "connifacereqproxy.h"
+
+/*
+ * Implementation of interface class ConnectionInterfaceRequestsProxy
+ */
+
+ConnectionInterfaceRequestsProxy::ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+ConnectionInterfaceRequestsProxy::~ConnectionInterfaceRequestsProxy()
+{
+}
+
--- /dev/null
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef CONNIFACEREQPROXY_H_1284203341
+#define CONNIFACEREQPROXY_H_1284203341
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+#include "connectioninterfacerequeststypes.h"
+
+/*
+ * Proxy class for interface org.freedesktop.Telepathy.Connection.Interface.Requests
+ */
+class ConnectionInterfaceRequestsProxy: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.freedesktop.Telepathy.Connection.Interface.Requests"; }
+
+public:
+ ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~ConnectionInterfaceRequestsProxy();
+
+ Q_PROPERTY(org::freedesktop::Telepathy::RequestableChannelClassList RequestableChannelClasses READ requestableChannelClasses)
+ inline org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses() const
+ { return qvariant_cast< org::freedesktop::Telepathy::RequestableChannelClassList >(property("RequestableChannelClasses")); }
+
+public Q_SLOTS: // METHODS
+ inline QDBusPendingReply<QDBusObjectPath, QVariantMap> CreateChannel(const QVariantMap &request)
+ {
+ QList<QVariant> argumentList;
+ argumentList << qVariantFromValue(request);
+ return asyncCallWithArgumentList(QLatin1String("CreateChannel"), argumentList);
+ }
+ inline QDBusReply<QDBusObjectPath> CreateChannel(const QVariantMap &request, QVariantMap &channel_properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << qVariantFromValue(request);
+ QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateChannel"), argumentList);
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
+ channel_properties = qdbus_cast<QVariantMap>(reply.arguments().at(1));
+ }
+ return reply;
+ }
+
+ inline QDBusPendingReply<bool, QDBusObjectPath, QVariantMap> EnsureChannel(const QVariantMap &request)
+ {
+ QList<QVariant> argumentList;
+ argumentList << qVariantFromValue(request);
+ return asyncCallWithArgumentList(QLatin1String("EnsureChannel"), argumentList);
+ }
+ inline QDBusReply<bool> EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << qVariantFromValue(request);
+ QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("EnsureChannel"), argumentList);
+ if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 3) {
+ channel_object = qdbus_cast<QDBusObjectPath>(reply.arguments().at(1));
+ channel_properties = qdbus_cast<QVariantMap>(reply.arguments().at(2));
+ }
+ return reply;
+ }
+
+Q_SIGNALS: // SIGNALS
+ void ChannelClosed(const QDBusObjectPath &removed_channel_object);
+ void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels);
+};
+
+namespace org {
+ namespace freedesktop {
+ namespace Telepathy {
+ namespace Connection {
+ namespace Interface {
+ typedef ::ConnectionInterfaceRequestsProxy Requests;
+ }
+ }
+ }
+ }
+}
+#endif
bool result = false;
if (profilesDB.isOpen()){
bool continueInsert = true;
- if (!this->tableExists()){
+ if (!this->tableExists("profiles")){
continueInsert = this->createProfilesTable();
}
#include "accountmanagerproxy.h"
#include "accountproxy.h"
#include "accountcompatproxy.h"
+#include "connifacereqproxy.h"
#include <QDBusInterface>
#include <QDBusConnection>
#include <QStringList>
return status;
}
-//Create Vicar telepathy account (used installation)
+//Create Vicar telepathy account (used during installation)
bool TelepathyUtility::createAccount(){
AccountManagerProxy *amProxy = new AccountManagerProxy(AM_SERVICE,AM_OBJ_PATH,QDBusConnection::sessionBus(),this);
return true;
}
+bool TelepathyUtility::callNumberWithRing(QString number){
+
+ bool result = false;
+
+ ConnectionInterfaceRequestsProxy *requestsProxy = new ConnectionInterfaceRequestsProxy(RING_CONN_SERVICE,RING_CONN_PATH,QDBusConnection::sessionBus(),this);
+ if (requestsProxy->isValid()){
+ QVariantMap channelRequestDetails;
+ uint targetHandleType(1);
+ channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetHandleType",targetHandleType);
+ channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetID",number);
+ channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.ChannelType","org.freedesktop.Telepathy.Channel.Type.StreamedMedia");
+ QDBusPendingReply<QDBusObjectPath,QVariantMap> dbusReply = requestsProxy->CreateChannel(channelRequestDetails);
+ dbusReply.waitForFinished();
+ if (!dbusReply.isError()){
+ QDBusObjectPath objPath = dbusReply.argumentAt<0>();
+ QVariantMap channelProperties = dbusReply.argumentAt<1>();
+ result = true;
+ }
+ else{
+ qDebug() << "Error occurred calling "<<number<< ". Error is "<< dbusReply.error();
+ result = false;
+ }
+ }
+
+ return result;
+}
+
+bool TelepathyUtility::sendDTMFTone(QString tone){
+ bool result = false;
+
+ return result;
+}
+
// Marshall the Presence data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const SimplePresence &simplePresence)
{
#define AM_SERVICE "org.freedesktop.Telepathy.AccountManager"
#define AM_OBJ_PATH "/org/freedesktop/Telepathy/AccountManager"
#define AM_INTERFACE "org.freedesktop.Telepathy.AccountManager"
+#define RING_CONN_SERVICE "org.freedesktop.Telepathy.Connection.ring.tel.ring"
+#define RING_CONN_PATH "/org/freedesktop/Telepathy/Connection/ring/tel/ring"
#define DBUS_SERVICE "org.freedesktop.DBus.Properties"
#define DBUS_OBJ_PATH "/org/freedesktop/DBus/Properties"
#define DBUS_PROPS_IFACE "org.freedesktop.DBus.Properties"
bool accountExists();
bool createAccount();
bool deleteAccount();
+ bool callNumberWithRing(QString number);
+ bool sendDTMFTone(QString tone);
};
#endif // TELEPATHYUTILITY_H
src/accountmanagerproxy.cpp \
src/accountproxy.cpp \
src/accountcompatproxy.cpp \
+ src/connifacereqproxy.cpp \
+ src/connectioninterfacerequeststypes.cpp \
src/databaseutility.cpp
HEADERS += src/dbusutility.h \
src/gconfutility.h \
src/accountmanagerproxy.h \
src/accountproxy.h \
src/accountcompatproxy.h \
+ src/connifacereqproxy.h \
+ src/connectioninterfacerequeststypes.h \
src/databaseutility.h \
src/vicarprofiletypes.h
return channel_path;
}
+ //Only allow requests with handle type as contact
+ QVariant vTargetHandleType = request.value("org.freedesktop.Telepathy.Channel.TargetHandleType");
+ uint intTargetHandleType = vTargetHandleType.toUInt();
+ if (intTargetHandleType != HandleContact)
+ {
+ QString strMessage = "VICaR - Supports handles of type Contact only. Recieved handle type ";
+ strMessage.append(vTargetHandleType.toString());
+
+ sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+ strMessage);
+ }
+
/*
Send an error reply to Tp Client (Mission Control) to force it to close the active channel.
Once it recieves the reply, the client does not bother what we return.
// register CM on D-BUS:
if (connection.registerService(cm_service_name)){
- qDebug(qPrintable(QObject::tr("Service %1 registered with session bus.").
+ qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Service %1 registered with session bus.").
arg(cm_service_name)));
}
else{
- qDebug(qPrintable(QObject::tr("Unable to register service %1 with session bus.").
+ qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register service %1 with session bus.").
arg(cm_service_name)));
}
ConnectionManager connection_mgr(&app);
if (!connection.registerObject(cm_object_path,&connection_mgr)){
- qDebug(qPrintable(QObject::tr("Unable to register VICaR connection manager at path %1 with session bus.").
+ qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register VICaR connection manager at path %1 with session bus.").
arg(cm_object_path)));
}
- qDebug(qPrintable(QObject::tr("Enternig main loop.")));
+ qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Enternig main loop.")));
// logfile.close();
return app.exec();
}
#include "telepathyutility.h"
#include "databaseutility.h"
#include "vicarprofiletypes.h"
+#include "connectioninterfacerequeststypes.h"
#include <QDebug>
#include <QDBusMetaType>
int main(int argc, char *argv[])
{
qDBusRegisterMetaType<org::freedesktop::Telepathy::SimplePresence>();
+ //From Connection Interface Requests
+ qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetails>();
+ qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetailsList>();
+ qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClass>();
+ qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClassList>();
+ //From Vicar Profile Types
//qDBusRegisterMetaType<org::maemo::vicar::Profile>();
//qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
QString status = tpUtility->getAccountStatus();
qDebug() << "Account Status is "<< status;
}
+ else if (instruction == "TESTING"){
+ tpUtility->callNumberWithRing(argv[2]);
+ }
}
delete (tpUtility);