Now, we will review an important concept called failure_route
. We will handle the following failure situations:
408: Request Timeout (phone not registered or disconnected)
480: Temporarily Unavailable (no answer)
486: Busy Here
To implement call forward on busy and call forward when unanswered, we will use the concept of the failure route. In this logic, we will call the t_on_failure("missed_call")
function just before sending the INVITE to the destination. This allows the handling of SIP negative replies (codes higher than 299).
We will use a logic similar to blind call forwarding; load an AVP to redirect the call to a specific URI as follows:
if(avp_db_load("$rU","$avp(fwdbusy)")) { $ru = $avp(fwdbusy); xlog("forwarded to: $avp(fwdbusy)"); }
Here is an excerpt of the route section with the changes highlighted:
####### Routing Logic ######## # main request routing logic route{ # apply DB based aliases (uncomment to enable) alias_db_lookup...