diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c
index 625372b..9c217c7 100644
--- a/modules/mediaproxy/mediaproxy.c
+++ b/modules/mediaproxy/mediaproxy.c
@@ -448,7 +448,7 @@ get_cseq_number(struct sip_msg *msg, str *cseq)
 {
     struct cell *trans = tm_api.t_gett();
 
-    if (msg->first_line.type == SIP_REPLY && trans != NULL && trans != T_UNDEFINED) {
+    if (trans != T_NULL_CELL && trans != T_UNDEFINED && trans->cseq_n.s != NULL && trans->cseq_n.len != 0) {
         cseq->s = trans->cseq_n.s+CSEQ_LEN;
         cseq->len = trans->cseq_n.len-CSEQ_LEN;
     } else {