FreeSWITCH 1.8
上QQ阅读APP看书,第一时间看更新

Variables

Variables in FreeSWITCH are associated to almost anything. You can think at variables as attributes of something. For example, before we defined the "destination_number" as an attribute of an incoming ("A leg") call, and we used it as a string to which we applied the "condition" (regex) of an extension, to decide if that extension's actions will be executed by the call, or if the extension (and its actions) has to be skipped because its condition "do not matches" the string contained by the variable "destination_number". "Variables" is the official name for all those call or session attributes.

For example, an incoming call has a big number of associated variables, referred to as "channel variables", or "call leg variables", or simply "variables". Those channel variables spans from "destination number" (we saw this one) to "caller source network", from "which audio codec is in use" to "at what time the call has been received", from "what kind of user agent (eg, phone model) is calling" to "what SIP headers were part of the incoming INVITE network packet". And not only those let's say "natural", "descriptive", "objective" variables. We can also create and assign all kind of arbitrary variables, and associate them to our call. For example the call has been originated by the "sales group". Or the call is directed to the "support group". Or, the cost per minute of the call is 5 cents. Or, the max allowed duration for this call is 600 seconds. etc etc

All of the variables (both "original" and "assigned") can be checked by regular expressions in an extension's condition. So, we can have a logic that if it is a working day, during working hours, and the call is destined to the sales group, then made John's, Rehan's and Giovanni's phone ring, and connect the call to the first one that answers.