is_possible_number_with_reason

is_possible_number_with_reason

Checks whether a phone number is a possible number, with a level of detail. It returns one of the following: IS_POSSIBLE, INVALID_COUNTRY_CODE, TOO_SHORT, TOO_LONG OR UNKNOWN.

This action makes use of the default_region parameter.

Consider the following dialplan fragments:

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

will set the phonenumber_caller_is_possible_number_with_reason channel variable to the resulting value.


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

will set the phonenumber_destination_is_possible_number_with_reason channel variable to the resulting value.


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

will set both the phonenumber_caller_is_possible_number_with_reason and the phonenumber_destination_is_possible_number_with_reason channel variables to the resulting value.


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

will set the phonenumber_number_is_possible_number_with_reason channel variable to the resulting value.

freeswitch@test> phonenumber is_possible_number_with_reason +16172531000

IS_POSSIBLE

freeswitch@test> phonenumber is_possible_number_with_reason 253-1000

IS_POSSIBLE

freeswitch@test> phonenumber is_possible_number_with_reason +999237000

INVALID_COUNTRY_CODE

freeswitch@test> phonenumber is_possible_number_with_reason +1256300

TOO_SHORT

freeswitch@test> phonenumber is_possible_number_with_reason 077400982200 default_region=IT

TOO_LONG

Consider the following hook definitions:

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

will set the phonenumber_caller_is_possible_number_with_reason channel variable to the resulting value.


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

will set the phonenumber_destination_is_possible_number_with_reason channel variable to the resulting value.


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

will set both the phonenumber_caller_is_possible_number_with_reason and the phonenumber_destination_is_possible_number_with_reason channel variables to the resulting value.