Cancel requests according to the RFC3261, needs to be routed in the same way as the INVITE requests. The script below checks if the CANCEL request matches an existing transaction and takes care of all the necessary routing. Sometimes, we have retransmissions associated with an existing transaction. If this is the case, the function t_check_trans()
will handle it and exit the script.
#CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans();