format_out_of_country_calling_number
Formats a phone number for out-of-country dialing purposes. Note this function takes care of the case for calling inside of NANPA and between Russia and Kazakhstan, which share the same country calling code. In those cases, no international prefix is used. For regions which have multiple international prefixes, the number in its international format will be returned instead.
This action makes use of the default_region
and calling_from
parameters.
Consider the following dialplan fragments:
<action application="phonenumber" data="format_out_of_country_calling_number caller default_region=US,calling_from=CA"/>
will set the phonenumber_caller_out_of_country_calling_number
channel variable to the resulting value.
<action application="phonenumber" data="format_out_of_country_calling_number destination default_region=US,calling_from=CA"/>
will set the phonenumber_destination_out_of_country_calling_number
channel variable to the resulting value.
<action application="phonenumber" data="format_out_of_country_calling_number all default_region=US,calling_from=CA"/>
will set both the phonenumber_caller_out_of_country_calling_number
and the phonenumber_destination_out_of_country_calling_number
channel variables to the resulting value.
<action application="phonenumber" data="format_out_of_country_calling_number ${variable} default_region=US,calling_from=CA"/>
will set the phonenumber_number_out_of_country_calling_number
channel variable to the resulting value.
freeswitch@test> phonenumber format_out_of_country_calling_number '(495) 939-10-00' default_region=RU,calling_from=RU
8 (495) 939-10-00
freeswitch@test> phonenumber format_out_of_country_calling_number '(495) 939-10-00' default_region=RU,calling_from=KZ
8 (495) 939-10-00
freeswitch@test> phonenumber format_out_of_country_calling_number '030 34637000' default_region=DE,calling_from=GB
00 49 30 34637000
freeswitch@test> phonenumber format_out_of_country_calling_number '030 34637000' default_region=DE,calling_from=US
011 49 30 34637000
Consider the following hook definitions:
<hook>
<param name="scope" value="caller"/>
<param name="actions" value="format_out_of_country_calling_number"/>
<param name="default_region" value="US"/>
<param name="calling_from" value="CA"/>
</hook>
will set the phonenumber_caller_out_of_country_calling_number
channel variable to the resulting value.
<hook>
<param name="scope" value="destination"/>
<param name="actions" value="format_out_of_country_calling_number"/>
<param name="default_region" value="US"/>
<param name="calling_from" value="CA"/>
</hook>
will set the phonenumber_destination_out_of_country_calling_number
channel variable to the resulting value.
<hook>
<param name="scope" value="all"/>
<param name="actions" value="format_out_of_country_calling_number"/>
<param name="default_region" value="US"/>
<param name="calling_from" value="CA"/>
</hook>
will set both the phonenumber_caller_out_of_country_calling_number
and the phonenumber_destination_out_of_country_calling_number
channel variables to the resulting value.