Accessing Routing Script Parameters

How to Access Routing Script Parameters

Get

This function is used to get the call parameters. The possible parameters are described in the section "Call parameters"

 called_number = caf_call.get :called

List_params

This function is used to retrieve the list of supported call parameters. For example to extract all the possible call parameters from the the call object and put it in hash.

 caf_call.list_params.each {|param| call[param] = caf_call.get param }

Accept

This function is used to accept a call. It actually creates one outgoing route that the gateway application will use to bridge the incoming call leg. If more than one outgoing route is "accepted", the gateway will try them one by one in the same order that they were accepted. If an outgoing call leg fails (according to 'route retry' parameters), the next route in line will be used.

This method takes 2 arguments, the call parameters (hash) and the route parameters (hash). Note that calling this method does NOT stop the flow of the script.

Apply route remapping rules

 caf_call.accept out_call, route

Refuse

This function is used to set the reason code for the incoming call leg refusal. However, this function does NOT stop the flow of the script.

 caf_call.refuse :reason => :temporary_failure

To immediately refuse the incoming call leg and stop processing the script, the script must raise an exception. Exiting the script by raising the exception overwrites any reason cause previously stored using refuse().

 raise RoutingException, :no_route

The supported refusal cause values for both refuse() and raise() are described in the section "Reason values".

Script parameters protocol mapping

The following call parameters are available in the call object. For example:

 called_number = call[:called]

For information on how to use and remap call parameters, see How to use regex in Remapped Called and Calling Number Mask

Last updated

Was this helpful?