Skip to content
Snippets Groups Projects
Commit 7174c1ec authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Send DTMF!

parent 2b557a0a
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -254,7 +254,7 @@ sflphone_keypad( guint keyval, gchar * key)
dbus_hang_up(c); dbus_hang_up(c);
break; break;
default: default:
//TODO send DTMF, dbus_play_dtmf(key);
if (keyval < 255 || (keyval >65453 && keyval < 65466)) if (keyval < 255 || (keyval >65453 && keyval < 65466))
{ {
gchar * temp = g_strconcat(call_get_number(c), key, NULL); gchar * temp = g_strconcat(call_get_number(c), key, NULL);
......
...@@ -273,6 +273,43 @@ static ...@@ -273,6 +273,43 @@ static
inline inline
#endif #endif
gboolean gboolean
org_sflphone_SFLphone_CallManager_play_dt_mf (DBusGProxy *proxy, const char * IN_key, GError **error)
{
return dbus_g_proxy_call (proxy, "playDTMF", error, G_TYPE_STRING, IN_key, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_CallManager_play_dt_mf_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_CallManager_play_dt_mf_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_CallManager_play_dt_mf_reply)data->cb) (proxy, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_CallManager_play_dt_mf_async (DBusGProxy *proxy, const char * IN_key, org_sflphone_SFLphone_CallManager_play_dt_mf_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "playDTMF", org_sflphone_SFLphone_CallManager_play_dt_mf_async_callback, stuff, g_free, G_TYPE_STRING, IN_key, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_CallManager_set_volume (DBusGProxy *proxy, const char * IN_device, const gdouble IN_value, GError **error) org_sflphone_SFLphone_CallManager_set_volume (DBusGProxy *proxy, const char * IN_device, const gdouble IN_value, GError **error)
{ {
......
...@@ -487,3 +487,27 @@ dbus_get_volume(const gchar * device) ...@@ -487,3 +487,27 @@ dbus_get_volume(const gchar * device)
} }
return value; return value;
} }
void
dbus_play_dtmf(const gchar * key)
{
GError *error = NULL;
org_sflphone_SFLphone_CallManager_play_dt_mf(
callManagerProxy,
key,
&error);
if (error)
{
g_printerr ("Failed to call playDTMF() on callManagerProxy: %s\n",
error->message);
g_error_free (error);
}
else
{
g_print ("DBus called playDTMF() on callManagerProxy\n");
}
}
...@@ -48,5 +48,6 @@ void dbus_set_account_details(account_t *a); ...@@ -48,5 +48,6 @@ void dbus_set_account_details(account_t *a);
void dbus_remove_account(gchar * accountID); void dbus_remove_account(gchar * accountID);
void dbus_set_volume(const gchar * device, gdouble value); void dbus_set_volume(const gchar * device, gdouble value);
gdouble dbus_get_volume(const gchar * device); gdouble dbus_get_volume(const gchar * device);
void dbus_play_dtmf(const gchar * key);
#endif #endif
...@@ -27,6 +27,7 @@ public: ...@@ -27,6 +27,7 @@ public:
register_method(CallManager, hold, _hold_stub); register_method(CallManager, hold, _hold_stub);
register_method(CallManager, unhold, _unhold_stub); register_method(CallManager, unhold, _unhold_stub);
register_method(CallManager, transfert, _transfert_stub); register_method(CallManager, transfert, _transfert_stub);
register_method(CallManager, playDTMF, _playDTMF_stub);
register_method(CallManager, setVolume, _setVolume_stub); register_method(CallManager, setVolume, _setVolume_stub);
register_method(CallManager, getVolume, _getVolume_stub); register_method(CallManager, getVolume, _getVolume_stub);
register_method(CallManager, getCallDetails, _getCallDetails_stub); register_method(CallManager, getCallDetails, _getCallDetails_stub);
...@@ -73,6 +74,11 @@ public: ...@@ -73,6 +74,11 @@ public:
{ "to", "s", true }, { "to", "s", true },
{ 0, 0, 0 } { 0, 0, 0 }
}; };
static ::DBus::IntrospectedArgument playDTMF_args[] =
{
{ "key", "s", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setVolume_args[] = static ::DBus::IntrospectedArgument setVolume_args[] =
{ {
{ "device", "s", true }, { "device", "s", true },
...@@ -141,6 +147,7 @@ public: ...@@ -141,6 +147,7 @@ public:
{ "hold", hold_args }, { "hold", hold_args },
{ "unhold", unhold_args }, { "unhold", unhold_args },
{ "transfert", transfert_args }, { "transfert", transfert_args },
{ "playDTMF", playDTMF_args },
{ "setVolume", setVolume_args }, { "setVolume", setVolume_args },
{ "getVolume", getVolume_args }, { "getVolume", getVolume_args },
{ "getCallDetails", getCallDetails_args }, { "getCallDetails", getCallDetails_args },
...@@ -189,6 +196,7 @@ public: ...@@ -189,6 +196,7 @@ public:
virtual void hold( const ::DBus::String& callID ) = 0; virtual void hold( const ::DBus::String& callID ) = 0;
virtual void unhold( const ::DBus::String& callID ) = 0; virtual void unhold( const ::DBus::String& callID ) = 0;
virtual void transfert( const ::DBus::String& callID, const ::DBus::String& to ) = 0; virtual void transfert( const ::DBus::String& callID, const ::DBus::String& to ) = 0;
virtual void playDTMF( const ::DBus::String& key ) = 0;
virtual void setVolume( const ::DBus::String& device, const ::DBus::Double& value ) = 0; virtual void setVolume( const ::DBus::String& device, const ::DBus::Double& value ) = 0;
virtual ::DBus::Double getVolume( const ::DBus::String& device ) = 0; virtual ::DBus::Double getVolume( const ::DBus::String& device ) = 0;
virtual std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ) = 0; virtual std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ) = 0;
...@@ -317,6 +325,15 @@ private: ...@@ -317,6 +325,15 @@ private:
::DBus::ReturnMessage reply(call); ::DBus::ReturnMessage reply(call);
return reply; return reply;
} }
::DBus::Message _playDTMF_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::String argin1; ri >> argin1;
playDTMF(argin1);
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _setVolume_stub( const ::DBus::CallMessage& call ) ::DBus::Message _setVolume_stub( const ::DBus::CallMessage& call )
{ {
::DBus::MessageIter ri = call.reader(); ::DBus::MessageIter ri = call.reader();
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<arg type="s" name="to" direction="in"/> <arg type="s" name="to" direction="in"/>
</method> </method>
<method name="playDTMF">
<arg type="s" name="key" direction="in"/>
</method>
<method name="setVolume"> <method name="setVolume">
<arg type="s" name="device" direction="in"/> <arg type="s" name="device" direction="in"/>
<arg type="d" name="value" direction="in"/> <arg type="d" name="value" direction="in"/>
......
...@@ -133,4 +133,10 @@ CallManager::getCurrentCallID( ) ...@@ -133,4 +133,10 @@ CallManager::getCurrentCallID( )
return Manager::instance().getCurrentCallId(); return Manager::instance().getCurrentCallId();
} }
void
CallManager::playDTMF( const ::DBus::String& key )
{
Manager::instance().sendDtmf(Manager::instance().getCurrentCallId(), key.c_str()[0]);
}
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
::DBus::Double getVolume( const ::DBus::String& device ); ::DBus::Double getVolume( const ::DBus::String& device );
std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ); std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID );
::DBus::String getCurrentCallID( ); ::DBus::String getCurrentCallID( );
void playDTMF( const ::DBus::String& key );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment