Ejemplo n.º 1
0
static void presence_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase){
	SalOp* op = (SalOp*)user_pointer;
	switch(status_code){
		case 481: {

			ms_message("The server or remote ua lost the SUBSCRIBE dialog context. Let's restart a new one.");
			belle_sip_refresher_stop(op->refresher);
			if (op->dialog) { /*delete previous dialog if any*/
				belle_sip_dialog_set_application_data(op->dialog,NULL);
				belle_sip_object_unref(op->dialog);
				op->dialog=NULL;
			}

			if (sal_op_get_contact_address(op)) {
				/*contact is also probably not good*/
				SalAddress* contact=sal_address_clone(sal_op_get_contact_address(op));
				sal_address_set_port(contact,-1);
				sal_address_set_domain(contact,NULL);
				sal_op_set_contact_address(op,contact);
				sal_address_destroy(contact);
			}

			sal_subscribe_presence(op,NULL,NULL,-1);
		break;
		}
	}
}
Ejemplo n.º 2
0
void __linphone_friend_do_subscribe(LinphoneFriend *fr){
	LinphoneCore *lc=fr->lc;

	if (fr->outsub==NULL){
		/* people for which we don't have yet an answer should appear as offline */
		fr->presence=NULL;
		/*
		if (fr->lc->vtable.notify_recv)
			fr->lc->vtable.notify_recv(fr->lc,(LinphoneFriend*)fr);
		 */
	}else{
		sal_op_release(fr->outsub);
		fr->outsub=NULL;
	}
	fr->outsub=sal_op_new(lc->sal);
	linphone_configure_op(lc,fr->outsub,fr->uri,NULL,TRUE);
	sal_subscribe_presence(fr->outsub,NULL,NULL,lp_config_get_int(lc->config,"sip","subscribe_expires",600));
	fr->subscribe_active=TRUE;
}
Ejemplo n.º 3
0
static void presence_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase){
	SalOp* op = (SalOp*)user_pointer;
	if (status_code >= 300) {
		ms_message("The SUBSCRIBE dialog no longer works. Let's restart a new one.");
		belle_sip_refresher_stop(op->refresher);
		if (op->dialog) { /*delete previous dialog if any*/
			set_or_update_dialog(op, NULL);
		}

		if (sal_op_get_contact_address(op)) {
			/*contact is also probably not good*/
			SalAddress* contact=sal_address_clone(sal_op_get_contact_address(op));
			sal_address_set_port(contact,-1);
			sal_address_set_domain(contact,NULL);
			sal_op_set_contact_address(op,contact);
			sal_address_destroy(contact);
		}
		/*send a new SUBSCRIBE, that will attempt to establish a new dialog*/
		sal_subscribe_presence(op,NULL,NULL,-1);
	}
}