Hooks

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:

Actioncallerdestination
is_alpha_numberphonenumber_caller_is_alpha_numberphonenumber_destination_is_alpha_number
convert_alpha_characters_in_numberphonenumber_caller_alpha_characters_in_numberphonenumber_destination_alpha_characters_in_number
normalize_digits_onlyphonenumber_caller_digits_onlyphonenumber_destination_digits_only
normalize_diallable_chars_onlyphonenumber_caller_diallable_chars_onlyphonenumber_destination_diallable_chars_only
get_national_significant_numberphonenumber_caller_national_significant_numberphonenumber_destination_national_significant_number
format_out_of_country_calling_numberphonenumber_caller_out_of_country_calling_numberphonenumber_destination_out_of_country_calling_number
formatphonenumber_caller_formatphonenumber_destination_format
get_number_typephonenumber_caller_number_typephonenumber_destination_number_type
is_valid_number_for_regionphonenumber_caller_valid_number_for_regionphonenumber_destination_valid_number_for_region
get_region_codephonenumber_caller_region_codephonenumber_destination_region_code
is_possible_number_with_reasonphonenumber_caller_is_possible_number_with_reasonphonenumber_destination_is_possible_number_with_reason
is_possible_numberphonenumber_caller_is_possible_numberphonenumber_destination_is_possible_number
get_description_for_numberphonenumber_caller_description_for_numberphonenumber_destination_description_for_number