From 8cdfef88fd0a554d6538ff24ba1a722dbea814af Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 5 Mar 2010 15:20:56 +0100 Subject: [PATCH] fix authentication that wasn't marked as "working". --- NEWS | 9 +++++++++ coreapi/callbacks.c | 6 +++++- coreapi/linphonecore.c | 12 +++++++++++- coreapi/sal_eXosip2.c | 29 +++++++++++++++++++++++++++-- gtk-glade/main.c | 3 ++- 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 6e15b91ef..ceab2b179 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,18 @@ +linphone-3.3.0 -- ????????? + * liblinphone is ported to iphoneOS and Google Android + * Internal refactoring of liblinphone (code factorisation, encapsulation + of signaling) + * enhancements made to presence support (SIP/SIMPLE) + linphone-3.2.2 -- ????????? * improve bitrate usage of speex codec * allow speex to run with vbr (variable bit rate) mode * add speex/32000 (ultra wide band speex codec) * answer empty SIP INFO requests * reverse order of call logs + * optimize video display + * manual or automatic network connectivity management (so that REGISTERs + are only sent when network is up or refreshed when it comes back) linphone-3.2.1 -- October 5, 2009 * improve graphics and behaviour of mute button diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index cb0c7b48e..edce2c4e3 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -329,12 +329,14 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de static void auth_requested(SalOp *h, const char *realm, const char *username){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username); + ms_message("auth_requested() for realm=%s, username=%s",realm,username); if (ai && (ai->works || ai->usecount<3)){ SalAuthInfo sai; sai.username=ai->username; sai.userid=ai->userid; sai.realm=ai->realm; sai.password=ai->passwd; + ms_message("auth_requested(): authenticating realm=%s, username=%s",realm,username); sal_op_authenticate(h,&sai); ai->usecount++; }else{ @@ -346,8 +348,10 @@ static void auth_requested(SalOp *h, const char *realm, const char *username){ static void auth_success(SalOp *h, const char *realm, const char *username){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username); - if (ai) + if (ai){ + ms_message("%s/%s authentication works.",realm,username); ai->works=TRUE; + } } static void register_success(SalOp *op, bool_t registered){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1833de2fd..0c5ad1772 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1833,6 +1833,10 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) } err=sal_call(call->op,from,real_url); + if (lc->sip_conf.sdp_200_ack){ + call->media_pending=TRUE; + sal_call_set_local_media_description(call->op,call->localdesc); + } barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url); lc->vtable.display_status(lc,barmsg); ms_free(barmsg); @@ -1919,10 +1923,16 @@ void linphone_core_init_media_streams(LinphoneCore *lc, LinphoneCall *call){ #endif } +static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'}; + static void linphone_core_dtmf_received(RtpSession* s, int dtmf, void* user_data){ LinphoneCore* lc = (LinphoneCore*)user_data; + if (dtmf<0 || dtmf>15){ + ms_warning("Bad dtmf value %i",dtmf); + return; + } if (lc->vtable.dtmf_received != NULL) - lc->vtable.dtmf_received(lc, dtmf); + lc->vtable.dtmf_received(lc, dtmf_tab[dtmf]); } static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index c4f00dac6..10d15526a 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -475,11 +475,13 @@ void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){ const char *userid; if (info->userid==NULL || info->userid[0]=='\0') userid=info->username; else userid=info->userid; + ms_message("Authentication info for %s %s added to eXosip", info->username,info->realm); eXosip_add_authentication_info (info->username,userid, info->password, NULL,info->realm); eXosip_lock(); eXosip_default_action(h->pending_auth); eXosip_unlock(); + ms_message("eXosip_default_action() done"); eXosip_clear_authentication_info(); eXosip_event_free(h->pending_auth); sal_remove_pending_auth(sal_op_get_sal(h),h); @@ -660,11 +662,10 @@ static void call_released(Sal *sal, eXosip_event_t *ev){ sal->callbacks.call_failure(op,SalErrorNoResponse,SalReasonUnknown,NULL); } -static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **username){ +static int get_auth_data_from_response(osip_message_t *resp, const char **realm, const char **username){ const char *prx_realm=NULL,*www_realm=NULL; osip_proxy_authenticate_t *prx_auth; osip_www_authenticate_t *www_auth; - osip_message_t *resp=ev->response; *username=osip_uri_get_username(resp->from->url); prx_auth=(osip_proxy_authenticate_t*)osip_list_get(&resp->proxy_authenticates,0); @@ -684,6 +685,30 @@ static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **us return 0; } +static int get_auth_data_from_request(osip_message_t *msg, const char **realm, const char **username){ + osip_authorization_t *auth=NULL; + osip_proxy_authorization_t *prx_auth=NULL; + + *username=osip_uri_get_username(msg->from->url); + osip_message_get_authorization(msg, 0, &auth); + if (auth){ + *realm=osip_authorization_get_realm(auth); + return 0; + } + osip_message_get_proxy_authorization(msg,0,&prx_auth); + if (prx_auth){ + *realm=osip_proxy_authorization_get_realm(prx_auth); + return 0; + } + return -1; +} + +static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **username){ + if (ev->response && get_auth_data_from_response(ev->response,realm,username)==0) return 0; + if (ev->request && get_auth_data_from_request(ev->request,realm,username)==0) return 0; + return -1; +} + int sal_op_get_auth_requested(SalOp *op, const char **realm, const char **username){ if (op->pending_auth){ return get_auth_data(op->pending_auth,realm,username); diff --git a/gtk-glade/main.c b/gtk-glade/main.c index e492d821a..0b885d09a 100644 --- a/gtk-glade/main.c +++ b/gtk-glade/main.c @@ -208,7 +208,7 @@ static const char *linphone_gtk_get_factory_config_file(){ } static void linphone_gtk_init_liblinphone(const char *config_file, - const char *factory_config_file) { + const char *factory_config_file) { linphone_core_set_user_agent("Linphone", LINPHONE_VERSION); the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL); linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL); @@ -763,6 +763,7 @@ static void linphone_gtk_bye_recv(LinphoneCore *lc, const char *from){ } static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){ + linphone_gtk_show_friends(); } static void linphone_gtk_new_subscriber_response(GtkWidget *dialog, guint response_id, LinphoneFriend *lf){