From f47bee4124c71f0803ffd87fdd3d64d25ee1ecfb Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Dec 2013 12:19:13 +0100 Subject: [PATCH] add supported header --- coreapi/bellesip_sal/sal_impl.c | 1 + coreapi/bellesip_sal/sal_impl.h | 2 ++ coreapi/bellesip_sal/sal_op_call.c | 2 +- coreapi/bellesip_sal/sal_op_impl.c | 23 ++++++++++++++--------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 7f55d453c..37384f3e9 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -857,6 +857,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){ belle_sip_response_t* sal_create_response_from_request ( Sal* sal, belle_sip_request_t* req, int code ) { belle_sip_response_t *resp=belle_sip_response_create_from_request(req,code); belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(sal->user_agent)); + belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),sal_make_supported_header(sal)); return resp; } diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index 371153ea5..4ae34095b 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -157,4 +157,6 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody); SalReason sal_reason_to_sip_code(SalReason r); +belle_sip_header_t * sal_make_supported_header(Sal *sal); + #endif /* SAL_IMPL_H_ */ diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index b434a1c38..a286001b2 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -647,7 +647,7 @@ int sal_call_accept(SalOp*h){ belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(create_allow())); if (h->base.root->session_expires!=0){ if (h->supports_session_timers) { - belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create( "Supported", "timer")); + belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create("Supported", "timer")); } } diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index 4c6a1091a..49fa7c5f8 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -111,6 +111,10 @@ belle_sip_header_contact_t* sal_op_create_contact(SalOp *op){ return contact_header; } +belle_sip_header_t * sal_make_supported_header(Sal *sal){ + return belle_sip_header_create("Supported","replaces, outbound"); +} + 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; @@ -133,16 +137,16 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { 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); + 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) { + 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)); } @@ -162,6 +166,7 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { 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; }