get_description_for_number

get_description_for_number

Returns a text description for the given phone number, in the locale provided. The description might consist of the name of the country where the phone number is from, or the name of the geographical area the phone number is from if more detailed information is available. Returns an empty string if the number could come from multiple countries, or the country code is in fact invalid.

This action makes use of the default_region and locale parameters.

Consider the following dialplan fragments:

  <action application="phonenumber" data="get_description_for_number caller default_region=US,locale=en_US"/>

will set the phonenumber_caller_description_for_number channel variable to the resulting value.


  <action application="phonenumber" data="get_description_for_number destination default_region=US,locale=en_US"/>

will set the phonenumber_destination_description_for_number channel variable to the resulting value.


  <action application="phonenumber" data="get_description_for_number all default_region=US,locale=en_US"/>

will set both the phonenumber_caller_description_for_number and the phonenumber_destination_description_for_number channel variables to the resulting value.


  <action application="phonenumber" data="get_description_for_number ${variable} default_region=US,locale=en_US"/>

will set the phonenumber_number_description_for_number channel variable to the resulting value.

freeswitch@test> phonenumber get_description_for_number 6172531000 default_region=US,locale=en_GB

Cambridge, MA

freeswitch@test> phonenumber get_description_for_number 02076792000 default_region=GB,locale=en_US

London

freeswitch@test> phonenumber get_description_for_number 8003569377 default_region=US,locale=en_GB

United States

freeswitch@test> phonenumber get_description_for_number 8003569377 default_region=US,locale=fr_FR

États-Unis

freeswitch@test> phonenumber get_description_for_number 8003569377 default_region=US,locale=es_ES

Estados Unidos

freeswitch@test> phonenumber get_description_for_number 07400982200 default_region=GB,locale=en_US

United Kingdom

freeswitch@test> phonenumber get_description_for_number 07400982200 default_region=GB,locale=fr_FR

Royaume-Uni

freeswitch@test> phonenumber get_description_for_number 07400982200 default_region=GB,locale=es_ES

Reino Unido

Consider the following hook definitions:

    <hook>
      <param name="scope" value="caller"/>
      <param name="actions" value="get_description_for_number"/>
      <param name="default_region" value="US"/>
      <param name="locale" value="en_US"/>
    </hook>

will set the phonenumber_caller_description_for_number channel variable to the resulting value.


    <hook>
      <param name="scope" value="destination"/>
      <param name="actions" value="get_description_for_number"/>
      <param name="default_region" value="US"/>
      <param name="locale" value="en_US"/>
    </hook>

will set the phonenumber_destination_description_for_number channel variable to the resulting value.


    <hook>
      <param name="scope" value="all"/>
      <param name="actions" value="get_description_for_number"/>
      <param name="default_region" value="US"/>
      <param name="locale" value="en_US"/>
    </hook>

will set both the phonenumber_caller_description_for_number and the phonenumber_destination_description_for_number channel variables to the resulting value.