Mini Scripting development guide for SmartMedia
Posted by Zsolt Erdei, Last modified by Danny Staub on 15 November 2017 02:55 PM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Most up to date parameter list (including SmartMedia 2.8 release) is available in this article.
Call objectGetThose function are used to get the call parameters. The possible parameters are described in the section "Call parameters" called_number = caf_call.get :called
List_paramsThis function is used to retrieve the list of supported call parameters. For example to extract all the possible call params from the the call object and put it in hash. caf_call.list_params.each {|param| call[param] = caf_call.get param }
AcceptThis function is used to accept a call. It actually creates one outgoing route that gateway application will use to bridge the incoming call leg. If more than one outgoing route is "accepted", gateway will try them one by one in the same order 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
RefuseThis 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 mappingThe following call parameters are available in the call object:
Notice: All values are documented in the noa_npi_remap.rb script and may change between major release. Noa values
Those values will be remapped to the protocol specific NOA value. To provide protocol specific value:
or
Npi values
Calling Display Type values
Those values will be remapped to the protocol specific Display Information Type value. To provide protocol specific value:
or
Calling Display value
Presentation values
Calling Party Categoryvalues for calling_category
Screening values
Redirecting number reason valuesISDN:
SS7:
OLI (originating line information) valuesThe OLI parameter is a string that represents an integer value from 0 to 255.
redirecting_number_forward_enabled valuesControls forwarding or discarding of redirecting number (SIP: diversion header) to outgoing call leg. Values for this parameter are "0", "1", "false" or "true. 0/false: Redirecting number (and original called number) is not forwarded to outgoing call leg 1/true: Redirecting number (and original called number) is forwarded to outgoing call leg The value for this parameter at input of routing script depends on the "Forward redirecting number" parameter in the "Advanced" section of the Gateway configuration page of the Web Portal. The script may change this value to override the Gateway configuration.
request_uriEnables access to the Request-Line URI. For example, if the Request-Line is: Request-Line: INVITE sip:4175162082@172.22.45.13:5060;user=phone;transport=udp SIP/2.0
Then the retrieved request_uri will be "sip:4175162082@172.22.45.13:5060;user=phone;transport=udp SIP/2.0". In the routing scripts, to retrieve only the called number, this script can be used: if call_params[:request_uri] && call_params[:request_uri] =~ /sip:(.*)@.*/
call_params[:called] = $1
end
request_uri_forward_enabled valuesControls forwarding or discarding of request uri to outgoing call leg.The request uri is the information in the "Request-Line:" of the SIP INVITE message. Values for this parameter are "0", "1", "false" or "true. 0/false: Request uri is not forwarded to outgoing call leg 1/true: Request uri is forwarded to outgoing call leg The value for this parameter at input of routing script is always false. sip_header valuesAny custom sip header can be added to an outgoing call leg: call[ :sip_header ] = ["P-my-custom-header:any value"]
Many can be added at one time: call[ :sip_header ] = ["P-my-custom-header:value1", "P-my-custom-header2:value2", "P-my-custom-header3:value3"]
Note: It is not possible to read custom sip headers from inbound call legs. Route parametersAll route may have these parameters:
Additionally it is possible to add dynamic route attributes in the web portal. These can be referenced by their name. Playing prompts announcements or tonesNew feature in release 2.6, all bridges may have these parameters. These can be used to play IVR prompts or wav files in different states of the call flow, like playing an announcement when the caller dials in. You can also manage the User to User information element.
The following sections show how to access those different parameters from inside a filter. The 'params' hash is the sole argument passed to a filter function and contains call, nap, route and bridge parameters. This hash is created by the base_routing.rb scripts to regroup all relevant information just before calling the filter functions. Tone string formatAll tone strings (:announcement_tone, :call_progress_tone, :ring_tone, :disconnect_tone) inside bridge parameters are using this format. "file1.wav:repeat:start_off:end_off,file2.wav:repeat:start_off:end_off,file3.wav:repeat:start_off:end_off"
optional repeat parameter: number of times to play the file (0 and 1 have the same result) announcement_toneparams[:bridge][:announcement_tone] = "announcement.wav" Prompt played on the incoming leg with the stream_server before any outgoing call is placed. The outgoing call occurs when the wav file is completed or when the "profile:Busy Tone max duration" is reached. call_progress_toneparams[:bridge][:call_progress_tone] = "no_route.wav" Prompt played after "announcement_tone" when reason is not "ok" or when outgoing call disconnect before answer state. ring_toneparams[:bridge][:ring_tone] = "ringing.wav" Prompt played between alerting state and answer state. Bypass any other ring back tone (RBT) configured in profile. max_call_durationparams[:bridge][:max_call_duration] = "60000" Maximum call duration in millisecond for the current bridge. This timer is started when entering answer state. call_duration_reasonparams[:bridge][:call_duration_reason] = :resource_unavailable Drop both legs with this reason when call duration (:max_call_duration) is reached. disconnect_toneparams[:bridge][:disconnect_tone] = "max_duration.wav" Prompt played (on the incoming leg only) when call duration (:max_call_duration) is reached before terminating the leg with call duration reason (:call_duration_reason). UUI (user-to-user indication) valuesByte array represented as ruby String. Use bridge=params[:bridge], then bridge[:uui] to access the data. To access the bytes in Ruby, use ruby String operator []. For example: bridge[:uui][0] will return the binary value of the first UUI byte. Function each_byte can also be useful to iterate through all bytes of the UUI. uui_forward_enabled valuesControls forwarding or discarding of UUI to outgoing call leg. Values for this parameter are "0", "1", "false" or "true. 0/false: UUI is not forwarded to outgoing call leg 1/true: UUI is forwarded to outgoing call leg The value for this parameter at input of routing script depends on the "Forward UUI" parameter in the "Advanced" section of the Gateway configuration page of the Web Portal. The script may change this value to override the Gateway configuration. Nap statusAll the status fields of the NAPs are provided for use by the routing scripts. See the nap status provider for more details on which fields are available in the CEngineStatTransNap.hpp file. Notice: These values may change between major release. #define NAP_STATS_FIELDS \
/* Field, szName, szDescription, szOptions */ \
( SIGNALING_TYPE, "signaling_type", "Signaling type.", "" ) \
( INCOMING_CALL_CNT, "inst_incoming_call_cnt", "Instantaneous Count of incoming calls.", "" ) \
( OUTGOING_CALL_CNT, "inst_outgoing_call_cnt", "Instantaneous Count of outgoing calls.", "" ) \
( AVAILABLE_CNT, "available_cnt", "Number of available circuits or channels.", "" ) \
( UNAVAILABLE_CNT, "unavailable_cnt", "Number of unavailable circuits or channels.", "" ) \
( AVAILABILITY_PCT, "availability_percent", "Percentage of available circuits or channels.", "" ) \
( USAGE_PCT, "usage_percent", "Percentage of used circuits or channels.", "" ) \
( TOTAL_INCOMING_CALL_CNT, "total_incoming_call_cnt", "Total Count of incoming calls.", "" ) \
( ASR_STRUCT, "asr_statistics_struct", "Detailed Answer-Seizure Rate Statistics.", "" ) \
( GLOBAL_ASR_PCT, "global_asr_percent", "Global calculated ASR percentage.", "" ) \
( TOTAL_OUTGOING_CALL_CNT, "total_outgoing_call_cnt", "Total Count of outgoing calls.", "" ) \
( LAST_24H_ASR_PCT, "last_24h_asr_percent", "Last 24 hours calculated ASR percentage.", "" ) \
( LAST_24H_OUTGOING_CALL_CNT, "last_24h_outgoing_call_cnt", "Last 24 hours outgoing calls.", "" ) \
( HOUR_ASR_PCT, "current_hour_asr_percent", "Current hour calculated ASR percentage.", "" ) \
( HOUR_OUTGOING_CALL_CNT, "current_hour_outgoing_call_cnt", "Current hour outgoing calls.", "" ) \
( LAST_HOUR_ASR_PCT, "last_hour_asr_percent", "Last hour calculated ASR percentage.", "" ) \
( LAST_HOUR_OUTGOING_CALL_CNT, "last_hour_outgoing_call_cnt", "Last hour outgoing calls.", "" ) \
( AVAILABILITY_DETECTION_STRUCT, "availability_detection_struct", "Detailed availibility detection Statistics", "" ) \
( POLL_REMOTE_PROXY, "poll_remote_proxy", "Remote proxy polling enabled", "" ) \
( IS_AVAILABLE, "is_available", "Remote proxy actually available or not", "" ) \
( TIME_SINCE_POLLING, "time_since_polling", "Time since the last availibility polling", "" ) \
( TIME_AVAILABLE_SECONDS, "time_available_seconds", "Number of seconds since the NAP is available", "x" ) \
( TIME_UNAVAILABLE_SECONDS, "time_unavailable_seconds", "Number of seconds since the NAP is unavailable", "x" ) \
( REGISTRATION_STRUCT, "registration_struct", "Detailed registration Statistics", "" ) \
( REGISTER_TO_PROXY, "register_to_proxy", "Register to proxy enabled", "" ) \
( IS_REGISTERED, "registered", "Actually registered or not", "" ) \
( TIME_SINCE_REFRESH, "time_since_refresh", "Time since the last refresh", "" ) \
( TIME_REGISTERED_SECONDS, "time_registered_seconds", "Number of seconds since the NAP is registered", "x" ) \
( TIME_NOT_REGISTERED_SECONDS, "time_not_registered_seconds", "Number of seconds since the NAP is not registered", "x" ) \
/*!< Nap Status Fields */
For example the name to use for the global ASR percentage is: asr_statistics_struct_global_asr_percent
Test parameters@call_paramsThat variable should contain a hash of call parameters that will passed to the routing script. This is equivalent to the incoming call parameters.
@nap_listA list of hash containing the nap statuses. This is equivalent to the nap statuses at the time the call is to be routed. The nap list is hashed by the nap names in UPPERCASE. It is important to consider this when creating new dynamic route or nap attributes that may nap names that will be used to fetch a status.
@paramsA hash of hashes containing parameters. This hash contains bridge parameters and other kind of parameter groups may be added in the future. Example: @params = {:bridge => {:announcement_tone, "announcement.wav"}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|