NAME

Asterisk::LCR::Dialer - Generic dialer object

SYNOPSIS

use Asterisk::LCR::Dialer;
my $dialer = Asterisk::LCR::Dialer::<CONCRETE_CLASS>->new ();

SUMMARY

Represents a generic dialing strategy. The strategy is defined in the $self->process() method, which in this package is undefined.

ATTRIBUTES

limit (numerical scalar)

Limit dialing strategies to 'limit' cheapest routes. Optional.

opts (scalar)

Options to be appended to the dialstring. Example:

'120|HS(7200)'

METHODS

$self->locale();

Returns the 'locale' attribute.

$self->set_locale ($locale);

Sets the 'locale' attribute to $locale.

$self->limit();

Returns the optional 'limit' attribute.

Returns 100000 if it's not defined (quasi-infinity)

$self->set_limit ($limit);

Sets the optional 'limit' attribute to $limit.

$self->opts();

Returns the optional 'opts' attribute.

If the 'opts' attribute is not TRUE, returns an empty string.

If the 'opts' attribute doesn't start with a pipe symbol, returns it prefixed with |.

$self->set_opts ($opts);

Sets the optional 'opts' attribute to $opts.

$self->process ($number);

Turns $number into a canonical, global number if $number if $self->locale() returns an Asterisk::LCR::Locale object.

Then calls $self->_process ($number). This method must be defined in subclasses.

$self->dial ($str);

Dials string $str, eventually with options $self->opts();

$self->dial_string ($number, $rate)

Returns a string from a variable template suitable for use within Dial()

Extract a string dial template from the asterisk config file.

For example, say $rate->{provider} = 'voipjet'. This method will look for an asterisk variable called 'ASTERISK_LCR_TMPL_VOIPJET'. The grammar to be used for this syntax is:

VARIABLE: [LOCALE] DIAL_STRING

LOCALE: (scalar string, i.e. 'us' or 'fr' or even /var/mylocale.txt)

DIAL_STRING: <whateverwhatever>REPLACEME<whateverwhatever>

Where REPLACEME will be replaced by the phone number to dial.

If LOCALE is defined and an Asterisk::LCR::Locale object can be created, then $num is assumed to be given as a canonical, international number.

For example, if LOCALE is 'fr' and the number is 33575874745, then 05175874745 will be dialled instead.

Otherwise the number is dialed "as is".

$self->rates ($number);

Returns an array of rates for $number, sorted cheapest first.