Kaynağa Gözat

tm: support for changing the reply status in the script

The reply status code is re-read after the onreply_route block
is executed which makes possile to change the status code from the script.
The status code shall be rewritten directly in the message buffer
and in the parsed structure, and the class of provisional and
positive final replies cannot be changed.
Miklos Tirpak 15 yıl önce
ebeveyn
işleme
4cca625ce8
1 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  1. 11 0
      modules/tm/t_reply.c

+ 11 - 0
modules/tm/t_reply.c

@@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg  *p_msg )
 			stop_rb_timers(&uac->request);
 	 	}
 #endif /* TM_ONREPLY_FINAL_DROP_OK */
+		/* Re-read the status code, it can be changed in the route block. */
+#ifdef EXTRA_DEBUG
+		/* The class of provisional and positive final replies cannot be changed. */
+		if (((msg_status < 300) || (p_msg->REPLY_STATUS < 300))
+			&& (msg_status/100 != p_msg->REPLY_STATUS/100)
+		) {
+			LOG(L_ERR, "ERROR: The class of provisional and "
+				"positive final replies should not be changed!\n");
+		}
+#endif /* EXTRA_DEBUG */
+		msg_status=p_msg->REPLY_STATUS;
 	}
 #ifdef USE_DST_BLACKLIST
 		/* add temporary to the blacklist the source of a 503 reply */