void linphone_event_terminate(LinphoneEvent *lev){ lev->terminating=TRUE; if (lev->dir==LinphoneSubscriptionIncoming){ sal_notify_close(lev->op); }else if (lev->dir==LinphoneSubscriptionOutgoing){ sal_unsubscribe(lev->op); } if (lev->publish_state!=LinphonePublishNone){ if (lev->publish_state==LinphonePublishOk && lev->expires!=-1){ sal_publish(lev->op,NULL,NULL,NULL,0,NULL); }else sal_op_stop_refreshing(lev->op); linphone_event_set_publish_state(lev,LinphonePublishCleared); return; } if (lev->subscription_state!=LinphoneSubscriptionNone){ linphone_event_set_state(lev,LinphoneSubscriptionTerminated); return; } }
/* * updates the subscriptions. * If only_when_registered is TRUE, subscribe will be sent only if the friend's corresponding proxy config is in registered. * Otherwise if the proxy config goes to unregistered state, the subscription refresh will be suspended. * An optional proxy whose state has changed can be passed to optimize the processing. **/ void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *proxy, bool_t only_when_registered){ int can_subscribe=1; if (only_when_registered && (fr->subscribe || fr->subscribe_active)){ LinphoneProxyConfig *cfg=linphone_core_lookup_known_proxy(fr->lc,fr->uri); if (proxy && proxy!=cfg) return; if (cfg && cfg->state!=LinphoneRegistrationOk){ char *tmp=linphone_address_as_string(fr->uri); ms_message("Friend [%s] belongs to proxy config with identity [%s], but this one isn't registered. Subscription is suspended.", tmp,linphone_proxy_config_get_identity(cfg)); ms_free(tmp); can_subscribe=0; } } if (can_subscribe && fr->subscribe && fr->subscribe_active==FALSE){ ms_message("Sending a new SUBSCRIBE"); __linphone_friend_do_subscribe(fr); }else if (can_subscribe && fr->subscribe_active && !fr->subscribe){ linphone_friend_unsubscribe(fr); }else if (!can_subscribe && fr->outsub){ fr->subscribe_active=FALSE; sal_op_stop_refreshing(fr->outsub); } }
void linphone_event_pause_publish(LinphoneEvent *lev) { if (lev->op) sal_op_stop_refreshing(lev->op); }