Hooks
This usage mode allows for the module actions to be performed when new channels are being created. A hook is defined as a combination of:
- filters - one can limit the eligible channels by FreeSWITCH context as well as direction (inbound or outbound);
- scope - whether the phone number the actions should be executed against is the caller, the destination or both;
- actions - one or more actions to execute against the scope;
- parameters - the parameters the action should use when executed. When omitted, they will be inferred from the default configuration;
One can define as many hooks as necessary; their definitions are located in module’s configuration file, in the <hooks>
section, the syntax being outlined in the configuration documentation.
In this usage mode, the actions’ output will be returned in the form of channel variables; their naming is dictated by the responsible action as well as the scope. The table below outlines the channel variable names based on the executed action and the scope:
Action | caller | destination |
---|---|---|
is_alpha_number | phonenumber_caller_is_alpha_number | phonenumber_destination_is_alpha_number |
convert_alpha_characters_in_number | phonenumber_caller_alpha_characters_in_number | phonenumber_destination_alpha_characters_in_number |
normalize_digits_only | phonenumber_caller_digits_only | phonenumber_destination_digits_only |
normalize_diallable_chars_only | phonenumber_caller_diallable_chars_only | phonenumber_destination_diallable_chars_only |
get_national_significant_number | phonenumber_caller_national_significant_number | phonenumber_destination_national_significant_number |
format_out_of_country_calling_number | phonenumber_caller_out_of_country_calling_number | phonenumber_destination_out_of_country_calling_number |
format | phonenumber_caller_format | phonenumber_destination_format |
get_number_type | phonenumber_caller_number_type | phonenumber_destination_number_type |
is_valid_number_for_region | phonenumber_caller_valid_number_for_region | phonenumber_destination_valid_number_for_region |
get_region_code | phonenumber_caller_region_code | phonenumber_destination_region_code |
is_possible_number_with_reason | phonenumber_caller_is_possible_number_with_reason | phonenumber_destination_is_possible_number_with_reason |
is_possible_number | phonenumber_caller_is_possible_number | phonenumber_destination_is_possible_number |
get_description_for_number | phonenumber_caller_description_for_number | phonenumber_destination_description_for_number |