Commit 180a835e authored by Simon Morlat's avatar Simon Morlat
Browse files

fix bug causing double subscribe.

parent 58c0d50b
......@@ -152,6 +152,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
fr->outsub=sal_op_new(fr->lc->sal);
sal_op_set_route(fr->outsub,route);
sal_subscribe_presence(fr->outsub,from,friend);
fr->subscribe_active=TRUE;
ms_free(friend);
}
......@@ -364,7 +365,7 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
fr->inc_subscribe_pending=FALSE;
}
if (fr->subscribe && fr->subscribe_active==FALSE){
ms_message("Sending a new SUBSCRIBE");
__linphone_friend_do_subscribe(fr);
}
ms_message("linphone_friend_apply() done.");
......
......@@ -1305,7 +1305,7 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
}
break;
case EXOSIP_IN_SUBSCRIPTION_NEW:
ms_message("CALL_SUBSCRIPTION_NEW ");
ms_message("CALL_IN_SUBSCRIPTION_NEW ");
sal_exosip_subscription_recv(sal,ev);
break;
case EXOSIP_IN_SUBSCRIPTION_RELEASED:
......
......@@ -416,7 +416,7 @@ int sal_notify_presence(SalOp *op, SalPresenceStatus status, const char *status_
}
int sal_notify_close(SalOp *op){
osip_message_t *msg;
osip_message_t *msg=NULL;
eXosip_lock();
eXosip_insubscription_build_notify(op->did,EXOSIP_SUBCRSTATE_TERMINATED,DEACTIVATED,&msg);
if (msg!=NULL){
......@@ -424,7 +424,8 @@ int sal_notify_close(SalOp *op){
if (identity==NULL) identity=sal_op_get_to(op);
osip_message_set_contact(msg,identity);
eXosip_insubscription_send_request(op->did,msg);
}else ms_error("sal_notify_close(): could not create notify for incoming subscription.");
}else ms_error("sal_notify_close(): could not create notify for incoming subscription"
" did=%i, nid=%i",op->did,op->nid);
eXosip_unlock();
return 0;
}
......@@ -668,15 +669,16 @@ void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev){
ms_error("Incoming subscription closed but no associated op !");
return;
}
sal_remove_in_subscribe(sal,op);
op->nid=-1;
op->did=-1;
if (ev->request){
osip_from_to_str(ev->request->from,&tmp);
sal->callbacks.subscribe_closed(op,tmp);
osip_free(tmp);
}
sal_remove_in_subscribe(sal,op);
op->nid=-1;
op->did=-1;
}
void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
......@@ -688,6 +690,7 @@ void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
sal_remove_out_subscribe(sal,op);
op->sid=-1;
op->did=-1;
sal->callbacks.notify(op,SalSubscribeTerminated, SalPresenceOffline,NULL);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment