mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 03:58:08 +00:00
Merge branch 'dev_sal' of belledonne-communications.com:linphone-private into dev_sal
This commit is contained in:
commit
43f044f08d
6 changed files with 51 additions and 10 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
@ -296,6 +297,7 @@ static void linphone_friend_unsubscribe(LinphoneFriend *lf){
|
|||
sal_unsubscribe(lf->outsub);
|
||||
sal_op_release(lf->outsub);
|
||||
lf->outsub=NULL;
|
||||
lf->subscribe_active=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,8 +364,8 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
|
|||
}
|
||||
fr->inc_subscribe_pending=FALSE;
|
||||
}
|
||||
if (fr->subscribe && fr->outsub==NULL){
|
||||
|
||||
if (fr->subscribe && fr->subscribe_active==FALSE){
|
||||
ms_message("Sending a new SUBSCRIBE");
|
||||
__linphone_friend_do_subscribe(fr);
|
||||
}
|
||||
ms_message("linphone_friend_apply() done.");
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
|
|||
friend=lf->uri;
|
||||
tmp=linphone_address_as_string(friend);
|
||||
lf->status=estatus;
|
||||
lf->subscribe_active=TRUE;
|
||||
lc->vtable.notify_recv(lc,(LinphoneFriend*)lf);
|
||||
ms_free(tmp);
|
||||
}else{
|
||||
|
|
@ -135,8 +136,10 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
|
|||
}
|
||||
if (ss==SalSubscribeTerminated){
|
||||
sal_op_release(op);
|
||||
if (lf)
|
||||
if (lf){
|
||||
lf->outsub=NULL;
|
||||
lf->subscribe_active=FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ struct _LinphoneFriend{
|
|||
BuddyInfo *info;
|
||||
char *refkey;
|
||||
bool_t subscribe;
|
||||
bool_t subscribe_active;
|
||||
bool_t inc_subscribe_pending;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1305,9 +1305,13 @@ 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:
|
||||
ms_message("CALL_SUBSCRIPTION_NEW ");
|
||||
sal_exosip_in_subscription_closed(sal,ev);
|
||||
break;
|
||||
case EXOSIP_SUBSCRIPTION_UPDATE:
|
||||
ms_message("CALL_SUBSCRIPTION_UPDATE");
|
||||
break;
|
||||
|
|
@ -1323,6 +1327,14 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
|
|||
ms_message("EXOSIP_SUBSCRIPTION_CLOSED\n");
|
||||
sal_exosip_subscription_closed(sal,ev);
|
||||
break;
|
||||
case EXOSIP_SUBSCRIPTION_REQUESTFAILURE: /**< announce a request failure */
|
||||
if (ev->response && (ev->response->status_code == 407 || ev->response->status_code == 401)){
|
||||
return process_authentication(sal,ev);
|
||||
}
|
||||
case EXOSIP_SUBSCRIPTION_SERVERFAILURE:
|
||||
case EXOSIP_SUBSCRIPTION_GLOBALFAILURE:
|
||||
sal_exosip_subscription_closed(sal,ev);
|
||||
break;
|
||||
case EXOSIP_CALL_RELEASED:
|
||||
ms_message("CALL_RELEASED\n");
|
||||
call_released(sal, ev);
|
||||
|
|
@ -1351,7 +1363,7 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ms_message("Unhandled exosip event ! %i");
|
||||
ms_message("Unhandled exosip event ! %i",ev->type);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ void sal_exosip_subscription_answered(Sal *sal,eXosip_event_t *ev);
|
|||
void sal_exosip_notify_recv(Sal *sal,eXosip_event_t *ev);
|
||||
void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev);
|
||||
|
||||
void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev);
|
||||
|
||||
void sal_exosip_fix_route(SalOp *op);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -661,15 +662,35 @@ void sal_exosip_subscription_answered(Sal *sal,eXosip_event_t *ev){
|
|||
op->did=ev->did;
|
||||
}
|
||||
|
||||
void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev){
|
||||
SalOp *op=sal_find_in_subscribe(sal,ev->nid);
|
||||
char *tmp;
|
||||
if (op==NULL){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
|
||||
SalOp *op=sal_find_in_subscribe(sal,ev->sid);
|
||||
SalOp *op=sal_find_out_subscribe(sal,ev->sid);
|
||||
if (op==NULL){
|
||||
ms_error("Subscription closed but no associated op !");
|
||||
return;
|
||||
}
|
||||
sal_remove_in_subscribe(sal,op);
|
||||
op->nid=-1;
|
||||
sal_remove_out_subscribe(sal,op);
|
||||
op->sid=-1;
|
||||
op->did=-1;
|
||||
sal->callbacks.notify(op,SalSubscribeTerminated, SalPresenceOffline,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue