Dial Plan Variables

Along with the methods that are exposed in the SIPSorcery Ruby dial plans there are also a number of variables that can be accessed as properties of the sys object.


sys.Log("The currently executing dial plan name is #{sys.DialPlanName}.")
sys.Log("last failure status=#{sys.LastDialled[0].TransactionFinalResponse.Status}.")

As well as the sys object properties the SIP request object that initated the dial plan execution is stored in a special object called req. Everything to do with the incoming SIP request is accessible through the req object. The main properties of a SIP request are the SIP URI, the SIP headers and the SIP body.

sys.Log("Call request received with SIP URI #{req.URI.ToString()}.")
sys.Log("The From header on the call request is #{req.Header.From.ToString()}.")
sys.Log("The body for the current call request is #{req.Body}.")

The code sample below demonstrates how to access the custom SIP headers from the INVITE request that initiated a dial plan. Thanks to bobpaul for the sample.