Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
4386f18b
Commit
4386f18b
authored
Apr 22, 2014
by
Gautier Pelloux-Prayer
Browse files
replace tabs with spaces and remove trailing spaces
parent
ee6d1e50
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
279 additions
and
279 deletions
+279
-279
coreapi/bellesip_sal/sal_impl.c
coreapi/bellesip_sal/sal_impl.c
+18
-18
coreapi/bellesip_sal/sal_op_call.c
coreapi/bellesip_sal/sal_op_call.c
+16
-16
coreapi/bellesip_sal/sal_op_impl.c
coreapi/bellesip_sal/sal_op_impl.c
+24
-24
coreapi/chat.c
coreapi/chat.c
+16
-16
coreapi/friend.c
coreapi/friend.c
+12
-12
coreapi/linphone_tunnel_stubs.c
coreapi/linphone_tunnel_stubs.c
+2
-2
coreapi/linphonecore.c
coreapi/linphonecore.c
+16
-16
coreapi/misc.c
coreapi/misc.c
+25
-25
coreapi/offeranswer.c
coreapi/offeranswer.c
+17
-17
coreapi/offeranswer.h
coreapi/offeranswer.h
+4
-4
coreapi/quality_reporting.c
coreapi/quality_reporting.c
+42
-42
coreapi/sal.c
coreapi/sal.c
+2
-2
coreapi/upnp.c
coreapi/upnp.c
+55
-55
coreapi/xml2lpc.c
coreapi/xml2lpc.c
+30
-30
No files found.
coreapi/bellesip_sal/sal_impl.c
View file @
4386f18b
...
@@ -117,7 +117,7 @@ void sal_process_authentication(SalOp *op) {
...
@@ -117,7 +117,7 @@ void sal_process_authentication(SalOp *op) {
belle_sip_response_t
*
response
=
belle_sip_transaction_get_response
((
belle_sip_transaction_t
*
)
op
->
pending_auth_transaction
);
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_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
);
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
){
if
(
strcasecmp
(
belle_sip_uri_get_host
(
from_uri
),
"anonymous.invalid"
)
==
0
){
/*prefer using the from from the SalOp*/
/*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
));
from_uri
=
belle_sip_header_address_get_uri
((
belle_sip_header_address_t
*
)
sal_op_get_from_address
(
op
));
...
@@ -137,7 +137,7 @@ void sal_process_authentication(SalOp *op) {
...
@@ -137,7 +137,7 @@ void sal_process_authentication(SalOp *op) {
ms_error
(
"sal_process_authentication() op=[%p] cannot obtain new request from dialog."
,
op
);
ms_error
(
"sal_process_authentication() op=[%p] cannot obtain new request from dialog."
,
op
);
return
;
return
;
}
}
if
(
belle_sip_provider_add_authorization
(
op
->
base
.
root
->
prov
,
new_request
,
response
,
from_uri
,
&
auth_list
))
{
if
(
belle_sip_provider_add_authorization
(
op
->
base
.
root
->
prov
,
new_request
,
response
,
from_uri
,
&
auth_list
))
{
if
(
is_within_dialog
)
{
if
(
is_within_dialog
)
{
sal_op_send_request
(
op
,
new_request
);
sal_op_send_request
(
op
,
new_request
);
...
@@ -308,7 +308,7 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
...
@@ -308,7 +308,7 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
belle_sip_client_transaction_t
*
client_transaction
=
belle_sip_response_event_get_client_transaction
(
event
);
belle_sip_client_transaction_t
*
client_transaction
=
belle_sip_response_event_get_client_transaction
(
event
);
belle_sip_response_t
*
response
=
belle_sip_response_event_get_response
(
event
);
belle_sip_response_t
*
response
=
belle_sip_response_event_get_response
(
event
);
int
response_code
=
belle_sip_response_get_status_code
(
response
);
int
response_code
=
belle_sip_response_get_status_code
(
response
);
if
(
!
client_transaction
)
{
if
(
!
client_transaction
)
{
ms_warning
(
"Discarding stateless response [%i]"
,
response_code
);
ms_warning
(
"Discarding stateless response [%i]"
,
response_code
);
return
;
return
;
...
@@ -334,11 +334,11 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
...
@@ -334,11 +334,11 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
}
}
sal_op_assign_recv_headers
(
op
,(
belle_sip_message_t
*
)
response
);
sal_op_assign_recv_headers
(
op
,(
belle_sip_message_t
*
)
response
);
if
(
op
->
callbacks
&&
op
->
callbacks
->
process_response_event
)
{
if
(
op
->
callbacks
&&
op
->
callbacks
->
process_response_event
)
{
/*handle authorization*/
/*handle authorization*/
switch
(
response_code
)
{
switch
(
response_code
)
{
case
200
:
case
200
:
break
;
break
;
case
401
:
case
401
:
case
407
:
case
407
:
...
@@ -677,10 +677,10 @@ static void set_tls_properties(Sal *ctx){
...
@@ -677,10 +677,10 @@ static void set_tls_properties(Sal *ctx){
if
(
lp
){
if
(
lp
){
belle_sip_tls_listening_point_t
*
tlp
=
BELLE_SIP_TLS_LISTENING_POINT
(
lp
);
belle_sip_tls_listening_point_t
*
tlp
=
BELLE_SIP_TLS_LISTENING_POINT
(
lp
);
int
verify_exceptions
=
0
;
int
verify_exceptions
=
0
;
if
(
!
ctx
->
tls_verify
)
verify_exceptions
=
BELLE_SIP_TLS_LISTENING_POINT_BADCERT_ANY_REASON
;
if
(
!
ctx
->
tls_verify
)
verify_exceptions
=
BELLE_SIP_TLS_LISTENING_POINT_BADCERT_ANY_REASON
;
else
if
(
!
ctx
->
tls_verify_cn
)
verify_exceptions
=
BELLE_SIP_TLS_LISTENING_POINT_BADCERT_CN_MISMATCH
;
else
if
(
!
ctx
->
tls_verify_cn
)
verify_exceptions
=
BELLE_SIP_TLS_LISTENING_POINT_BADCERT_CN_MISMATCH
;
belle_sip_tls_listening_point_set_root_ca
(
tlp
,
ctx
->
root_ca
);
/*root_ca might be NULL */
belle_sip_tls_listening_point_set_root_ca
(
tlp
,
ctx
->
root_ca
);
/*root_ca might be NULL */
belle_sip_tls_listening_point_set_verify_exceptions
(
tlp
,
verify_exceptions
);
belle_sip_tls_listening_point_set_verify_exceptions
(
tlp
,
verify_exceptions
);
}
}
...
@@ -802,7 +802,7 @@ void sal_auth_info_set_mode(SalAuthInfo* auth_info, SalAuthMode mode) { auth_inf
...
@@ -802,7 +802,7 @@ void sal_auth_info_set_mode(SalAuthInfo* auth_info, SalAuthMode mode) { auth_inf
void
sal_certificates_chain_delete
(
SalCertificatesChain
*
chain
)
{
void
sal_certificates_chain_delete
(
SalCertificatesChain
*
chain
)
{
belle_sip_object_unref
((
belle_sip_object_t
*
)
chain
);
belle_sip_object_unref
((
belle_sip_object_t
*
)
chain
);
}
}
void
sal_signing_key_delete
(
SalSigningKey
*
key
)
{
void
sal_signing_key_delete
(
SalSigningKey
*
key
)
{
belle_sip_object_unref
((
belle_sip_object_t
*
)
key
);
belle_sip_object_unref
((
belle_sip_object_t
*
)
key
);
}
}
...
@@ -829,7 +829,7 @@ int sal_auth_compute_ha1(const char* userid,const char* realm,const char* passwo
...
@@ -829,7 +829,7 @@ int sal_auth_compute_ha1(const char* userid,const char* realm,const char* passwo
SalCustomHeader
*
sal_custom_header_append
(
SalCustomHeader
*
ch
,
const
char
*
name
,
const
char
*
value
){
SalCustomHeader
*
sal_custom_header_append
(
SalCustomHeader
*
ch
,
const
char
*
name
,
const
char
*
value
){
belle_sip_message_t
*
msg
=
(
belle_sip_message_t
*
)
ch
;
belle_sip_message_t
*
msg
=
(
belle_sip_message_t
*
)
ch
;
belle_sip_header_t
*
h
;
belle_sip_header_t
*
h
;
if
(
msg
==
NULL
){
if
(
msg
==
NULL
){
msg
=
(
belle_sip_message_t
*
)
belle_sip_request_new
();
msg
=
(
belle_sip_message_t
*
)
belle_sip_request_new
();
belle_sip_object_ref
(
msg
);
belle_sip_object_ref
(
msg
);
...
@@ -846,7 +846,7 @@ SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name,
...
@@ -846,7 +846,7 @@ SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name,
const
char
*
sal_custom_header_find
(
const
SalCustomHeader
*
ch
,
const
char
*
name
){
const
char
*
sal_custom_header_find
(
const
SalCustomHeader
*
ch
,
const
char
*
name
){
if
(
ch
){
if
(
ch
){
belle_sip_header_t
*
h
=
belle_sip_message_get_header
((
belle_sip_message_t
*
)
ch
,
name
);
belle_sip_header_t
*
h
=
belle_sip_message_get_header
((
belle_sip_message_t
*
)
ch
,
name
);
if
(
h
){
if
(
h
){
return
belle_sip_header_get_unparsed_value
(
h
);
return
belle_sip_header_get_unparsed_value
(
h
);
}
}
...
@@ -879,12 +879,12 @@ void sal_set_uuid(Sal *sal, const char *uuid){
...
@@ -879,12 +879,12 @@ void sal_set_uuid(Sal *sal, const char *uuid){
}
}
typedef
struct
{
typedef
struct
{
unsigned
int
time_low
;
unsigned
int
time_low
;
unsigned
short
time_mid
;
unsigned
short
time_mid
;
unsigned
short
time_hi_and_version
;
unsigned
short
time_hi_and_version
;
unsigned
char
clock_seq_hi_and_reserved
;
unsigned
char
clock_seq_hi_and_reserved
;
unsigned
char
clock_seq_low
;
unsigned
char
clock_seq_low
;
unsigned
char
node
[
6
];
unsigned
char
node
[
6
];
}
sal_uuid_t
;
}
sal_uuid_t
;
...
@@ -892,7 +892,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
...
@@ -892,7 +892,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
sal_uuid_t
uuid_struct
;
sal_uuid_t
uuid_struct
;
int
i
;
int
i
;
int
written
;
int
written
;
if
(
len
==
0
)
return
-
1
;
if
(
len
==
0
)
return
-
1
;
/*create an UUID as described in RFC4122, 4.4 */
/*create an UUID as described in RFC4122, 4.4 */
belle_sip_random_bytes
((
unsigned
char
*
)
&
uuid_struct
,
sizeof
(
sal_uuid_t
));
belle_sip_random_bytes
((
unsigned
char
*
)
&
uuid_struct
,
sizeof
(
sal_uuid_t
));
...
@@ -900,7 +900,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
...
@@ -900,7 +900,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){
uuid_struct
.
clock_seq_hi_and_reserved
|=
1
<<
7
;
uuid_struct
.
clock_seq_hi_and_reserved
|=
1
<<
7
;
uuid_struct
.
time_hi_and_version
&=~
(
0xf
<<
12
);
uuid_struct
.
time_hi_and_version
&=~
(
0xf
<<
12
);
uuid_struct
.
time_hi_and_version
|=
4
<<
12
;
uuid_struct
.
time_hi_and_version
|=
4
<<
12
;
written
=
snprintf
(
uuid
,
len
,
"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-"
,
uuid_struct
.
time_low
,
uuid_struct
.
time_mid
,
written
=
snprintf
(
uuid
,
len
,
"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-"
,
uuid_struct
.
time_low
,
uuid_struct
.
time_mid
,
uuid_struct
.
time_hi_and_version
,
uuid_struct
.
clock_seq_hi_and_reserved
,
uuid_struct
.
time_hi_and_version
,
uuid_struct
.
clock_seq_hi_and_reserved
,
uuid_struct
.
clock_seq_low
);
uuid_struct
.
clock_seq_low
);
...
...
coreapi/bellesip_sal/sal_op_call.c
View file @
4386f18b
...
@@ -111,9 +111,9 @@ static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription
...
@@ -111,9 +111,9 @@ static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription
}
}
static
void
call_process_io_error
(
void
*
user_ctx
,
const
belle_sip_io_error_event_t
*
event
){
static
void
call_process_io_error
(
void
*
user_ctx
,
const
belle_sip_io_error_event_t
*
event
){
SalOp
*
op
=
(
SalOp
*
)
user_ctx
;
SalOp
*
op
=
(
SalOp
*
)
user_ctx
;
if
(
op
->
state
==
SalOpStateTerminated
)
return
;
if
(
op
->
state
==
SalOpStateTerminated
)
return
;
if
(
!
op
->
dialog
)
{
if
(
!
op
->
dialog
)
{
/*call terminated very early*/
/*call terminated very early*/
sal_error_info_set
(
&
op
->
error_info
,
SalReasonIOError
,
503
,
"IO error"
,
NULL
);
sal_error_info_set
(
&
op
->
error_info
,
SalReasonIOError
,
503
,
"IO error"
,
NULL
);
...
@@ -129,7 +129,7 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
...
@@ -129,7 +129,7 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
if
(
op
->
dialog
&&
op
->
dialog
==
belle_sip_dialog_terminated_event_get_dialog
(
event
))
{
if
(
op
->
dialog
&&
op
->
dialog
==
belle_sip_dialog_terminated_event_get_dialog
(
event
))
{
/*belle_sip_transaction_t* trans=belle_sip_dialog_get_last_transaction(op->dialog);*/
/*belle_sip_transaction_t* trans=belle_sip_dialog_get_last_transaction(op->dialog);*/
ms_message
(
"Dialog [%p] terminated for op [%p]"
,
belle_sip_dialog_terminated_event_get_dialog
(
event
),
op
);
ms_message
(
"Dialog [%p] terminated for op [%p]"
,
belle_sip_dialog_terminated_event_get_dialog
(
event
),
op
);
switch
(
belle_sip_dialog_get_previous_state
(
op
->
dialog
))
{
switch
(
belle_sip_dialog_get_previous_state
(
op
->
dialog
))
{
case
BELLE_SIP_DIALOG_CONFIRMED
:
case
BELLE_SIP_DIALOG_CONFIRMED
:
if
(
op
->
state
!=
SalOpStateTerminated
&&
op
->
state
!=
SalOpStateTerminating
)
{
if
(
op
->
state
!=
SalOpStateTerminated
&&
op
->
state
!=
SalOpStateTerminating
)
{
...
@@ -192,7 +192,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
...
@@ -192,7 +192,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
req
=
belle_sip_transaction_get_request
(
BELLE_SIP_TRANSACTION
(
client_transaction
));
req
=
belle_sip_transaction_get_request
(
BELLE_SIP_TRANSACTION
(
client_transaction
));
set_or_update_dialog
(
op
,
belle_sip_response_event_get_dialog
(
event
));
set_or_update_dialog
(
op
,
belle_sip_response_event_get_dialog
(
event
));
dialog_state
=
op
->
dialog
?
belle_sip_dialog_get_state
(
op
->
dialog
)
:
BELLE_SIP_DIALOG_NULL
;
dialog_state
=
op
->
dialog
?
belle_sip_dialog_get_state
(
op
->
dialog
)
:
BELLE_SIP_DIALOG_NULL
;
ms_message
(
"Op [%p] receiving call response [%i], dialog is [%p] in state [%s]"
,
op
,
code
,
op
->
dialog
,
belle_sip_dialog_state_to_string
(
dialog_state
));
ms_message
(
"Op [%p] receiving call response [%i], dialog is [%p] in state [%s]"
,
op
,
code
,
op
->
dialog
,
belle_sip_dialog_state_to_string
(
dialog_state
));
switch
(
dialog_state
)
{
switch
(
dialog_state
)
{
...
@@ -290,9 +290,9 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
...
@@ -290,9 +290,9 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
static
void
call_process_timeout
(
void
*
user_ctx
,
const
belle_sip_timeout_event_t
*
event
)
{
static
void
call_process_timeout
(
void
*
user_ctx
,
const
belle_sip_timeout_event_t
*
event
)
{
SalOp
*
op
=
(
SalOp
*
)
user_ctx
;
SalOp
*
op
=
(
SalOp
*
)
user_ctx
;
if
(
op
->
state
==
SalOpStateTerminated
)
return
;
if
(
op
->
state
==
SalOpStateTerminated
)
return
;
if
(
!
op
->
dialog
)
{
if
(
!
op
->
dialog
)
{
/*call terminated very early*/
/*call terminated very early*/
sal_error_info_set
(
&
op
->
error_info
,
SalReasonRequestTimeout
,
408
,
"Request timeout"
,
NULL
);
sal_error_info_set
(
&
op
->
error_info
,
SalReasonRequestTimeout
,
408
,
"Request timeout"
,
NULL
);
...
@@ -342,7 +342,7 @@ static void unsupported_method(belle_sip_server_transaction_t* server_transactio
...
@@ -342,7 +342,7 @@ static void unsupported_method(belle_sip_server_transaction_t* server_transactio
* Extract the sdp from a sip message.
* Extract the sdp from a sip message.
* If there is no body in the message, the session_desc is set to null, 0 is returned.
* If there is no body in the message, the session_desc is set to null, 0 is returned.
* If body was present is not a SDP or parsing of SDP failed, -1 is returned and SalReason is set appropriately.
* If body was present is not a SDP or parsing of SDP failed, -1 is returned and SalReason is set appropriately.
*
*
**/
**/
static
int
extract_sdp
(
belle_sip_message_t
*
message
,
belle_sdp_session_description_t
**
session_desc
,
SalReason
*
error
)
{
static
int
extract_sdp
(
belle_sip_message_t
*
message
,
belle_sdp_session_description_t
**
session_desc
,
SalReason
*
error
)
{
belle_sip_header_content_type_t
*
content_type
=
belle_sip_message_get_header_by_type
(
message
,
belle_sip_header_content_type_t
);
belle_sip_header_content_type_t
*
content_type
=
belle_sip_message_get_header_by_type
(
message
,
belle_sip_header_content_type_t
);
...
@@ -388,7 +388,7 @@ static int process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
...
@@ -388,7 +388,7 @@ static int process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
belle_sip_object_unref
(
sdp
);
belle_sip_object_unref
(
sdp
);
}
else
op
->
sdp_offering
=
TRUE
;
/*INVITE without SDP*/
}
else
op
->
sdp_offering
=
TRUE
;
/*INVITE without SDP*/
}
else
err
=-
1
;
}
else
err
=-
1
;
if
(
err
==-
1
){
if
(
err
==-
1
){
sal_call_decline
(
op
,
reason
,
NULL
);
sal_call_decline
(
op
,
reason
,
NULL
);
}
}
...
@@ -582,7 +582,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
...
@@ -582,7 +582,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
if
(
op
->
base
.
local_media
)
if
(
op
->
base
.
local_media
)
sal_media_description_unref
(
op
->
base
.
local_media
);
sal_media_description_unref
(
op
->
base
.
local_media
);
op
->
base
.
local_media
=
desc
;
op
->
base
.
local_media
=
desc
;
if
(
op
->
base
.
remote_media
){
if
(
op
->
base
.
remote_media
){
/*case of an incoming call where we modify the local capabilities between the time
/*case of an incoming call where we modify the local capabilities between the time
* the call is ringing and it is accepted (for example if you want to accept without video*/
* the call is ringing and it is accepted (for example if you want to accept without video*/
...
@@ -597,7 +597,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
...
@@ -597,7 +597,7 @@ int sal_call_set_local_media_description(SalOp *op, SalMediaDescription *desc){
static
belle_sip_header_allow_t
*
create_allow
(){
static
belle_sip_header_allow_t
*
create_allow
(){
belle_sip_header_allow_t
*
header_allow
;
belle_sip_header_allow_t
*
header_allow
;
header_allow
=
belle_sip_header_allow_create
(
"INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE"
);
header_allow
=
belle_sip_header_allow_create
(
"INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE"
);
return
header_allow
;
return
header_allow
;
}
}
...
@@ -633,7 +633,7 @@ int sal_call(SalOp *op, const char *from, const char *to){
...
@@ -633,7 +633,7 @@ int sal_call(SalOp *op, const char *from, const char *to){
}
}
if
(
op
->
referred_by
)
if
(
op
->
referred_by
)
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
invite
),
BELLE_SIP_HEADER
(
op
->
referred_by
));
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
invite
),
BELLE_SIP_HEADER
(
op
->
referred_by
));
return
sal_op_send_request
(
op
,
invite
);
return
sal_op_send_request
(
op
,
invite
);
}
}
...
@@ -679,7 +679,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
...
@@ -679,7 +679,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
belle_sip_response_t
*
ringing_response
=
sal_op_create_response_from_request
(
op
,
req
,
status_code
);
belle_sip_response_t
*
ringing_response
=
sal_op_create_response_from_request
(
op
,
req
,
status_code
);
belle_sip_header_t
*
require
;
belle_sip_header_t
*
require
;
const
char
*
tags
=
NULL
;
const
char
*
tags
=
NULL
;
if
(
early_media
){
if
(
early_media
){
handle_offer_answer_response
(
op
,
ringing_response
);
handle_offer_answer_response
(
op
,
ringing_response
);
}
}
...
@@ -692,7 +692,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
...
@@ -692,7 +692,7 @@ int sal_call_notify_ringing(SalOp *op, bool_t early_media){
}
}
#ifndef SAL_OP_CALL_FORCE_CONTACT_IN_RINGING
#ifndef SAL_OP_CALL_FORCE_CONTACT_IN_RINGING
if
(
tags
&&
strstr
(
tags
,
"100rel"
)
!=
0
)
if
(
tags
&&
strstr
(
tags
,
"100rel"
)
!=
0
)
#endif
#endif
{
{
belle_sip_header_address_t
*
contact
=
(
belle_sip_header_address_t
*
)
sal_op_get_contact_address
(
op
);
belle_sip_header_address_t
*
contact
=
(
belle_sip_header_address_t
*
)
sal_op_get_contact_address
(
op
);
...
@@ -740,7 +740,7 @@ int sal_call_accept(SalOp*h){
...
@@ -740,7 +740,7 @@ int sal_call_accept(SalOp*h){
if
((
contact_header
=
sal_op_create_contact
(
h
)))
{
if
((
contact_header
=
sal_op_create_contact
(
h
)))
{
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
response
),
BELLE_SIP_HEADER
(
contact_header
));
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
response
),
BELLE_SIP_HEADER
(
contact_header
));
}
}
_sal_op_add_custom_headers
(
h
,
BELLE_SIP_MESSAGE
(
response
));
_sal_op_add_custom_headers
(
h
,
BELLE_SIP_MESSAGE
(
response
));
handle_offer_answer_response
(
h
,
response
);
handle_offer_answer_response
(
h
,
response
);
...
@@ -757,7 +757,7 @@ int sal_call_decline(SalOp *op, SalReason reason, const char *redirection /*opti
...
@@ -757,7 +757,7 @@ int sal_call_decline(SalOp *op, SalReason reason, const char *redirection /*opti
belle_sip_response_t
*
response
;
belle_sip_response_t
*
response
;
belle_sip_header_contact_t
*
contact
=
NULL
;
belle_sip_header_contact_t
*
contact
=
NULL
;
int
status
=
sal_reason_to_sip_code
(
reason
);
int
status
=
sal_reason_to_sip_code
(
reason
);
if
(
reason
==
SalReasonRedirect
){
if
(
reason
==
SalReasonRedirect
){
if
(
redirection
!=
NULL
)
{
if
(
redirection
!=
NULL
)
{
if
(
strstr
(
redirection
,
"sip:"
)
!=
0
)
status
=
302
;
if
(
strstr
(
redirection
,
"sip:"
)
!=
0
)
status
=
302
;
...
@@ -812,7 +812,7 @@ int sal_call_send_dtmf(SalOp *h, char dtmf){
...
@@ -812,7 +812,7 @@ int sal_call_send_dtmf(SalOp *h, char dtmf){
if
(
req
){
if
(
req
){
int
bodylen
;
int
bodylen
;
char
dtmf_body
[
128
]
=
{
0
};
char
dtmf_body
[
128
]
=
{
0
};
snprintf
(
dtmf_body
,
sizeof
(
dtmf_body
)
-
1
,
"Signal=%c
\r\n
Duration=250
\r\n
"
,
dtmf
);
snprintf
(
dtmf_body
,
sizeof
(
dtmf_body
)
-
1
,
"Signal=%c
\r\n
Duration=250
\r\n
"
,
dtmf
);
bodylen
=
strlen
(
dtmf_body
);
bodylen
=
strlen
(
dtmf_body
);
belle_sip_message_set_body
((
belle_sip_message_t
*
)
req
,
dtmf_body
,
bodylen
);
belle_sip_message_set_body
((
belle_sip_message_t
*
)
req
,
dtmf_body
,
bodylen
);
...
...
coreapi/bellesip_sal/sal_op_impl.c
View file @
4386f18b
...
@@ -90,19 +90,19 @@ SalAuthInfo * sal_op_get_auth_requested(SalOp *op){
...
@@ -90,19 +90,19 @@ SalAuthInfo * sal_op_get_auth_requested(SalOp *op){
belle_sip_header_contact_t
*
sal_op_create_contact
(
SalOp
*
op
){
belle_sip_header_contact_t
*
sal_op_create_contact
(
SalOp
*
op
){
belle_sip_header_contact_t
*
contact_header
;
belle_sip_header_contact_t
*
contact_header
;
belle_sip_uri_t
*
contact_uri
;
belle_sip_uri_t
*
contact_uri
;
if
(
sal_op_get_contact_address
(
op
))
{
if
(
sal_op_get_contact_address
(
op
))
{
contact_header
=
belle_sip_header_contact_create
(
BELLE_SIP_HEADER_ADDRESS
(
sal_op_get_contact_address
(
op
)));
contact_header
=
belle_sip_header_contact_create
(
BELLE_SIP_HEADER_ADDRESS
(
sal_op_get_contact_address
(
op
)));
}
else
{
}
else
{
contact_header
=
belle_sip_header_contact_new
();
contact_header
=
belle_sip_header_contact_new
();
}
}
if
(
!
(
contact_uri
=
belle_sip_header_address_get_uri
(
BELLE_SIP_HEADER_ADDRESS
(
contact_header
))))
{
if
(
!
(
contact_uri
=
belle_sip_header_address_get_uri
(
BELLE_SIP_HEADER_ADDRESS
(
contact_header
))))
{
/*no uri, just creating a new one*/
/*no uri, just creating a new one*/
contact_uri
=
belle_sip_uri_new
();
contact_uri
=
belle_sip_uri_new
();
belle_sip_header_address_set_uri
(
BELLE_SIP_HEADER_ADDRESS
(
contact_header
),
contact_uri
);
belle_sip_header_address_set_uri
(
BELLE_SIP_HEADER_ADDRESS
(
contact_header
),
contact_uri
);
}
}
belle_sip_uri_set_secure
(
contact_uri
,
sal_op_is_secure
(
op
));
belle_sip_uri_set_secure
(
contact_uri
,
sal_op_is_secure
(
op
));
if
(
op
->
privacy
!=
SalPrivacyNone
){
if
(
op
->
privacy
!=
SalPrivacyNone
){
belle_sip_uri_set_user
(
contact_uri
,
NULL
);
belle_sip_uri_set_user
(
contact_uri
,
NULL
);
...
@@ -213,7 +213,7 @@ void sal_op_resend_request(SalOp* op, belle_sip_request_t* request) {
...
@@ -213,7 +213,7 @@ void sal_op_resend_request(SalOp* op, belle_sip_request_t* request) {
}
}
static
void
add_headers
(
SalOp
*
op
,
belle_sip_header_t
*
h
,
belle_sip_message_t
*
msg
){
static
void
add_headers
(
SalOp
*
op
,
belle_sip_header_t
*
h
,
belle_sip_message_t
*
msg
){
if
(
BELLE_SIP_OBJECT_IS_INSTANCE_OF
(
h
,
belle_sip_header_contact_t
)){
if
(
BELLE_SIP_OBJECT_IS_INSTANCE_OF
(
h
,
belle_sip_header_contact_t
)){
belle_sip_header_contact_t
*
newct
;
belle_sip_header_contact_t
*
newct
;
/*special case for contact, we want to keep everything from the custom contact but set automatic mode and add our own parameters as well*/
/*special case for contact, we want to keep everything from the custom contact but set automatic mode and add our own parameters as well*/
...
@@ -224,7 +224,7 @@ static void add_headers(SalOp *op, belle_sip_header_t *h, belle_sip_message_t *m
...
@@ -224,7 +224,7 @@ static void add_headers(SalOp *op, belle_sip_header_t *h, belle_sip_message_t *m
}
}
/*if a header already exists in the message, replace it*/
/*if a header already exists in the message, replace it*/
belle_sip_message_set_header
(
msg
,
h
);
belle_sip_message_set_header
(
msg
,
h
);
}
}
void
_sal_op_add_custom_headers
(
SalOp
*
op
,
belle_sip_message_t
*
msg
){
void
_sal_op_add_custom_headers
(
SalOp
*
op
,
belle_sip_message_t
*
msg
){
...
@@ -246,20 +246,20 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
...
@@ -246,20 +246,20 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
belle_sip_header_contact_t
*
contact
;
belle_sip_header_contact_t
*
contact
;
int
result
=-
1
;
int
result
=-
1
;
belle_sip_uri_t
*
next_hop_uri
=
NULL
;
belle_sip_uri_t
*
next_hop_uri
=
NULL
;
if
(
add_contact
)
{
if
(
add_contact
)
{
contact
=
sal_op_create_contact
(
op
);
contact
=
sal_op_create_contact
(
op
);
belle_sip_message_set_header
(
BELLE_SIP_MESSAGE
(
request
),
BELLE_SIP_HEADER
(
contact
));
belle_sip_message_set_header
(
BELLE_SIP_MESSAGE
(
request
),
BELLE_SIP_HEADER
(
contact
));
}
}
_sal_op_add_custom_headers
(
op
,
(
belle_sip_message_t
*
)
request
);
_sal_op_add_custom_headers
(
op
,
(
belle_sip_message_t
*
)
request
);
if
(
!
op
->
dialog
||
belle_sip_dialog_get_state
(
op
->
dialog
)
==
BELLE_SIP_DIALOG_NULL
)
{
if
(
!
op
->
dialog
||
belle_sip_dialog_get_state
(
op
->
dialog
)
==
BELLE_SIP_DIALOG_NULL
)
{
/*don't put route header if dialog is in confirmed state*/
/*don't put route header if dialog is in confirmed state*/
const
MSList
*
elem
=
sal_op_get_route_addresses
(
op
);
const
MSList
*
elem
=
sal_op_get_route_addresses
(
op
);
const
char
*
transport
;
const
char
*
transport
;
const
char
*
method
=
belle_sip_request_get_method
(
request
);
const
char
*
method
=
belle_sip_request_get_method
(
request
);
if
(
elem
)
{
if
(
elem
)
{
outbound_proxy
=
belle_sip_header_address_get_uri
((
belle_sip_header_address_t
*
)
elem
->
data
);
outbound_proxy
=
belle_sip_header_address_get_uri
((
belle_sip_header_address_t
*
)
elem
->
data
);
next_hop_uri
=
outbound_proxy
;
next_hop_uri
=
outbound_proxy
;
...
@@ -284,7 +284,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
...
@@ -284,7 +284,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
}
}
}
}
}
}
if
((
strcmp
(
method
,
"REGISTER"
)
==
0
||
strcmp
(
method
,
"SUBSCRIBE"
)
==
0
)
&&
transport
&&
if
((
strcmp
(
method
,
"REGISTER"
)
==
0
||
strcmp
(
method
,
"SUBSCRIBE"
)
==
0
)
&&
transport
&&
(
strcasecmp
(
transport
,
"TCP"
)
==
0
||
strcasecmp
(
transport
,
"TLS"
)
==
0
)){
(
strcasecmp
(
transport
,
"TCP"
)
==
0
||
strcasecmp
(
transport
,
"TLS"
)
==
0
)){
/*RFC 5923: add 'alias' parameter to tell the server that we want it to keep the connection for future requests*/
/*RFC 5923: add 'alias' parameter to tell the server that we want it to keep the connection for future requests*/
belle_sip_header_via_t
*
via
=
belle_sip_message_get_header_by_type
(
BELLE_SIP_MESSAGE
(
request
),
belle_sip_header_via_t
);
belle_sip_header_via_t
*
via
=
belle_sip_message_get_header_by_type
(
BELLE_SIP_MESSAGE
(
request
),
belle_sip_header_via_t
);
...
@@ -307,12 +307,12 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
...
@@ -307,12 +307,12 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
belle_sip_provider_add_authorization
(
op
->
base
.
root
->
prov
,
request
,
NULL
,
NULL
,
NULL
);
belle_sip_provider_add_authorization
(
op
->
base
.
root
->
prov
,
request
,
NULL
,
NULL
,
NULL
);
}
}
result
=
belle_sip_client_transaction_send_request_to
(
client_transaction
,
next_hop_uri
/*might be null*/
);
result
=
belle_sip_client_transaction_send_request_to
(
client_transaction
,
next_hop_uri
/*might be null*/
);
/*update call id if not set yet for this OP*/
/*update call id if not set yet for this OP*/
if
(
result
==
0
&&
!
op
->
base
.
call_id
)
{
if
(
result
==
0
&&
!
op
->
base
.
call_id
)
{
op
->
base
.
call_id
=
ms_strdup
(
belle_sip_header_call_id_get_call_id
(
BELLE_SIP_HEADER_CALL_ID
(
belle_sip_message_get_header_by_type
(
BELLE_SIP_MESSAGE
(
request
),
belle_sip_header_call_id_t
))));
op
->
base
.
call_id
=
ms_strdup
(
belle_sip_header_call_id_get_call_id
(
BELLE_SIP_HEADER_CALL_ID
(
belle_sip_message_get_header_by_type
(
BELLE_SIP_MESSAGE
(
request
),
belle_sip_header_call_id_t
))));
}
}
return
result
;
return
result
;
}
}
...
@@ -323,9 +323,9 @@ int sal_op_send_request(SalOp* op, belle_sip_request_t* request) {
...
@@ -323,9 +323,9 @@ int sal_op_send_request(SalOp* op, belle_sip_request_t* request) {
return
-
1
;
/*sanity check*/
return
-
1
;
/*sanity check*/
}
}
/*
/*
Header field where proxy ACK BYE CAN INV OPT REG
Header field where proxy ACK BYE CAN INV OPT REG
___________________________________________________________
___________________________________________________________
Contact R o - - m o o
Contact R o - - m o o
*/
*/
if
(
strcmp
(
belle_sip_request_get_method
(
request
),
"INVITE"
)
==
0
if
(
strcmp
(
belle_sip_request_get_method
(
request
),
"INVITE"
)
==
0
||
strcmp
(
belle_sip_request_get_method
(
request
),
"REGISTER"
)
==
0
||
strcmp
(
belle_sip_request_get_method
(
request
),
"REGISTER"
)
==
0
...
@@ -415,7 +415,7 @@ SalReason sal_reason_to_sip_code(SalReason r){
...
@@ -415,7 +415,7 @@ SalReason sal_reason_to_sip_code(SalReason r){
SalReason
_sal_reason_from_sip_code
(
int
code
)
{
SalReason
_sal_reason_from_sip_code
(
int
code
)
{
if
(
code
>=
100
&&
code
<
300
)
return
SalReasonNone
;
if
(
code
>=
100
&&
code
<
300
)
return
SalReasonNone
;
switch
(
code
)
{
switch
(
code
)
{
case
0
:
case
0
:
return
SalReasonIOError
;
return
SalReasonIOError
;
...
@@ -490,7 +490,7 @@ void sal_error_info_reset(SalErrorInfo *ei){
...
@@ -490,7 +490,7 @@ void sal_error_info_reset(SalErrorInfo *ei){
if
(
ei
->
warnings
){
if
(
ei
->
warnings
){
ms_free
(
ei
->
warnings
);
ms_free
(
ei
->
warnings
);
ei
->
warnings
=
NULL
;
ei
->
warnings
=
NULL
;
}
}
if
(
ei
->
full_string
){
if
(
ei
->
full_string
){
ms_free
(
ei
->
full_string
);
ms_free
(
ei
->
full_string
);
...
@@ -522,7 +522,7 @@ void sal_op_set_error_info_from_response(SalOp *op, belle_sip_response_t *respon
...
@@ -522,7 +522,7 @@ void sal_op_set_error_info_from_response(SalOp *op, belle_sip_response_t *respon
belle_sip_header_t
*
warning
=
belle_sip_message_get_header
(
BELLE_SIP_MESSAGE
(
response
),
"Warning"
);
belle_sip_header_t
*
warning
=
belle_sip_message_get_header
(
BELLE_SIP_MESSAGE
(
response
),
"Warning"
);
SalErrorInfo
*
ei
=&
op
->
error_info
;
SalErrorInfo
*
ei
=&
op
->
error_info
;
const
char
*
warnings
;
const
char
*
warnings
;
warnings
=
warning
?
belle_sip_header_get_unparsed_value
(
warning
)
:
NULL
;
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
;
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
);
sal_error_info_set
(
ei
,
SalReasonUnknown
,
code
,
reason_phrase
,
warnings
);
...
@@ -618,7 +618,7 @@ void sal_op_assign_recv_headers(SalOp *op, belle_sip_message_t *incoming){
...
@@ -618,7 +618,7 @@ void sal_op_assign_recv_headers(SalOp *op, belle_sip_message_t *incoming){
}
}
const
char
*
sal_op_get_remote_contact
(
const
SalOp
*
op
){
const
char
*
sal_op_get_remote_contact
(
const
SalOp
*
op
){
/*
/*
* remote contact is filled in process_response
* remote contact is filled in process_response
* return sal_custom_header_find(op->base.recv_custom_headers,"Contact");
* return sal_custom_header_find(op->base.recv_custom_headers,"Contact");
*/
*/
...
@@ -649,16 +649,16 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody){
...
@@ -649,16 +649,16 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody){
belle_sip_header_content_type_t
*
content_type
;
belle_sip_header_content_type_t
*
content_type
;
belle_sip_header_content_length_t
*
clen
=
NULL
;
belle_sip_header_content_length_t
*
clen
=
NULL
;
belle_sip_header_t
*
content_encoding
;
belle_sip_header_t
*
content_encoding
;
content_type
=
belle_sip_message_get_header_by_type
(
msg
,
belle_sip_header_content_type_t
);
content_type
=
belle_sip_message_get_header_by_type
(
msg
,
belle_sip_header_content_type_t
);
if
(
content_type
){
if
(
content_type
){
body
=
belle_sip_message_get_body
(
msg
);
body
=
belle_sip_message_get_body
(
msg
);
clen
=
belle_sip_message_get_header_by_type
(
msg
,
belle_sip_header_content_length_t
);
clen
=
belle_sip_message_get_header_by_type
(
msg
,
belle_sip_header_content_length_t
);
}
}
content_encoding
=
belle_sip_message_get_header
(
msg
,
"Content-encoding"
);
content_encoding
=
belle_sip_message_get_header
(
msg
,
"Content-encoding"
);
memset
(
salbody
,
0
,
sizeof
(
SalBody
));
memset
(
salbody
,
0
,
sizeof
(
SalBody
));
if
(
content_type
&&
body
&&
clen
)
{