res_pjsip_outbound_registration: Don't assume that a registration client will always exist.

........

Merged revisions 404935 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/97/197/1
Joshua Colp 12 years ago
parent 11f18e4724
commit 986c9e897d

@ -307,27 +307,30 @@ static void schedule_registration(struct sip_outbound_registration_client_state
static int handle_client_state_destruction(void *data)
{
RAII_VAR(struct sip_outbound_registration_client_state *, client_state, data, ao2_cleanup);
pjsip_regc_info info;
cancel_registration(client_state);
pjsip_regc_get_info(client_state->client, &info);
if (client_state->client) {
pjsip_regc_info info;
if (info.is_busy == PJ_TRUE) {
/* If a client transaction is in progress we defer until it is complete */
client_state->destroy = 1;
return 0;
}
pjsip_regc_get_info(client_state->client, &info);
if (client_state->status != SIP_REGISTRATION_UNREGISTERED && client_state->status != SIP_REGISTRATION_REJECTED_PERMANENT) {
pjsip_tx_data *tdata;
if (info.is_busy == PJ_TRUE) {
/* If a client transaction is in progress we defer until it is complete */
client_state->destroy = 1;
return 0;
}
if (client_state->status != SIP_REGISTRATION_UNREGISTERED && client_state->status != SIP_REGISTRATION_REJECTED_PERMANENT) {
pjsip_tx_data *tdata;
if (pjsip_regc_unregister(client_state->client, &tdata) == PJ_SUCCESS) {
pjsip_regc_send(client_state->client, tdata);
if (pjsip_regc_unregister(client_state->client, &tdata) == PJ_SUCCESS) {
pjsip_regc_send(client_state->client, tdata);
}
}
}
pjsip_regc_destroy(client_state->client);
pjsip_regc_destroy(client_state->client);
}
client_state->status = SIP_REGISTRATION_STOPPED;
ast_sip_auth_vector_destroy(&client_state->outbound_auths);

Loading…
Cancel
Save