get_number_type

get_number_type

Gets the type of a valid phone number, or UNKNOWN if it is invalid.

This action makes use of the default_region parameter.

Consider the following dialplan fragments:

  <action application="phonenumber" data="get_number_type caller default_region=US"/>

will set the phonenumber_caller_number_type channel variable to the resulting value.


  <action application="phonenumber" data="get_number_type destination default_region=US"/>

will set the phonenumber_destination_number_type channel variable to the resulting value.


  <action application="phonenumber" data="get_number_type all default_region=US"/>

will set both the phonenumber_caller_number_type and the phonenumber_destination_number_type channel variables to the resulting value.


  <action application="phonenumber" data="get_number_type ${variable} default_region=US"/>

will set the phonenumber_number_number_type channel variable to the resulting value.

freeswitch@test> phonenumber get_number_type 6172531000 default_region=US

FIXED_LINE_OR_MOBILE

freeswitch@test> phonenumber get_number_type 02076792000 default_region=GB

FIXED_LINE

freeswitch@test> phonenumber get_number_type 07400982200 default_region=GB

MOBILE

freeswitch@test> phonenumber get_number_type 18006427676 default_region=CA

TOLL_FREE

Consider the following hook definitions:

    <hook>
      <param name="scope" value="caller"/>
      <param name="actions" value="get_number_type"/>
      <param name="default_region" value="US"/>
    </hook>

will set the phonenumber_caller_number_type channel variable to the resulting value.


    <hook>
      <param name="scope" value="destination"/>
      <param name="actions" value="get_number_type"/>
      <param name="default_region" value="US"/>
    </hook>

will set the phonenumber_destination_number_type channel variable to the resulting value.


    <hook>
      <param name="scope" value="all"/>
      <param name="actions" value="get_number_type"/>
      <param name="default_region" value="US"/>
    </hook>

will set both the phonenumber_caller_number_type and the phonenumber_destination_number_type channel variables to the resulting value.