コード例 #1
0
static int _linphone_event_send_publish(LinphoneEvent *lev, const LinphoneContent *body, bool_t notify_err){
	SalBody salbody;
	int err;

	if (lev->dir!=LinphoneSubscriptionInvalidDir){
		ms_error("linphone_event_update_publish(): this is not a PUBLISH event.");
		return -1;
	}
	if (lev->send_custom_headers){
		sal_op_set_sent_custom_header(lev->op,lev->send_custom_headers);
		lev->send_custom_headers=NULL;
	}else sal_op_set_sent_custom_header(lev->op,NULL);
	err=sal_publish(lev->op,NULL,NULL,lev->name,lev->expires,sal_body_from_content(&salbody,body));
	if (err==0){
		linphone_event_set_publish_state(lev,LinphonePublishProgress);
	}else if (notify_err){
		linphone_event_set_publish_state(lev,LinphonePublishError);
	}
	return err;
}
コード例 #2
0
ファイル: event.c プロジェクト: hvatum/dcm-linphone
int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *body){
	SalBodyHandler *body_handler;
	int err;

	if (lev->dir!=LinphoneSubscriptionOutgoing){
		ms_error("linphone_event_send_subscribe(): cannot send or update something that is not an outgoing subscription.");
		return -1;
	}
	switch (lev->subscription_state){
		case LinphoneSubscriptionIncomingReceived:
		case LinphoneSubscriptionTerminated:
		case LinphoneSubscriptionOutgoingInit:
			ms_error("linphone_event_send_subscribe(): cannot update subscription while in state [%s]", linphone_subscription_state_to_string(lev->subscription_state));
			return -1;
		break;
		case LinphoneSubscriptionNone:
		case LinphoneSubscriptionActive:
		case LinphoneSubscriptionExpiring:
		case LinphoneSubscriptionError:
		case LinphoneSubscriptionPending:
			/*those states are ok*/
		break;
	}

	if (lev->send_custom_headers){
		sal_op_set_sent_custom_header(lev->op,lev->send_custom_headers);
		lev->send_custom_headers=NULL;
	}else sal_op_set_sent_custom_header(lev->op,NULL);

	body_handler = sal_body_handler_from_content(body);
	err=sal_subscribe(lev->op,NULL,NULL,lev->name,lev->expires,body_handler);
	if (err==0){
		if (lev->subscription_state==LinphoneSubscriptionNone)
			linphone_event_set_state(lev,LinphoneSubscriptionOutgoingInit);
	}
	return err;
}
コード例 #3
0
ファイル: info.c プロジェクト: brenttsai1148/linphone-android
/**
 * Send a LinphoneInfoMessage through an established call
 * @param call the call
 * @param info the info message
**/
int linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info){
	SalBody body;
	sal_op_set_sent_custom_header(call->op,info->headers);
	return sal_send_info(call->op,NULL, NULL, sal_body_from_content(&body,&info->content));
}
コード例 #4
0
ファイル: info.c プロジェクト: CTA/linphone
/**
 * Send a LinphoneInfoMessage through an established call
 * @param call the call
 * @param info the info message
**/
int linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info) {
	SalBodyHandler *body_handler = sal_body_handler_from_content(info->content);
	sal_op_set_sent_custom_header(call->op, info->headers);
	return sal_send_info(call->op,NULL, NULL, body_handler);
}