In some cases far ends wants to see user=phone on URI and headers. You can simply add this to your URI and headers with following;
Create a new script named add_user_phone
Copy following script part and Save
Code: ## Script version 1.0## Version history:# 1.0 Initial version of this script## This filter is used to add "user=phone" to call URI's#module AddUserPhone def init_add_user_phone(params) end def add_sip_header_param( call, field, param_level, value ) call[ field ] = {} unless call[ field ].is_a? Hash call[ field ] ||= {} # Create a hash if not already present call[ field ][ param_level ] ||= "" # Create a string if not already present call[ field ][ param_level ] += ";" if call[ field ][ param_level ] != "" # Append ; if already some parameters call[ field ][ param_level ] += value # Append the value end def add_user_phone(params) call = params[ :call ] # Add to SIP URI call[:request_uri_forward_enabled] = true if call[:request_uri] && !call[:request_uri].include?( "user=phone" ) call[:request_uri] += ";user=phone" end add_sip_header_param( call, :calling_parameters, :uri_param, "user=phone" ) # Add to From header add_sip_header_param( call, :called_parameters, :uri_param, "user=phone" ) # Add to To header add_sip_header_param( call, :contact_parameters, :uri_param, "user=phone" ) # Add to Contact header add_sip_header_param( call, :private_address_parameters, :uri_param, "user=phone" ) # Add to P-Asserted-Identity add_sip_header_param( call, :redirecting_number_parameters, :uri_param, "user=phone") # Add to SIP Diversion # header # Remote-party-id -> Can't modify for now params end end
Select simple_routing_sbc script and add following script parts and Save
Code: ..require 'add_user_phone'..include AddUserPhone..after_filter :method => :add_user_phone..[*]Activate the configuration
You could use an after filter script to add user=phone easily to the field required. This script is called “sip_header_params.rb” from routing script section of web portal.
Below is a detailed instruction to use this script (it is available in the script itself),
How to use this script
1. Import this script with other filter script in the Web Portal (if not already done)
2. Locate your “main” script (the routing scripts entry point, like “simple_routing.rb”)
and include current filter as an after_remap_filter
2.1. Add the following line at begining of the main routing script to load current filter script:
:documentation => “Add user=phone to user parameters of most SIP headers”,
:type => :uri_param,
:contents => “user=phone”,
:sip_headers => [
:calling,
:called,
:private_address,
:contact,
:redirecting_number,
:original_called_number,
“X-CustomHeader”
]
},
{
:documentation => “Add foo=123 to uri parameters of ‘From’ header”,
:type => :uri_param,
:contents => “foo=bar”,
:sip_headers => [ :calling ]
}
]
3. Optionnally, you can create a new route column named “add_sip_header_params”, type boolean.
This route column (attribute) will determine, per route, if the defined SIP headers must be added or not.
(custom route column can be created in the “Routes” section of the web portal under “Create New Route Column”)
It is self explanatory. The above script also can cater if you want to do this just per route, using point 3, create a new route column. You could do this at static route, “create new route column,
You could also copy existing configuration to another new configuration with new name, and work on the new name configuration, so you would not affect the current active configuration.
For any change, please do save and activate configuration. If there is any question, we could advise you further.
Kindly note routing script development normally would require a purchase of 9-5 professional service package.