diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index 503c84f22776ca6880f39ab6045babeca917e9fc..61ecf9a9c04677e304c316d9a986e62e9e317d1d 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -411,11 +411,35 @@ <arg type="s" name="codecName"/> </signal> + <signal name="newCallCreated" tp:name-for-bindings="newCallCreated"> + <tp:docstring> + <p>Notify that a cell have been created.</p> + <p>The callID generated by the daemon must be stored by the clients in order to address other action for + this call. This signal is emitted when call have been created by the daemon itself.</p> + <tp:rationale> The client must subscribe to this signal to handle calls created by other clients </tp:rationale> + </tp:docstring> + <arg type="s" name="accountID"> + <tp:docstring> + The account ID of the calle. Clients must notify teh right account when receiving this signal. + </tp:docstring> + </arg> + <arg type="s" name="callID"> + <tp:docstring> + A new call ID. + </tp:docstring> + </arg> + <arg type="s" name="to"> + <tp:docstring> + The sip uri this call is trying to reach + </tp:docstring> + </arg> + </signal> + <signal name="incomingCall" tp:name-for-bindings="incomingCall"> <tp:docstring> <p>Notify an incoming call.</p> - <p>The callID generated by the daemon and must be stored by the clients in order to address other action for - this call.</p> + <p>The callID generated by the daemon must be stored by the clients in order to address other action for + this call. This signal is emitted when we receive a call from a remote peer</p> <tp:rationale>The client must subscribe to this signal to handle incoming calls.</tp:rationale> </tp:docstring> <arg type="s" name="accountID"> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index c2b0c19cc01d978c2205767fbca2af0fc86ec5dc..2b6149ff8c9fbf4d4c0541c6698d3ae13062492b 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -58,20 +58,43 @@ DBusGProxy * callManagerProxy; DBusGProxy * configurationManagerProxy; DBusGProxy * instanceProxy; +static void +new_call_created_cb (DBusGProxy *proxy UNUSED, const gchar *accountID, + const gchar *callID, const gchar *to, void *foo UNUSED) +{ + callable_obj_t *c; + gchar *peer_name = to; + gchar *peer_number = ""; + + DEBUG("DBus: New Call (%s) created to (%s)", callID, to); + + create_new_call(CALL, CALL_STATE_RINGING, g_strdup(callID), g_strdup(accountID), + peer_name, peer_number, &c); + + set_timestamp(&c->_time_start); + + calllist_add(current_calls, c); + calllist_add(history, c); + calltree_add_call(current_calls, c, NULL); + update_actions(); + calltree_display(current_calls); +} + static void incoming_call_cb (DBusGProxy *proxy UNUSED, const gchar* accountID, const gchar* callID, const gchar* from, void * foo UNUSED) { - DEBUG ("DBus: Incoming call (%s) from %s", callID, from); - callable_obj_t * c; gchar *peer_name, *peer_number; + + DEBUG ("DBus: Incoming call (%s) from %s", callID, from); + // We receive the from field under a formatted way. We want to extract the number and the name of the caller peer_name = call_get_peer_name (from); peer_number = call_get_peer_number (from); - DEBUG (" peer name: %s", peer_name); - DEBUG (" peer number: %s", peer_number); + DEBUG ("DBus incoming peer name: %s", peer_name); + DEBUG ("DBus incoming peer number: %s", peer_number); create_new_call (CALL, CALL_STATE_INCOMING, g_strdup (callID), g_strdup ( accountID), peer_name, peer_number, &c); @@ -569,6 +592,10 @@ dbus_connect (GError **error) dbus_g_object_register_marshaller ( g_cclosure_user_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal (callManagerProxy, "newCallCreated", G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (callManagerProxy, "newCallCreated", + G_CALLBACK (new_call_created_cb), NULL, NULL); dbus_g_proxy_add_signal (callManagerProxy, "incomingCall", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, "incomingCall", diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 503c84f22776ca6880f39ab6045babeca917e9fc..61ecf9a9c04677e304c316d9a986e62e9e317d1d 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -411,11 +411,35 @@ <arg type="s" name="codecName"/> </signal> + <signal name="newCallCreated" tp:name-for-bindings="newCallCreated"> + <tp:docstring> + <p>Notify that a cell have been created.</p> + <p>The callID generated by the daemon must be stored by the clients in order to address other action for + this call. This signal is emitted when call have been created by the daemon itself.</p> + <tp:rationale> The client must subscribe to this signal to handle calls created by other clients </tp:rationale> + </tp:docstring> + <arg type="s" name="accountID"> + <tp:docstring> + The account ID of the calle. Clients must notify teh right account when receiving this signal. + </tp:docstring> + </arg> + <arg type="s" name="callID"> + <tp:docstring> + A new call ID. + </tp:docstring> + </arg> + <arg type="s" name="to"> + <tp:docstring> + The sip uri this call is trying to reach + </tp:docstring> + </arg> + </signal> + <signal name="incomingCall" tp:name-for-bindings="incomingCall"> <tp:docstring> <p>Notify an incoming call.</p> - <p>The callID generated by the daemon and must be stored by the clients in order to address other action for - this call.</p> + <p>The callID generated by the daemon must be stored by the clients in order to address other action for + this call. This signal is emitted when we receive a call from a remote peer</p> <tp:rationale>The client must subscribe to this signal to handle incoming calls.</tp:rationale> </tp:docstring> <arg type="s" name="accountID"> diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 30a4a6e76c4eb457e1c75878c402c2f470189874..a082cae1957e000aed4a2f22276ff17f4f88a21a 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1336,7 +1336,10 @@ void ManagerImpl::createConfFromParticipantList(const std::vector< std::string > std::string tostr = participantList[i].c_str(); generatedCallID = generatedCallID + participantList[i]; conf->add(generatedCallID); - outgoingCall(accountstr, generatedCallID, tostr, conf->getConfID()); + outgoingCall(accountstr, generatedCallID, tostr, conf->getConfID()); + if(_dbus) { + _dbus->getCallManager()->newCallCreated(accountstr, generatedCallID, tostr); + } } _conferencemap.insert(std::pair<CallID, Conference *> (conf->getConfID(), conf)); @@ -1868,10 +1871,9 @@ bool ManagerImpl::incomingCall (Call* call, const AccountID& accountId) display.append (" "); display.append (from); - if (_dbus) + if (_dbus) { _dbus->getCallManager()->incomingCall (accountId, call->getCallId(), display.c_str()); - - // answerCall(call->getCallId()); + } return true; }