diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index f3b20a5b1..d41ab5206 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1,7 +1,7 @@ /* linphone -Copyright (C) 2010 Belledonne Communications SARL +Copyright (C) 2010 Belledonne Communications SARL (simon.morlat@linphone.org) This program is free software; you can redistribute it and/or @@ -169,14 +169,14 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); - + md->session_id=session_id; md->session_ver=session_ver; md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); strncpy(md->username,username,sizeof(md->username)); md->bandwidth=linphone_core_get_download_bandwidth(lc); - + /*set audio capabilities */ strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr)); md->streams[0].port=call->audio_port; @@ -187,7 +187,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); md->streams[0].payloads=l; - + if (call->params.has_video){ md->nstreams++; @@ -254,7 +254,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, if (port_offset==-1) return; call->audio_port=linphone_core_get_audio_port(call->core)+port_offset; call->video_port=linphone_core_get_video_port(call->core)+port_offset; - + } static void discover_mtu(LinphoneCore *lc, const char *remote){ @@ -310,7 +310,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str); ms_free(from_str); } - + linphone_address_clean(from); linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip); linphone_call_init_common(call, from, to); @@ -331,13 +331,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro static void linphone_call_set_terminated(LinphoneCall *call){ LinphoneCore *lc=call->core; - + linphone_core_update_allocated_audio_bandwidth(lc); call->owns_call_log=FALSE; linphone_call_log_completed(call); - - + + if (call == lc->current_call){ ms_message("Resetting the current call"); lc->current_call=NULL; @@ -346,10 +346,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){ if (linphone_core_del_call(lc,call) != 0){ ms_error("Could not remove the call from the list !!!"); } - + if (ms_list_size(lc->calls)==0) linphone_core_notify_all_friends(lc,lc->presence_mode); - + } const char *linphone_call_state_to_string(LinphoneCallState cs){ @@ -423,7 +423,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const if (cstate == LinphoneCallConnected) { call->log->status=LinphoneCallSuccess; } - + if (lc->vtable.call_state_changed) lc->vtable.call_state_changed(lc,call,cstate,message); if (cstate==LinphoneCallReleased){ @@ -593,7 +593,7 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){ * executed yet. * Pending transfers are executed when this call is being paused or closed, * locally or by remote endpoint. - * If the call is already paused while receiving the transfer request, the + * If the call is already paused while receiving the transfer request, the * transfer immediately occurs. **/ bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){ @@ -758,7 +758,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; - + call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); @@ -784,7 +784,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ int enabled=lp_config_get_int(lc->config,"sound","noisegate",0); audio_stream_enable_noise_gate(audiostream,enabled); } - + if (lc->a_rtp) rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp); @@ -853,10 +853,10 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05); float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0); int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0); - + if (!muted) audio_stream_set_mic_gain(st,mic_gain); - else + else audio_stream_set_mic_gain(st,0); recv_gain = lc->sound_conf.soft_play_lev; @@ -915,11 +915,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m LinphoneCore *lc=call->core; int up_ptime=0; *used_pt=-1; - + for(elem=desc->payloads;elem!=NULL;elem=elem->next){ PayloadType *pt=(PayloadType*)elem->data; int number; - + if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) { if (desc->type==SalAudio){ linphone_core_update_allocated_audio_bandwidth_in_call(call,pt); @@ -936,8 +936,8 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m remote_bw=get_video_bandwidth(remote_bw,call->audio_bw); } } - - if (desc->type==SalAudio){ + + if (desc->type==SalAudio){ bw=get_min_bandwidth(call->audio_bw,remote_bw); }else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw); if (bw>0) pt->normal_bitrate=bw*1000; @@ -976,9 +976,9 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna int used_pt=-1; const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalAudio); - + if (stream && stream->dir!=SalStreamInactive && stream->port!=0){ - MSSndCard *playcard=lc->sound_conf.lsd_card ? + MSSndCard *playcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; MSSndCard *captcard=lc->sound_conf.capt_sndcard; const char *playfile=lc->play_file; @@ -1052,7 +1052,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna linphone_call_add_to_conf(call); } }else ms_warning("No audio stream accepted ?"); - } + } } static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){ @@ -1131,7 +1131,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalVideo); #endif - + if(call->audiostream == NULL) { ms_fatal("start_media_stream() called without prior init !"); @@ -1148,12 +1148,12 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut } #endif linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc); - linphone_call_start_video_stream(call,cname,all_inputs_muted); + if (call->videostream!=NULL) linphone_call_start_video_stream(call,cname,all_inputs_muted); call->all_muted=all_inputs_muted; call->playing_ringbacktone=send_ringbacktone; call->up_bw=linphone_core_get_upload_bandwidth(lc); - + if (ortp_zrtp_available()) { OrtpZrtpParams params; params.zid=get_hexa_zrtp_identifier(lc); @@ -1204,7 +1204,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ call->videostream=NULL; } ms_event_queue_skip(call->core->msevq); - + #endif if (call->audio_profile){ rtp_profile_clear_all(call->audio_profile); @@ -1261,11 +1261,11 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){ /** * @addtogroup call_misc * @{ -**/ +**/ /** * Returns the measured sound volume played locally (received from remote) - * It is expressed in dbm0. + * It is expressed in dbm0. **/ float linphone_call_get_play_volume(LinphoneCall *call){ AudioStream *st=call->audiostream; @@ -1273,14 +1273,14 @@ float linphone_call_get_play_volume(LinphoneCall *call){ float vol=0; ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&vol); return vol; - + } return LINPHONE_VOLUME_DB_LOWEST; } /** * Returns the measured sound volume recorded locally (sent to remote) - * It is expressed in dbm0. + * It is expressed in dbm0. **/ float linphone_call_get_record_volume(LinphoneCall *call){ AudioStream *st=call->audiostream; @@ -1288,7 +1288,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){ float vol=0; ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol); return vol; - + } return LINPHONE_VOLUME_DB_LOWEST; } @@ -1307,7 +1307,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){ * 1-2 = very poor quality
* 0-1 = can't be worse, mostly unusable
* - * @returns The function returns -1 if no quality measurement is available, for example if no + * @returns The function returns -1 if no quality measurement is available, for example if no * active audio stream exist. Otherwise it returns the quality rating. **/ float linphone_call_get_current_quality(LinphoneCall *call){ @@ -1350,7 +1350,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ { snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from); free(from); - } + } else { snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed."); @@ -1363,7 +1363,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){ int disconnect_timeout = linphone_core_get_nortp_timeout(call->core); bool_t disconnected=FALSE; - + if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){ RtpSession *as=NULL,*vs=NULL; float audio_load=0, video_load=0; @@ -1427,9 +1427,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse void linphone_call_log_completed(LinphoneCall *call){ LinphoneCore *lc=call->core; - + call->log->duration=time(NULL)-call->start_time; - + if (call->log->status==LinphoneCallMissed){ char *info; lc->missed_calls++; diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b6c7ca47c..2e2df6d42 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1394,8 +1394,10 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv *env,jobject thiz,jlong pCore) { linphone_core_terminate_all_calls((LinphoneCore *) pCore); } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) { - return (jlong)ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) { + LinphoneCoreData *lcd=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)pCore); + LinphoneCall* lCall = (LinphoneCall*) ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); + return lcd->getCall(env,lCall); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) { return ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); @@ -1420,11 +1422,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIE } } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) { +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) { const char* cUri=env->GetStringUTFChars(jUri, NULL); - const LinphoneCall *call=linphone_core_find_call_from_uri((LinphoneCore *) pCore,cUri); + LinphoneCall *call= (LinphoneCall *) linphone_core_find_call_from_uri((LinphoneCore *) pCore,cUri); env->ReleaseStringUTFChars(jUri, cUri); - return (jlong) call; + LinphoneCoreData *lcdata=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)pCore); + return (jobject) lcdata->getCall(env,call); } diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 5b9500509..03fec5b47 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -810,6 +810,7 @@ static void pop_auth_from_exosip() { int sal_call_terminate(SalOp *h){ int err; + if (h == NULL) return -1; if (h->auth_info) push_auth_to_exosip(h->auth_info); eXosip_lock(); err=eXosip_call_terminate(h->cid,h->did); diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 8b43f12aa..9af426212 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -41,6 +41,13 @@ 1 10 + + 1 + 65535 + 5060 + 1 + 9.9999999995529656 + 65535 1 @@ -127,6 +134,23 @@ + + + + + + + + SIP (UDP) + + + SIP (TCP) + + + SIP (TLS) + + + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -275,134 +299,126 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 - + True False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 2 - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment2 - - - - 1 - 2 - 3 - 4 - + - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment3 - - - - 1 - 2 - 2 - 3 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment_tcp_port - - - - 1 - 2 - 1 - 2 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment4 - - - - 1 - 2 - - - - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Video RTP/UDP: - right + 3 + 2 + + + True + False + model8 + + + + + 0 + + + + + + + True + True + + True + False + False + True + True + adjustment7 + + + + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + False + False + True + True + adjustment2 + + + + 1 + 2 + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + False + False + True + True + adjustment3 + + + + 1 + 2 + 2 + 3 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Video RTP/UDP: + right + + + 1 + 2 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Audio RTP/UDP: + right + + + 2 + 3 + + - 3 - 4 + True + True + 1 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Audio RTP/UDP: - right - - - 2 - 3 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP (TCP): - right - - - 1 - 2 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP (UDP): - right - - @@ -412,7 +428,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Ports</b> + <b>Network protocol and ports</b> True @@ -760,7 +776,7 @@ model1 - + 0 @@ -782,7 +798,7 @@ model2 - + 0 @@ -858,7 +874,7 @@ model3 - + 0 @@ -946,7 +962,7 @@ model4 - + 0 @@ -977,7 +993,7 @@ 0 - + 0 @@ -1600,7 +1616,7 @@ virtual network ! 0 - + 0 @@ -1973,7 +1989,7 @@ virtual network ! model7 - + 0 diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 625fd8293..ce090d638 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -33,7 +33,7 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices, This dummy text needs to be removed first*/ gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0); for(;*p!=NULL;++p){ - if ( cap==CAP_IGNORE + if ( cap==CAP_IGNORE || (cap==CAP_CAPTURE && linphone_core_sound_device_can_capture(linphone_gtk_get_core(),*p)) || (cap==CAP_PLAYBACK && linphone_core_sound_device_can_playback(linphone_gtk_get_core(),*p)) ){ gtk_combo_box_append_text(GTK_COMBO_BOX(combo),*p); @@ -87,6 +87,49 @@ void linphone_gtk_update_my_contact(GtkWidget *w){ linphone_gtk_load_identities(); } +void linphone_gtk_update_my_port(GtkWidget *w){ + GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(w)); + LCSipTransports tr; + LinphoneCore *lc=linphone_gtk_get_core(); + GtkComboBox *combo = GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo")); + + gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + if (port == 1) { // We use default port if not specified + if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (UDP)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5060); + } + else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TCP)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5060); + } + else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TLS)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5061); + } + } + + linphone_core_get_sip_transports(lc,&tr); + gchar *selected = gtk_combo_box_get_active_text(combo); + if (strcmp(selected, "SIP (TCP)") == 0) { + tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + tr.udp_port = 0; + tr.tls_port = 0; + } + else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (UDP)") == 0) { + tr.udp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + tr.tcp_port = 0; + tr.tls_port = 0; + } + else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (TLS)") == 0){ + tr.udp_port = 0; + tr.tcp_port = 0; + tr.tls_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + } + + linphone_core_set_sip_transports(lc,&tr); +} + void linphone_gtk_stun_server_changed(GtkWidget *w){ const gchar *addr=gtk_entry_get_text(GTK_ENTRY(w)); linphone_core_set_stun_server(linphone_gtk_get_core(),addr); @@ -102,7 +145,7 @@ void linphone_gtk_ipv6_toggled(GtkWidget *w){ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); } -void linphone_gtk_udp_sip_port_changed(GtkWidget *w){ +/* void linphone_gtk_udp_sip_port_changed(GtkWidget *w){ LCSipTransports tr; LinphoneCore *lc=linphone_gtk_get_core(); @@ -118,7 +161,7 @@ void linphone_gtk_tcp_sip_port_changed(GtkWidget *w){ linphone_core_get_sip_transports(lc,&tr); tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); linphone_core_set_sip_transports(lc,&tr); -} +} */ void linphone_gtk_audio_port_changed(GtkWidget *w){ linphone_core_set_audio_port(linphone_gtk_get_core(), @@ -329,7 +372,7 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl for(elem=codeclist; elem!=NULL; elem=elem->next){ gchar *status; gint rate; - gfloat bitrate; + gfloat bitrate; const gchar *color; const char *params=""; @@ -355,9 +398,9 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl CODEC_INFO,(gpointer)linphone_core_get_payload_type_description(linphone_gtk_get_core(),pt), -1); } - - - + + + /* Setup the selection handler */ selection = gtk_tree_view_get_selection (listview); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); @@ -374,10 +417,10 @@ static void linphone_gtk_check_codec_bandwidth(GtkTreeView *v){ g_return_if_fail(gtk_tree_model_get_iter_first(model,&iter)); do{ PayloadType *pt=NULL; - + gfloat bitrate; gtk_tree_model_get(model,&iter,CODEC_PRIVDATA,&pt,-1); - + bitrate=payload_type_get_bitrate(pt)/1000.0; gtk_list_store_set(GTK_LIST_STORE(model),&iter,CODEC_COLOR, (gpointer)get_codec_color(linphone_gtk_get_core(),pt), CODEC_BITRATE, bitrate,-1); @@ -397,7 +440,7 @@ static void linphone_gtk_select_codec(GtkTreeView *v, PayloadType *ref){ if (pt==ref){ gtk_tree_selection_select_iter(selection,&iter); } - + }while(gtk_tree_model_iter_next(model,&iter)); } @@ -516,7 +559,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){ GtkTreeViewColumn *column; /* create the proxy list */ store = gtk_list_store_new (PROXY_CONFIG_NCOL, G_TYPE_STRING, G_TYPE_POINTER); - + gtk_tree_view_set_model(v,GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); renderer = gtk_cell_renderer_text_new (); @@ -525,7 +568,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){ "text", PROXY_CONFIG_IDENTITY, NULL); gtk_tree_view_append_column (v, column); - + select = gtk_tree_view_get_selection (v); gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE); model=GTK_TREE_MODEL(store); @@ -712,7 +755,7 @@ static void linphone_gtk_fill_langs(GtkWidget *pb){ name=lang_get_name(code); snprintf(text,sizeof(text)-1,"%s : %s",code,name!=NULL ? _(name) : code); gtk_combo_box_append_text(GTK_COMBO_BOX(combo),text); - if (cur_lang_index==-1 && lang_equals(cur_lang,code)) + if (cur_lang_index==-1 && lang_equals(cur_lang,code)) cur_lang_index=index; index++; } @@ -743,6 +786,14 @@ void linphone_gtk_lang_changed(GtkComboBox *combo){ } } +void linphone_gtk_proto_changed(GtkComboBox *combo){ + GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(combo)); + + GtkWidget *proto_port = linphone_gtk_get_widget(pb, "proto_port"); + // When we change the network protocol, we call update_my_port to move the port number from the old protocol to the new one + linphone_gtk_update_my_port(proto_port); +} + static void linphone_gtk_ui_level_adapt(GtkWidget *top) { gboolean ui_advanced; const char *simple_ui = linphone_gtk_get_ui_config("simple_ui", "parameters.codec_tab parameters.transport_frame parameters.ports_frame"); @@ -781,14 +832,28 @@ void linphone_gtk_show_parameters(void){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); linphone_core_get_sip_transports(lc,&tr); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"udp_sip_port")), - tr.udp_port); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"tcp_sip_port")), + + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), linphone_core_get_audio_port(lc)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), linphone_core_get_video_port(lc)); + tmp=linphone_core_get_nat_address(lc); if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"nat_address")),tmp); tmp=linphone_core_get_stun_server(lc); @@ -852,7 +917,7 @@ void linphone_gtk_show_parameters(void){ linphone_core_get_download_bandwidth(lc)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"upload_bw")), linphone_core_get_upload_bandwidth(lc)); - + /* UI CONFIG */ linphone_gtk_fill_langs(pb);