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
6a89a97f
Commit
6a89a97f
authored
Dec 20, 2012
by
jehan
Browse files
add unsubscribe test
parent
a7618e45
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
3 deletions
+25
-3
coreapi/bellesip_sal/sal_impl.c
coreapi/bellesip_sal/sal_impl.c
+1
-0
coreapi/bellesip_sal/sal_impl.h
coreapi/bellesip_sal/sal_impl.h
+1
-1
coreapi/bellesip_sal/sal_op_call.c
coreapi/bellesip_sal/sal_op_call.c
+5
-2
coreapi/bellesip_sal/sal_op_presence.c
coreapi/bellesip_sal/sal_op_presence.c
+4
-0
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+14
-0
No files found.
coreapi/bellesip_sal/sal_impl.c
View file @
6a89a97f
...
...
@@ -183,6 +183,7 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
belle_sip_request_t
*
old_request
=
NULL
;;
belle_sip_response_t
*
old_response
=
NULL
;;
int
response_code
=
belle_sip_response_get_status_code
(
response
);
if
(
op
->
state
==
SalOpStateTerminated
)
{
belle_sip_message
(
"Op is terminated, nothing to do with this [%i]"
,
response_code
);
return
;
...
...
coreapi/bellesip_sal/sal_impl.h
View file @
6a89a97f
...
...
@@ -38,7 +38,7 @@ struct Sal{
typedef
enum
SalOpSate
{
SalOpStateEarly
=
0
,
SalOpStateActive
,
SalOpStateTerminating
/*this state is used to wait until a proce
d
ding state, so we can send the cancel*/
,
SalOpStateTerminating
/*this state is used to wait until a proce
e
ding state, so we can send the cancel*/
,
SalOpStateTerminated
}
SalOpSate_t
;
...
...
coreapi/bellesip_sal/sal_op_call.c
View file @
6a89a97f
...
...
@@ -84,8 +84,11 @@ 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
){
ms_error
(
"process_io_error not implemented yet"
);
}
static
void
process_dialog_terminated
(
void
*
op
,
const
belle_sip_dialog_terminated_event_t
*
event
)
{
if
(((
SalOp
*
)
op
)
->
dialog
)
((
SalOp
*
)
op
)
->
dialog
=
NULL
;
static
void
process_dialog_terminated
(
void
*
ctx
,
const
belle_sip_dialog_terminated_event_t
*
event
)
{
SalOp
*
op
=
(
SalOp
*
)
ctx
;
if
(
op
->
dialog
)
{
op
->
dialog
=
NULL
;
}
}
static
void
handle_sdp_from_response
(
SalOp
*
op
,
belle_sip_response_t
*
response
)
{
belle_sdp_session_description_t
*
sdp
;
...
...
coreapi/bellesip_sal/sal_op_presence.c
View file @
6a89a97f
...
...
@@ -591,6 +591,10 @@ int sal_subscribe_presence(SalOp *op, const char *from, const char *to){
}
int
sal_unsubscribe
(
SalOp
*
op
){
belle_sip_request_t
*
req
=
belle_sip_dialog_create_request
(
op
->
dialog
,
"SUBSCRIBE"
);
if
(
!
req
)
{
ms_error
(
"Cannot unsubscribe to [%s]"
,
sal_op_get_to
(
op
));
return
-
1
;
}
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
req
),
belle_sip_header_create
(
"Event"
,
"Presence"
));
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
req
),
BELLE_SIP_HEADER
(
belle_sip_header_expires_create
(
0
)));
return
sal_op_send_request
(
op
,
req
);
...
...
tester/liblinphone_tester.c
View file @
6a89a97f
...
...
@@ -611,6 +611,17 @@ static void simple_subscribe() {
linphone_core_manager_destroy
(
pauline
);
}
static
void
unsubscribe_while_subscribing
()
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"./tester/marie_rc"
);
LinphoneFriend
*
friend
=
linphone_friend_new_with_addr
(
"sip:toto@git.linphone.org"
);
/*any unexisting address*/
linphone_friend_edit
(
friend
);
linphone_friend_enable_subscribes
(
friend
,
TRUE
);
linphone_friend_done
(
friend
);
linphone_core_add_friend
(
marie
->
lc
,
friend
);
linphone_core_iterate
(
marie
->
lc
);
linphone_core_manager_destroy
(
marie
);
}
static
void
call_early_media
()
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"./tester/marie_early_rc"
);
...
...
@@ -692,6 +703,9 @@ CU_pSuite pSuite = CU_add_suite("liblinphone", init, uninit);
if
(
NULL
==
CU_add_test
(
pSuite
,
"simple_publish"
,
simple_publish
))
{
return
CU_get_error
();
}
if
(
NULL
==
CU_add_test
(
pSuite
,
"unsubscribe_while_subscribing"
,
unsubscribe_while_subscribing
))
{
return
CU_get_error
();
}
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment