Actions

Routing script tutorial:Mini Development Guide: Difference between revisions

No edit summary
 
(296 intermediate revisions by 13 users not shown)
Line 1: Line 1:
== Call object  ==
{{DISPLAYTITLE:Routing Script Tutorial: Development Guide}}


=== Get  ===


Those function are used to get the call parameters. The possible parameters are described in the section "Call parameters"
==Introduction==
This Routing Script Tutorial provides you with essential information in managing the routing of your calls. Consult the sections below to learn more.


  called_number = caf_call.get :called
{| class="wikitable"


=== List_params  ===
|[[File:NoteIcon.png|100px]]|| An alternate version of this guide for routing scripts is available. [[Routing script tutorial|Consult it to enhance your learning.]]
 
This 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 }
 
=== Accept  ===
 
This 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
 
=== 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 "[[Routing_script_tutorial:Mini_Development_Guide#Reason_values|Reason values]]".
 
=== Script parameters protocol mapping  ===
 
The following call parameters are available in the call object. For example
 
  called_number = call[:called]
 
{| cellspacing="1" cellpadding="1" border="1" style="width: 921px; height: 805px;"
|-
! scope="col" | '''Script parameter name'''
! scope="col" | '''ISDN<br>'''
! scope="col" | '''R2 CAS'''<br>
! scope="col" | '''SS7<br>'''
! scope="col" | '''SIP<br>'''
! scope="col" | '''Comment<br>'''
! scope="col" | '''Toolpack version<br>'''
|-
| leg_id<br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Leg ID<br>
| <br>
|-
| session_id<br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Session ID<br>
| <br>
|-
| calling<br>
| Q931: 'Calling party number' IE - Number digits <br>
| ANI (Group B)<br>
| Q763: 'Calling party number' IE - address signals (*)<br>
| SIP:From - user-info<br>
| * In ANSI SS7 LNP networks, the IE 'generic address parameter' is used (when present) instead.<br>
| <br>
|-
| calling_noa<br>
| Q931: 'Calling party number' IE - Type of number<br>
| N/A<br>
| Q763: 'Calling party number' IE - nature of address indicator (*)<br>
| N/A<br>
| * In ANSI SS7 LNP networks, the IE 'generic address parameter' is used (when present) instead<br>
| <br>
|-
| calling_npi <br>
| Q931: 'Calling party number' IE - Numbering plan identification<br>
| N/A<br>
| Q763: 'Calling party number' IE - numbering plan indicator (*)<br>
| N/A<br>
| * In ANSI SS7 LNP networks, the IE 'generic address parameter' is used&nbsp;(when present) instead<br>
| <br>
|-
| calling_display <br>
| Q931: 'Display' IE - Display information<br>
Q931: 'Facility CNAM' IE when presentation is allowed for DMS/NI2 variants<br>
| N/A<br>
| Q763: 'Display information' IE - display information<br>
| SIP:From - display-name<br>
| <br>
| <br>
|-
| calling_display_type<br>
| Q931: 'Display' IE - Display information (present and/or first byte)<br>
| N/A<br>
| Q763: 'Display information' IE - present or not<br>
| N/A<br>
| <br>
| <br>
|-
| calling_presentation <br>
| Q931: 'Calling party number' IE - Presentation indicator<br>
| N/A<br>
| Q763: 'Calling party number' IE - address presentation restricted indicator<br>
|
SIP:From - display-name (displays 'anonymous' or not)
 
SIP:Remote-party-id - privacy<br>
 
| <br>
| <br>
|-
| calling_screening<br>
| Q931: 'Calling party number' IE - Screening indicator<br>
| N/A<br>
| Q763: 'Calling party number' IE - screening<br>
| SIP:Remote-party-id - screen<br>
| <br>
| <br>
|-
| calling_category<br>
| N/A<br>
| Call party category (Group A)<br>
| Q763: 'Calling party's category' IE - calling party's category<br>
|
SIP:From - cpc
 
SIP:P-asserted-identity - cpc<br>
 
| <br>
| <br>
|-
| calling_subscriber
(Generic Number / NDS)<br>
| Q931: 2nd 'Calling party number' IE - Number digits <br>
| N/A<br>
| Q763: Generic number IE with type 'additional calling party number' - Number digits<br>
|
SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
| Requires option 'support 2 calling number IE' in the profile.  This variable has priority over 'private_address' in the outgoing direction.<br>
| <br>
|-
| calling_subscriber_noa<br>
| Q931: 2nd 'Calling party number' IE - Type of number<br>
| N/A<br>
| Q763: Generic number IE with type 'additional calling party number' - nature of address indicator<br>
| SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
| <br>
| <br>
|-
| calling_subscriber_npi <br>
| Q931: 2nd 'Calling party number' IE - Numbering plan identification<br>
| N/A<br>
| Q763: Generic number IE with type 'additional calling party number' - numbering plan indicator<br>
| SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
| <br>
<br>
| <br>
|-
| calling_subscriber_presentation<br>
| Q931: 2nd 'Calling party number' IE - Presentation indicator<br>
| N/A<br>
| Q763: Generic number IE with type 'additional calling party number' - presentation restricted indicator<br>
| SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
| <br>
| <br>
|-
| calling_subscriber_screening <br>
| Q931: 2nd 'Calling party number' IE - Screening indicator<br>
| N/A<br>
| Q763: Generic number IE with type 'additional calling party number' - screening<br>
| SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
| <br>
| <br>
|-
| private_display<br>
| Q931: 'Facility CNAM' IE when presentation is restricted for DMS/NI2 variants<br>
| N/A<br>
| N/A<br>
|
SIP:P-asserted-identity - display-name<br>
 
SIP:Remote-party-id - display-name<br>
 
| <br>
| <br>
|-
| private_display_type <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Indicate presence or not of the private calling information<br>
| <br>
|-
| private_address<br>
| N/A<br>
| N/A<br>
| N/A<br>
|
SIP:P-asserted-identity - userinfo
 
SIP:Remote-party-id - user-info<br>
 
| <br>
| <br>
|-
| called <br>
| Q931: 'Called party number' IE - Number digits <br>
| DNIS (Group A)<br>
| Q763: 'Called party number' IE - address signals<br>
| SIP:To - user-info and host<br>
| <br>
| <br>
|-
| called_noa <br>
| Q931: 'Called party number' IE - Type of number<br>
| N/A<br>
| Q763: 'Called party number' IE - nature of address indicator<br>
| N/A<br>
| <br>
| <br>
|-
| called_npi <br>
| Q931: 'Called party number' IE - Numbering plan identification<br>
| N/A<br>
| Q763: 'Called party number' IE - numbering plan indicator<br>
| N/A<br>
| <br>
| <br>
|-
| charge_number<br>
| N/A<br>
| N/A<br>
| ANSI: 'Charge number' IE - address signals<br>
| N/A<br>
| <br>
| <br>
|-
| charge_number_noa <br>
| N/A<br>
| N/A<br>
| ANSI: 'Charge number' IE - nature of address indicator<br>
| N/A<br>
| <br>
| <br>
|-
| charge_number_npi<br>
| N/A<br>
| N/A<br>
| ANSI: 'Charge number' IE - numbering plan indicator<br>
| N/A<br>
| <br>
| <br>
|-
| redirecting_number_forward_enabled <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Overwrite default redirecting number and original called number forwarding behavior from incoming to outgoing leg <br>
| <br>
|-
| redirecting_number <br>
| Q931: 'Redirecting number' 1st IE - Number digits <br>
| N/A<br>
| Q763: 'Redirecting number' IE - address signals<br>
| SIP:Diversion (2nd header) - display-name<br>
| <br>
| <br>
|-
| redirecting_number_noa <br>
| Q931: 'Redirecting number'&nbsp;1st IE - Type of number<br>
| N/A<br>
| Q763: 'Redirecting number' IE - nature of address indicator<br>
| N/A<br>
| <br>
| <br>
|-
| redirecting_number_npi <br>
| Q931: 'Redirecting number' 1st IE - Numbering plan identification<br>
| N/A<br>
| Q763: 'Redirecting number' IE - numbering plan indicator<br>
| N/A<br>
| <br>
| <br>
|-
| redirecting_number_presentation <br>
| Q931: 'Redirecting number' 1st IE - Presentation indicator <br>
| N/A<br>
| Q763: 'Redirecting number' IE - address presentation restricted indicator<br>
| SIP:Diversion&nbsp;(2nd header) - diversion-privacy<br>
| <br>
| <br>
|-
| redirecting_number_indicator <br>
| N/A<br>
| N/A<br>
| Q763: 'Redirection information' IE - redirecting indicator<br>
| N/A<br>
| <br>
| <br>
|-
| redirecting_number_reason <br>
| Q931: 'Redirecting number' 1st IE - Reason for redirection<br>
| N/A<br>
| Q763: 'Redirection information' IE - redirecting reason<br>
| SIP:Diversion (2nd header) - diversion-reason<br>
| <br>
| <br>
|-
| redirecting_number_counter <br>
| N/A<br>
| N/A<br>
| Q763: 'Redirection information' IE - redirection counter<br>
| SIP:Diversion (2nd header) - diversion-counter<br>
| <br>
| <br>
|-
| original_called_number
(OCN) <br>
| Q931: 'Redirecting number' 2nd IE - Number digits <br>
| N/A<br>
| Q763: 'Redirection number' IE - address signals<br>
| SIP:Diversion&nbsp; (1st header) - display-name<br>
| <br>
| <br>
|-
| original_called_number_noa <br>
| Q931: 'Redirecting number' 2nd IE - Type of number<br>
| N/A<br>
| Q763: 'Redirection number' IE - nature of address indicator<br>
| N/A<br>
| <br>
| <br>
|-
| original_called_number_npi <br>
| Q931: 'Redirecting number' 2nd IE - Numbering plan identification<br>
| N/A<br>
| Q763: 'Redirection number' IE - numbering plan indicator<br>
| N/A<br>
| <br>
| <br>
|-
| original_called_number_presentation <br>
| Q931: 'Redirecting number' 2nd IE - Presentation indicator <br>
| N/A<br>
| Q763: 'Redirection number' IE - address presentation restricted indicator<br>
| SIP:Diversion (1st header) - diversion-privacy<br>
| <br>
| <br>
|-
| original_called_number_reason <br>
| Q931: 'Redirecting number' 2nd IE - Reason for redirection<br>
| N/A<br>
| Q763: 'Redirection information' IE - original redirection reason<br>
| SIP:Diversion (1st header) - diversion-reason<br>
| <br>
| <br>
|-
| original_called_number_counter <br>
| N/A<br>
| N/A<br>
| N/A<br>
| SIP:Diversion (1st header) - diversion-counter<br>
| <br>
| <br>
|-
| ported_number <br>
| N/A<br>
| N/A<br>
| Q763: 'Called party number' IE - address signals<br>
| SIP:RequestURI - rn<br>
| Only valid if SIP/SS7 supports LNP<br>
| <br>
|-
| ported_number_noa <br>
| N/A<br>
| N/A<br>
| Q763: 'Called party number' IE - nature of address indicator<br>
| N/A<br>
| Only valid if SIP/SS7 supports LNP<br>
| <br>
|-
| ported_number_npi <br>
| N/A<br>
| N/A<br>
| Q763: 'Called party number' IE - numbering plan indicator<br>
| N/A<br>
| Only valid if SIP/SS7 supports LNP<br>
| <br>
|-
| oli
(Originating line information) <br>
| 5ESS Codeset 6 OLI - Value<br>
| N/A<br>
| ANSI: 'Originating line information' IE - OLI<br>
|
SIP:From - oli
 
SIP:P-asserted-identity - oli<br>
 
| <br>
| <br>
|-
| request_uri <br>
| N/A<br>
| N/A<br>
| N/A<br>
| Complete Request URI string<br>
| <br>
| <br>
|-
| request_uri_forward_enabled <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Overwrite default URI&nbsp;forwarding behavior from incoming to outgoing leg<br>
| <br>
|-
| sip_header<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Any header<br>
| Requires option 'Forward custom headers' in Profiles->SIP <br>
| 2.7.63<br>
|-
| nap
(Network Access Point) <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg NAP name (read-only)<br>
| <br>
|-
| type_of_network_identification<br>
| Q931: 'Transit network selection' IE - Type of network identification <br>
| N/A<br>
| Q763: 'Transit network selection' IE - Type of network identification <br>
| N/A<br>
| <br>
| 2.7<br>
|-
| network_identification<br>
| Q931: 'Transit network selection' IE - Network identification <br>
| N/A<br>
| Q763: 'Transit network selection' IE - Network identification <br>
| SIP: Request-Line - cic<br>
| <br>
| 2.7<br>
|-
| network_identification_plan<br>
| Q931: 'Transit network selection' IE - Network identification plan <br>
| N/A<br>
| Q763: 'Transit network selection' IE - Network identification plan <br>
| N/A<br>
| <br>
| 2.7<br>
|-
| location_number_forward_enabled <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Overwrite default location number forwarding behavior from incoming to outgoing leg <br>
| 2.7<br>
|-
| location_number <br>
| N/A<br>
| N/A<br>
| Q763: 'Location number' IE - address signals<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| location_number_noa <br>
| N/A<br>
| N/A<br>
| Q763: 'Location number' IE - nature of address indicator<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| location_number_npi <br>
| N/A<br>
| N/A<br>
| Q763: 'Location number' IE - numbering plan indicator<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| location_number_presentation<br>
| N/A<br>
| N/A<br>
| Q763: 'Location number' IE - presentation restricted indicator<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| location_number_screening <br>
| N/A<br>
| N/A<br>
| Q763: 'Location number' IE - screening<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| mlpp_forward_enabled <br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| A script needs to set this to true if it wants to overwrite MLPP information in the outgoing leg.  Otherwise, profile relay 'outgoing mode' applies automatically.<br>
| 2.7<br>
|-
| mlpp_look_for_busy <br>
| N/A<br>
| N/A<br>
| Q763: 'MLPP precedence' IE - look ahead for busy<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| mlpp_precedence_level <br>
| N/A<br>
| N/A<br>
| Q763: 'MLPP precedence' IE - precedence level<br>
| SIP:Resource-Priority - q735<br>
| <br>
| 2.7<br>
|-
| mlpp_network_identity <br>
| N/A<br>
| N/A<br>
| Q763: 'MLPP precedence' IE - network identity<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| mlpp_service_domain<br>
| N/A<br>
| N/A<br>
| Q763: 'MLPP precedence' IE - MLPP service domain<br>
| N/A<br>
| <br>
| 2.7<br>
|-
| called_isub <br>
| Q931: 'Called party subaddress' IE - subaddress information<br>
| N/A<br>
| Q763: 'Access transport' IE - Q931: 'Called party subaddress' IE - subaddress information<br>
| SIP:To - isub parameter<br>
| <br>
| 2.7<br>
|-
| called_isub_type<br>
| Q931: 'Called party subaddress' IE - type of subaddress<br>
| N/A<br>
| Q763: 'Access transport' IE - Q931: 'Called party subaddress' IE - type of subaddress<br>
| SIP:To - isub-encoding parameter<br>
| <br>
| 2.7<br>
|-
| calling_isub <br>
| Q931: 'Calling party subaddress' IE - subaddress information<br>
| N/A<br>
| Q763: 'Access transport' IE - Q931: 'Calling party subaddress' IE - subaddress information<br>
| SIP:From - isub<br>
| <br>
| 2.7<br>
|-
| calling_isub_type<br>
| Q931: 'Callinf party subaddress' IE - type of subaddress<br>
| N/A<br>
| Q763: 'Access transport' IE - Q931: 'Calling party subaddress' IE - type of subaddress<br>
| SIP:From - isub-encoding<br>
| <br>
| 2.7<br>
|-
| ss7_fci_default <br>
| N/A<br>
| N/A<br>
| Default forward call indicator (FCI) value.<br>
| N/A<br>
| Toolpack will overwrite FCI bits A, D, F, I and M with appropriate values according to call conditions<br>
| 2.7<br>
|-
| ss7_fci_force_mask <br>
| N/A<br>
| N/A<br>
| Mask to select bits from ss7_fci_default that must be forced.<br>
| N/A<br>
| Bits from ss7_fci_default which corresponding bit in ss7_fci_force_mask is set will be forced, and no more controlled by Toolpack<br>
| 2.7<br>
|-
| ss7_bci_default <br>
| N/A<br>
| N/A<br>
| Default backward call indicator (BCI) value.<br>
| N/A<br>
| Toolpack will overwrite BCI bits AB, I, K, M and N with appropriate values according to call conditions<br>
| 2.7<br>
|-
| ss7_bci_force_mask <br>
| N/A<br>
| N/A<br>
| Mask to select bits from ss7_bci_default that must be forced.<br>
| N/A<br>
| Bits from ss7_bci_default which corresponding bit in ss7_bci_force_mask is set will be forced, and no more controlled by Toolpack<br>
| 2.7<br>
|-
| tdm_ls_name
(Line Service or T1/E1 trunk) <br>
| Incoming leg line service name<br>
| Incoming leg line service name<br>
| Incoming leg line service name<br>
| N/A<br>
| (read-only)<br>
| 2.7<br>
|-
| tdm_timeslot_nb<br>
| Incoming leg timeslot number<br>
| Incoming leg timeslot number<br>
| Incoming leg timeslot number<br>
| N/A<br>
| (read-only)<br>
| 2.7<br>
|-
| rtp_local_addr<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg local SDP IP address<br>
| (read-only)<br>
| 2.7<br>
|-
| rtp_local_port<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg local SDP IP port<br>
| (read-only)<br>
| 2.7<br>
|-
| rtp_remote_addr<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg remote SDP IP address<br>
| (read-only)<br>
| 2.7<br>
|-
| rtp_remote_port<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg remote SDP IP port<br>
| (read-only)<br>
| 2.7<br>
|-
| ss7_cot_enabled <br>
| N/A<br>
| N/A<br>
| Requests SS7 in-call continuity test for this outgoing SS7 call<br>
| N/A<br>
| Toolpack will request continuity test on the timeslot before making the outgoing call. If COT fails, the call will be dropped (then another route may be attempted)<br>
| 2.8<br>
|-
| reverse_charging_indication<br>
| Incoming leg Reverse charging indication IE present<br>
| N/A<br>
| N/A<br>
| N/A<br>
| If set in routing script, will add Reverse charging indication IE in outgoing leg (also use reverse_charging_indication_forward_enabled)<br>
| 2.8.12<br>
|-
| reverse_charging_indication_forward_enabled<br>
| N/A<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Enable forwarding of reverse charging indication from incoming to outgoing leg<br>
| 2.8.12<br>
|-
| sip_local_addr<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg local SIP IP address<br>
| (read-only)<br>
| 2.8.13<br>
|-
| sip_local_port<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg local SIP UDP port<br>
| (read-only)<br>
| 2.8.13<br>
|-
| sip_remote_addr<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg remote SIP IP address<br>
| (read-only)<br>
| 2.8.13<br>
|-
| sip_remote_port<br>
| N/A<br>
| N/A<br>
| N/A<br>
| Incoming leg remote SIP UDP port<br>
| (read-only)<br>
| 2.8.13<br>
|}
|}


<br>
==Accessing Routing Script Parameters ==
 
[[Routing Script Tutorial: Accessing Routing Script Parameters|Learn how to access routing script parameters.]]
'''Notice:''' All values are documented in the '''noa_npi_remap.rb''' script and may change between major release.
 
=== Noa values  ===
 
*<tt>unknown_number (0x2)</tt>
*<tt>international_number (0x4)</tt>
*<tt>national_number (0x3)</tt>
*<tt>subscriber_number (0x1)</tt>
*<tt>network_specific (0x5)</tt>
*<tt>network_routing_national_format (0x7)</tt>
*<tt>network_routing_international_format (0x8)</tt>
*<tt>abbreviated_number (0x6)</tt>
*<tt>subscriber_number_operator_requested (0x71)</tt>
*<tt>national_number_operator_requested (0x72)</tt>
*<tt>international_number_operator_requested (0x73)</tt>
*<tt>no_number_present_operator_requested (0x74)</tt>
*<tt>no_number_present_cut_through_call_to_carrier (0x75)</tt>
*<tt>test_line_test_code (0x77)</tt>
*<tt>non_unique_subscriber_number (0x71)</tt>
*<tt>non_unique_national_number (0x73)</tt>
*<tt>non_unique_international_number (0x74)</tt>
*<tt>call_950_numbe (0x76)</tt>
*<tt>special_number (0x73)</tt>
*<tt>national_number_with_transit_network_selection (0x74)</tt>
*<tt>international_number_with_transit_network_selection (0x75)</tt>
 
Those values will be remapped to the protocol specific NOA value. To provide protocol specific value:
 
*<tt>call_params[:called_noa] = 0x70</tt>
 
or
 
*<tt>call_params[:called_noa] = 112</tt>
 
=== Npi values  ===
 
*<tt>unknown_number</tt>
*<tt>isdn</tt>
*<tt>telephony</tt>
*<tt>private</tt>
*<tt>data</tt>
*<tt>telex</tt>
*<tt>national</tt>
 
=== Calling Display Type values  ===
 
*<tt>unspecified</tt> =&gt; Type is unspecified.
*<tt>calling_party_name</tt> =&gt; Type is 0xB1.
 
Those values will be remapped to the protocol specific Display Information Type value. To provide protocol specific value:
 
*<tt>call_params[:calling_display_type] = 0xB1</tt>
 
or
 
*<tt>call_params[:calling_display_type] = 177</tt>
 
=== Calling Display value  ===
 
*<tt>call_params[:calling_display] = "Roger Fluffy"</tt>
 
=== Presentation values for Calling number, Calling Subscriber (Generic Number), Redirecting Number, Original Called Number (OCN) and Location Number ===
 
*<tt>unspecified</tt>
*<tt>not_available (0x2)</tt>
*<tt>allowed (0x0)</tt>
*<tt>restricted (0x1)</tt>
*<tt>addr_restricted</tt>
*<tt>name_restricted</tt>
 
=== Calling Party Category  ===
values for calling_category
*<tt>unspecified</tt> <tt>(0xa)</tt>
*<tt>unknown</tt> <tt>(0x0)</tt>
*<tt>operator_french</tt> <tt>(0x1)</tt>
*<tt>operator_english</tt> <tt>(0x2)</tt>
*<tt>operator_german</tt> <tt>(0x3)</tt>
*<tt>operator_russian</tt> <tt>(0x4)</tt>
*<tt>operator_spanish</tt> <tt>(0x5)</tt>
*<tt>subscriber</tt> <tt>(0xa)</tt>
*<tt>subscriber_with_priority</tt> <tt>(0xb)</tt>
*<tt>data</tt> <tt>(0xc)</tt>
*<tt>test</tt> <tt>(0xd)</tt>
*<tt>payphone</tt> <tt>(0xf)</tt>
 
=== Screening values for Calling number, Calling Subscriber (Generic Number), and Location Number  ===
 
*<tt>unspecified</tt>
*<tt>no (0x0)</tt>
*<tt>pass (0x1)</tt>
*<tt>fail (0x2)</tt>
*<tt>network_provided (0x3)</tt>
 
=== Redirecting indicator values  ===
 
SS7:
 
*<tt>no_redirection</tt>
*<tt>call_rerouted</tt>
*<tt>call_rerouted_all_restricted</tt>
*<tt>call_diverted</tt>
*<tt>call_diverted_all_restricted</tt>
*<tt>call_rerouted_restricted</tt>
*<tt>call_diverted_restricted</tt>
*<tt>spare</tt>
 
=== Redirecting number, Original Called Number and Diversion Reason ===
 
ISDN:
 
*<tt>unknown</tt>
*<tt>busy</tt>
*<tt>no_reply</tt>
*<tt>deflection</tt>
*<tt>dte_out_of_order</tt>
*<tt>forwarding_by_called_dte</tt>
*<tt>unconditional</tt>
 
SS7:
 
*<tt>unknown</tt>
*<tt>busy      (SIP: user-busy)</tt>
*<tt>no_reply  (SIP: no-answer)</tt>
*<tt>unconditional</tt>
*<tt>deflection</tt>
*<tt>deflection_immediate</tt>
*<tt>mobile_not_reachable</tt>
 
=== OLI (originating line information) values  ===
 
The OLI parameter is a string that represents an integer value from 0 to 255.
 
=== Information Transfer Capability values  ===
 
information_transfer_capability:
 
*<tt>digital</tt>
*<tt>restricted_digital</tt>
*<tt>digital_with_tones</tt>
*<tt>speech</tt>
*<tt>3_1_khz_audio</tt>
 
=== redirecting_number_forward_enabled values  ===
 
Controls 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.
 
Note: To "insert" a new redirecting number value on the outgoing leg, redirecting_number_forward_enabled must also be set to true.
 
=== request_uri  ===
 
Enables access to the Request-Line URI.<br>
 
For example, if the Request-Line is:
<pre>Request-Line: INVITE sip:4175162082@172.22.45.13:5060;user=phone;transport=udp SIP/2.0</pre>
Then the retrieved request_uri will be "sip:4175162082@172.22.45.13:5060;user=phone;transport=udp SIP/2.0". <br>
 
In the routing scripts, to retrieve only the called number, this script can be used:<br>
<pre>    if call_params[:request_uri] &amp;&amp; call_params[:request_uri] =~ /sip:(.*)@.*/
      call_params[:called] = $1
    end
</pre>
=== request_uri_forward_enabled values  ===
 
Controls 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.<br>
 
Values for this parameter are "0", "1", "false" or "true. <br>
 
* 0/false: Request uri is not forwarded to outgoing call leg <br>
 
* 1/true: Request uri is forwarded to outgoing call leg <br>
 
The value for this parameter at input of routing script is always false. <br>
 
=== sip_header values  ===
Contains a hash table of custom sip headers from the inbound call leg. Any custom sip header can be added to an outgoing call leg:<br />
 
<pre>call[ :sip_header ] = {"P-my-custom-header"=>"value1", "P-my-custom-header2"=>"value2", "P-my-custom-header3"=>"value3"}</pre>
 
* PCAP sample: [[File:TB_Custom_SIP_Headers.pcap]]
 
List of sip headers that will not appear in call[:sip_header] since they are already processed by the SIP stack:
<pre>
Accept              Error-Info            Remote-Party-ID     
Accept-Contact      Event                  Replaces                       
Accept-Encoding      Expires                Reply-To             
Accept-Language      From                  Request-Disposition   
Alert-Info          In-Reply-To            Subject         
Allow                Max-Forwards          Subscription-State 
Allow-Events        MIME-version          Supported         
Also                Min-Expires            Timestamp         
Anonymity            Min-SE                To           
Authorization        Organization          Unsupported 
Authentication-Info  Path                  User-Agent 
Call-ID              Priority              Via 
Call-Info            Privacy                Warning 
Contact              Proxy-Authenticate    WWW-Authenticate 
Content-Disposition  Proxy-Authorization    Require 
Content-Encoding    Proxy-Require          Response-Key 
Content-Language    P-Media-Authorization  Retry-After 
Content-Length      P-Preferred-Identity  RPID-Privacy 
Content-Type        P-Asserted-Identity    Route 
CSeq                RAck                  RSeq 
RAck                Reason                Security-Client 
Reason              Record-Route          Security-Server 
Date                Refer-To              Security-Verify
Diversion            Referred-By            Server
Encryption          Reject-Contact        Service-Route           
                                            Session-Expires
</pre>
 
=== MLPP Precedence values  ===
 
mlpp_look_for_busy:
 
*<tt>allowed</tt>
*<tt>path_reserved</tt>
*<tt>not_allowed</tt>
 
 
mlpp_precedence_level:
 
*<tt>flash_override</tt>
*<tt>flash</tt>
*<tt>immediate</tt>
*<tt>priority</tt>
*<tt>routine</tt>


==Routing Script Parameter Mapping Table==
[[Routing Script Parameter Mapping Table|Learn how each Routing Script Parameter maps to varying protocols.]]


mlpp_network_identity:
==Script Parameters Definition==
[[Routing Script Tutorial: Script Parameters Definition|Learn about the definition of each script parameter.]]


3 digits value from 0 to 999
==Script Parameters Definition for SIP==
[[Routing Script Tutorial: Script Parameters Definition for SIP|Learn about the definition of each script parameter for SIP.]]


==Registered Users Information==
[[Routing Script Tutorial: Registered Users Information|Learn how routing scripts access information about registered users.]]


mlpp_service_domain:
==Route Parameters and Call Routing==
[[Routing Script Tutorial: Route Parameters and Call Routing|Learn about the standard parameters used in a call and how they route to registered users.]]


24 bits value from 0 to 16777215
==Playing prompts announcements or tones==
[[Routing Script Tutorial: Playing prompts announcements and tones|Learn how to play all sorts of media files for call prompts, announcements, and tones.]]


=== ISUB subaddress information values ===
==Recording==
[[Routing Script Tutorial: Recording|Learn how to use routing scripts to record incoming and/or outgoing call legs.]]


called_isub_type:
==User-to-User Information==
calling_isub_type:  
[[Routing Script Tutorial: User-to-User Information|Learn how  to use User-to-User Information (UUI) in routing scripts.]]


*<tt>nsap</tt>
==Radius Autorization==
*<tt>nsap_ia5</tt>
[[Routing Script Tutorial: Radius Authorization|Learn how to send RADIUS authorization requests in routing scripts.]]
*<tt>nsap_bcd</tt>
*<tt>user</tt>


==ENUM Query==
[[Routing Script Tutorial: ENUM Query|Learn how to send ENUM Query requests to DNS servers in routing scripts.]]


called_isub:
== DNS Query ==
calling_isub:  
[[Routing Script Tutorial: DNS Query|Learn how to send DNS Query requests to DNS servers in routing scripts.]]


Digits for the subaddress information.
== Call Diversion Options ==
[[Routing Script Tutorial: Call Diversion Options|Learn how control a call flow with diversion options.]]


== Route parameters  ==
== Call Transfer Requests ==
[[Routing Script Tutorial: Call Transfer Requests|Learn how to route call transfer requests.]]


All route may have these parameters:  
== Redirection ==
[[Routing Script Tutorial: Redirection|Learn how to get redirection contacts.]]


*calling
== Connected Number ==
*called
[[Routing Script Tutorial: Connected Number|Connected Number]]
*nap
*remapped_calling
*remapped_called
*remapped_nap
*remapped_profile
*remapped_incoming_profile


Example:
== Terminating Calls ==
[[Routing Script Tutorial: Terminating Calls|Learn how to terminate calls with routing scripts.]]


  route[:remapped_nap]
== NAP status and other NAP information ==
[[Routing Script Tutorial: NAP Status and other NAP Information|Learn how to use NAP status field in routing scripts.]]


Additionally it is possible to add dynamic route attributes in the web portal. These can be referenced by their name.
== Telephony Services (CNAM Request over SS7)==
[[Routing Script Tutorial: CNAM Request|Learn how to manage CNAM requests over SS7.]]


== Playing prompts announcements or tones  ==
== Custom User Context ==
 
[[Routing Script Tutorial: Custom User Context|Custom User Context]]
New feature in release 2.6, all bridges may have these parameters. These can be used to play IVR prompts (audio files) in different states of the call flow.
 
