diff --git a/src/sip/strans.c b/src/sip/strans.c index 2a002e0a8..13a875c2e 100644 --- a/src/sip/strans.c +++ b/src/sip/strans.c @@ -368,13 +368,11 @@ int sip_strans_reply(struct sip_strans **stp, struct sip *sip, } else if (scode < 300) { tmr_start(&st->tmr, 64 * SIP_T1, tmr_handler, st); - if (pl_strcmp(&msg->met, "PRACK")) - st->state = ACCEPTED; + st->state = ACCEPTED; } else { tmr_start(&st->tmr, 64 * SIP_T1, tmr_handler, st); - if (pl_strcmp(&msg->met, "PRACK")) - st->state = COMPLETED; + st->state = COMPLETED; if (!sip_transp_reliable(st->msg->tp)) tmr_start(&st->tmrg, SIP_T1, diff --git a/src/sipsess/accept.c b/src/sipsess/accept.c index 2a88e66d2..7c0f262f4 100644 --- a/src/sipsess/accept.c +++ b/src/sipsess/accept.c @@ -22,8 +22,8 @@ static void cancel_handler(void *arg) { struct sipsess *sess = arg; - (void)sip_treply(&sess->st, sess->sip, sess->msg, 487, - "Request Terminated"); + (void)sip_treply(&sess->st, sess->sip, sess->msg, + 487, "Request Terminated"); sess->peerterm = true; @@ -229,14 +229,8 @@ int sipsess_reject(struct sipsess *sess, uint16_t scode, const char *reason, return EINVAL; va_start(ap, fmt); - - if (!sess->st && !sess->awaiting_answer && !sess->established) - err = sip_replyf(sess->sip, sess->msg, scode, reason, - fmt ? "%v" : NULL, fmt, &ap); - else - err = sip_treplyf(&sess->st, NULL, sess->sip, sess->msg, false, - scode, reason, fmt ? "%v" : NULL, fmt, &ap); - + err = sip_treplyf(&sess->st, NULL, sess->sip, sess->msg, false, + scode, reason, fmt ? "%v" : NULL, fmt, &ap); va_end(ap); return err; diff --git a/src/sipsess/reply.c b/src/sipsess/reply.c index eeae08ac3..4f03145d6 100644 --- a/src/sipsess/reply.c +++ b/src/sipsess/reply.c @@ -102,9 +102,8 @@ int sipsess_reply_2xx(struct sipsess *sess, const struct sip_msg *msg, reply->msg = mem_ref((void *)msg); reply->sess = sess; - sip_contact_set(&contact, sess->cuser, &msg->dst, msg->tp); - is_prack = !pl_strcmp(&msg->met, "PRACK"); + sip_contact_set(&contact, sess->cuser, &msg->dst, msg->tp); err = sip_treplyf(is_prack ? NULL : &sess->st, &reply->mb, sess->sip, msg, true, scode, reason, @@ -143,6 +142,7 @@ int sipsess_reply_2xx(struct sipsess *sess, const struct sip_msg *msg, if (err) { if (!is_prack) sess->st = mem_deref(sess->st); + mem_deref(reply); }