diff options
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 78d9fe0ae..79408c046 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7400,7 +7400,6 @@ static enum match_req_res match_req_to_dialog(struct sip_pvt *sip_pvt_ptr, struc */ static struct sip_pvt *find_call(struct sip_request *req, struct ast_sockaddr *addr, const int intended_method) { - struct sip_pvt *p = NULL; char totag[128]; char fromtag[128]; const char *callid = get_header(req, "Call-ID"); @@ -7517,6 +7516,8 @@ static struct sip_pvt *find_call(struct sip_request *req, struct ast_sockaddr *a /* See if the method is capable of creating a dialog */ if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) { + struct sip_pvt *p = NULL; + if (intended_method == SIP_REFER) { /* We do support REFER, but not outside of a dialog yet */ transmit_response_using_temp(callid, addr, 1, intended_method, req, "603 Declined (no dialog)"); @@ -23529,9 +23530,13 @@ static int handle_request_register(struct sip_pvt *p, struct sip_request *req, s return res; } -/*! \brief Handle incoming SIP requests (methods) -\note This is where all incoming requests go first */ -/* called with p and p->owner locked */ +/*! + * \brief Handle incoming SIP requests (methods) + * \note + * This is where all incoming requests go first. + * \note + * called with p and p->owner locked + */ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock) { /* Called with p->lock held, as well as p->owner->lock if appropriate, keeping things @@ -24030,8 +24035,8 @@ static int handle_request_do(struct sip_request *req, struct ast_sockaddr *addr) if (p->owner && !nounlock) ast_channel_unlock(p->owner); sip_pvt_unlock(p); - ast_mutex_unlock(&netlock); ao2_t_ref(p, -1, "throw away dialog ptr from find_call at end of routine"); /* p is gone after the return */ + ast_mutex_unlock(&netlock); return 1; } @@ -27210,6 +27215,7 @@ static int reload_config(enum channelreloadreason reason) if (sipsock < 0) { ast_log(LOG_WARNING, "Unable to create SIP socket: %s\n", strerror(errno)); ast_config_destroy(cfg); + ast_mutex_unlock(&netlock); return -1; } else { /* Allow SIP clients on the same host to access us: */ |