diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 638650dd0ed6c549a61265119b7189de9aa9a21b..9e0f068a716508bde7e48b49887200e6a86d5b85 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -1276,7 +1276,28 @@ void sflphone_save_history (void) } void -sflphone_srtp_on( callable_obj_t * c) +sflphone_srtp_sdes_on(callable_obj_t * c) +{ + DEBUG("*************** Srtp SDES ON *************"); + + c->_srtp_state = SRTP_STATE_SDES_SUCCESS; + + calltree_update_call(current_calls, c, NULL); + update_actions(); +} + + void +sflphone_srtp_sdes_off(callable_obj_t * c) +{ + c->_srtp_state = SRTP_STATE_UNLOCKED; + + calltree_update_call(current_calls, c, NULL); + update_actions(); +} + + + void +sflphone_srtp_zrtp_on( callable_obj_t * c) { c->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED; @@ -1285,7 +1306,7 @@ sflphone_srtp_on( callable_obj_t * c) } void -sflphone_srtp_off( callable_obj_t * c ) +sflphone_srtp_zrtp_off( callable_obj_t * c ) { c->_srtp_state = SRTP_STATE_UNLOCKED; calltree_update_call(current_calls, c, NULL); @@ -1293,7 +1314,7 @@ sflphone_srtp_off( callable_obj_t * c ) } void -sflphone_srtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean verified) +sflphone_srtp_zrtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean verified) { if(c == NULL) { DEBUG("Panic callable obj is NULL in %s at %d", __FILE__, __LINE__); @@ -1309,7 +1330,7 @@ sflphone_srtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean ver } void -sflphone_zrtp_not_supported( callable_obj_t * c ) +sflphone_srtp_zrtp_not_supported( callable_obj_t * c ) { DEBUG("ZRTP not supported"); main_window_zrtp_not_supported(c); diff --git a/sflphone-client-gnome/src/actions.h b/sflphone-client-gnome/src/actions.h index 41e3ab2ef244812b2e8e044dde175b56ac0849ce..c0dbd5da1e1a2537493d1a0ead3334673f0c222a 100644 --- a/sflphone-client-gnome/src/actions.h +++ b/sflphone-client-gnome/src/actions.h @@ -179,6 +179,7 @@ void sflphone_set_current_account(); */ void sflphone_fill_codec_list(); + void sflphone_add_participant(); void sflphone_record (callable_obj_t *c); @@ -191,50 +192,82 @@ void sflphone_fill_history (void); void sflphone_save_history (void); +/** + * Action called when two single call are dragged on together to create a new conference + */ void sflphone_join_participant(const gchar* sel_callID, const gchar* drag_callID); +/** + * Action called when a new participant is dragged in + */ void sflphone_add_participant(const gchar* callID, const gchar* confID); +/** + * Action called when a conference participant is draged out + */ void sflphone_detach_participant(const gchar* callID); +/** + * Action called when two conference are merged together + */ void sflphone_join_conference(const gchar* sel_confID, const gchar* drag_confID); -/** Nofity that the communication is - * now secured. + +/** + * Nofity that the communication is + * now secured using SRTP/SDES. * @param c* The current call */ -void sflphone_srtp_on( callable_obj_t * c); +void sflphone_srtp_sdes_on(callable_obj_t * c); -/** Called when the RTP session goes +/** + * Notify that the SRTP/SDES session + * is not secured + */ + +/** + * Nofity that the communication is + * now secured using ZRTP. + * @param c* The current call + */ +void sflphone_srtp_zrtp_on( callable_obj_t * c); + +/** + * Called when the ZRTP session goes * unsecured. * @param c* The current call */ -void sflphone_srtp_off( callable_obj_t * c ); +void sflphone_srtp_zrtp_off( callable_obj_t * c ); -/** Called when the sas has been computed +/** + * Called when the sas has been computed * and is ready to be displayed. * @param c* The current call * @param sas* The Short Authentication String * @param verified* Weather the SAS was confirmed or not. */ -void sflphone_srtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean verified); +void sflphone_srtp_zrtp_show_sas( callable_obj_t * c, const gchar* sas, const gboolean verified); -/** Called when the remote peer does not support ZRTP +/** + * Called when the remote peer does not support ZRTP * @param c* The current call */ -void sflphone_zrtp_not_supported( callable_obj_t * c ); +void sflphone_srtp_zrtp_not_supported( callable_obj_t * c ); -/** Called when user wants to confirm go clear request. +/** + * Called when user wants to confirm go clear request. * @param c* The call to confirm the go clear request. */ void sflphone_set_confirm_go_clear( callable_obj_t * c ); -/** Called when user wants to confirm go clear request. +/** + * Called when user wants to confirm go clear request. * @param c* The call to confirm the go clear request. */ void sflphone_confirm_go_clear( callable_obj_t * c ); -/** Called when user wants to clear. +/** + * Called when user wants to clear. * @param c* The call on which to go clear */ void sflphone_request_go_clear(void); @@ -247,7 +280,6 @@ void sflphone_request_go_clear(void); * @param description A textual description of the code * @param code The status code as in SIP or IAX */ - void sflphone_call_state_changed(callable_obj_t * c, const gchar * description, const guint code); diff --git a/sflphone-client-gnome/src/callable_obj.h b/sflphone-client-gnome/src/callable_obj.h index 269746867bfc51cd5b71c0d4367586aa38837ca4..4325b6b345a9781eaaf04eb25c460dc8d0c8fa68 100644 --- a/sflphone-client-gnome/src/callable_obj.h +++ b/sflphone-client-gnome/src/callable_obj.h @@ -62,8 +62,7 @@ typedef enum /** @enum call_state_t * This enum have all the states a call can take. */ -typedef enum -{ +typedef enum { CALL_STATE_INVALID = 0, CALL_STATE_INCOMING, CALL_STATE_RINGING, @@ -73,17 +72,18 @@ typedef enum CALL_STATE_FAILURE, CALL_STATE_BUSY, CALL_STATE_TRANSFERT, - CALL_STATE_RECORD + CALL_STATE_RECORD, } call_state_t; -typedef enum -{ - SRTP_STATE_UNLOCKED = 0, - SRTP_STATE_ZRTP_SAS_CONFIRMED, - SRTP_STATE_ZRTP_SAS_UNCONFIRMED, - SRTP_STATE_ZRTP_SAS_SIGNED, +typedef enum { + SRTP_STATE_UNLOCKED = 0, + SRTP_STATE_SDES_SUCCESS, + SRTP_STATE_ZRTP_SAS_CONFIRMED, + SRTP_STATE_ZRTP_SAS_UNCONFIRMED, + SRTP_STATE_ZRTP_SAS_SIGNED, } srtp_state_t; + /** @struct callable_obj_t * @brief Call information. * This struct holds information about a call. @@ -105,7 +105,7 @@ typedef struct { gchar* _sas; // The Short Authentication String that should be displayed gboolean _zrtp_confirmed; // Override real state. Used for hold/unhold // since rtp session is killed each time and - // libzrtpcpp does not remember state (yet?). + // libzrtpcpp does not remember state (yet?) /** * The information about the person we are talking */ diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index fec54bcf59119951dc1ef36c8174f6cd85a4e5f0..c4d7f25f6d6e8f99dd37519411af35b73575b906 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -707,6 +707,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) gchar* srtp_enabled = ""; gboolean display_sas = TRUE; + gboolean sdes_success = TRUE; account_t* account_details=NULL; gchar *audio_codec = ""; @@ -723,6 +724,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) GHashTable * properties = NULL; sflphone_get_ip2ip_properties (&properties); if(properties != NULL) { + srtp_enabled = g_hash_table_lookup(properties, ACCOUNT_SRTP_ENABLED); if(g_strcasecmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0) { display_sas = FALSE; } } @@ -786,7 +788,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/current.svg", NULL); break; case CALL_STATE_DIALING: - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/dial.svg", NULL); + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/dial.svg", NULL); break; case CALL_STATE_FAILURE: pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/fail.svg", NULL); @@ -805,6 +807,10 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) } switch(c->_srtp_state) { + case SRTP_STATE_SDES_SUCCESS: + DEBUG("SDES negotiation succes"); + pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); + break; case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: DEBUG("Secure is ON"); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_unconfirmed.svg", NULL); diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index ba4e42577b4b546a1cb001049cbe63622e491dda..3d1720ac18676692e6e84ea7db212c83d6f2be12 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -202,13 +202,21 @@ <method name="requestGoClear"> <arg type="s" name="callID" direction="in"/> </method> - - <signal name="secureOn"> + + <signal name="secureSdesOn"> + <arg type="s" name="callID" direction="out" /> + </signal> + + <signal name="secureSdesOff"> + <arg type="s" name="callID" direction="out" /> + </signal> + + <signal name="secureZrtpOn"> <arg type="s" name="callID" direction="out" /> <arg type="s" name="cipher" direction="out" /> </signal> - <signal name="secureOff"> + <signal name="secureZrtpOff"> <arg type="s" name="callID" direction="out" /> </signal> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 7d4fb6f4e767ef415441d039c2eefe4ffd16b5bb..a96a478d672db1624fe97fc19a25614cc3749841 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -347,36 +347,65 @@ transfer_failed_cb (DBusGProxy *proxy UNUSED, sflphone_display_transfer_status("Transfer failed"); } +static void +secure_sdes_on_cb(DBusGProxy *proxy UNUSED, + const gchar *callID, + void *foo UNUSED) +{ + DEBUG("SRTP using SDES is on"); + callable_obj_t *c = calllist_get(current_calls, callID); + if(c) { + sflphone_srtp_sdes_on(c); + notify_secure_on(c); + } + +} + + +static void +secure_sdes_off_cb(DBusGProxy *proxy UNUSED, + const gchar *callID, + void *foo UNUSED) +{ + DEBUG("SRTP using SDES is off"); + callable_obj_t *c = calllist_get(current_calls, callID); + if(c) { + sflphone_srtp_sdes_off(c); + notify_secure_off(c); + } +} + static void -secure_on_cb (DBusGProxy *proxy UNUSED, +secure_zrtp_on_cb (DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* cipher, void * foo UNUSED ) { - DEBUG ("SRTP is ON secure_on_cb"); + DEBUG ("SRTP using ZRTP is ON secure_on_cb"); callable_obj_t * c = calllist_get(current_calls, callID); if(c) { c->_srtp_cipher = g_strdup(cipher); - sflphone_srtp_on (c); + + sflphone_srtp_zrtp_on (c); notify_secure_on(c); } } static void -secure_off_cb (DBusGProxy *proxy UNUSED, +secure_zrtp_off_cb (DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED ) { - DEBUG ("SRTP is OFF"); + DEBUG ("SRTP using ZRTP is OFF"); callable_obj_t * c = calllist_get(current_calls, callID); if(c) { - sflphone_srtp_off (c); + sflphone_srtp_zrtp_off (c); notify_secure_off (c); } } static void -show_sas_cb (DBusGProxy *proxy UNUSED, +show_zrtp_sas_cb (DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* sas, const gboolean verified, @@ -385,7 +414,7 @@ show_sas_cb (DBusGProxy *proxy UNUSED, DEBUG ("Showing SAS"); callable_obj_t * c = calllist_get(current_calls, callID); if(c) { - sflphone_srtp_show_sas (c, sas, verified); + sflphone_srtp_zrtp_show_sas (c, sas, verified); } } @@ -409,7 +438,7 @@ zrtp_not_supported_cb (DBusGProxy *proxy UNUSED, DEBUG ("ZRTP not supported on the other end"); callable_obj_t * c = calllist_get(current_calls, callID); if(c) { - sflphone_zrtp_not_supported (c); + sflphone_srtp_zrtp_not_supported (c); notify_zrtp_not_supported(c); } } @@ -582,6 +611,16 @@ dbus_connect () "conferenceRemoved", G_CALLBACK(conference_removed_cb), NULL, NULL); /* Security related callbacks */ + + dbus_g_proxy_add_signal (callManagerProxy, + "secureSdesOn", G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (callManagerProxy, + "secureSdesOn", G_CALLBACK(secure_sdes_on_cb), NULL, NULL); + + dbus_g_proxy_add_signal (callManagerProxy, + "secureSdesOff", G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (callManagerProxy, + "secureSdesOff", G_CALLBACK(secure_sdes_off_cb), NULL, NULL); /* Register a marshaller for STRING,STRING,BOOL */ dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_BOOL, @@ -589,21 +628,21 @@ dbus_connect () dbus_g_proxy_add_signal (callManagerProxy, "showSAS", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, - "showSAS", G_CALLBACK(show_sas_cb), NULL, NULL); + "showSAS", G_CALLBACK(show_zrtp_sas_cb), NULL, NULL); dbus_g_proxy_add_signal (callManagerProxy, - "secureOn", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + "secureZrtpOn", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, - "secureOn", G_CALLBACK(secure_on_cb), NULL, NULL); + "secureZrtpOn", G_CALLBACK(secure_zrtp_on_cb), NULL, NULL); /* Register a marshaller for STRING*/ dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (callManagerProxy, - "secureOff", G_TYPE_STRING, G_TYPE_INVALID); + "secureZrtpOff", G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, - "secureOff", G_CALLBACK(secure_off_cb), NULL, NULL); + "secureZrtpOff", G_CALLBACK(secure_zrtp_off_cb), NULL, NULL); dbus_g_proxy_add_signal (callManagerProxy, "zrtpNotSuppOther", G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, diff --git a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp index ebdcd8f95e277e0d8de0628045cb3bc6a03ee212..da38f1e0a2c038e3732f5456c519083f10586778 100644 --- a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp +++ b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp @@ -115,14 +115,14 @@ void ZrtpSessionCallback::secureOn (std::string cipher) { _debug ("Secure mode is on with cipher %s", cipher.c_str()); - DBusManager::instance().getCallManager()->secureOn (_sipcall->getCallId(), cipher); + DBusManager::instance().getCallManager()->secureZrtpOn (_sipcall->getCallId(), cipher); } void ZrtpSessionCallback::secureOff (void) { _debug ("Secure mode is off"); - DBusManager::instance().getCallManager()->secureOff (_sipcall->getCallId()); + DBusManager::instance().getCallManager()->secureZrtpOff (_sipcall->getCallId()); } void diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 77d48b130c62b371cba633573e4453c1a0100736..724eddda89055fb3d3b0f3d6161add5052dc84be 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -191,14 +191,22 @@ <signal name="transferFailed"> </signal> + + <signal name="secureSdesOn"> + <arg type="s" name="callID" direction="out" /> + </signal> + + <signal name="secureSdesOff"> + <arg type="s" name="callID" direction="out" /> + </signal> <!-- ZRTP Methods and Signals --> - <signal name="secureOn"> + <signal name="secureZrtpOn"> <arg type="s" name="callID" direction="out" /> <arg type="s" name="cipher" direction="out" /> </signal> - <signal name="secureOff"> + <signal name="secureZrtpOff"> <arg type="s" name="callID" direction="out" /> </signal> diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index d39542037c384a992212ce11d3c42ad0b8f77063..bd58638899e8272834a94a6cda819a16582de220 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -3208,17 +3208,11 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) call->getAudioRtp()->setRemoteCryptoInfo(sdesnego); } catch(...) {} - + + DBusManager::instance().getCallManager()->secureSdesOn (call->getCallId()); } else { - - //@TODO Handle fallback mechanism here - // - Call may Failed if SrtpOnly - // - Call fallback to RTP (make sure PBX support it, if not ...) - // - Ask (display a pop-up message) - - call->getAudioRtp()->getAudioRtpType(); - + DBusManager::instance().getCallManager()->secureSdesOff (call->getCallId()); } }