Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone

This commit is contained in:
Simon Morlat 2011-01-18 16:42:01 +01:00
commit 68f44409c9
5 changed files with 49 additions and 7 deletions

View file

@ -2184,6 +2184,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
lc->vtable.display_status(lc,_("Modifying call parameters..."));
sal_call_set_local_media_description (call->op,call->localdesc);
err=sal_call_update(call->op);
#ifdef VIDEO_ENABLED
}else{
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){

View file

@ -267,3 +267,21 @@ void __sal_op_free(SalOp *op){
sal_media_description_unref(b->remote_media);
ms_free(op);
}
SalAuthInfo* sal_auth_info_new() {
return ms_new0(SalAuthInfo,1);
}
SalAuthInfo* sal_auth_info_clone(const SalAuthInfo* auth_info) {
SalAuthInfo* new_auth_info=sal_auth_info_new();
new_auth_info->username=auth_info->username?ms_strdup(auth_info->username):NULL;
new_auth_info->userid=auth_info->userid?ms_strdup(auth_info->userid):NULL;
new_auth_info->realm=auth_info->realm?ms_strdup(auth_info->realm):NULL;
new_auth_info->password=auth_info->password?ms_strdup(auth_info->password):NULL;
return new_auth_info;
}
void sal_auth_info_delete(const SalAuthInfo* auth_info) {
if (auth_info->username) ms_free(auth_info->username);
if (auth_info->userid) ms_free(auth_info->userid);
if (auth_info->realm) ms_free(auth_info->realm);
if (auth_info->password) ms_free(auth_info->password);
ms_free((void*)auth_info);
}

View file

@ -238,6 +238,10 @@ typedef struct SalAuthInfo{
char *realm;
}SalAuthInfo;
SalAuthInfo* sal_auth_info_new();
SalAuthInfo* sal_auth_info_clone(const SalAuthInfo* auth_info);
void sal_auth_info_delete(const SalAuthInfo* auth_info);
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
int sal_unlisten_ports(Sal *ctx);

View file

@ -165,6 +165,7 @@ SalOp * sal_op_new(Sal *sal){
op->referred_by=NULL;
op->masquerade_via=FALSE;
op->auto_answer_asked=FALSE;
op->auth_info=NULL;
return op;
}
@ -209,6 +210,9 @@ void sal_op_release(SalOp *op){
if (op->referred_by){
ms_free(op->referred_by);
}
if (op->auth_info) {
sal_auth_info_delete(op->auth_info);
}
__sal_op_free(op);
}
@ -735,11 +739,28 @@ int sal_call_send_dtmf(SalOp *h, char dtmf){
return 0;
}
static void push_auth_to_exosip(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 username [%s], id[%s], realm [%s] added to eXosip", info->username,userid, info->realm);
eXosip_add_authentication_info (info->username,userid,
info->password, NULL,info->realm);
}
/**
* Just for symmetry ;-)
*/
static void pop_auth_from_exosip() {
eXosip_clear_authentication_info();
}
int sal_call_terminate(SalOp *h){
int err;
if (h->auth_info) push_auth_to_exosip(h->auth_info);
eXosip_lock();
err=eXosip_call_terminate(h->cid,h->did);
eXosip_unlock();
pop_auth_from_exosip();
if (err!=0){
ms_warning("Exosip could not terminate the call: cid=%i did=%i", h->cid,h->did);
}
@ -750,20 +771,17 @@ int sal_call_terminate(SalOp *h){
void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){
if (h->pending_auth){
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);
push_auth_to_exosip(info);
eXosip_lock();
eXosip_default_action(h->pending_auth);
eXosip_unlock();
ms_message("eXosip_default_action() done");
eXosip_clear_authentication_info();
pop_auth_from_exosip();
eXosip_event_free(h->pending_auth);
sal_remove_pending_auth(sal_op_get_sal(h),h);
h->pending_auth=NULL;
if (h->auth_info) sal_auth_info_delete(h->auth_info); /*if already exist*/
h->auth_info=sal_auth_info_clone(info); /*store auth info for subsequent request*/
}
}

View file

@ -64,6 +64,7 @@ struct SalOp{
bool_t reinvite;
bool_t masquerade_via;
bool_t auto_answer_asked;
const SalAuthInfo *auth_info;
};
void sal_remove_out_subscribe(Sal *sal, SalOp *op);