]> sjero.net Git - linphone/commitdiff
Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone
authorJehan Monnier <jehan.monnier@linphone.org>
Wed, 29 Sep 2010 13:26:32 +0000 (15:26 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Wed, 29 Sep 2010 13:26:32 +0000 (15:26 +0200)
12 files changed:
console/commands.c
coreapi/Makefile.am
coreapi/callbacks.c
coreapi/help/Makefile.am
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/private.h
gtk/linphone.h
gtk/loginframe.c
gtk/main.c
gtk/support.c

index 658f0fe2436e59c3865756cc0805b73d889ad7fc..142ac833db24c97858a82aefa98ecad2267a4ea2 100644 (file)
@@ -95,6 +95,7 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
 #endif
 static int lpc_cmd_states(LinphoneCore *lc, char *args);
 static int lpc_cmd_identify(LinphoneCore *lc, char *args);
+static int lpc_cmd_ringback(LinphoneCore *lc, char *args);
 
 /* Command handler helpers */
 static void linphonec_proxy_add(LinphoneCore *lc);
@@ -302,6 +303,10 @@ static LPC_COMMAND advanced_commands[] = {
                "'identify' \t: returns remote user-agent string for current call.\n"
                "'identify <id>' \t: returns remote user-agent string for call with supplied id.\n"
        },
+       { "ringback", lpc_cmd_ringback, "Specifies a ringback tone to be played to remote end during incoming calls",
+               "'ringback <path of mono .wav file>'\t: Specifies a ringback tone to be played to remote end during incoming calls\n"
+               "'ringback disable'\t: Disable playing of ringback tone to callers\n"
+       },
        {       NULL,NULL,NULL,NULL}
 };
 
@@ -650,7 +655,7 @@ static int
 lpc_cmd_terminate(LinphoneCore *lc, char *args)
 {
        if (linphone_core_get_calls(lc)==NULL){
-               linphonec_out("No active calls");
+               linphonec_out("No active calls\n");
                return 1;
        }
        if (!args)
@@ -671,7 +676,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
                LinphoneCall *call=linphonec_get_call(id);
                if (call){
                        if (linphone_core_terminate_call(lc,call)==-1){
-                               linphonec_out("Could not stop the call with id %li",id);
+                               linphonec_out("Could not stop the call with id %li\n",id);
                        }
                }else return 0;
                return 1;
@@ -2357,6 +2362,18 @@ static int lpc_cmd_identify(LinphoneCore *lc, char *args){
        return 1;
 }
 
+static int lpc_cmd_ringback(LinphoneCore *lc, char *args){
+       if (!args) return 0;
+       if (strcmp(args,"disable")==0){
+               linphone_core_set_remote_ringback_tone(lc,NULL);
+               linphonec_out("Disabling ringback tone.\n");
+               return 1;
+       }
+       linphone_core_set_remote_ringback_tone (lc,args);
+       linphonec_out("Using %s as ringback tone to be played to callers.",args);
+       return 1;
+}
+
 /***************************************************************************
  *
  *  Command table management funx
index fa4b38576d2cc5c5715e11abd3b1376975d1f061..0e498053db8589da842674cda702719d54c53288 100644 (file)
@@ -53,7 +53,9 @@ noinst_PROGRAMS=test_lsd
 
 test_lsd_SOURCES=test_lsd.c
 
-test_lsd_LDADD=liblinphone.la
+test_lsd_LDADD=liblinphone.la \
+                                                       $(MEDIASTREAMER_LIBS) \
+                                                       $(ORTP_LIBS)
 
 AM_CFLAGS=$(STRICT_OPTIONS)  -DIN_LINPHONE \
        $(ORTP_CFLAGS) \
index ffb0f2b25643b58727239b17dca2acdbfa1767eb..7f5060809eeb7cea236775bc4d23e93f5f20a993 100644 (file)
@@ -42,8 +42,8 @@ static void call_received(SalOp *h){
        const char *from,*to;
        char *tmp;
        LinphoneAddress *from_parsed;
-       bool_t early_media=lp_config_get_int(lc->config,"sip","send_early_media",0);
-
+       const char * early_media=linphone_core_get_remote_ringback_tone (lc);
+       
        /* first check if we can answer successfully to this invite */
        if (lc->presence_mode==LinphoneStatusBusy ||
            lc->presence_mode==LinphoneStatusOffline ||
@@ -118,10 +118,10 @@ static void call_received(SalOp *h){
        }else{
                /*TODO : play a tone within the context of the current call */
        }
-       sal_call_notify_ringing(h,early_media);
+       sal_call_notify_ringing(h,early_media!=NULL);
 #if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)
        linphone_call_init_media_streams(call);
-       if (early_media){
+       if (early_media!=NULL){
                linphone_call_start_early_media (call);
        }
 #endif
index d4cebffd71e97777e73177538821d940fd9128c7..0cdd3f8f0aebea5916082f064ea88fe5f3b00f7e 100644 (file)
@@ -36,7 +36,9 @@ noinst_PROGRAMS=helloworld
 
 helloworld_SOURCES=helloworld.c
 
-helloworld_LDADD=$(top_builddir)/coreapi/liblinphone.la
+helloworld_LDADD=$(top_builddir)/coreapi/liblinphone.la \
+                               $(MEDIASTREAMER_LIBS) \
+                               $(ORTP_LIBS)
 
 INCLUDES=-I$(top_srcdir)/coreapi \
                $(MEDIASTREAMER_CFLAGS)
index cee14639137361a8bf2c142a668db390d8dd5475..f96b4ed747f613a0438c6d6acb94058d97ea7978 100644 (file)
@@ -710,14 +710,8 @@ static RtpProfile *make_profile(LinphoneCore *lc, const SalMediaDescription *md,
 }
 
 static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){
-       const char *ringfile=lc->sound_conf.remote_ring;
        int pause_time=3000;
-       if (lc->play_file!=NULL){
-               audio_stream_play(call->audiostream,lc->play_file);
-               pause_time=0;
-       }else{
-               audio_stream_play(call->audiostream,ringfile);
-       }
+       audio_stream_play(call->audiostream,lc->sound_conf.ringback_tone);
        ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
 }
 
@@ -764,6 +758,8 @@ static void _linphone_call_start_media_streams(LinphoneCall *call, bool_t send_e
                                        playcard=NULL;
                                        captcard=NULL;
                                        recfile=NULL;
+                                       if (send_early_media)
+                                               playfile=NULL;
                                }
                                /*if playfile are supplied don't use soundcards*/
                                if (lc->use_files) {
index 14298990e4db466f4afba2a615b07ac8657085b9..f2a760b4c8090fa79ddee97d9f9854d1218d71d4 100644 (file)
@@ -467,6 +467,8 @@ static void sound_config_read(LinphoneCore *lc)
 
        gain=lp_config_get_float(lc->config,"sound","playback_gain_db",0);
        linphone_core_set_playback_gain_db (lc,gain);
+
+       linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL));
 }
 
 static void sip_config_read(LinphoneCore *lc)
@@ -3868,6 +3870,25 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
        return 0;
 }
 
+/**
+ * Specifiies a ring back tone to be played to far end during incoming calls.
+**/
+void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
+       if (lc->sound_conf.ringback_tone){
+               ms_free(lc->sound_conf.ringback_tone);
+               lc->sound_conf.ringback_tone=NULL;
+       }
+       if (file)
+               lc->sound_conf.ringback_tone=ms_strdup(file);
+}
+
+/**
+ * Returns the ring back tone played to far end during incoming calls.
+**/
+const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc){
+       return lc->sound_conf.ringback_tone;
+}
+
 static PayloadType* find_payload_type_from_list(const char* type, int rate,const MSList* from) {
        const MSList *elem;
        for(elem=from;elem!=NULL;elem=elem->next){
index d94ed2d09d3d3a93aa0fe6fe42316137eb4b2af2..179002c36cf04cd7accb909d38fd1dae005c002a 100644 (file)
@@ -746,6 +746,8 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path);
 const char *linphone_core_get_ring(const LinphoneCore *lc);
 void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
 const char * linphone_core_get_ringback(const LinphoneCore *lc);
+void linphone_core_set_remote_ringback_tone(LinphoneCore *lc,const char *);
+const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc);
 int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
 void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
 bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc);
index 7b6b999deb37f967b2eb48028d65007c1aa7e434..c233515959ff50e95a46abd5d8c2987b8f785cb5 100644 (file)
@@ -320,6 +320,7 @@ typedef struct sound_config
        char source;
        char *local_ring;
        char *remote_ring;
+       char *ringback_tone;
        bool_t ec;
        bool_t ea;
        bool_t agc;
index 5cbf79fb5d73a68b4762860ec6566370c71165ff..ed1ec9e31e4b0e3108c0b3b1c73de4579b115621 100644 (file)
@@ -99,4 +99,4 @@ void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive);
 void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon);
 
 void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg);
-
+void linphone_gtk_set_ui_config(const char *key, const char *value);
index 957b267267bfe88c388f1cbfa8af8ba29e41e6a8..62092c6b29dace62c06b7890574339c7db97d809 100644 (file)
@@ -96,6 +96,11 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
        g_free(str);
 
        from=linphone_address_new(linphone_proxy_config_get_identity(cfg));
+       if (linphone_address_get_username(from)[0]=='?'){
+               const char *username=linphone_gtk_get_ui_config ("login_username",NULL);
+               if (username)
+                       linphone_address_set_username(from,username);
+       }
        
        ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),linphone_address_get_username(from));
        /*display the last entered username, if not '?????'*/
@@ -152,6 +157,7 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
 
        autologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(mw,"automatic_login")));
        linphone_gtk_set_ui_config_int("automatic_login",autologin);
+       linphone_gtk_set_ui_config("login_username",username);
 
        from=linphone_address_new(linphone_proxy_config_get_identity(cfg));
        linphone_address_set_username(from,username);
index 452c7783fb68f13361d7746e08f70a0dd6cdbabc..bdb983c138985476f56263760e29681b24eef04e 100644 (file)
@@ -413,8 +413,10 @@ void linphone_gtk_show_about(){
        struct stat filestat;
        const char *license_file=PACKAGE_DATA_DIR "/linphone/COPYING";
        GtkWidget *about;
+       const char *tmp;
        GdkPixbuf *logo=create_pixbuf(
            linphone_gtk_get_ui_config("logo","linphone-banner.png"));
+       static const char *defcfg="defcfg";
        
        about=linphone_gtk_create_window("about");
        gtk_about_dialog_set_url_hook(about_url_clicked,NULL,NULL);
@@ -436,7 +438,19 @@ void linphone_gtk_show_about(){
        gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("title","Linphone"));
        gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("home","http://www.linphone.org"));
        if (logo)       gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about),logo);
-           
+       tmp=linphone_gtk_get_ui_config("artists",defcfg);
+       if (tmp!=defcfg){
+               const char *tmp2[2];
+               tmp2[0]=tmp;
+               tmp2[1]=NULL;
+               gtk_about_dialog_set_artists(GTK_ABOUT_DIALOG(about),tmp2);
+       }
+       tmp=linphone_gtk_get_ui_config("translators",defcfg);
+       if (tmp!=defcfg)
+               gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about),tmp);
+       tmp=linphone_gtk_get_ui_config("comments",defcfg);
+       if (tmp!=defcfg)
+               gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about),tmp);
        gtk_widget_show(about);
 }
 
index 2124d2ee8deda69c1b565aae1d146fe8659845f6..227d5b42cfcbd8ca238ebfcd2e3ae08025febe7f 100644 (file)
@@ -192,6 +192,10 @@ void linphone_gtk_set_ui_config_int(const char *key , int val){
        lp_config_set_int(cfg,"GtkUi",key,val);
 }
 
+void linphone_gtk_set_ui_config(const char *key , const char * val){
+       LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
+       lp_config_set_string(cfg,"GtkUi",key,val);
+}
 
 static void parse_item(const char *item, const char *window_name, GtkWidget *w,  gboolean show){
        char tmp[64];