}
}
-void linphone_friend_destroy(LinphoneFriend *lf){
+void linphone_friend_close_subscriptions(LinphoneFriend *lf){
linphone_friend_notify(lf,LINPHONE_STATUS_OFFLINE);
linphone_friend_unsubscribe(lf);
if (lf->insub){
sal_notify_close(lf->insub);
sal_op_release(lf->insub);
+ lf->insub=NULL;
}
+}
+
+void linphone_friend_destroy(LinphoneFriend *lf){
+
if (lf->uri!=NULL) linphone_address_destroy(lf->uri);
if (lf->info!=NULL) buddy_info_free(lf->info);
ms_free(lf);
return lc->sip_conf.sip_port;
}
-static bool_t exosip_running=FALSE;
static char _ua_name[64]="Linphone";
static char _ua_version[64]=LINPHONE_VERSION;
linphone_core_iterate(lc);
}
}
+ if (lc->friends)
+ ms_list_for_each(lc->friends,(void (*)(void *))linphone_friend_close_subscriptions);
gstate_new_state(lc, GSTATE_POWER_SHUTDOWN, NULL);
#ifdef VIDEO_ENABLED
if (lc->previewstream!=NULL){
linphone_core_free_payload_types();
ortp_exit();
- exosip_running=FALSE;
gstate_new_state(lc, GSTATE_POWER_OFF, NULL);
}
int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphoneOnlineStatus os);
int linphone_online_status_to_eXosip(LinphoneOnlineStatus os);
-
+void linphone_friend_close_subscriptions(LinphoneFriend *lf);
void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os);
LinphoneFriend *linphone_find_friend_by_inc_subscribe(MSList *l, SalOp *op);
LinphoneFriend *linphone_find_friend_by_out_subscribe(MSList *l, SalOp *op);
ms_message("Cleaning cid %i",op->cid);
eXosip_call_set_reference(op->cid,NULL);
}
+ if (op->sid!=-1){
+ sal_remove_out_subscribe(op->base.root,op);
+ }
+ if (op->nid!=-1){
+ sal_remove_in_subscribe(op->base.root,op);
+ }
if (op->pending_auth){
sal_remove_pending_auth(op->base.root,op);
}
bool_t reinvite;
};
+void sal_remove_out_subscribe(Sal *sal, SalOp *op);
+void sal_remove_in_subscribe(Sal *sal, SalOp *op);
+
void sal_exosip_subscription_recv(Sal *sal, eXosip_event_t *ev);
void sal_exosip_subscription_answered(Sal *sal,eXosip_event_t *ev);
void sal_exosip_notify_recv(Sal *sal,eXosip_event_t *ev);
sal->out_subscribes=ms_list_append(sal->out_subscribes,op);
}
-static void sal_remove_out_subscribe(Sal *sal, int sid){
- MSList *elem;
- SalOp *op;
- for(elem=sal->out_subscribes;elem!=NULL;elem=elem->next){
- op=(SalOp*)elem->data;
- if (op->sid==sid) {
- sal->out_subscribes=ms_list_remove_link(sal->out_subscribes,elem);
- return;
- }
- }
+void sal_remove_out_subscribe(Sal *sal, SalOp *op){
+ sal->out_subscribes=ms_list_remove(sal->out_subscribes,op);
}
static SalOp * sal_find_in_subscribe(Sal *sal, int nid){
sal->in_subscribes=ms_list_append(sal->in_subscribes,op);
}
-static void sal_remove_in_subscribe(Sal *sal, int nid){
- MSList *elem;
- SalOp *op;
- for(elem=sal->in_subscribes;elem!=NULL;elem=elem->next){
- op=(SalOp*)elem->data;
- if (op->nid==nid) {
- sal->in_subscribes=ms_list_remove_link(sal->in_subscribes,elem);
- return;
- }
- }
+void sal_remove_in_subscribe(Sal *sal, SalOp *op){
+ sal->in_subscribes=ms_list_remove(sal->in_subscribes,op);
}
int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){
}
ms_message("We are notified that %s has online status %i",tmp,estatus);
if (ev->ss_status==EXOSIP_SUBCRSTATE_TERMINATED) {
- sal_remove_out_subscribe(sal,op->sid);
+ sal_remove_out_subscribe(sal,op);
op->sid=-1;
op->did=-1;
ms_message("And outgoing subscription terminated by remote.");
ms_error("Subscription closed but no associated op !");
return;
}
- sal_remove_in_subscribe(sal,op->nid);
+ sal_remove_in_subscribe(sal,op);
op->nid=-1;
- op->did=0;
+ op->did=-1;
}