Skip to content
Snippets Groups Projects
Commit a8db6284 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Add a different tone when having voice mails

TONE::CONGESTION
parent 9c19181c
No related branches found
No related tags found
No related merge requests found
......@@ -35,9 +35,15 @@
#define ALSA_ERROR 0
#define TONE_WITHOUT_MESSAGE 0
#define TONE_WITH_MESSAGE 1
guint voice_mails;
void
sflphone_notify_voice_mail (guint count)
{
voice_mails = count ;
if(count > 0)
{
gchar * message = g_new0(gchar, 50);
......@@ -335,7 +341,7 @@ sflphone_incoming_call (call_t * c)
void process_dialing(call_t * c, guint keyval, gchar * key)
{
// We stop the tone
dbus_start_tone( FALSE );
dbus_start_tone( FALSE , 0 );
switch (keyval)
{
case 65293: /* ENTER */
......@@ -397,7 +403,9 @@ void process_dialing(call_t * c, guint keyval, gchar * key)
call_t * sflphone_new_call()
{
if( call_list_get_size() == 0 )
dbus_start_tone(TRUE);
{
dbus_start_tone( TRUE , ( voice_mails > 0 )? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ;
}
call_t * c = g_new0 (call_t, 1);
c->state = CALL_STATE_DIALING;
c->from = g_strconcat("\"\" <>", NULL);
......
......@@ -310,10 +310,10 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_CallManager_start_tone (DBusGProxy *proxy, const gint IN_start, GError **error)
org_sflphone_SFLphone_CallManager_start_tone (DBusGProxy *proxy, const gint IN_start, const gint IN_type, GError **error)
{
return dbus_g_proxy_call (proxy, "startTone", error, G_TYPE_INT, IN_start, G_TYPE_INVALID, G_TYPE_INVALID);
return dbus_g_proxy_call (proxy, "startTone", error, G_TYPE_INT, IN_start, G_TYPE_INT, IN_type, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_CallManager_start_tone_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
......@@ -333,14 +333,14 @@ static
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_CallManager_start_tone_async (DBusGProxy *proxy, const gint IN_start, org_sflphone_SFLphone_CallManager_start_tone_reply callback, gpointer userdata)
org_sflphone_SFLphone_CallManager_start_tone_async (DBusGProxy *proxy, const gint IN_start, const gint IN_type, org_sflphone_SFLphone_CallManager_start_tone_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, "startTone", org_sflphone_SFLphone_CallManager_start_tone_async_callback, stuff, g_free, G_TYPE_INT, IN_start, G_TYPE_INVALID);
return dbus_g_proxy_begin_call (proxy, "startTone", org_sflphone_SFLphone_CallManager_start_tone_async_callback, stuff, g_free, G_TYPE_INT, IN_start, G_TYPE_INT, IN_type, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
......
......@@ -632,13 +632,14 @@ dbus_play_dtmf(const gchar * key)
}
void
dbus_start_tone(const int start)
dbus_start_tone(const int start , const guint type )
{
GError *error = NULL;
org_sflphone_SFLphone_CallManager_start_tone(
callManagerProxy,
start,
start,
type,
&error);
if (error)
......
......@@ -83,6 +83,7 @@ public:
static ::DBus::IntrospectedArgument startTone_args[] =
{
{ "start", "i", true },
{ "type", "i", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setVolume_args[] =
......@@ -204,7 +205,7 @@ public:
virtual void unhold( const ::DBus::String& callID ) = 0;
virtual void transfert( const ::DBus::String& callID, const ::DBus::String& to ) = 0;
virtual void playDTMF( const ::DBus::String& key ) = 0;
virtual void startTone( const ::DBus::Int32& start ) = 0;
virtual void startTone( const ::DBus::Int32& start, const ::DBus::Int32& type ) = 0;
virtual void setVolume( const ::DBus::String& device, const ::DBus::Double& value ) = 0;
virtual ::DBus::Double getVolume( const ::DBus::String& device ) = 0;
virtual std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID ) = 0;
......@@ -347,7 +348,8 @@ private:
::DBus::MessageIter ri = call.reader();
::DBus::Int32 argin1; ri >> argin1;
startTone(argin1);
::DBus::Int32 argin2; ri >> argin2;
startTone(argin1, argin2);
::DBus::ReturnMessage reply(call);
return reply;
}
......
......@@ -39,6 +39,7 @@
<method name="startTone">
<arg type="i" name="start" direction="in"/>
<arg type="i" name="type" direction="in"/>
</method>
<method name="setVolume">
......
......@@ -135,10 +135,15 @@ CallManager::playDTMF( const ::DBus::String& key )
}
void
CallManager::startTone( const ::DBus::Int32& start )
CallManager::startTone( const ::DBus::Int32& start , const ::DBus::Int32& type )
{
if( start == true )
Manager::instance().playTone();
{
if( type == 0 )
Manager::instance().playTone();
else
Manager::instance().playToneWithMessage();
}
else
Manager::instance().stopTone(true);
}
......
......@@ -51,7 +51,7 @@ public:
std::map< ::DBus::String, ::DBus::String > getCallDetails( const ::DBus::String& callID );
::DBus::String getCurrentCallID( );
void playDTMF( const ::DBus::String& key );
void startTone( const ::DBus::Int32& start );
void startTone( const ::DBus::Int32& start, const ::DBus::Int32& type );
};
......
......@@ -873,6 +873,15 @@ ManagerImpl::playTone()
playATone(Tone::TONE_DIALTONE);
}
/**
* Multi Thread
*/
bool
ManagerImpl::playToneWithMessage()
{
playATone(Tone::TONE_CONGESTION);
}
/**
* Multi Thread
*/
......
......@@ -176,6 +176,7 @@ public:
bool sendDtmf(const CallID& id, char code);
bool playDtmf(char code, bool isTalking);
bool playTone ();
bool playToneWithMessage ();
void stopTone(bool stopAudio/*=true*/);
// From links
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment