diff --git a/README b/README index 05b0b1dcb..658f07ae0 100644 --- a/README +++ b/README @@ -16,7 +16,7 @@ This is Linphone, a free (GPL) video softphone based on the SIP protocol. - libswscale (part of ffmpeg too) for better scaling performance - theora (optional) + if you want uPnP support: - - libupnp + - libupnp (version 1.6 branch (not patched with 18-url-upnpstrings.patch)) with their corresponding -dev or -devel package if you don't use source packages. diff --git a/README.macos b/README.macos index bb78575bf..dd39c2f6e 100644 --- a/README.macos +++ b/README.macos @@ -99,4 +99,20 @@ For a better appearance, you can install the gtk-quartz-engine (a gtk theme) tha Generate a new bundle to have it included. +libiconv hack +************* + +The Makefile.am rules used to generate the bundle fetch a libiconv.2.dylib from a linphone download page. +This library adds some additional symbols so that dependencies requiring the iconv from /usr/lib and the ones requiring from the bundle are both satisfied. +In case this library needs to generated, here are the commands: + $ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz + $ cd libiconv-1.14 + $ patch -p1 < ../linphone/build/macos/libiconv-macos.patch + $ ./configure --prefix=/opt/local --disable-static 'CFLAGS=-arch i386 -arch x86_64 -mmacosx-version-min=10.5' 'LDFLAGS=-arch i386 -arch x86_64 -mmacosx-version-min=10.5' CXXFLAGS="-arch i386 -arch x86_64 -mmacosx-version-min=10.5" && make + $ make install DESTDIR=/tmp + +The resulted library can be found in /tmp/opt/local/lib + + + diff --git a/build/macos/libiconv-macos.patch b/build/macos/libiconv-macos.patch new file mode 100644 index 000000000..e0654843f --- /dev/null +++ b/build/macos/libiconv-macos.patch @@ -0,0 +1,26 @@ +--- libiconv-1.14.orig/lib/iconv.c 2013-03-14 16:30:50.000000000 +0100 ++++ libiconv-1.14/lib/iconv.c 2013-03-15 10:24:38.000000000 +0100 +@@ -607,4 +607,23 @@ + strong_alias (libiconv_close, iconv_close) + #endif + ++#undef iconv_open ++#undef iconv ++#undef iconv_close ++ ++LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode){ ++ return libiconv_open(tocode,fromcode); ++} ++ ++LIBICONV_DLL_EXPORTED size_t iconv (iconv_t icd, ++ ICONV_CONST char* * inbuf, size_t *inbytesleft, ++ char* * outbuf, size_t *outbytesleft){ ++ return libiconv(icd,inbuf,inbytesleft,outbuf,outbytesleft); ++} ++ ++LIBICONV_DLL_EXPORTED int iconv_close (iconv_t icd){ ++ return libiconv_close(icd); ++} ++ ++ + #endif diff --git a/configure.ac b/configure.ac index 6fc67547d..5017f1b3d 100644 --- a/configure.ac +++ b/configure.ac @@ -183,7 +183,12 @@ AC_ARG_ENABLE(upnp, ) if test "$build_upnp" != "false" ; then - PKG_CHECK_MODULES([LIBUPNP], [libupnp], [build_upnp=true], + PKG_CHECK_MODULES([LIBUPNP], [libupnp], + [if pkg-config --atleast-version=1.6 "libupnp < 1.7"; then + build_upnp=true + else + AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.]) + fi], [if test "$build_upnp" == "true" ; then AC_MSG_ERROR([libupnp not found.]) else diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 99449c99f..d4bfd43dc 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -151,7 +151,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia bool_t send_ringbacktone=FALSE; if (call->audiostream==NULL){ - /*this happens after pausing the call locally. The streams is destroyed and then we wait the 200Ok to recreate it*/ + /*this happens after pausing the call locally. The streams are destroyed and then we wait the 200Ok to recreate them*/ linphone_call_init_media_streams (call); } if (call->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){ @@ -163,6 +163,9 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia } linphone_call_start_media_streams(call,all_muted,send_ringbacktone); } + if (call->state==LinphoneCallPausing && call->paused_by_app && ms_list_size(lc->calls)==1){ + linphone_core_play_named_tone(lc,LinphoneToneCallOnHold); + } } #if 0 static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){ @@ -654,6 +657,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de } else if (sr == SalReasonBusy) { call->reason=LinphoneReasonBusy; linphone_call_set_state(call,LinphoneCallError,"User is busy."); + linphone_core_play_named_tone(lc,LinphoneToneBusy); } else { linphone_call_set_state(call,LinphoneCallError,msg); } @@ -809,7 +813,7 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ } if (call->state!=LinphoneCallPaused){ ms_message("Automatically pausing current call to accept transfer."); - linphone_core_pause_call(lc,call); + _linphone_core_pause_call(lc,call); call->was_automatically_paused=TRUE; /*then we will start the refered when the pause is accepted, in order to serialize transactions within the dialog. * Indeed we need to avoid to send a NOTIFY to inform about of state of the refered call while the pause isn't completed. diff --git a/coreapi/conference.c b/coreapi/conference.c index c98392e95..4417ba372 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -241,7 +241,7 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a err=linphone_core_update_call(lc,call,&call->params); } else{ ms_message("Pausing call to actually remove from conference"); - err=linphone_core_pause_call(lc,call); + err=_linphone_core_pause_call(lc,call); } return err; @@ -342,7 +342,7 @@ int linphone_core_enter_conference(LinphoneCore *lc){ return -1; } if (lc->current_call != NULL) { - linphone_core_pause_call(lc, lc->current_call); + _linphone_core_pause_call(lc, lc->current_call); } conf=&lc->conf_ctx; if (conf->local_participant==NULL) add_local_endpoint(conf,lc); diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index f0f009747..1fbf3f0c8 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -133,6 +133,9 @@ static void on_tone_received(void *data, MSFilter *f, unsigned int event_id, voi static void ecc_play_tones(EcCalibrator *ecc){ MSDtmfGenCustomTone tone; MSToneDetectorDef expected_tone; + + memset(&tone,0,sizeof(tone)); + memset(&expected_tone,0,sizeof(expected_tone)); ms_filter_set_notify_callback(ecc->det,on_tone_received,ecc); @@ -161,7 +164,7 @@ static void ecc_play_tones(EcCalibrator *ecc){ /*play an initial tone to startup the audio playback/capture*/ - tone.frequency=140; + tone.frequencies[0]=140; tone.duration=1000; tone.amplitude=0.5; @@ -172,17 +175,17 @@ static void ecc_play_tones(EcCalibrator *ecc){ /* play the three tones*/ - tone.frequency=2000; + tone.frequencies[0]=2000; tone.duration=100; ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_usleep(300000); - tone.frequency=2300; + tone.frequencies[0]=2300; tone.duration=100; ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_usleep(300000); - tone.frequency=2500; + tone.frequencies[0]=2500; tone.duration=100; ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 8cdb9c5b4..fd92ba42e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -485,7 +485,9 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr } #ifdef BUILD_UPNP if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseUpnp) { - call->upnp_session = linphone_upnp_session_new(call); + if(!lc->rtp_conf.disable_upnp) { + call->upnp_session = linphone_upnp_session_new(call); + } } #endif //BUILD_UPNP call->camera_active=params->has_video; @@ -559,12 +561,14 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro break; case LinphonePolicyUseUpnp: #ifdef BUILD_UPNP - call->upnp_session = linphone_upnp_session_new(call); - if (call->upnp_session != NULL) { - linphone_call_init_media_streams(call); - if (linphone_core_update_upnp_from_remote_media_description(call, sal_call_get_remote_media_description(op))<0) { - /* uPnP port mappings failed, proceed with the call anyway. */ - linphone_call_delete_upnp_session(call); + if(!lc->rtp_conf.disable_upnp) { + call->upnp_session = linphone_upnp_session_new(call); + if (call->upnp_session != NULL) { + linphone_call_init_media_streams(call); + if (linphone_core_update_upnp_from_remote_media_description(call, sal_call_get_remote_media_description(op))<0) { + /* uPnP port mappings failed, proceed with the call anyway. */ + linphone_call_delete_upnp_session(call); + } } } #endif //BUILD_UPNP @@ -2130,7 +2134,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ if (from) { snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from); - free(from); + ms_free(from); } else { @@ -2139,6 +2143,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ if (lc->vtable.display_warning!=NULL) lc->vtable.display_warning(lc,temp); linphone_core_terminate_call(lc,call); + linphone_core_play_named_tone(lc,LinphoneToneCallFailed); } static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d979c8700..5ea3fb763 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -753,6 +753,7 @@ static void rtp_config_read(LinphoneCore *lc) linphone_core_enable_audio_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE); linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled); + lc->rtp_conf.disable_upnp = lp_config_get_int(lc->config, "rtp", "disable_upnp", FALSE); } static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){ @@ -2124,9 +2125,10 @@ void linphone_core_iterate(LinphoneCore *lc){ if (one_second_elapsed) ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout); + LinphoneReason decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined; call->log->status=LinphoneCallMissed; call->reason=LinphoneReasonNotAnswered; - linphone_core_terminate_call(lc,call); + linphone_core_decline_call(lc,call,decline_reason); } } if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) { @@ -2830,7 +2832,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ }else{ /* else play a tone within the context of the current call */ call->ringing_beep=TRUE; - linphone_core_play_tone(lc); + linphone_core_play_named_tone(lc,LinphoneToneCallWaiting); } linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call"); @@ -3397,8 +3399,7 @@ bool_t linphone_core_in_call(const LinphoneCore *lc){ * * @ingroup call_control **/ -LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc) -{ +LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc){ return lc->current_call; } @@ -3408,7 +3409,14 @@ LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc) * * @ingroup call_control **/ -int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) +int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call){ + int err=_linphone_core_pause_call(lc,call); + if (err==0) call->paused_by_app=TRUE; + return err; +} + +/* Internal version that does not play tone indication*/ +int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) { const char *subject=NULL; @@ -3446,6 +3454,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) lc->vtable.display_status(lc,_("Pausing the current call...")); if (call->audiostream || call->videostream) linphone_call_stop_media_streams (call); + call->paused_by_app=FALSE; return 0; } @@ -3459,7 +3468,7 @@ int linphone_core_pause_all_calls(LinphoneCore *lc){ LinphoneCall *call=(LinphoneCall *)elem->data; LinphoneCallState cs=linphone_call_get_state(call); if (cs==LinphoneCallStreamsRunning || cs==LinphoneCallPausedByRemote){ - linphone_core_pause_call(lc,call); + _linphone_core_pause_call(lc,call); } } return 0; @@ -3474,7 +3483,11 @@ void linphone_core_preempt_sound_resources(LinphoneCore *lc){ current_call=linphone_core_get_current_call(lc); if(current_call != NULL){ ms_message("Pausing automatically the current call."); - linphone_core_pause_call(lc,current_call); + _linphone_core_pause_call(lc,current_call); + } + if (lc->ringstream){ + ring_stop(lc->ringstream); + lc->ringstream=NULL; } } @@ -5010,13 +5023,54 @@ void linphone_core_play_tone(LinphoneCore *lc){ ms_error("No dtmf generator at this time !"); return; } + memset(&def,0,sizeof(def)); def.duration=300; - def.frequency=500; + def.frequencies[0]=500; def.amplitude=1; def.interval=2000; ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def); } +void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID toneid){ + if (linphone_core_tone_indications_enabled(lc)){ + MSFilter *f=get_dtmf_gen(lc); + MSDtmfGenCustomTone def; + if (f==NULL){ + ms_error("No dtmf generator at this time !"); + return; + } + memset(&def,0,sizeof(def)); + def.amplitude=1; + /*these are french tones, excepted the failed one, which is USA congestion tone (does not exist in France)*/ + switch(toneid){ + case LinphoneToneCallOnHold: + case LinphoneToneCallWaiting: + def.duration=300; + def.frequencies[0]=440; + def.interval=2000; + break; + case LinphoneToneBusy: + def.duration=500; + def.frequencies[0]=440; + def.interval=500; + def.repeat_count=3; + break; + case LinphoneToneCallFailed: + def.duration=250; + def.frequencies[0]=480; + def.frequencies[0]=620; + def.interval=250; + def.repeat_count=3; + + break; + default: + ms_warning("Unhandled tone id."); + } + if (def.duration>0) + ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def); + } +} + /** * @ingroup media_parameters * diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 9da6c5b7a..cacf432f7 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -194,6 +194,7 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ if (pos2-pos1>=0){ /* found a pair key,value */ + if (cur!=NULL){ item=lp_section_find_item(cur,key); if (item==NULL){ @@ -202,7 +203,7 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ ms_free(item->value); item->value=strdup(pos1); } - /*printf("Found %s %s={%s}\n",cur->name,key,pos1);*/ + /*ms_message("Found %s=%s",key,pos1);*/ }else{ ms_warning("found key,item but no sections"); } @@ -217,6 +218,7 @@ LpConfig * lp_config_new(const char *filename){ LpConfig *lpconfig=lp_new0(LpConfig,1); struct stat fileStat; if (filename!=NULL){ + ms_message("Using (r/w) config information from %s", filename); lpconfig->filename=ortp_strdup(filename); lpconfig->file=fopen(filename,"rw"); if (lpconfig->file!=NULL){ @@ -241,6 +243,7 @@ LpConfig * lp_config_new(const char *filename){ int lp_config_read_file(LpConfig *lpconfig, const char *filename){ FILE* f=fopen(filename,"r"); if (f!=NULL){ + ms_message("Reading config information from %s", filename); lp_config_parse(lpconfig,f); fclose(f); return 0; diff --git a/coreapi/misc.c b/coreapi/misc.c index 6758cb91f..f3eb54ae8 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -886,7 +886,7 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, for (i = 0; i < md->n_total_streams; i++) { const SalStreamDescription *stream = &md->streams[i]; IceCheckList *cl = ice_session_check_list(call->ice_session, i); - if (cl == NULL) { + if ((cl == NULL) && (i < md->n_active_streams)) { cl = ice_check_list_new(); ice_session_add_check_list(call->ice_session, cl); switch (stream->type) { @@ -1015,6 +1015,9 @@ unsigned int linphone_core_get_audio_features(LinphoneCore *lc){ return ret; } +bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc){ + return lp_config_get_int(lc->config,"sound","tone_indications",1); +} #ifdef HAVE_GETIFADDRS diff --git a/coreapi/private.h b/coreapi/private.h index d5389eca4..dfa061c51 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -211,6 +211,7 @@ struct _LinphoneCall bool_t was_automatically_paused; bool_t ping_replied; bool_t record_active; + bool_t paused_by_app; }; @@ -466,6 +467,7 @@ typedef struct rtp_config int audio_jitt_comp; /*jitter compensation*/ int video_jitt_comp; /*jitter compensation*/ int nortp_timeout; + int disable_upnp; bool_t rtp_no_xmit_on_audio_mute; /* stop rtp xmit when audio muted */ bool_t audio_adaptive_jitt_comp_enabled; @@ -684,6 +686,8 @@ void ec_calibrator_destroy(EcCalibrator *ecc); void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed); void linphone_core_preempt_sound_resources(LinphoneCore *lc); +int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call); + /*conferencing subsystem*/ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted); /* When a conference participant pause the conference he may send a music. @@ -724,6 +728,15 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg); void linphone_core_message_storage_init(LinphoneCore *lc); void linphone_core_message_storage_close(LinphoneCore *lc); +typedef enum _LinphoneToneID{ + LinphoneToneBusy, + LinphoneToneCallWaiting, + LinphoneToneCallOnHold, + LinphoneToneCallFailed +}LinphoneToneID; +void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id); +bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc); + #ifdef __cplusplus } #endif diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index 9297077e6..debd8550f 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "sal.h" #include -#define keywordcmp(key,b) strncmp(key,b,sizeof(key)) +#define keywordcmp(key,b) strcmp(key,b) #ifdef FOR_LATER diff --git a/mediastreamer2 b/mediastreamer2 index 06e505707..07824fcf3 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 06e505707c31d11e056f2dad4de3ac617985333b +Subproject commit 07824fcf3879d265c59beaf970d833b5859f3691