*'''announcement_tone''' (played before outgoing call is routed)
*'''ring_tone''' (played after when waiting for outgoing call to answer)
*'''busy_tone''' (played if outgoing call failed)
*'''disconnect_tone''' (played after the call has reached it's maximum duration)
 
 
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 format  ===
 
All tone strings (:announcement_tone,&nbsp;:busy_tone,&nbsp;:ring_tone,&nbsp;:disconnect_tone) inside bridge parameters are using this format.
<pre>"file1.wav:repeat:start_off:end_off,file2.wav:repeat:start_off:end_off,file3.wav:repeat:start_off:end_off"
</pre>
Optional parameters:
* repeat: number of times to play the file (0 and 1 have the same result)
* start_off: Start offset in milliseconds
* end_off: End offset in milliseconds
 
==== Example 1 ====
The following example will play file1.wav once, and then play file2.wav in loop:
  "file1.wav,file2.wav:-1"
 
==== Example 2 ====
The following example will play file1.wav from start offset of 1 second to end offset of 3 seconds, then twice file2.wav from second 5 to second 10.
  "file1.wav:0:1000:3000,file2.wav:2:5000:10000"
 
==== Example 3 ====
The following example will play file1.wav once, ending at offset of 30 seconds.
  "file1.wav:0:0:30000"
 
 
 
=== announcement_tone  ===
 
  params[:bridge][:announcement_tone] = "announcement.wav"
 
Audio file played on the incoming call before any outgoing call is placed. The outgoing call occurs when the file finished playing.
 
==== announcement_tone options ====
===== announcement_tone_answer =====
  params[:bridge][:announcement_tone_answer] = "yes"
 
Forces an answer of the call before playing the announcement. Default if argument not provided is "no", in which case call is only alerted with in-band media.
 
 
 
=== ring_tone  ===
  params[:bridge][:ring_tone] = "ringing.wav"
 
Audio file played on the incoming call while waiting for the outgoing call to be answered.
 
Ring tone playback can also be configured in the Web Portal, from the incoming call's profile (under "Tones and Call Progress Options").
 
Routing script has precedence over profile (a routing script that fills params[:bridge][:ring_tone] will override the profile's ring tone behavior).
 
==== ring_tone options ====
===== ring_tone_state =====
  params[:bridge][:ring_tone_state] = :alerted
 
Call state from which ring tone is being played. Available values are:
* '''immediately''':  Ring tone starts playing immediately on the incoming leg
* '''accepted''':    Ring tone starts playing as soon as outgoing call is accepted
* '''callprogress''': Ring tone starts playing as soon as "call progress" is received on the outgoing call
* '''alerted''' (default):      Ring tone starts playing only once outgoing call is alerted (but won't play if alert indicates early media from outgoing call)
 
This option also apply when params[:bridge][:ring_tone] is not used, because it also apply to ring tone playback configured in the Web Portal, from the incoming call's profile.
 
=== busy_tone  ===
  Toolpack 2.8 and above:
    params[:bridge][:busy_tone] = "no_route.wav"
 
  Note: Obsolete name (toolpack 2.7.153 and earlier, but still supported in recent releases):
    params[:bridge][:call_progress_tone] = "no_route.wav"
 
Audio file played on the incoming call when outgoing call fails (never answered).
 
Note that announcement_tone, if used, is played before the outgoing call attempt is made, and thus before the busy_tone.
 
Busy tone playback can also be configured in the Web Portal, from the incoming call's profile (under "Tones and Call Progress Options").
 
Routing script has precedence over profile (a routing script that fills params[:bridge][:busy_tone] will override the profile's busy tone behavior).
 
Special value '''"none"''' can be used by routing script to force playing nothing (as empty string would default to profile's behavior)
 
==== busy_tone options ====
===== busy_tone_answer =====
  params[:bridge][:busy_tone_answer] = "yes"
 
Forces an answer of the call before playing the busy tone. Default if argument not provided is "no", in which case call is only alerted with in-band media.
 
=== disconnect_tone  ===
  params[:bridge][:disconnect_tone] = "max_duration.wav"
 
Audio file played on the incoming call when call duration (:max_call_duration) is reached. Then the leg will be terminated with specified reason (:call_duration_reason).
 
==== disconnect_tone options ====
===== disconnect_tone_answer =====
  params[:bridge][:disconnect_tone_answer] = "yes"
 
Forces an answer of the call before playing the disconnect tone. Default if argument not provided is "no", in which case call is only alerted with in-band media.
 
===== max_call_duration  =====
  params[:bridge][:max_call_duration] = "60000"
 
Maximum call duration in millisecond. This timer is started when entering answer state.
 
===== call_duration_reason  =====
  params[:bridge][:call_duration_reason] =&nbsp;:resource_unavailable
 
Drop both legs with this reason when call duration (:max_call_duration) is reached.
 
 
 
=== Managing audio prompts through Web Portal ===
Audio prompts can be uploaded or deleted from the TMedia unit through the Web Portal:
[[Toolpack:Configuring_Audio_Prompts_A|Managing audio prompts]]
 
Prompts management must be done using the Web Portal of the primary server (in systems with redundant TMedia units or redundant host servers).
The file will automatically get replicated to the secondary server.
 
=== Managing audio prompts manually ===
Any file on the TMedia host file system can be played. This means it's possible to manage prompts through ssh/scp.
 
==== The default (replicated) prompts folder ====
By default, when playing a prompt, Toolpack will look in the default prompts folder:
/lib/tb/toolpack/pkg/prompts
The root of this "prompts" directory is automatically replicated to secondary unit of redundant setups (1+1, N+1, redundant hosts). Sub-folders won't be replicated.
 
Any prompt play request without explicit file path will map to this folder. For example:
  params[:bridge][:busy_tone] = "no_route.wav"
This will correspond to file /lib/tb/toolpack/pkg/prompts/no_route.wav
 
==== Relative file paths ====
Any file path that begins with "file://" is considered relative to the tbstreamserver application's working directory:
/lib/tb/toolpack/setup/12358/2.8/apps/tbstreamserver/
(Where "2.8" may be replaced by the current major version of your system)
 
For example:
  params[:bridge][:busy_tone] = "file://my_folder/no_route.wav"
This will correspond to file /lib/tb/toolpack/setup/12358/2.8/apps/tbstreamserver/my_folder/no_route.wav
 
==== Absolute file paths ====
Absolute paths can also be provided.
For example:
  params[:bridge][:busy_tone] = "file:///root/my_folder/no_route.wav"
This will correspond to file /root/my_folder/no_route.wav
 
== Recording call legs  ==
Introduced in release 2.6.44, it's now possible to use routing scripts to ask for recording incoming and/or outgoing call legs.
 
See example filter script "call_recording" (created by default in Web Portal routing scripts starting with 2.6.44) for an example.
 
=== Recording the incoming call leg  ===
To record the incoming call leg, the routing script (in a "after filter" for example) has to set the following parameter:
 
  bridge[ :record_incoming ]  = ""
 
=== Recording the outgoing call leg  ===
To record the outgoing call leg, the routing script (in a "after filter" for example) has to set the following parameter, per route (the decision to record or not, or the file name to record to, can be set per matching route):
 
  # Need to clone the routes in order to have the right to modify them
  routes = clone_routes params[:routes]
  routes.each do |route|
    route[ :record_outgoing ]  = ""
  end
  # Store modified routes back to the parameters for this outgoing call
  params[:routes] = routes
 
=== Record the outgoing call leg within incoming leg's recorded file (mixing)  ===
  [...]
    route[ :record_outgoing ]  = "@{MixWithIncoming}"
  [...]
 
=== Choosing file path to record to  ===
The value assigned to ":record_incoming" or ":record_outgoing" is the path to record the file to.
 
The paths can be absolute, or relative. When relative, they are relative to the "tbstreamserver" application working directory, for example:
  /lib/tb/toolpack/setup/12358/2.7/apps/tbstreamserver/
 
* Empty file name will default to a name that contains various information about the call:
** ''LinkId'':    Id common between all legs of this call bridge
** ''LegId'':      Unique Id for this leg
** ''Nap'':        Current NAP name this call leg is from
** ''Direction'':  "IN" or "OUT" (depends if call leg is incoming or outgoing leg)
** ''Calling'':    The calling number of this call leg
** ''Called'':    The called number of this call leg
** ''Protocol'':  The signaling protocol of this call leg (SS7, ISDN, CAS, SIP)
** ''Media info'': Codec + IP/Port for SIP calls, Trunk/Timeslot for TDM calls
* To record outgoing call leg in the same audio file as incoming call leg (mixing), use the following:
** @{MixWithIncoming}: Record outgoing legs in same file as incoming legs
* Variables can be used to insert in the recording path information that's not already available from routing scripts:
** @{DefaultName}: Same file name (without parent folder path) as the one used when empty string is provided
*** Example: "73EBA698-F3D67B4B-NAP_SS7-IN-5550000-5550001-SS7-TRUNK_BELL_11-24.wav"
*** Example: "73EBA698-73EBA698-NAP_SIP-OUT-5550000-5550001-SIP-G723-10.3.10.101-1050.wav"
** @{DefaultPath}: Same path as the one used when empty string is provided
*** Example: "/lib/tb/toolpack/setup/12358/recorded_calls/73EBA698-F3D67B4B-NAP_SS7-IN-5550000-5550001-SS7-TRUNK_BELL_11-24.wav"
*** Example: "/lib/tb/toolpack/setup/12358/recorded_calls/73EBA698-73EBA698-NAP_SIP-OUT-5550000-5550001-SIP-G723-10.3.10.101-1050.wav"
** @{LinkId}: Current LinkId (Id common between all legs of this call bridge)
*** Example: "73EBA698"
** And all variables listed here: [[Customer_application_framework:play_audio_files#Helpful_variables_to_build_play_or_record_file_paths|Building play or record file path]]
 
== Controlling UUI (user-to-user information) relay  ==
UUI (user-to-user information) can be present in different messages received by either call leg during a call. For example, information can be carried during the initial invite, other information can be carried when the call is alerted, answered, or terminated.
 
Routing scripts can control if the UUI received from one leg through the call will be forwarded or not to the other call leg:
*uui_forward_enabled
 
Routing scripts can also read and modify the UUI received with the incoming call leg, before it gets forwarded upon creation of the outgoing call leg:
*uui
 
=== UUI (user-to-user indication) values  ===
 
Byte 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 values  ===
 
Controls 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 between call legs
* 1/true: UUI is forwarded between call legs
 
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.
 
== Authorization ==
Starting with release 2.7, it is possible to issue RADIUS authorization requests from routing scripts. To do so, the params[:authorization] object must be filled with the required RADIUS attributes and [[#Refuse|an exception must be raised]] with reason :authorization_required.
 
When the authorization is completed, the routing script is called again with the result. The params[:authorization] object will be filled with the RADIUS attributes from the response. The params[:authorization][:result] field will also contain a string indicating the result of the authorization:
 
* ''accept'': The authorization was successful.
* ''reject'': The authorization was refused.
* ''challenge'': The authorization was challenged.
* ''timeout'': The authorization was not answered.
 
== Call diversion options ==
It's possible to control the call flow when a call diversion information is received in the alerting state.
 
Two fields are available: bridge[ :diversion ] and bridge[ :diversion_reason ]
 
The internal release cause TOOLPACK_DIVERT_NOT_ALLOWED is used by gateway application to terminate both legs.
 
  bridge[ :diversion ] = :allowed
The alert message will not be analyzed and the call will be progressed. Default behavior.
  bridge[ :diversion ] = :not_allowed
If the alert message indicates that the call is diverted, the call will be released no matter the In-band information to allow
early media.
  bridge[ :diversion ] = :not_allowed_w_early_media
The call will be released If the alert message indicates that the call is diverted with in-band information to allow early media.
  bridge[ :diversion_reason ] = "*"
If the diversion is not allowed, the gateway will drop the call for any redirecting reason.
  bridge[ :diversion_reason ] = []
  bridge[ :diversion_reason ] << :busy
  bridge[ :diversion_reason ] << :unconditional
If the diversion is not allowed, the redirecting reason will be analyzed and the call will only be dropped for the configured cases.
 
See section [[Routing_script_tutorial:Mini_Development_Guide#Redirecting_number_reason_values|Redirecting number reason values]].
 
 
== Call transfer requests ==
Toolpack allows to relay [[Call transfer]] requests from one leg to the other, or to process them locally (making another outgoing call to replace the call that requested the call transfer).
 
If the chosen [[Call transfer]] mode is to process requests locally, upon reception of a call transfer request (SIP REFER or ISDN Facility), routing script will be called once again, to select the routes for the new outgoing call (call transfer target).
 
=== How to route call transfer request ===
Routing of a call transfer request is done exactly like routing of a normal incoming call.
The routing script generally does not need any modification to support that.
 
In some cases, the routing script may want to use information related to the transfer request to perform routing, or to insert information in the outgoing call leg.
Additional information is provided to the routing script, allowing routing decisions using information from the call transfer request (SIP REFER or ISDN Facility).
See below...
 
=== params[ :call ] content during transfer request ===
When processing a call transfer request, the params[ :call ] hash contains the information from the inbound call (same as was passed to the routing script upon arrival of the inbound call)
call = params[ :call ]          -> Information from original inbound call, with exception of call[ :called ]
 
One exception (convenient because it allows a unmodified routing script to process call transfer request the same way as any other routing request):
call[ :called ]                -> Replaced by the called number from the call transfer request (also called "redirection number")
Complementary information:
call[ :original_called_number ] -> Contains the called number that was initially received from the incoming call, prior to call transfer request
call[ :redirecting_number ]    -> Number of the call from which the call transfer request was received (generally equals to original_called_number)
 
These fields will also be included in the outgoing call made after routing:
* original called number and redirecting number are existing fields on SS7 and ISDN calls
* SIP "diversion" header is used for SIP calls
 
=== params[ :transfer ] content ===
(this if valid only for release 2.7.102 and above)<br>
When processing a call transfer request, information from the call transfer request message (SIP REFER, ISDN Facility) is provided in params[ :transfer ]:
  transfer = params[ :transfer ]
The following field is always present:
  transfer[ :original_nap ]      -> Contains the NAP of the first call from which a call transfer request was received
  transfer[ :redirecting_nap ]  -> Contains the NAP of the call from which the current call transfer request was received
                                    (same as :original_nap for the first call transfer, different for subsequent transfers)
Examples of other fields that may be present, when appropriate:
  transfer[ :uui ]              -> The UUI (user-to-user information) found in the call transfer request
  transfer[ :sip_header ]        -> Contains custom SIP headers from the call transfer request
  transfer[ :request_uri ]      -> Contains the SIP Request URI
 
These field are 'read-only'. They won't be included in the outgoing call, as they represent the content of the call transfer request, not the outgoing call to make.
 
To insert/modify attributes of the outgoing call, the parameters from params[ :call ] must be edited instead.
 
== Reason values  ==
 
Check here for Termination Reason Cause codes:<br>
 
[[Termination_cause_codes|Termination Reason Cause codes]]
<br>
 
Example to refuse an incoming call leg.
  raise RoutingException, :no_route
 
Reason cause strings available inside routing scripts:
 
List of Q.850 reason causes:
  :unallocated_number
  :no_route_to_network
  :no_route_to_destination
  :send_special_tone
  :misdialled_trunk_prefix
  :channel_unacceptable
  :call_awarded_in_established_channel
  :preemption
  :reattempt
  :ported_number
  :normal_call_clearing
  :user_busy
  :no_user_responding
  :no_answer_from_user
  :subscriber_absent
  :call_rejected
  :number_changed
  :redirection
  :exchange_routing_error
  :non_selected_user_clearing
  :destination_out_of_order
  :address_incomplete
  :facility_rejected
  :response_to_status_enquiry
  :normal_unspecified
  :no_circuit_available
  :network_out_of_order
  :frame_mode_out_of_service
  :frame_mode_connection_operational
  :temporary_failure
  :switching_equipment_congestion
  :access_information_discarded
  :requested_circuit_not_available
  :precedence_call_blocked
  :resource_unavailable
  :quality_of_service_not_available
  :requested_facility_not_subscribed
  :outgoing_calls_barred
  :outgoing_calls_barred_within_cug
  :incoming_calls_barred
  :incoming_calls_barred_within_cug
  :bearer_cap_not_authorized
  :bearer_cap_not_available
  :inconsistency_access_info
  :service_not_available
  :bearer_cap_not_implemented
  :channel_type_not_implemented
  :requested_facility_not_implemented
  :only_restricted_digital_info
  :service_not_implemented
  :invalid_call_reference
  :channel_does_not_exist
  :call_identity_does_not_exist
  :call_identity_in_use
  :no_call_suspended
  :call_has_been_cleared
  :user_not_member_of_cug
  :incompatible_destination
  :non_existant_cug
  :invalid_transit_network
  :invalid_message_unspecified
  :mandatory_ie_missing
  :message_type_non_existent
  :not_compatible_with_call_state
  :ie_non_existent
  :invalid_ie_content
  :message_not_compatible
  :recovery_on_timer_expiry
  :parameter_non_existent_passed_on
  :msg_with_non_recognized_param_discarded
  :protocol_error
  :interworking_unspecified
 
List of toolpack reason causes:
 
  :toolpack_normal                      or :normal
  :toolpack_resource_error              or :resource_error
  :toolpack_timeout                      or :timeout
  :toolpack_no_route                    or :no_route
  :toolpack_call_collision              or :call_collision
  :toolpack_sync_drop                    or :sync_drop
  :toolpack_signaling_error              or :signaling_error
  :toolpack_locally_rejected            or :locally_rejected
  :toolpack_interface_not_available      or :interface_not_available
  :toolpack_reset_in_progress            or :reset_in_progress
  :toolpack_adapter_reject              or :adapter_reject
  :toolpack_missing_or_invalid_ie        or :missing_or_invalid_ie
  :toolpack_incoming_only                or :incoming_only
  :toolpack_system_configuration_changed or :system_configuration_changed
  :toolpack_resource_no_more_available  or :resource_no_more_available
  :toolpack_incompatible_media          or :incompatible_media
  :toolpack_resource_allocation_failed  or :resource_allocation_failed
  :toolpack_data_path_not_available      or :data_path_not_available
  :toolpack_local_congestion            or :local_congestion
  :toolpack_authorization_required      or :authorization_required
  :toolpack_call_divert_is_not_allowed  or :call_divert_is_not_allowed
 
List of SIP reason causes:<br/>
Reason causes starting with a digit must use the following syntax (can't use : as prefix).
 
  '400_bad_request'
  '401_unauthorized'
  '402_payment_required'
  '403_forbidden'
  '404_not_found'
  '405_method_not_allowed'
  '406_not_acceptable'
  '407_proxy_authentication_required'
  '408_request_timeout'
  '409_conflict'
  '410_gone'
  '413_request_entity_too_large'
  '414_request_URI_too_long'
  '415_unsupported_media'
  '416_unsupported_URI_scheme'
  '420_bad_extension'
  '421_extension_required'
  '422_session_timer_too_small'
  '423_interval_too_brief'
  '429_referrer_identity_error'
  '480_temporary_unavailable'
  '481_call_or_transaction_does_not_exist'
  '482_loop_detected'
  '483_too_many_hops'
  '484_address_incomplete'
  '485_ambiguous'
  '486_busy_here'
  '487_request_terminated'
  '488_not_acceptable_here'
  '489_bad_event'
  '491_retry_after'
  '500_server_internal_error'
  '501_not_implemented'
  '502_bad_gateway'
  '503_service_unavailable'
  '504_server_timeout'
  '505_version_unsupported'
  '513_message_too_large'
  '600_busy_everywhere'
  '603_decline'
  '604_not_exist_anywhere'
  '606_not_acceptable'
 
== Nap status  ==
 
All 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.
 
  Routing script call attribute name    Description
  --------------------------------------------------------------------------------------------
  "signaling_type"                      Signaling type.
  "inst_incoming_call_cnt"              Instantaneous Count of incoming calls.
  "inst_outgoing_call_cnt"              Instantaneous Count of outgoing calls.
  "available_cnt"                      Number of available circuits or channels.
  "unavailable_cnt"                    Number of unavailable circuits or channels.
  "availability_percent"                Percentage of available circuits or channels.
  "usage_percent"                      Percentage of used circuits or channels.
  "unused_shared_percent"              Percentage of used circuits or channels of this NAP available to make new calls with (taking into account shared with other NAPs)
  "total_incoming_call_cnt"            Total Count of incoming calls.
  "asr_statistics_struct"              Detailed Answer-Seizure Rate Statistics.
  "global_asr_percent"                  Global calculated ASR percentage.
  "total_outgoing_call_cnt"            Total Count of outgoing calls.
  "last_24h_asr_percent"                Last 24 hours calculated ASR percentage.
  "last_24h_outgoing_call_cnt"          Last 24 hours outgoing calls.
  "current_hour_asr_percent"            Current hour calculated ASR percentage.
  "current_hour_outgoing_call_cnt"      Current hour outgoing calls.
  "last_hour_asr_percent"              Last hour calculated ASR percentage.
  "last_hour_outgoing_call_cnt"        Last hour outgoing calls.
  "availability_detection_struct"      Detailed availibility detection Statistics
  "poll_remote_proxy"                  Remote proxy polling enabled
  "is_available"                        Remote proxy actually available or not
  "time_since_polling"                  Time since the last availibility polling
  "time_available_seconds"              Number of seconds since the NAP is available
  "time_unavailable_seconds"            Number of seconds since the NAP is unavailable
  "registration_struct"                Detailed registration Statistics
  "register_to_proxy"                  Register to proxy enabled
  "registered"                          Actually registered or not
  "time_since_refresh"                  Time since the last refresh
  "time_registered_seconds"            Number of seconds since the NAP is registered
  "time_not_registered_seconds"        Number of seconds since the NAP is not registered
 
 
<br> If the nap status is part of a substructure, it's name in the routing scripts must be composed of the structure name appended by an underscore and the field name.
 
For example the name to use for the global [[ASR]] percentage is:
 
  asr_statistics_struct_global_asr_percent
 
<br> It is also possible to add dynamic nap attributes in the web portal. These can be referenced by their name.


== Routing Script Tests ==
== Routing Script Tests ==
The Web portal features a tool for Testing Scripts. The user must enter parameters to simulate the incoming call and after pressing the Test button, will output selected routes and numbers.  You do not need to activate the new routes, or the new scripts to use this test tool: It can be used to test the routing scripts and routing table before activating it.
[[Routing Script Tutorial: Routing Script Tests|Learn how to use the Web Portal to test your routing scripts.]]
This is available in the Routing Scripts section of the Web portal.
 
=== Test parameters ===
==== @call_params  ====
 
That variable should contain a hash of call parameters that will passed to the routing script. This is equivalent to the incoming call parameters.
 
<br>
 
==== @nap_list  ====
 
A 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.
 
<br>
 
==== @params  ====
 
A 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"}}
 
<br>
 
----
 
<br> Back to [[Routing script tutorial|Routing Script Tutorial]].
 
[[category:Needs revising]]

Latest revision as of 09:58, 9 May 2024


Hide TOC

Introduction

This Routing Script Tutorial provides you with essential information in managing the routing of your calls. Consult the sections below to learn more.

An alternate version of this guide for routing scripts is available. Consult it to enhance your learning.

Accessing Routing Script Parameters

Learn how to access routing script parameters.

Routing Script Parameter Mapping Table

Learn how each Routing Script Parameter maps to varying protocols.

Script Parameters Definition

Learn about the definition of each script parameter.

Script Parameters Definition for SIP

Learn about the definition of each script parameter for SIP.

Registered Users Information

Learn how routing scripts access information about registered users.

Route Parameters and Call Routing

Learn about the standard parameters used in a call and how they route to registered users.

Playing prompts announcements or tones

Learn how to play all sorts of media files for call prompts, announcements, and tones.

Recording

Learn how to use routing scripts to record incoming and/or outgoing call legs.

User-to-User Information

Learn how to use User-to-User Information (UUI) in routing scripts.

Radius Autorization

Learn how to send RADIUS authorization requests in routing scripts.

ENUM Query

Learn how to send ENUM Query requests to DNS servers in routing scripts.

DNS Query

Learn how to send DNS Query requests to DNS servers in routing scripts.

Call Diversion Options

Learn how control a call flow with diversion options.

Call Transfer Requests

Learn how to route call transfer requests.

Redirection

Learn how to get redirection contacts.

Connected Number

Connected Number

Terminating Calls

Learn how to terminate calls with routing scripts.

NAP status and other NAP information

Learn how to use NAP status field in routing scripts.

Telephony Services (CNAM Request over SS7)

Learn how to manage CNAM requests over SS7.

Custom User Context

Custom User Context

Routing Script Tests

Learn how to use the Web Portal to test your routing scripts.