From 9938815efff6f5f2385730f857cb008ed0c39c9c Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 20 Dec 2013 12:01:47 +0100 Subject: [PATCH 01/10] Update mediastreamer 2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6920f363d..1451d9c76 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6920f363d8f6db7c98f6dc471a045f43e4f26200 +Subproject commit 1451d9c76af5741f89d21bc96ab40032647ffa7a From e8d63aa3bae0a13788fdb09a9499190eb406f4c3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Dec 2013 14:01:58 +0100 Subject: [PATCH 02/10] remove uri headers from Contact --- coreapi/bellesip_sal/sal_address_impl.c | 5 ++++- coreapi/proxy.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/coreapi/bellesip_sal/sal_address_impl.c b/coreapi/bellesip_sal/sal_address_impl.c index 01a5b6229..f73a06240 100644 --- a/coreapi/bellesip_sal/sal_address_impl.c +++ b/coreapi/bellesip_sal/sal_address_impl.c @@ -123,7 +123,10 @@ void sal_address_set_port(SalAddress *addr, int port){ void sal_address_clean(SalAddress *addr){ belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr); belle_sip_uri_t* uri=belle_sip_header_address_get_uri(header_addr); - if (uri) belle_sip_parameters_clean(BELLE_SIP_PARAMETERS(uri)); + if (uri) { + belle_sip_parameters_clean(BELLE_SIP_PARAMETERS(uri)); + belle_sip_uri_headers_clean(uri); + } belle_sip_parameters_clean(BELLE_SIP_PARAMETERS(header_addr)); return ; } diff --git a/coreapi/proxy.c b/coreapi/proxy.c index d5bbe3e47..ade9e3a52 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -289,6 +289,8 @@ LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){ int localport = -1; const char *localip = NULL; LinphoneAddress *contact=linphone_address_new(obj->reg_identity); + + linphone_address_clean(contact); if (obj->contact_params) { // We want to add a list of contacts params to the linphone address From ef29131c4079d4a75428b0f62242c139043fa6ca Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Dec 2013 14:54:39 +0100 Subject: [PATCH 03/10] fix unused variable --- coreapi/proxy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index ade9e3a52..214aabea8 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -302,7 +302,6 @@ LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){ #ifdef BUILD_UPNP if (obj->lc->upnp != NULL && linphone_core_get_firewall_policy(obj->lc)==LinphonePolicyUseUpnp && linphone_upnp_context_get_state(obj->lc->upnp) == LinphoneUpnpStateOk) { - LCSipTransports tr; localip = linphone_upnp_context_get_external_ipaddress(obj->lc->upnp); localport = linphone_upnp_context_get_external_port(obj->lc->upnp); } From 0dc3eae678aad5957340036ae3d6939679f580d1 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Dec 2013 15:03:40 +0100 Subject: [PATCH 04/10] update README --- README.macos | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.macos b/README.macos index 76fa6ef83..db01b4869 100644 --- a/README.macos +++ b/README.macos @@ -62,10 +62,16 @@ The next pieces need to be compiled manually. To ensure compatibility with multi $ cd zrtpcpp && cmake -Denable-ccrtp=false . && make $ sudo make install + +- Install gsm codec (optional) + $ git clone git://git.linphone.org/gsm.git + $ cd gsm + $ make CCFLAGS="$CFLAGS -c -O2 -DNeedFunctionPrototypes=1" + $ sudo make install INSTALL_ROOT=/opt/local GSM_INSTALL_INC=/opt/local/include + - Compile and install the tunnel library (optional, proprietary extension only) - If you got the source code from git, run ./autogen.sh first - + If you got the source code from git, run ./autogen.sh first. Then or otherwise, do: $ ./configure --prefix=/opt/local && make && sudo make install @@ -110,7 +116,7 @@ For a better appearance, you can install the gtk-quartz-engine (a gtk theme) tha $ git clone https://github.com/jralls/gtk-quartz-engine.git $ cd gtk-quartz-engine $ autoreconf -i - $ ./configure --prefix=/opt/local CFLAGS="-Wno-error" && make + $ ./configure --prefix=/opt/local CFLAGS="$CFLAGS -Wno-error" && make $ sudo make install Generate a new bundle to have it included. From a8b47c508f1d8d87c9e9bae654e4909441e52553 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Dec 2013 16:30:17 +0100 Subject: [PATCH 05/10] Add missing symbol exports. --- coreapi/linphonecall.c | 4 +- coreapi/linphonecore.h | 108 ++++++++++++++++++------------------- coreapi/linphonepresence.h | 40 +++++++------- coreapi/lpconfig.h | 4 +- 4 files changed, 78 insertions(+), 78 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index fe0df1221..4510ef12f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1092,16 +1092,16 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){ #endif } -#ifdef VIDEO_ENABLED /** * Request remote side to send us a Video Fast Update. **/ void linphone_call_send_vfu_request(LinphoneCall *call) { +#ifdef VIDEO_ENABLED if (LinphoneCallStreamsRunning == linphone_call_get_state(call)) sal_call_send_vfu_request(call->op); -} #endif +} /** diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index ab1af9c2a..c6a3332df 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -226,10 +226,10 @@ void lp_config_load_dict_to_section( LpConfig* lpconfig, const char* section, co #endif LINPHONE_PUBLIC LinphoneAddress * linphone_address_new(const char *addr); -LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr); -LinphoneAddress * linphone_address_ref(LinphoneAddress *addr); -void linphone_address_unref(LinphoneAddress *addr); -const char *linphone_address_get_scheme(const LinphoneAddress *u); +LINPHONE_PUBLIC LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr); +LINPHONE_PUBLIC LinphoneAddress * linphone_address_ref(LinphoneAddress *addr); +LINPHONE_PUBLIC void linphone_address_unref(LinphoneAddress *addr); +LINPHONE_PUBLIC const char *linphone_address_get_scheme(const LinphoneAddress *u); LINPHONE_PUBLIC const char *linphone_address_get_display_name(const LinphoneAddress* u); LINPHONE_PUBLIC const char *linphone_address_get_username(const LinphoneAddress *u); LINPHONE_PUBLIC const char *linphone_address_get_domain(const LinphoneAddress *u); @@ -615,7 +615,7 @@ LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs); LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call); LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call); -bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call); +LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call); LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc); LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call); LINPHONE_PUBLIC char *linphone_call_get_remote_address_as_string(const LinphoneCall *call); @@ -796,7 +796,7 @@ LINPHONE_PUBLIC const char* linphone_proxy_config_get_contact_uri_parameters(con * @param[in] obj #LinphoneProxyConfig object. * @returns The #LinphoneCore object to which is associated the #LinphoneProxyConfig. **/ -LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj); +LINPHONE_PUBLIC LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj); LINPHONE_PUBLIC bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg); LINPHONE_PUBLIC const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg); @@ -806,7 +806,7 @@ LINPHONE_PUBLIC const char * linphone_proxy_config_get_dial_prefix(const Linphon * @param[in] cfg #LinphoneProxyConfig object. * @returns The reason why registration failed for this proxy config. **/ -LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg); +LINPHONE_PUBLIC LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg); /* * return the transport from either : service route, route, or addr @@ -817,10 +817,10 @@ LINPHONE_PUBLIC const char* linphone_proxy_config_get_transport(const LinphonePr /* destruction is called automatically when removing the proxy config */ -void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg); -void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type); +LINPHONE_PUBLIC void linphone_proxy_config_destroy(LinphoneProxyConfig *cfg); +LINPHONE_PUBLIC void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type); SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg); -SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg); +LINPHONE_PUBLIC SipSetup *linphone_proxy_config_get_sip_setup(LinphoneProxyConfig *cfg); /** * normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222 */ @@ -922,8 +922,8 @@ LINPHONE_PUBLIC const char *linphone_auth_info_get_domain(const LinphoneAuthInfo LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i); /* you don't need those function*/ -void linphone_auth_info_destroy(LinphoneAuthInfo *info); -LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos); +LINPHONE_PUBLIC void linphone_auth_info_destroy(LinphoneAuthInfo *info); +LINPHONE_PUBLIC LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos); struct _LinphoneChatRoom; @@ -1379,8 +1379,8 @@ LINPHONE_PUBLIC const char *linphone_core_get_primary_contact(LinphoneCore *lc); LINPHONE_PUBLIC const char * linphone_core_get_identity(LinphoneCore *lc); -void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val); -bool_t linphone_core_get_guess_hostname(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val); +LINPHONE_PUBLIC bool_t linphone_core_get_guess_hostname(LinphoneCore *lc); LINPHONE_PUBLIC bool_t linphone_core_ipv6_enabled(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val); @@ -1394,8 +1394,8 @@ LINPHONE_PUBLIC void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw LINPHONE_PUBLIC int linphone_core_get_download_bandwidth(const LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_get_upload_bandwidth(const LinphoneCore *lc); -void linphone_core_enable_adaptive_rate_control(LinphoneCore *lc, bool_t enabled); -bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_enable_adaptive_rate_control(LinphoneCore *lc, bool_t enabled); +LINPHONE_PUBLIC bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime); LINPHONE_PUBLIC int linphone_core_get_download_ptime(LinphoneCore *lc); @@ -1423,11 +1423,11 @@ LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc); /* returns a MSList of PayloadType */ LINPHONE_PUBLIC const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc); -int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs); +LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs); /* returns a MSList of PayloadType */ LINPHONE_PUBLIC const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc); -int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs); +LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs); /** * Tells whether the specified payload type is enabled. @@ -1529,7 +1529,7 @@ LINPHONE_PUBLIC void linphone_core_clear_all_auth_info(LinphoneCore *lc); * @param[in] enable TRUE to enable the audio adaptive jitter compensation, FALSE to disable it. * @ingroup media_parameters */ -void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); +LINPHONE_PUBLIC void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); /** * Tells whether the audio adaptive jitter compensation is enabled. @@ -1537,11 +1537,11 @@ void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore *lc, bool_t enabl * @returns TRUE if the audio adaptive jitter compensation is enabled, FALSE otherwise. * @ingroup media_parameters */ -bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore *lc); +LINPHONE_PUBLIC bool_t linphone_core_audio_adaptive_jittcomp_enabled(LinphoneCore *lc); -int linphone_core_get_audio_jittcomp(LinphoneCore *lc); +LINPHONE_PUBLIC int linphone_core_get_audio_jittcomp(LinphoneCore *lc); -void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); +LINPHONE_PUBLIC void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); /** * Enable or disable the video adaptive jitter compensation. @@ -1549,7 +1549,7 @@ void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value); * @param[in] enable TRUE to enable the video adaptive jitter compensation, FALSE to disable it. * @ingroup media_parameters */ -void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); +LINPHONE_PUBLIC void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore *lc, bool_t enable); /** * Tells whether the video adaptive jitter compensation is enabled. @@ -1557,11 +1557,11 @@ void linphone_core_enable_video_adaptive_jittcomp(LinphoneCore *lc, bool_t enabl * @returns TRUE if the video adaptive jitter compensation is enabled, FALSE otherwise. * @ingroup media_parameters */ -bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore *lc); +LINPHONE_PUBLIC bool_t linphone_core_video_adaptive_jittcomp_enabled(LinphoneCore *lc); -int linphone_core_get_video_jittcomp(LinphoneCore *lc); +LINPHONE_PUBLIC int linphone_core_get_video_jittcomp(LinphoneCore *lc); -void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value); +LINPHONE_PUBLIC void linphone_core_set_video_jittcomp(LinphoneCore *lc, int value); LINPHONE_PUBLIC int linphone_core_get_audio_port(const LinphoneCore *lc); @@ -1642,7 +1642,7 @@ LINPHONE_PUBLIC const char * linphone_core_get_stun_server(const LinphoneCore *l * * @return true if uPnP is available otherwise return false. */ -bool_t linphone_core_upnp_available(); +LINPHONE_PUBLIC bool_t linphone_core_upnp_available(); /** * @ingroup network_parameters @@ -1651,7 +1651,7 @@ bool_t linphone_core_upnp_available(); * @param lc #LinphoneCore * @return an LinphoneUpnpState. */ -LinphoneUpnpState linphone_core_get_upnp_state(const LinphoneCore *lc); +LINPHONE_PUBLIC LinphoneUpnpState linphone_core_get_upnp_state(const LinphoneCore *lc); /** * @ingroup network_parameters @@ -1663,7 +1663,7 @@ LinphoneUpnpState linphone_core_get_upnp_state(const LinphoneCore *lc); * @return a null terminated string containing the external ip address. If the * the external ip address is not available return null. */ -const char * linphone_core_get_upnp_external_ipaddress(const LinphoneCore *lc); +LINPHONE_PUBLIC const char * linphone_core_get_upnp_external_ipaddress(const LinphoneCore *lc); /** * Set the public IP address of NAT when using the firewall policy is set to use NAT. @@ -1671,7 +1671,7 @@ const char * linphone_core_get_upnp_external_ipaddress(const LinphoneCore *lc); * @param[in] addr The public IP address of NAT to use. * @ingroup network_parameters */ -void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr); +LINPHONE_PUBLIC void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr); /** * Get the public IP address of NAT being used. @@ -1679,7 +1679,7 @@ void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr); * @returns The public IP address of NAT being used. * @ingroup network_parameters */ -const char *linphone_core_get_nat_address(const LinphoneCore *lc); +LINPHONE_PUBLIC const char *linphone_core_get_nat_address(const LinphoneCore *lc); /** * Set the policy to use to pass through firewalls. @@ -1699,7 +1699,7 @@ LINPHONE_PUBLIC LinphoneFirewallPolicy linphone_core_get_firewall_policy(const L /* sound functions */ /* returns a null terminated static array of string describing the sound devices */ -const char** linphone_core_get_sound_devices(LinphoneCore *lc); +LINPHONE_PUBLIC const char** linphone_core_get_sound_devices(LinphoneCore *lc); /** * Update detection of sound devices. @@ -1709,13 +1709,13 @@ const char** linphone_core_get_sound_devices(LinphoneCore *lc); * @param[in] lc #LinphoneCore object. * @ingroup media_parameters **/ -void linphone_core_reload_sound_devices(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_reload_sound_devices(LinphoneCore *lc); -bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device); -bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device); +LINPHONE_PUBLIC bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device); +LINPHONE_PUBLIC bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device); LINPHONE_PUBLIC int linphone_core_get_ring_level(LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_get_play_level(LinphoneCore *lc); -int linphone_core_get_rec_level(LinphoneCore *lc); +LINPHONE_PUBLIC int linphone_core_get_rec_level(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_set_ring_level(LinphoneCore *lc, int level); LINPHONE_PUBLIC void linphone_core_set_play_level(LinphoneCore *lc, int level); @@ -1724,13 +1724,13 @@ LINPHONE_PUBLIC float linphone_core_get_mic_gain_db(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level); LINPHONE_PUBLIC float linphone_core_get_playback_gain_db(LinphoneCore *lc); -void linphone_core_set_rec_level(LinphoneCore *lc, int level); -const char * linphone_core_get_ringer_device(LinphoneCore *lc); -const char * linphone_core_get_playback_device(LinphoneCore *lc); -const char * linphone_core_get_capture_device(LinphoneCore *lc); -int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid); -int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid); -int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid); +LINPHONE_PUBLIC void linphone_core_set_rec_level(LinphoneCore *lc, int level); +LINPHONE_PUBLIC const char * linphone_core_get_ringer_device(LinphoneCore *lc); +LINPHONE_PUBLIC const char * linphone_core_get_playback_device(LinphoneCore *lc); +LINPHONE_PUBLIC const char * linphone_core_get_capture_device(LinphoneCore *lc); +LINPHONE_PUBLIC int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid); +LINPHONE_PUBLIC int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid); +LINPHONE_PUBLIC int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid); char linphone_core_get_sound_source(LinphoneCore *lc); void linphone_core_set_sound_source(LinphoneCore *lc, char source); LINPHONE_PUBLIC void linphone_core_stop_ringing(LinphoneCore *lc); @@ -1907,8 +1907,8 @@ LINPHONE_PUBLIC void linphone_core_set_preferred_video_size(LinphoneCore *lc, MS LINPHONE_PUBLIC MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name); -void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val); -bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val); +LINPHONE_PUBLIC bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val); LINPHONE_PUBLIC bool_t linphone_core_self_view_enabled(const LinphoneCore *lc); @@ -1922,7 +1922,7 @@ LINPHONE_PUBLIC bool_t linphone_core_self_view_enabled(const LinphoneCore *lc); * @param[in] lc #LinphoneCore object. * @ingroup media_parameters **/ -void linphone_core_reload_video_devices(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_reload_video_devices(LinphoneCore *lc); /* returns a null terminated static array of string describing the webcams */ LINPHONE_PUBLIC const char** linphone_core_get_video_devices(const LinphoneCore *lc); @@ -1936,7 +1936,7 @@ LINPHONE_PUBLIC const char *linphone_core_get_video_device(const LinphoneCore *l * @param[in] path The path to the image file to use. * @ingroup media_parameters */ -int linphone_core_set_static_picture(LinphoneCore *lc, const char *path); +LINPHONE_PUBLIC int linphone_core_set_static_picture(LinphoneCore *lc, const char *path); /** * Get the path to the image file streamed when "Static picture" is set as the video device. @@ -1944,7 +1944,7 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path); * @returns The path to the image file streamed when "Static picture" is set as the video device. * @ingroup media_parameters */ -const char *linphone_core_get_static_picture(LinphoneCore *lc); +LINPHONE_PUBLIC const char *linphone_core_get_static_picture(LinphoneCore *lc); /** * Set the frame rate for static picture. @@ -1952,7 +1952,7 @@ const char *linphone_core_get_static_picture(LinphoneCore *lc); * @param[in] fps The new frame rate to use for static picture. * @ingroup media_parameters */ -int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps); +LINPHONE_PUBLIC int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps); /** * Get the frame rate for static picture @@ -1960,7 +1960,7 @@ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps); * @return The frame rate used for static picture. * @ingroup media_parameters */ -float linphone_core_get_static_picture_fps(LinphoneCore *lc); +LINPHONE_PUBLIC float linphone_core_get_static_picture_fps(LinphoneCore *lc); /*function to be used for eventually setting window decorations (icons, title...)*/ LINPHONE_PUBLIC unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc); @@ -1998,7 +1998,7 @@ void linphone_core_show_video(LinphoneCore *lc, bool_t show); /*play/record support: use files instead of soundcard*/ void linphone_core_use_files(LinphoneCore *lc, bool_t yesno); LINPHONE_PUBLIC void linphone_core_set_play_file(LinphoneCore *lc, const char *file); -void linphone_core_set_record_file(LinphoneCore *lc, const char *file); +LINPHONE_PUBLIC void linphone_core_set_record_file(LinphoneCore *lc, const char *file); LINPHONE_PUBLIC void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms); LINPHONE_PUBLIC void linphone_core_stop_dtmf(LinphoneCore *lc); @@ -2006,7 +2006,7 @@ LINPHONE_PUBLIC void linphone_core_stop_dtmf(LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_get_current_call_duration(const LinphoneCore *lc); -int linphone_core_get_mtu(const LinphoneCore *lc); +LINPHONE_PUBLIC int linphone_core_get_mtu(const LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_set_mtu(LinphoneCore *lc, int mtu); /** @@ -2091,7 +2091,7 @@ LINPHONE_PUBLIC void linphone_core_refresh_registers(LinphoneCore* lc); * @param[in] file The path to the file to use to store the zrtp secrets cache. * @ingroup initializing */ -void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file); +LINPHONE_PUBLIC void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file); /** * Get the path to the file storing the zrtp secrets cache. @@ -2099,7 +2099,7 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file); * @returns The path to the file storing the zrtp secrets cache. * @ingroup initializing */ -const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc); +LINPHONE_PUBLIC const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc); /** * Search from the list of current calls if a remote address match uri diff --git a/coreapi/linphonepresence.h b/coreapi/linphonepresence.h index dd2045262..851ccf63e 100644 --- a/coreapi/linphonepresence.h +++ b/coreapi/linphonepresence.h @@ -731,140 +731,140 @@ LINPHONE_PUBLIC int linphone_presence_note_set_lang(LinphonePresenceNote *note, * @param[in] model The #LinphonePresenceModel object for which the reference count is to be increased. * @return The #LinphonePresenceModel object with the increased reference count. */ -LinphonePresenceModel * linphone_presence_model_ref(LinphonePresenceModel *model); +LINPHONE_PUBLIC LinphonePresenceModel * linphone_presence_model_ref(LinphonePresenceModel *model); /** * Decrease the reference count of the #LinphonePresenceModel object and destroy it if it reaches 0. * @param[in] model The #LinphonePresenceModel object for which the reference count is to be decreased. * @return The #LinphonePresenceModel object if the reference count is still positive, NULL if the object has been destroyed. */ -LinphonePresenceModel * linphone_presence_model_unref(LinphonePresenceModel *model); +LINPHONE_PUBLIC LinphonePresenceModel * linphone_presence_model_unref(LinphonePresenceModel *model); /** * Sets the user data of a #LinphonePresenceModel object. * @param[in] model The #LinphonePresenceModel object for which to set the user data. * @param[in] user_data A pointer to the user data to set. */ -void linphone_presence_model_set_user_data(LinphonePresenceModel *model, void *user_data); +LINPHONE_PUBLIC void linphone_presence_model_set_user_data(LinphonePresenceModel *model, void *user_data); /** * Gets the user data of a #LinphonePresenceModel object. * @param[in] model The #LinphonePresenceModel object for which to get the user data. * @return A pointer to the user data. */ -void * linphone_presence_model_get_user_data(LinphonePresenceModel *model); +LINPHONE_PUBLIC void * linphone_presence_model_get_user_data(LinphonePresenceModel *model); /** * Increase the reference count of the #LinphonePresenceService object. * @param[in] service The #LinphonePresenceService object for which the reference count is to be increased. * @return The #LinphonePresenceService object with the increased reference count. */ -LinphonePresenceService * linphone_presence_service_ref(LinphonePresenceService *service); +LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_ref(LinphonePresenceService *service); /** * Decrease the reference count of the #LinphonePresenceService object and destroy it if it reaches 0. * @param[in] service The #LinphonePresenceService object for which the reference count is to be decreased. * @return The #LinphonePresenceService object if the reference count is still positive, NULL if the object has been destroyed. */ -LinphonePresenceService * linphone_presence_service_unref(LinphonePresenceService *service); +LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_unref(LinphonePresenceService *service); /** * Sets the user data of a #LinphonePresenceService object. * @param[in] service The #LinphonePresenceService object for which to set the user data. * @param[in] user_data A pointer to the user data to set. */ -void linphone_presence_service_set_user_data(LinphonePresenceService *service, void *user_data); +LINPHONE_PUBLIC void linphone_presence_service_set_user_data(LinphonePresenceService *service, void *user_data); /** * Gets the user data of a #LinphonePresenceService object. * @param[in] service The #LinphonePresenceService object for which to get the user data. * @return A pointer to the user data. */ -void * linphone_presence_service_get_user_data(LinphonePresenceService *service); +LINPHONE_PUBLIC void * linphone_presence_service_get_user_data(LinphonePresenceService *service); /** * Increase the reference count of the #LinphonePresencePerson object. * @param[in] person The #LinphonePresencePerson object for which the reference count is to be increased. * @return The #LinphonePresencePerson object with the increased reference count. */ -LinphonePresencePerson * linphone_presence_person_ref(LinphonePresencePerson *person); +LINPHONE_PUBLIC LinphonePresencePerson * linphone_presence_person_ref(LinphonePresencePerson *person); /** * Decrease the reference count of the #LinphonePresencePerson object and destroy it if it reaches 0. * @param[in] person The #LinphonePresencePerson object for which the reference count is to be decreased. * @return The #LinphonePresencePerson object if the reference count is still positive, NULL if the object has been destroyed. */ -LinphonePresencePerson * linphone_presence_person_unref(LinphonePresencePerson *person); +LINPHONE_PUBLIC LinphonePresencePerson * linphone_presence_person_unref(LinphonePresencePerson *person); /** * Sets the user data of a #LinphonePresencePerson object. * @param[in] person The #LinphonePresencePerson object for which to set the user data. * @param[in] user_data A pointer to the user data to set. */ -void linphone_presence_person_set_user_data(LinphonePresencePerson *person, void *user_data); +LINPHONE_PUBLIC void linphone_presence_person_set_user_data(LinphonePresencePerson *person, void *user_data); /** * Gets the user data of a #LinphonePresencePerson object. * @param[in] person The #LinphonePresencePerson object for which to get the user data. * @return A pointer to the user data. */ -void * linphone_presence_person_get_user_data(LinphonePresencePerson *person); +LINPHONE_PUBLIC void * linphone_presence_person_get_user_data(LinphonePresencePerson *person); /** * Increase the reference count of the #LinphonePresenceActivity object. * @param[in] activity The #LinphonePresenceActivity object for which the reference count is to be increased. * @return The #LinphonePresenceActivity object with the increased reference count. */ -LinphonePresenceActivity * linphone_presence_activity_ref(LinphonePresenceActivity *activity); +LINPHONE_PUBLIC LinphonePresenceActivity * linphone_presence_activity_ref(LinphonePresenceActivity *activity); /** * Decrease the reference count of the #LinphonePresenceActivity object and destroy it if it reaches 0. * @param[in] activity The #LinphonePresenceActivity object for which the reference count is to be decreased. * @return The #LinphonePresenceActivity object if the reference count is still positive, NULL if the object has been destroyed. */ -LinphonePresenceActivity * linphone_presence_activity_unref(LinphonePresenceActivity *activity); +LINPHONE_PUBLIC LinphonePresenceActivity * linphone_presence_activity_unref(LinphonePresenceActivity *activity); /** * Sets the user data of a #LinphonePresenceActivity object. * @param[in] activity The #LinphonePresenceActivity object for which to set the user data. * @param[in] user_data A pointer to the user data to set. */ -void linphone_presence_activity_set_user_data(LinphonePresenceActivity *activity, void *user_data); +LINPHONE_PUBLIC void linphone_presence_activity_set_user_data(LinphonePresenceActivity *activity, void *user_data); /** * Gets the user data of a #LinphonePresenceActivity object. * @param[in] activity The #LinphonePresenceActivity object for which to get the user data. * @return A pointer to the user data. */ -void * linphone_presence_activity_get_user_data(LinphonePresenceActivity *activity); +LINPHONE_PUBLIC void * linphone_presence_activity_get_user_data(LinphonePresenceActivity *activity); /** * Increase the reference count of the #LinphonePresenceNote object. * @param[in] note The #LinphonePresenceNote object for which the reference count is to be increased. * @return The #LinphonePresenceNote object with the increased reference count. */ -LinphonePresenceNote * linphone_presence_note_ref(LinphonePresenceNote *note); +LINPHONE_PUBLIC LinphonePresenceNote * linphone_presence_note_ref(LinphonePresenceNote *note); /** * Decrease the reference count of the #LinphonePresenceNote object and destroy it if it reaches 0. * @param[in] note The #LinphonePresenceNote object for which the reference count is to be decreased. * @return The #LinphonePresenceNote object if the reference count is still positive, NULL if the object has been destroyed. */ -LinphonePresenceNote * linphone_presence_note_unref(LinphonePresenceNote *note); +LINPHONE_PUBLIC LinphonePresenceNote * linphone_presence_note_unref(LinphonePresenceNote *note); /** * Sets the user data of a #LinphonePresenceNote object. * @param[in] note The #LinphonePresenceNote object for which to set the user data. * @param[in] user_data A pointer to the user data to set. */ -void linphone_presence_note_set_user_data(LinphonePresenceNote *note, void *user_data); +LINPHONE_PUBLIC void linphone_presence_note_set_user_data(LinphonePresenceNote *note, void *user_data); /** * Gets the user data of a #LinphonePresenceNote object. * @param[in] note The #LinphonePresenceNote object for which to get the user data. * @return A pointer to the user data. */ -void * linphone_presence_note_get_user_data(LinphonePresenceNote *note); +LINPHONE_PUBLIC void * linphone_presence_note_get_user_data(LinphonePresenceNote *note); /***************************************************************************** diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index f413bf7a6..3af570e79 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -167,7 +167,7 @@ LINPHONE_PUBLIC void lp_config_set_int(LpConfig *lpconfig,const char *section, c * * @ingroup misc **/ -void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value); +LINPHONE_PUBLIC void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value); /** * Sets a 64 bits integer config item @@ -220,7 +220,7 @@ void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, voi /*tells whether uncommited (with lp_config_sync()) modifications exist*/ int lp_config_needs_commit(const LpConfig *lpconfig); -void lp_config_destroy(LpConfig *cfg); +LINPHONE_PUBLIC void lp_config_destroy(LpConfig *cfg); #ifdef __cplusplus } From 6aba836d5cd618d6b4dd4206bcfd6d97ba40d205 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 20 Dec 2013 16:30:28 +0100 Subject: [PATCH 06/10] Update ms2 submodule for missing symbol exports. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1451d9c76..4103f0b1d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1451d9c76af5741f89d21bc96ab40032647ffa7a +Subproject commit 4103f0b1d7757558d06e6e32b657308bb2556c9b From b0d827bae5b590a2da8d6d7e2b718a687372cb30 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 23 Dec 2013 12:14:18 +0100 Subject: [PATCH 07/10] Updated wp8 build project --- build/vsx/LibLinphone/LibLinphone.vcxproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/vsx/LibLinphone/LibLinphone.vcxproj b/build/vsx/LibLinphone/LibLinphone.vcxproj index 25e1543e4..c2d421126 100644 --- a/build/vsx/LibLinphone/LibLinphone.vcxproj +++ b/build/vsx/LibLinphone/LibLinphone.vcxproj @@ -234,6 +234,9 @@ {072fad20-7007-4da2-b2e7-16ce2b219f67} + + {b16b81a9-bef2-44c9-b603-1065183ae844} + {36b528f9-fb79-4078-a16b-0a7442581bb7} From 68ff65b224ae85970d9d335f6b8d604687843c22 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 24 Dec 2013 10:59:08 +0100 Subject: [PATCH 08/10] turn ping_with_options to 0 by default, since it is no longer required thanks to belle-sip --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 104925d51..f4773e111 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -710,7 +710,7 @@ static void sip_config_read(LinphoneCore *lc) lp_config_get_int(lc->config,"sip","register_only_when_network_is_up",1); lc->sip_conf.register_only_when_upnp_is_ok= lp_config_get_int(lc->config,"sip","register_only_when_upnp_is_ok",1); - lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",1); + lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",0); lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1); lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000); lc->sip_conf.tcp_tls_keepalive=lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0); From 62eaa0c0e551c1b42c4c642e926e5429afd03e33 Mon Sep 17 00:00:00 2001 From: margaux clerc Date: Sat, 7 Dec 2013 12:38:43 +0100 Subject: [PATCH 09/10] Add wizard button in preferences only if it is enabled Changes the version of .ui for older gtk version Fix chat without message storage --- configure.ac | 2 +- gtk/call_statistics.ui | 2 +- gtk/chat.c | 14 ++++++++++---- gtk/keypad.ui | 2 +- gtk/main.c | 2 +- gtk/propertybox.c | 3 +++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index a35089e36..d44cda018 100644 --- a/configure.ac +++ b/configure.ac @@ -710,7 +710,7 @@ AC_ARG_ENABLE(msg-storage, AM_CONDITIONAL(BUILD_MSG_STORAGE, test x$enable_msg_storage = xtrue) if test x$enable_msg_storage != xfalse; then - PKG_CHECK_MODULES(SQLITE3,[ sqlite3 >= 3.7.0],[ + PKG_CHECK_MODULES(SQLITE3,[ sqlite3 >= 3.6.0],[ SQLITE3_CFLAGS+="-DMSG_STORAGE_ENABLED" AC_SUBST(SQLITE3_CFLAGS) AC_SUBST(SQLITE3_LIBS) diff --git a/gtk/call_statistics.ui b/gtk/call_statistics.ui index c6f71deb6..a647a8dca 100644 --- a/gtk/call_statistics.ui +++ b/gtk/call_statistics.ui @@ -1,6 +1,6 @@ - + False diff --git a/gtk/chat.c b/gtk/chat.c index bfb6529e8..b44605ae3 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -357,7 +357,7 @@ void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){ GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame"); - GtkWidget *main_window=linphone_gtk_get_main_window (); + GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch"); GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview"); GdkColor color; @@ -375,7 +375,7 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres colorb.red = 56832; colorb.green = 60928; colorb.blue = 61952; - + with_str=linphone_address_as_string_uri_only(with); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR); gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE); @@ -468,9 +468,10 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, gboolean send=TRUE; /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/ const LinphoneAddress *from= linphone_chat_message_get_from ( msg ); - + w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" ); if ( w!=NULL ) { + /* Chat window opened */ const LinphoneAddress *from_chatview=linphone_gtk_friend_list_get_active_address(); if (linphone_address_weak_equal(from,from_chatview)) { send=TRUE; @@ -480,8 +481,13 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, } send=FALSE; } - } else { + } else { + /* Chat window closed */ +#ifdef MSG_STORAGE_ENABLED send=FALSE; +#else + send=TRUE; +#endif if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } diff --git a/gtk/keypad.ui b/gtk/keypad.ui index 5dfcfc487..2dd62a0f0 100644 --- a/gtk/keypad.ui +++ b/gtk/keypad.ui @@ -1,6 +1,6 @@ - + False diff --git a/gtk/main.c b/gtk/main.c index a25b42523..135dfe5f4 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1591,7 +1591,7 @@ static void linphone_gtk_init_status_icon(){ const char *title; title=linphone_gtk_get_ui_config("title",_("Linphone - a video internet phone")); icon=gtk_status_icon_new_from_pixbuf(pbuf); -#if GTK_CHECK_VERSION(2,20,0) +#if GTK_CHECK_VERSION(2,20,2) gtk_status_icon_set_name(icon,title); #endif g_signal_connect_swapped(G_OBJECT(icon),"activate",(GCallback)handle_icon_click,NULL); diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 57f3b0c4e..46a750ead 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1400,6 +1400,9 @@ void linphone_gtk_show_parameters(void){ if (linphone_address_get_username(contact)) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact)); } +#ifdef BUILD_WIZARD + gtk_widget_show(linphone_gtk_get_widget(pb,"wizard")); +#endif linphone_address_destroy(contact); linphone_gtk_show_sip_accounts(pb); /* CODECS CONFIG */ From 2bb42f89cc62ff05b177383fe662c06674dc8e88 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 30 Dec 2013 17:07:10 +0100 Subject: [PATCH 10/10] Update LDAP provider to handle connection asynchronously. This is done through a thread which is launched to keep the UI responsive. Also configured the default server to "localhost" so that misconfiguration doesn't query example.com... --- coreapi/ldap/ldapprovider.c | 285 ++++++++++++++++++------------------ gtk/propertybox.c | 7 +- 2 files changed, 146 insertions(+), 146 deletions(-) diff --git a/coreapi/ldap/ldapprovider.c b/coreapi/ldap/ldapprovider.c index 6bdfa072a..8392ff8cb 100644 --- a/coreapi/ldap/ldapprovider.c +++ b/coreapi/ldap/ldapprovider.c @@ -18,6 +18,7 @@ #include "private.h" #include "lpconfig.h" #include "contact_providers_priv.h" +#include "mediastreamer2/mscommon.h" #include #ifdef BUILD_LDAP @@ -28,12 +29,6 @@ #define MAX_RUNNING_REQUESTS 10 #define FILTER_MAX_SIZE 512 -typedef enum { - ANONYMOUS, - PLAIN, - SASL -} LDAPAuthMethod; - struct LDAPFriendData { char* name; char* sip; @@ -49,16 +44,19 @@ struct _LinphoneLDAPContactProvider uint req_count; // bind transaction - int bind_msgid; - const char* auth_mechanism; bool_t connected; + ms_thread_t bind_thread; // config int use_tls; - LDAPAuthMethod auth_method; + const char* auth_method; const char* username; const char* password; const char* server; + const char* bind_dn; + + const char* sasl_authname; + const char* sasl_realm; const char* base_object; const char* sip_attr; @@ -70,6 +68,7 @@ struct _LinphoneLDAPContactProvider int timeout; int deref_aliases; int max_results; + }; struct _LinphoneLDAPContactSearch @@ -92,7 +91,6 @@ LinphoneLDAPContactSearch* linphone_ldap_contact_search_create(LinphoneLDAPConta { LinphoneLDAPContactSearch* search = belle_sip_object_new(LinphoneLDAPContactSearch); LinphoneContactSearch* base = LINPHONE_CONTACT_SEARCH(search); - struct timeval timeout = { cp->timeout, 0 }; linphone_contact_search_init(base, predicate, cb, cb_data); @@ -102,27 +100,6 @@ LinphoneLDAPContactSearch* linphone_ldap_contact_search_create(LinphoneLDAPConta snprintf(search->filter, FILTER_MAX_SIZE-1, cp->filter, predicate); search->filter[FILTER_MAX_SIZE-1] = 0; - ms_message("Calling ldap_search_ext with predicate '%s' on base %s", search->filter, cp->base_object); - - int ret = ldap_search_ext(search->ld, - cp->base_object, // base from which to start - LDAP_SCOPE_SUBTREE, - search->filter, // search predicate - cp->attributes, // which attributes to get - 0, // 0 = get attrs AND value, 1 = get attrs only - NULL, - NULL, - &timeout, // server timeout for the search - cp->max_results,// max result number - &search->msgid ); - - if( ret != LDAP_SUCCESS ){ - ms_error("Error ldap_search_ext returned %d (%s)", ret, ldap_err2string(ret)); - belle_sip_object_unref(search); - return NULL; - } else { - ms_message("LinphoneLDAPContactSearch created @%p : msgid %d", search, search->msgid); - } return search; } @@ -136,7 +113,6 @@ unsigned int linphone_ldap_contact_search_result_count(LinphoneLDAPContactSearch return obj->found_count; } - static void linphone_ldap_contact_search_destroy( LinphoneLDAPContactSearch* obj ) { //ms_message("~LinphoneLDAPContactSearch(%p)", obj); @@ -163,31 +139,7 @@ static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContact static void linphone_ldap_contact_provider_conf_destroy(LinphoneLDAPContactProvider* obj ); static bool_t linphone_ldap_contact_provider_iterate(void *data); static int linphone_ldap_contact_provider_bind_interact(LDAP *ld, unsigned flags, void *defaults, void *sasl_interact); - - -/* Authentication methods */ -struct AuthMethodDescription{ - LDAPAuthMethod method; - const char* description; -}; - -static struct AuthMethodDescription ldap_auth_method_description[] = { - {ANONYMOUS, "anonymous"}, - {PLAIN, "plain"}, - {SASL, "sasl"}, - {0, NULL} -}; - -static LDAPAuthMethod linphone_ldap_contact_provider_auth_method( const char* description ) -{ - struct AuthMethodDescription* desc = ldap_auth_method_description; - while( desc && desc->description ){ - if( strcmp(description, desc->description) == 0) - return desc->method; - desc++; - } - return ANONYMOUS; -} +static int linphone_ldap_contact_provider_perform_search( LinphoneLDAPContactProvider* obj, LinphoneLDAPContactSearch* req); static void linphone_ldap_contact_provider_destroy_request_cb(void *req) { @@ -210,38 +162,6 @@ static void linphone_ldap_contact_provider_destroy( LinphoneLDAPContactProvider* linphone_ldap_contact_provider_conf_destroy(obj); } -static int linphone_ldap_contact_provider_parse_bind_results( LinphoneLDAPContactProvider* obj, LDAPMessage* results ) -{ - int ret; - if( obj->auth_method == ANONYMOUS ) { - ms_message("ANONYMOUS BIND OK"); - ret = LDAP_SUCCESS; - } else { - ms_message("Advanced BIND follow-up"); - ret = ldap_sasl_interactive_bind(obj->ld, - NULL, // dn, should be NULL - "DIGEST-MD5", // TODO: use defined auth - NULL,NULL, // server and client controls - LDAP_SASL_QUIET, // never prompt, only use callback - linphone_ldap_contact_provider_bind_interact, // callback to call when info is needed - obj, // private data - results, // result, to pass later on when a ldap_result() comes - &obj->auth_mechanism, - &obj->bind_msgid ); - if( ret != LDAP_SUCCESS){ - ms_error("ldap_parse_sasl_bind_result failed(%d)", ret); - } - } - - if( ret == LDAP_SUCCESS ){ - obj->connected = TRUE; - obj->bind_msgid = 0; - } - - return ret; - -} - static int linphone_ldap_contact_provider_complete_contact( LinphoneLDAPContactProvider* obj, struct LDAPFriendData* lf, const char* attr_name, const char* attr_value) { if( strcmp(attr_name, obj->name_attr ) == 0 ){ @@ -335,7 +255,7 @@ static void linphone_ldap_contact_provider_handle_search_result( LinphoneLDAPCon static bool_t linphone_ldap_contact_provider_iterate(void *data) { LinphoneLDAPContactProvider* obj = LINPHONE_LDAP_CONTACT_PROVIDER(data); - if( obj->ld && ((obj->req_count > 0) || (obj->bind_msgid != 0) )){ + if( obj->ld && obj->connected && (obj->req_count > 0) ){ // never block struct timeval timeout = {0,0}; @@ -346,19 +266,14 @@ static bool_t linphone_ldap_contact_provider_iterate(void *data) switch( ret ){ case -1: { - ms_warning("Error in ldap_result : returned -1 (req_count %d, bind_msgid %d): %s", obj->req_count, obj->bind_msgid, ldap_err2string(errno)); + ms_warning("Error in ldap_result : returned -1 (req_count %d): %s", obj->req_count, ldap_err2string(errno)); break; } case 0: break; // nothing to do case LDAP_RES_BIND: { - ms_message("iterate: LDAP_RES_BIND"); - if( ldap_msgid( results ) != obj->bind_msgid ) { - ms_error("Bad msgid"); - } else { - linphone_ldap_contact_provider_parse_bind_results( obj, results ); - } + ms_error("iterate: unexpected LDAP_RES_BIND"); break; } case LDAP_RES_EXTENDED: @@ -389,6 +304,20 @@ static bool_t linphone_ldap_contact_provider_iterate(void *data) if( results ) ldap_msgfree(results); } + + if( obj->ld && obj->connected ){ + // check for pending searches + uint i; + + for( i=0; ireq_count; i++){ + LinphoneLDAPContactSearch* search = (LinphoneLDAPContactSearch*)ms_list_nth_data( obj->requests, i ); + if( search && search->msgid == 0){ + ms_message("Found pending search %p (for %s), launching...", search, search->filter); + linphone_ldap_contact_provider_perform_search(obj, search); + } + } + } + return TRUE; } @@ -410,6 +339,9 @@ static char* required_config_keys[] = { "auth_method", "username", "password", + "bind_dn", + "sasl_authname", + "sasl_realm", // search "base_object", @@ -455,24 +387,25 @@ static void linphone_ldap_contact_provider_loadconfig(LinphoneLDAPContactProvide // clone new config into the dictionary obj->config = linphone_dictionary_ref(linphone_dictionary_clone(dict)); +#if 0 // until sasl auth is set up, force anonymous auth. + linphone_dictionary_set_string(obj->config, "auth_method", "ANONYMOUS"); +#endif + obj->use_tls = linphone_dictionary_get_int(obj->config, "use_tls", 0); obj->timeout = linphone_dictionary_get_int(obj->config, "timeout", 10); obj->deref_aliases = linphone_dictionary_get_int(obj->config, "deref_aliases", 0); obj->max_results = linphone_dictionary_get_int(obj->config, "max_results", 50); + obj->auth_method = linphone_dictionary_get_string(obj->config, "auth_method", "ANONYMOUS"); obj->username = linphone_dictionary_get_string(obj->config, "username", ""); obj->password = linphone_dictionary_get_string(obj->config, "password", ""); + obj->bind_dn = linphone_dictionary_get_string(obj->config, "bind_dn", ""); obj->base_object = linphone_dictionary_get_string(obj->config, "base_object", "dc=example,dc=com"); - obj->server = linphone_dictionary_get_string(obj->config, "server", "ldap://192.168.0.230:10389"); + obj->server = linphone_dictionary_get_string(obj->config, "server", "ldap://localhost"); obj->filter = linphone_dictionary_get_string(obj->config, "filter", "uid=*%s*"); obj->name_attr = linphone_dictionary_get_string(obj->config, "name_attribute", "givenName"); obj->sip_attr = linphone_dictionary_get_string(obj->config, "sip_attribute", "mobile"); - - /* - * Get authentication method - */ - obj->auth_method = linphone_ldap_contact_provider_auth_method( - linphone_dictionary_get_string(obj->config, "auth_method", "anonymous") - ); + obj->sasl_authname = linphone_dictionary_get_string(obj->config, "sasl_authname", ""); + obj->sasl_realm = linphone_dictionary_get_string(obj->config, "sasl_realm", ""); /* * parse the attributes list @@ -520,20 +453,23 @@ static int linphone_ldap_contact_provider_bind_interact(LDAP *ld, switch( interact->id ) { case SASL_CB_GETREALM: - ms_message("* SASL_CB_GETREALM"); - dflt=NULL; + ms_message("* SASL_CB_GETREALM -> %s", obj->sasl_realm); + dflt = obj->sasl_realm; + break; + case SASL_CB_AUTHNAME: + ms_message("* SASL_CB_AUTHNAME -> %s", obj->sasl_authname); + dflt = obj->sasl_authname; break; case SASL_CB_USER: - case SASL_CB_AUTHNAME: - ms_message("* SASL_CB_AUTHNAME -> %s", obj->username); - dflt=obj->username; + ms_message("* SASL_CB_USER -> %s", obj->username); + dflt = obj->username; break; case SASL_CB_PASS: - ms_message("* SASL_CB_PASS -> %s", obj->password); - dflt=obj->password; + ms_message("* SASL_CB_PASS (hidden)"); + dflt = obj->password; break; default: - ms_message("my_sasl_interact asked for unknown %lx\n",interact->id); + ms_message("SASL interact asked for unknown id %lx\n",interact->id); } interact->result = (dflt && *dflt) ? dflt : (const char*)""; interact->len = strlen( (const char*)interact->result ); @@ -543,32 +479,42 @@ static int linphone_ldap_contact_provider_bind_interact(LDAP *ld, return LDAP_SUCCESS; } -static int linphone_ldap_contact_provider_bind( LinphoneLDAPContactProvider* obj ) +static void* ldap_bind_thread_func( void*arg) { + LinphoneLDAPContactProvider* obj = linphone_ldap_contact_provider_ref(arg); + const char* auth_mechanism = obj->auth_method; int ret; - const char* auth_mechanism = linphone_dictionary_get_string(obj->config, "auth_method", "anonymous"); - LDAPAuthMethod method = obj->auth_method; - if( method == ANONYMOUS ){ - // for anonymous authentication, use a simple sasl_bind - struct berval creds = {strlen(obj->password), ms_strdup(obj->password)}; - ret = ldap_sasl_bind(obj->ld, obj->base_object, NULL, &creds, NULL, NULL, &obj->bind_msgid); - if(creds.bv_val) ms_free(creds.bv_val); - } else { - ret = ldap_sasl_interactive_bind(obj->ld, - NULL, // dn, should be NULL - "SIMPLE",//"DIGEST-MD5", - NULL,NULL, // server and client controls - LDAP_SASL_QUIET, // never prompt, only use callback - linphone_ldap_contact_provider_bind_interact, // callback to call when info is needed - obj, // private data - NULL, // result, to pass later on when a ldap_result() comes - &obj->auth_mechanism, - &obj->bind_msgid ); + if( (strcmp(auth_mechanism, "ANONYMOUS") == 0) || (strcmp(auth_mechanism, "SIMPLE") == 0) ) + { + struct berval passwd = { strlen(obj->password), ms_strdup(obj->password)}; + auth_mechanism = LDAP_SASL_SIMPLE; + ret = ldap_sasl_bind_s(obj->ld, + obj->bind_dn, + auth_mechanism, + &passwd, + NULL, + NULL, + NULL); + + ms_free(passwd.bv_val); } - if( ret == LDAP_SUCCESS || ret == LDAP_SASL_BIND_IN_PROGRESS ) { - if( ret == LDAP_SASL_BIND_IN_PROGRESS) ms_message("BIND_IN_PROGRESS"); - ms_message("LDAP bind request sent, auth: %s, msgid %x", obj->auth_mechanism?obj->auth_mechanism:"-", obj->bind_msgid); + else + { + + ms_message("LDAP interactive bind"); + ret = ldap_sasl_interactive_bind_s(obj->ld, + obj->bind_dn, + auth_mechanism, + NULL,NULL, + LDAP_SASL_QUIET, + linphone_ldap_contact_provider_bind_interact, + obj); + } + + if( ret == LDAP_SUCCESS ) { + ms_message("LDAP bind OK"); + obj->connected = 1; } else { int err; ldap_get_option(obj->ld, LDAP_OPT_RESULT_CODE, &err); @@ -576,6 +522,15 @@ static int linphone_ldap_contact_provider_bind( LinphoneLDAPContactProvider* obj ret, err, ldap_err2string(err), auth_mechanism ); } + obj->bind_thread = 0; + linphone_ldap_contact_provider_unref(obj); + return (void*)0; +} + +static int linphone_ldap_contact_provider_bind( LinphoneLDAPContactProvider* obj ) +{ + // perform the bind in an alternate thread, so that we don't stall the main loop + ms_thread_create(&obj->bind_thread, NULL, ldap_bind_thread_func, obj); return 0; } @@ -619,7 +574,7 @@ LinphoneLDAPContactProvider*linphone_ldap_contact_provider_create(LinphoneCore* } else { // prevents blocking calls to bind() when the server is invalid, but this is not working for now.. // see bug https://bugzilla.mozilla.org/show_bug.cgi?id=79509 - ldap_set_option( obj->ld, LDAP_OPT_CONNECT_ASYNC, LDAP_OPT_ON); + //ldap_set_option( obj->ld, LDAP_OPT_CONNECT_ASYNC, LDAP_OPT_ON); // register our hook into iterate so that LDAP can do its magic asynchronously. linphone_core_add_iterate_hook(lc, linphone_ldap_contact_provider_iterate, obj); @@ -678,22 +633,67 @@ static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContact return ret; } +static int linphone_ldap_contact_provider_perform_search( LinphoneLDAPContactProvider* obj, LinphoneLDAPContactSearch* req) +{ + int ret = -1; + struct timeval timeout = { obj->timeout, 0 }; + + if( req->msgid == 0 ){ + ms_message ( "Calling ldap_search_ext with predicate '%s' on base %s", req->filter, obj->base_object ); + ret = ldap_search_ext(obj->ld, + obj->base_object,// base from which to start + LDAP_SCOPE_SUBTREE, + req->filter, // search predicate + obj->attributes, // which attributes to get + 0, // 0 = get attrs AND value, 1 = get attrs only + NULL, + NULL, + &timeout, // server timeout for the search + obj->max_results,// max result number + &req->msgid ); + + if( ret != LDAP_SUCCESS ){ + ms_error("Error ldap_search_ext returned %d (%s)", ret, ldap_err2string(ret)); + } else { + ms_message("LinphoneLDAPContactSearch created @%p : msgid %d", req, req->msgid); + } + + } else { + ms_warning( "LDAP Search already performed for %s, msgid %d", req->filter, req->msgid); + } + return ret; +} + static LinphoneLDAPContactSearch* linphone_ldap_contact_provider_begin_search ( LinphoneLDAPContactProvider* obj, const char* predicate, ContactSearchCallback cb, void* cb_data ) { + bool_t connected = obj->connected; + // if we're not yet connected, bind - if( !obj->connected ) linphone_ldap_contact_provider_bind(obj); + if( !connected ) { + if( !obj->bind_thread ) linphone_ldap_contact_provider_bind(obj); + } - LinphoneLDAPContactSearch* request = linphone_ldap_contact_search_create ( obj, predicate, cb, cb_data ); + LinphoneLDAPContactSearch* request = linphone_ldap_contact_search_create( obj, predicate, cb, cb_data ); - if ( request != NULL ) { + if( connected ){ + int ret = linphone_ldap_contact_provider_perform_search(obj, request); ms_message ( "Created search %d for '%s', msgid %d, @%p", obj->req_count, predicate, request->msgid, request ); + if( ret != LDAP_SUCCESS ){ + belle_sip_object_unref(request); + request = NULL; + } + } else { + ms_message("Delayed search, wait for connection"); + } - obj->requests = ms_list_append ( obj->requests, request ); + if( request != NULL ) { + obj->requests = ms_list_append ( obj->requests, request ); obj->req_count++; } + return request; } @@ -708,13 +708,10 @@ static int linphone_ldap_contact_provider_marshal(LinphoneLDAPContactProvider* o error = belle_sip_snprintf(buff, buff_size, offset, "req_count:%d,\n", obj->req_count); if(error!= BELLE_SIP_OK) return error; - error = belle_sip_snprintf(buff, buff_size, offset, "bind_msgid:%d,\n", obj->bind_msgid); - if(error!= BELLE_SIP_OK) return error; - error = belle_sip_snprintf(buff, buff_size, offset, "CONFIG:\n" "tls: %d \n" - "auth: %d \n" + "auth: %s \n" "user: %s \n" "pass: %s \n" "server: %s \n" diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 46a750ead..4590e106c 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -76,7 +76,7 @@ static void linphone_gtk_ldap_load_settings(GtkWidget* param) entry = GTK_ENTRY(linphone_gtk_get_widget(pb,"ldap_server")); - gtk_entry_set_text(entry, linphone_dictionary_get_string(ldap_conf,"server", "ldap://example.com") ); + gtk_entry_set_text(entry, linphone_dictionary_get_string(ldap_conf,"server", "ldap://localhost") ); entry = GTK_ENTRY(linphone_gtk_get_widget(pb,"ldap_username")); gtk_entry_set_text(entry, linphone_dictionary_get_string(ldap_conf,"username", "") ); @@ -86,7 +86,7 @@ static void linphone_gtk_ldap_load_settings(GtkWidget* param) // TODO // GtkComboBox* cbox = GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"ldap_auth_method")); - // gtk_combo_box_set_active(entry, linphone_dictionary_get_string(ldap_conf,"auth_method", "anonymous") ); + // gtk_combo_box_set_active(entry, linphone_dictionary_get_string(ldap_conf,"auth_method", "ANONYMOUS") ); entry = GTK_ENTRY(linphone_gtk_get_widget(pb,"ldap_base_object")); gtk_entry_set_text(entry, linphone_dictionary_get_string(ldap_conf,"base_object", "dc=example,dc=com") ); @@ -113,6 +113,9 @@ static void linphone_gtk_ldap_load_settings(GtkWidget* param) spin = GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"ldap_timeout")); gtk_spin_button_set_value(spin, linphone_dictionary_get_int(ldap_conf,"timeout", 10) ); + // TODO: add missing LDAP components + // TODO: move this to an external box + } void linphone_gtk_ldap_reset(GtkWidget *tabmgr)