From 358516fd6809c797af015ab8a2dd62b0667195a6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Sep 2013 14:14:27 +0200 Subject: [PATCH] prevent publish to be sent while client is registering on the same proxy. --- coreapi/bellesip_sal/sal_impl.c | 6 ++++-- coreapi/bellesip_sal/sal_op_call.c | 2 +- coreapi/callbacks.c | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index c86064e24..4f88c257d 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -114,7 +114,9 @@ void sal_process_authentication(SalOp *op) { sal_add_pending_auth(op->base.root,op); if (op->dialog && belle_sip_dialog_get_state(op->dialog)==BELLE_SIP_DIALOG_CONFIRMED) { - request = belle_sip_dialog_create_queued_request_from(op->dialog,(const belle_sip_request_t *)request); + request = belle_sip_dialog_create_request_from(op->dialog,request); + if (!request) + request = belle_sip_dialog_create_queued_request_from(op->dialog,request); is_within_dialog=TRUE; } else { belle_sip_message_remove_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_AUTHORIZATION); @@ -346,7 +348,7 @@ static void process_transaction_terminated(void *user_ctx, const belle_sip_trans if (op && op->callbacks.process_transaction_terminated) { op->callbacks.process_transaction_terminated(op,event); } else { - ms_error("Unhandled transaction terminated [%p]",trans); + ms_message("Unhandled transaction terminated [%p]",trans); } if (op && client_transaction) sal_op_unref(op); /*because every client transaction ref op*/ diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index 186195c73..69aefd556 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -764,7 +764,7 @@ int sal_call_terminate(SalOp *op){ break; } default: { - ms_fatal("sal_call_terminate not implemented yet for dialog state [%s]",belle_sip_dialog_state_to_string(dialog_state)); + ms_error("sal_call_terminate not implemented yet for dialog state [%s]",belle_sip_dialog_state_to_string(dialog_state)); return -1; } } diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index cba47183e..6d0083ea0 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -807,6 +807,12 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const } else { linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details); } + if (cfg->publish_op){ + /*prevent publish to be sent now until registration gets successful*/ + sal_op_release(cfg->publish_op); + cfg->publish_op=NULL; + cfg->send_publish=cfg->publish; + } if (error== SalErrorFailure && reason == SalReasonForbidden) { const char *realm=NULL,*username=NULL; if (sal_op_get_auth_requested(op,&realm,&username)==0){