Commit ad1d7c12 authored by jehan's avatar jehan
Browse files

Fix ZRTP conference

parent e8081ed7
......@@ -35,10 +35,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void register_failure(SalOp *op);
static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd) {
if (call->params->in_conference != call->current_params->in_conference) return SAL_MEDIA_DESCRIPTION_CHANGED;
if (call->up_bw != linphone_core_get_upload_bandwidth(call->core)) return SAL_MEDIA_DESCRIPTION_CHANGED;
int result=0;
if (call->params->in_conference != call->current_params->in_conference) return SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION;
if (call->up_bw != linphone_core_get_upload_bandwidth(call->core)) return SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION;
if (call->localdesc_changed) ms_message("Local description has changed: %i", call->localdesc_changed);
return call->localdesc_changed | sal_media_description_equals(oldmd, newmd);
result = call->localdesc_changed | sal_media_description_equals(oldmd, newmd);
return result;
}
void linphone_core_update_streams_destinations(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) {
......@@ -152,7 +154,8 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
md_changed = media_parameters_changed(call, oldmd, new_md);
if ((md_changed & ( SAL_MEDIA_DESCRIPTION_CODEC_CHANGED
|SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED
|SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED))){
|SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED
|SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION ))){
ms_message("Media descriptions are different, need to restart the streams.");
} else if ( call->playing_ringbacktone) {
ms_message("Playing ringback tone, will restart the streams.");
......
......@@ -68,20 +68,16 @@ typedef enum {
SalTransportDTLS, /*DTLS*/
}SalTransport;
#define SAL_MEDIA_DESCRIPTION_UNCHANGED 0x00
#define SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED (1)
#define SAL_MEDIA_DESCRIPTION_CODEC_CHANGED (1<<1)
#define SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED (1<<2)
#define SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED (1<<3)
#define SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED (1<<4)
#define SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED (1<<5) /* use to notify when switching from multicast to unicast*/
#define SAL_MEDIA_DESCRIPTION_CHANGED (SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED \
|SAL_MEDIA_DESCRIPTION_CODEC_CHANGED \
|SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED \
|SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED \
|SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED \
|SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED)
#define SAL_MEDIA_DESCRIPTION_UNCHANGED 0x00
#define SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED (1)
#define SAL_MEDIA_DESCRIPTION_CODEC_CHANGED (1<<1)
#define SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED (1<<2)
#define SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED (1<<3)
#define SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED (1<<4)
#define SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED (1<<5) /* use to notify when switching from multicast to unicast*/
#define SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION (1<<6) /* use force graph reconstruction*/
const char* sal_transport_to_string(SalTransport transport);
SalTransport sal_transport_parse(const char*);
......
......@@ -186,7 +186,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
LinphoneCall* marie_call_pauline;
LinphoneCall* pauline_called_by_marie;
LinphoneCall* marie_call_laure;
const MSList* calls;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
......@@ -229,6 +229,10 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
}
}
*/
for (calls=linphone_core_get_calls(marie->lc);calls!=NULL;calls=calls->next) {
LinphoneCall *call=(LinphoneCall *)calls->data;
BC_ASSERT_EQUAL(linphone_core_get_media_encryption(marie->lc),linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)),int,"%d");
}
linphone_core_terminate_conference(marie->lc);
......@@ -250,24 +254,43 @@ static void simple_conference(void) {
linphone_core_manager_destroy(laure);
}
static void simple_conference_with_ice(void) {
static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc");
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(marie->lc,"stun.linphone.org");
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(pauline->lc,"stun.linphone.org");
linphone_core_set_firewall_policy(laure->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(laure->lc,"stun.linphone.org");
if (linphone_core_media_encryption_supported(marie->lc,mode)) {
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(marie->lc,"stun.linphone.org");
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(pauline->lc,"stun.linphone.org");
linphone_core_set_firewall_policy(laure->lc,LinphonePolicyUseIce);
linphone_core_set_stun_server(laure->lc,"stun.linphone.org");
linphone_core_set_media_encryption(marie->lc,mode);
linphone_core_set_media_encryption(pauline->lc,mode);
linphone_core_set_media_encryption(laure->lc,mode);
simple_conference_base(marie,pauline,laure);
} else {
ms_warning("No [%s] support available",linphone_media_encryption_to_string(mode));
BC_PASS("Passed");
}
simple_conference_base(marie,pauline,laure);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
}
static void simple_conference_with_ice(void) {
simple_encrypted_conference_with_ice(LinphoneMediaEncryptionNone);
}
static void simple_zrtp_conference_with_ice(void) {
simple_encrypted_conference_with_ice(LinphoneMediaEncryptionZRTP);
}
static void simple_call_transfer(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
......@@ -496,6 +519,7 @@ test_t multi_call_tests[] = {
{ "Call waiting indication with privacy", call_waiting_indication_with_privacy },
{ "Simple conference", simple_conference },
{ "Simple conference with ICE",simple_conference_with_ice},
{ "Simple ZRTP conference with ICE",simple_zrtp_conference_with_ice},
{ "Simple call transfer", simple_call_transfer },
{ "Unattended call transfer", unattended_call_transfer },
{ "Unattended call transfer with error", unattended_call_transfer_with_error },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment