mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
add unsubscribe test
This commit is contained in:
parent
a7618e45c1
commit
6a89a97fcf
5 changed files with 25 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct Sal{
|
|||
typedef enum SalOpSate {
|
||||
SalOpStateEarly=0
|
||||
,SalOpStateActive
|
||||
,SalOpStateTerminating /*this state is used to wait until a procedding state, so we can send the cancel*/
|
||||
,SalOpStateTerminating /*this state is used to wait until a proceeding state, so we can send the cancel*/
|
||||
,SalOpStateTerminated
|
||||
}SalOpSate_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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[]) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue