本文整理汇总了C++中BELLE_SIP_MESSAGE函数的典型用法代码示例。如果您正苦于以下问题:C++ BELLE_SIP_MESSAGE函数的具体用法?C++ BELLE_SIP_MESSAGE怎么用?C++ BELLE_SIP_MESSAGE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BELLE_SIP_MESSAGE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sal_process_authentication
void sal_process_authentication(SalOp *op) {
belle_sip_request_t* initial_request=belle_sip_transaction_get_request((belle_sip_transaction_t*)op->pending_auth_transaction);
belle_sip_request_t* new_request;
bool_t is_within_dialog=FALSE;
belle_sip_list_t* auth_list=NULL;
belle_sip_auth_event_t* auth_event;
belle_sip_response_t *response=belle_sip_transaction_get_response((belle_sip_transaction_t*)op->pending_auth_transaction);
belle_sip_header_from_t *from=belle_sip_message_get_header_by_type(initial_request,belle_sip_header_from_t);
belle_sip_uri_t *from_uri=belle_sip_header_address_get_uri((belle_sip_header_address_t*)from);
if (strcasecmp(belle_sip_uri_get_host(from_uri),"anonymous.invalid")==0){
/*prefer using the from from the SalOp*/
from_uri=belle_sip_header_address_get_uri((belle_sip_header_address_t*)sal_op_get_from_address(op));
}
if (op->dialog && belle_sip_dialog_get_state(op->dialog)==BELLE_SIP_DIALOG_CONFIRMED) {
new_request = belle_sip_dialog_create_request_from(op->dialog,initial_request);
if (!new_request)
new_request = belle_sip_dialog_create_queued_request_from(op->dialog,initial_request);
is_within_dialog=TRUE;
} else {
new_request=initial_request;
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(new_request),BELLE_SIP_AUTHORIZATION);
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(new_request),BELLE_SIP_PROXY_AUTHORIZATION);
}
if (new_request==NULL) {
ms_error("sal_process_authentication() op=[%p] cannot obtain new request from dialog.",op);
return;
}
if (belle_sip_provider_add_authorization(op->base.root->prov,new_request,response,from_uri,&auth_list,op->base.realm)) {
if (is_within_dialog) {
sal_op_send_request(op,new_request);
} else {
sal_op_resend_request(op,new_request);
}
sal_remove_pending_auth(op->base.root,op);
}else {
belle_sip_header_from_t *from=belle_sip_message_get_header_by_type(response,belle_sip_header_from_t);
char *tmp=belle_sip_object_to_string(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from)));
ms_message("No auth info found for [%s]",tmp);
belle_sip_free(tmp);
sal_add_pending_auth(op->base.root,op);
if (is_within_dialog) {
belle_sip_object_unref(new_request);
}
}
/*always store auth info, for case of wrong credential*/
if (op->auth_info) {
sal_auth_info_delete(op->auth_info);
op->auth_info=NULL;
}
if (auth_list){
auth_event=(belle_sip_auth_event_t*)(auth_list->data);
op->auth_info=sal_auth_info_create(auth_event);
belle_sip_list_free_with_data(auth_list,(void (*)(void*))belle_sip_auth_event_destroy);
}
}
开发者ID:CTA,项目名称:linphone,代码行数:59,代码来源:sal_impl.c
示例2: sal_notify_close
int sal_notify_close(SalOp *op){
belle_sip_request_t* notify;
if (!op->dialog) return -1;
if (!(notify=belle_sip_dialog_create_queued_request(op->dialog,"NOTIFY"))) return -1;
if (op->event) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),op->event);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,-1)));
return sal_op_send_request(op,notify);
}
开发者ID:Gui13,项目名称:linphone,代码行数:9,代码来源:sal_op_events.c
示例3: sal_op_build_request
belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) {
belle_sip_header_from_t* from_header;
belle_sip_header_to_t* to_header;
belle_sip_provider_t* prov=op->base.root->prov;
belle_sip_request_t *req;
belle_sip_uri_t* req_uri;
char token[10];
if (strcmp("REGISTER",method)==0 || op->privacy==SalPrivacyNone) {
from_header = belle_sip_header_from_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_from_address(op))
,belle_sip_random_token(token,sizeof(token)));
} else {
from_header=belle_sip_header_from_create2("Anonymous <sip:[email protected]>",belle_sip_random_token(token,sizeof(token)));
}
/*make sure to preserve components like headers or port*/
req_uri = (belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op))));
belle_sip_uri_set_secure(req_uri,sal_op_is_secure(op));
to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)),NULL);
req=belle_sip_request_create(
req_uri,
method,
belle_sip_provider_create_call_id(prov),
belle_sip_header_cseq_create(20,method),
from_header,
to_header,
belle_sip_header_via_new(),
70);
if (op->privacy & SalPrivacyId) {
belle_sip_header_p_preferred_identity_t* p_preferred_identity=belle_sip_header_p_preferred_identity_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_from_address(op)));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(p_preferred_identity));
}
if (strcmp("REGISTER",method)!=0 && op->privacy!=SalPrivacyNone ){
belle_sip_header_privacy_t* privacy_header=belle_sip_header_privacy_new();
if (op->privacy&SalPrivacyCritical)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyCritical));
if (op->privacy&SalPrivacyHeader)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyHeader));
if (op->privacy&SalPrivacyId)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyId));
if (op->privacy&SalPrivacyNone)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyNone));
if (op->privacy&SalPrivacySession)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacySession));
if (op->privacy&SalPrivacyUser)
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyUser));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(privacy_header));
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),sal_make_supported_header(op->base.root));
return req;
}
开发者ID:codingtony,项目名称:linphone,代码行数:54,代码来源:sal_op_impl.c
示例4: send_notify_for_refer
static int send_notify_for_refer(SalOp* op, int code, const char *reason){
belle_sip_request_t* notify=belle_sip_dialog_create_queued_request(op->dialog,"NOTIFY");
char *sipfrag=belle_sip_strdup_printf("SIP/2.0 %i %s\r\n",code,reason);
size_t content_length=strlen(sipfrag);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_ACTIVE,-1)));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),belle_sip_header_create("Event","refer"));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(belle_sip_header_content_type_create("message","sipfrag")));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(belle_sip_header_content_length_create(content_length)));
belle_sip_message_assign_body(BELLE_SIP_MESSAGE(notify),sipfrag,content_length);
return sal_op_send_request(op,notify);
}
开发者ID:artur,项目名称:linphone,代码行数:13,代码来源:sal_op_call_transfer.c
示例5: sal_call_refer_to
int sal_call_refer_to(SalOp *op, belle_sip_header_refer_to_t* refer_to, belle_sip_header_referred_by_t* referred_by){
char* tmp;
belle_sip_request_t* req=op->dialog?belle_sip_dialog_create_request(op->dialog,"REFER"):sal_op_build_request(op, "REFER");
if (!req) {
tmp=belle_sip_uri_to_string(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(refer_to)));
ms_error("Cannot refer to [%s] for op [%p]",tmp,op);
belle_sip_free(tmp);
return -1;
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(refer_to));
if (referred_by) belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(referred_by));
return sal_op_send_request(op,req);
}
开发者ID:artur,项目名称:linphone,代码行数:13,代码来源:sal_op_call_transfer.c
示例6: sal_notify_presence_close
int sal_notify_presence_close(SalOp *op){
belle_sip_request_t* notify=NULL;
if (sal_op_check_dialog_state(op)) {
return -1;
}
notify=create_presence_notify(op);
if (!notify) return-1;
sal_add_presence_info(op,BELLE_SIP_MESSAGE(notify),NULL); /*FIXME, what about expires ??*/
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,-1)));
return sal_op_send_request(op,notify);
}
开发者ID:codingtony,项目名称:linphone,代码行数:13,代码来源:sal_op_presence.c
示例7: sal_op_set_error_info_from_response
void sal_op_set_error_info_from_response(SalOp *op, belle_sip_response_t *response){
int code = belle_sip_response_get_status_code(response);
const char *reason_phrase=belle_sip_response_get_reason_phrase(response);
/*Remark: the reason header is to be used mainly in SIP requests, thus the use and prototype of this function should be changed.*/
belle_sip_header_t* reason_header = belle_sip_message_get_header(BELLE_SIP_MESSAGE(response),"Reason");
belle_sip_header_t *warning=belle_sip_message_get_header(BELLE_SIP_MESSAGE(response),"Warning");
SalErrorInfo *ei=&op->error_info;
const char *warnings;
warnings=warning ? belle_sip_header_get_unparsed_value(warning) : NULL;
if (warnings==NULL) warnings=reason_header ? belle_sip_header_get_unparsed_value(reason_header) : NULL;
sal_error_info_set(ei,SalReasonUnknown,code,reason_phrase,warnings);
}
开发者ID:42p,项目名称:linphone,代码行数:13,代码来源:sal_op_impl.c
示例8: sal_op_fill_invite
static void sal_op_fill_invite(SalOp *op, belle_sip_request_t* invite) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),BELLE_SIP_HEADER(create_allow(op->base.root->enable_sip_update)));
if (op->base.root->session_expires!=0){
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Session-expires", "600;refresher=uas"));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Supported", "timer"));
}
if (op->base.local_media){
op->sdp_offering=TRUE;
set_sdp_from_desc(BELLE_SIP_MESSAGE(invite),op->base.local_media);
}else op->sdp_offering=FALSE;
return;
}
开发者ID:Accontech,项目名称:ace-ios,代码行数:13,代码来源:sal_op_call.c
示例9: sal_notify
int sal_notify(SalOp *op, const SalBody *body){
belle_sip_request_t* notify;
if (!op->dialog) return -1;
if (!(notify=belle_sip_dialog_create_queued_request(op->dialog,"NOTIFY"))) return -1;
if (op->event) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),op->event);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_ACTIVE,600)));
sal_op_add_body(op,(belle_sip_message_t*)notify, body);
return sal_op_send_request(op,notify);
}
开发者ID:Gui13,项目名称:linphone,代码行数:15,代码来源:sal_op_events.c
示例10: linphone_xml_rpc_session_send_request
void linphone_xml_rpc_session_send_request(LinphoneXmlRpcSession *session, LinphoneXmlRpcRequest *request) {
belle_http_request_listener_callbacks_t cbs = { 0 };
belle_http_request_listener_t *l;
belle_generic_uri_t *uri;
belle_http_request_t *req;
belle_sip_memory_body_handler_t *bh;
const char *data;
linphone_xml_rpc_request_ref(request);
uri = belle_generic_uri_parse(session->url);
if (!uri) {
ms_error("Could not send request, URL %s is invalid", session->url);
process_io_error_from_post_xml_rpc_request(request, NULL);
return;
}
req = belle_http_request_create("POST", uri, belle_sip_header_content_type_create("text", "xml"), NULL);
if (!req) {
belle_sip_object_unref(uri);
process_io_error_from_post_xml_rpc_request(request, NULL);
return;
}
data = linphone_xml_rpc_request_get_content(request);
bh = belle_sip_memory_body_handler_new_copy_from_buffer(data, strlen(data), NULL, NULL);
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(bh));
cbs.process_response = process_response_from_post_xml_rpc_request;
cbs.process_io_error = process_io_error_from_post_xml_rpc_request;
cbs.process_auth_requested = process_auth_requested_from_post_xml_rpc_request;
l = belle_http_request_listener_create_from_callbacks(&cbs, request);
belle_http_provider_send_request(session->core->http_provider, req, l);
/*ensure that the listener object will be destroyed with the request*/
belle_sip_object_data_set(BELLE_SIP_OBJECT(request), "listener", l, belle_sip_object_unref);
/*prevent destruction of the session while there are still pending http requests*/
belle_sip_object_data_set(BELLE_SIP_OBJECT(request), "session", belle_sip_object_ref(session), belle_sip_object_unref);
}
开发者ID:artur,项目名称:linphone,代码行数:34,代码来源:xmlrpc.c
示例11: handle_notify
static void handle_notify(SalOp *op, belle_sip_request_t *req, belle_sip_dialog_t *dialog){
belle_sip_response_t* resp=NULL;
belle_sip_server_transaction_t* server_transaction=op->pending_server_trans;
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t);
SalSubscribeStatus sub_state;
if (strcmp("NOTIFY",belle_sip_request_get_method(req))==0) {
SalPresenceModel *presence_model = NULL;
const char* body = belle_sip_message_get_body(BELLE_SIP_MESSAGE(req));
if (op->dialog !=NULL && dialog != op->dialog){
ms_warning("Receiving a NOTIFY from a dialog we haven't stored (op->dialog=%p dialog=%p)", op->dialog, dialog);
}
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
sub_state=SalSubscribeTerminated;
ms_message("Outgoing subscription terminated by remote [%s]",sal_op_get_to(op));
} else {
sub_state=SalSubscribeActive;
}
presence_model = process_presence_notification(op, req);
if (presence_model != NULL || body==NULL) {
/* Presence notification body parsed successfully. */
resp = sal_op_create_response_from_request(op, req, 200); /*create first because the op may be destroyed by notify_presence */
op->base.root->callbacks.notify_presence(op, sub_state, presence_model, NULL);
} else if (body){
/* Formatting error in presence notification body. */
ms_warning("Wrongly formatted presence document.");
resp = sal_op_create_response_from_request(op, req, 488);
}
if (resp) belle_sip_server_transaction_send_response(server_transaction,resp);
}
}
开发者ID:krieger-od,项目名称:linphone,代码行数:33,代码来源:sal_op_presence.c
示例12: sal_call_decline
int sal_call_decline(SalOp *op, SalReason reason, const char *redirection /*optional*/){
belle_sip_response_t* response;
belle_sip_header_contact_t* contact=NULL;
int status=sal_reason_to_sip_code(reason);
belle_sip_transaction_t *trans;
if (reason==SalReasonRedirect){
if (redirection!=NULL) {
if (strstr(redirection,"sip:")!=0) status=302;
else status=380;
contact= belle_sip_header_contact_new();
belle_sip_header_address_set_uri(BELLE_SIP_HEADER_ADDRESS(contact),belle_sip_uri_parse(redirection));
} else {
ms_error("Cannot redirect to null");
}
}
trans=(belle_sip_transaction_t*)op->pending_server_trans;
if (!trans) trans=(belle_sip_transaction_t*)op->pending_update_server_trans;
if (!trans){
ms_error("sal_call_decline(): no pending transaction to decline.");
return -1;
}
response = sal_op_create_response_from_request(op,belle_sip_transaction_get_request(trans),status);
if (contact) belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(contact));
belle_sip_server_transaction_send_response(BELLE_SIP_SERVER_TRANSACTION(trans),response);
return 0;
}
开发者ID:Accontech,项目名称:ace-ios,代码行数:27,代码来源:sal_op_call.c
示例13: handle_notify
static void handle_notify(SalOp *op, belle_sip_request_t *req){
belle_sip_response_t* resp;
belle_sip_server_transaction_t* server_transaction=op->pending_server_trans;
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t);
SalSubscribeStatus sub_state;
if (strcmp("NOTIFY",belle_sip_request_get_method(req))==0) {
SalPresenceModel *presence_model = NULL;
const char* body = belle_sip_message_get_body(BELLE_SIP_MESSAGE(req));
if (body==NULL){
ms_error("No body in NOTIFY received from [%s]",sal_op_get_from(op));
resp = sal_op_create_response_from_request(op, req, 415);
belle_sip_server_transaction_send_response(server_transaction,resp);
return;
}
presence_model = process_presence_notification(op, req);
if (presence_model != NULL) {
/* Presence notification body parsed successfully. */
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
sub_state=SalSubscribeTerminated;
ms_message("Outgoing subscription terminated by remote [%s]",sal_op_get_to(op));
} else {
sub_state=SalSubscribeActive;
}
resp = sal_op_create_response_from_request(op, req, 200); /*create first because the op may be destroyed by notify_presence */
op->base.root->callbacks.notify_presence(op, sub_state, presence_model, NULL);
} else {
/* Formatting error in presence notification body. */
ms_error("Wrongly formatted presence notification received");
resp = sal_op_create_response_from_request(op, req, 400);
}
belle_sip_server_transaction_send_response(server_transaction,resp);
}
}
开发者ID:codingtony,项目名称:linphone,代码行数:35,代码来源:sal_op_presence.c
示例14: unregister_user
void unregister_user(belle_sip_stack_t * stack
,belle_sip_provider_t *prov
,belle_sip_request_t* initial_request
,int use_transaction) {
belle_sip_request_t *req;
belle_sip_header_cseq_t* cseq;
belle_sip_header_expires_t* expires_header;
int i;
belle_sip_provider_add_sip_listener(prov,l);
is_register_ok=0;
using_transaction=0;
req=(belle_sip_request_t*)belle_sip_object_clone((belle_sip_object_t*)initial_request);
cseq=(belle_sip_header_cseq_t*)belle_sip_message_get_header((belle_sip_message_t*)req,BELLE_SIP_CSEQ);
belle_sip_header_cseq_set_seq_number(cseq,belle_sip_header_cseq_get_seq_number(cseq)+2); /*+2 if initial reg was challenged*/
expires_header=(belle_sip_header_expires_t*)belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_EXPIRES);
belle_sip_header_expires_set_expires(expires_header,0);
if (use_transaction){
belle_sip_client_transaction_t *t;
belle_sip_provider_add_authorization(prov,req,NULL,NULL,NULL,NULL); /*just in case*/
t=belle_sip_provider_create_client_transaction(prov,req);
belle_sip_client_transaction_send_request(t);
}else belle_sip_provider_send_request(prov,req);
for(i=0;!is_register_ok && i<2 ;i++)
belle_sip_stack_sleep(stack,5000);
CU_ASSERT_EQUAL(is_register_ok,1);
CU_ASSERT_EQUAL(using_transaction,use_transaction);
belle_sip_provider_remove_sip_listener(prov,l);
}
开发者ID:Gui13,项目名称:belle-sip,代码行数:28,代码来源:belle_sip_register_tester.c
示例15: sal_call_notify_ringing
int sal_call_notify_ringing(SalOp *op, bool_t early_media){
int status_code =early_media?183:180;
belle_sip_request_t* req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(op->pending_server_trans));
belle_sip_response_t* ringing_response = sal_op_create_response_from_request(op,req,status_code);
belle_sip_header_t *require;
const char *tags=NULL;
if (early_media){
handle_offer_answer_response(op,ringing_response);
}
require=belle_sip_message_get_header((belle_sip_message_t*)req,"Require");
if (require) tags=belle_sip_header_get_unparsed_value(require);
/* if client requires 100rel, then add necessary stuff*/
if (tags && strstr(tags,"100rel")!=0) {
belle_sip_message_add_header((belle_sip_message_t*)ringing_response,belle_sip_header_create("Require","100rel"));
belle_sip_message_add_header((belle_sip_message_t*)ringing_response,belle_sip_header_create("RSeq","1"));
}
#ifndef SAL_OP_CALL_FORCE_CONTACT_IN_RINGING
if (tags && strstr(tags,"100rel")!=0)
#endif
{
belle_sip_header_address_t* contact= (belle_sip_header_address_t*)sal_op_get_contact_address(op);
belle_sip_header_contact_t* contact_header;
if (contact && (contact_header=belle_sip_header_contact_create(contact))) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(ringing_response),BELLE_SIP_HEADER(contact_header));
}
}
belle_sip_server_transaction_send_response(op->pending_server_trans,ringing_response);
return 0;
}
开发者ID:Accontech,项目名称:ace-ios,代码行数:31,代码来源:sal_op_call.c
示例16: linphone_xml_rpc_session_send_request
void linphone_xml_rpc_session_send_request(LinphoneXmlRpcSession *session, LinphoneXmlRpcRequest *request) {
belle_http_request_listener_callbacks_t cbs = { 0 };
belle_http_request_listener_t *l;
belle_generic_uri_t *uri;
belle_http_request_t *req;
belle_sip_memory_body_handler_t *bh;
const char *data;
LinphoneContent *content;
linphone_xml_rpc_request_ref(request);
uri = belle_generic_uri_parse(session->url);
if (!uri) {
ms_error("Could not send request, URL %s is invalid", session->url);
process_io_error_from_post_xml_rpc_request(request, NULL);
return;
}
req = belle_http_request_create("POST", uri, belle_sip_header_content_type_create("text", "xml"), NULL);
if (!req) {
belle_sip_object_unref(uri);
process_io_error_from_post_xml_rpc_request(request, NULL);
}
content = linphone_content_new();
linphone_content_set_type(content, "text");
linphone_content_set_subtype(content, "xml");
linphone_content_set_string_buffer(content, linphone_xml_rpc_request_get_content(request));
data = linphone_xml_rpc_request_get_content(request);
bh = belle_sip_memory_body_handler_new_copy_from_buffer(data, strlen(data), NULL, NULL);
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(bh));
cbs.process_response = process_response_from_post_xml_rpc_request;
cbs.process_io_error = process_io_error_from_post_xml_rpc_request;
cbs.process_auth_requested = process_auth_requested_from_post_xml_rpc_request;
l = belle_http_request_listener_create_from_callbacks(&cbs, request);
belle_http_provider_send_request(session->core->http_provider, req, l);
linphone_content_unref(content);
}
开发者ID:kevinlovesing,项目名称:linphone,代码行数:35,代码来源:xmlrpc.c
示例17: sal_process_authentication
void sal_process_authentication(SalOp *op) {
belle_sip_request_t* initial_request=belle_sip_transaction_get_request((belle_sip_transaction_t*)op->pending_auth_transaction);
belle_sip_request_t* new_request;
bool_t is_within_dialog=FALSE;
belle_sip_list_t* auth_list=NULL;
belle_sip_auth_event_t* auth_event;
belle_sip_response_t *response=belle_sip_transaction_get_response((belle_sip_transaction_t*)op->pending_auth_transaction);
if (op->dialog && belle_sip_dialog_get_state(op->dialog)==BELLE_SIP_DIALOG_CONFIRMED) {
new_request = belle_sip_dialog_create_request_from(op->dialog,initial_request);
if (!new_request)
new_request = belle_sip_dialog_create_queued_request_from(op->dialog,initial_request);
is_within_dialog=TRUE;
} else {
new_request=initial_request;
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(new_request),BELLE_SIP_AUTHORIZATION);
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(new_request),BELLE_SIP_PROXY_AUTHORIZATION);
}
if (new_request==NULL) {
ms_error("sal_process_authentication() op=[%p] cannot obtain new request from dialog.",op);
return;
}
if (belle_sip_provider_add_authorization(op->base.root->prov,new_request,response,&auth_list)) {
if (is_within_dialog) {
sal_op_send_request(op,new_request);
} else {
sal_op_resend_request(op,new_request);
}
sal_remove_pending_auth(op->base.root,op);
}else {
ms_message("No auth info found for [%s]",sal_op_get_from(op));
sal_add_pending_auth(op->base.root,op);
if (is_within_dialog) {
belle_sip_object_unref(new_request);
}
}
/*always store auth info, for case of wrong credential*/
if (op->auth_info) sal_auth_info_delete(op->auth_info);
if (auth_list){
auth_event=(belle_sip_auth_event_t*)(auth_list->data);
op->auth_info=sal_auth_info_create(auth_event);
belle_sip_list_free_with_data(auth_list,(void (*)(void*))belle_sip_auth_event_destroy);
}
}
开发者ID:korobool,项目名称:linphonecdbus,代码行数:47,代码来源:sal_impl.c
示例18: belle_sip_refresher_get_contact
belle_sip_header_contact_t* belle_sip_refresher_get_contact(const belle_sip_refresher_t* refresher) {
belle_sip_transaction_t* transaction = BELLE_SIP_TRANSACTION(refresher->transaction);
belle_sip_request_t*request=belle_sip_transaction_get_request(transaction);
belle_sip_response_t*response=transaction->last_response;
const belle_sip_list_t* contact_header_list;
belle_sip_header_contact_t* unfixed_local_contact;
belle_sip_header_contact_t* fixed_local_contact;
char* tmp_string;
char* tmp_string2;
if (!response)
return NULL;
/*we assume, there is only one contact in request*/
unfixed_local_contact= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request),belle_sip_header_contact_t);
fixed_local_contact= BELLE_SIP_HEADER_CONTACT(belle_sip_object_clone(BELLE_SIP_OBJECT(unfixed_local_contact)));
/*first fix contact using received/rport*/
belle_sip_response_fix_contact(response,fixed_local_contact);
contact_header_list = belle_sip_message_get_headers(BELLE_SIP_MESSAGE(response),BELLE_SIP_CONTACT);
if (contact_header_list) {
contact_header_list = belle_sip_list_find_custom((belle_sip_list_t*)contact_header_list
,(belle_sip_compare_func)belle_sip_header_contact_not_equals
, (const void*)fixed_local_contact);
if (!contact_header_list) {
/*reset header list*/
contact_header_list = belle_sip_message_get_headers(BELLE_SIP_MESSAGE(response),BELLE_SIP_CONTACT);
contact_header_list = belle_sip_list_find_custom((belle_sip_list_t*)contact_header_list
,(belle_sip_compare_func)belle_sip_header_contact_not_equals
,unfixed_local_contact);
}
if (!contact_header_list) {
tmp_string=belle_sip_object_to_string(BELLE_SIP_OBJECT(fixed_local_contact));
tmp_string2=belle_sip_object_to_string(BELLE_SIP_OBJECT(unfixed_local_contact));
belle_sip_message("No matching contact neither for [%s] nor [%s]", tmp_string, tmp_string2);
belle_sip_object_unref(fixed_local_contact);
belle_sip_free(tmp_string);
belle_sip_free(tmp_string2);
return NULL;
} else {
belle_sip_object_unref(fixed_local_contact);
return BELLE_SIP_HEADER_CONTACT(contact_header_list->data);
}
} else {
return NULL;
}
}
开发者ID:MorphyMac,项目名称:belle-sip,代码行数:46,代码来源:refresher.c
示例19: handle_sdp_from_response
static void handle_sdp_from_response(SalOp* op,belle_sip_response_t* response) {
belle_sdp_session_description_t* sdp;
if ((sdp=belle_sdp_session_description_create(BELLE_SIP_MESSAGE(response)))) {
op->base.remote_media=sal_media_description_new();
sdp_to_media_description(sdp,op->base.remote_media);
if (op->base.local_media) sdp_process(op);
}
}
开发者ID:zengtaoxian,项目名称:linphone,代码行数:8,代码来源:sal_op_call.c
示例20: sal_subscribe_accept
int sal_subscribe_accept(SalOp *op){
belle_sip_request_t* req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(op->pending_server_trans));
belle_sip_header_expires_t* expires = belle_sip_message_get_header_by_type(req,belle_sip_header_expires_t);
belle_sip_response_t* resp = sal_op_create_response_from_request(op,req,200);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(expires));
belle_sip_server_transaction_send_response(op->pending_server_trans,resp);
return 0;
}
开发者ID:Gui13,项目名称:linphone,代码行数:8,代码来源:sal_op_events.c
注:本文中的BELLE_SIP_MESSAGE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论