Multi modem - kalkun-sms/Kalkun GitHub Wiki
So lets say you have more than one phone/modem and you want to utilize all modems with Kalkun. Then this feature is right for you.
Make sure gammu-smsd is configured
You must configure gammu-smsd to work with all modems that you want to use with Kalkun. This blog post Using gammu-smsd with multiple phone might help you.
The key is on the phoneid, you have to set different/unique phoneid for all modems. For this example, let's say you have 2 modems, and the phoneid are sierra
and fasttrack
.
The strategy
Kalkun comes up with some strategy that might suit your needs.
Scheduled Time
Let say you want to use sierra modem to work from 00:00:00
to 12:00:00
. And fasttrack on 12:00:01
through 23:59:59
. Then your configuration should be like this:
$config['multiple_modem_strategy'] = 'scheduled_time';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = '00:00:00-12:00:00';
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = '12:00:01-23:59:59';
The valid format is HH:MM:SS-HH:MM:SS
.
Scheduled Day
You want to use sierra on Sunday
until Wednesday
and fasttrack on Thursday
through Saturday
.
$config['multiple_modem_strategy'] = 'scheduled_day';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = '0-3';
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = '4-6';
The valid value is 0
through 6
. Where 0
is Sunday, 1
is Monday, 2
is Tuesday, 3
is Wednesday, 4
is Thursday, 5
is Friday, and 6
is Saturday.
Scheduled Date
You want to use sierra from 17 April 2012
to 17 May 2012
and fasttrack from 18 May 2012
through 18 June 2012
.
$config['multiple_modem_strategy'] = 'scheduled_date';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = '2012-04-17:2012-05-17';
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = '2012-05-18:2012-06-18';
The valid format is YYYY-MM-DD:YYYY-MM-DD
Phone Number Prefix
You want to use sierra to deliver SMS that destinate to phone number that have prefix +62813
and +62856
. While fasttrack to prefix +62857
and +62812
.
$config['multiple_modem_strategy'] = 'phone_number_prefix';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = array('+62813', '+62856');
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = array('+62857', '+62812');
Note that the value must be in array form, just like example above.
Phone Number
You want sierra to handle SMS to phone number +628123456789
and +6285987654321
. While fasttrack to +62857890123
and +628131000112
.
$config['multiple_modem_strategy'] = 'phone_number';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = array('+628123456789', '+6285987654321');
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = array('+62857890123', '+628131000112');
Note that the value must be in array form, just like example above.
Round Robin
You want to all modem take equal portions and in circular order.
$config['multiple_modem_strategy'] = 'round_robin';
$config['multiple_modem'] = array('sierra', 'fasttrack');
User
Only specific user (defined by user id) can use specific modem.
$config['multiple_modem_strategy'] = 'user';
$config['multiple_modem'][0]['id'] = 'sierra';
$config['multiple_modem'][0]['value'] = array(1, 2);
$config['multiple_modem'][1]['id'] = 'fasttrack';
$config['multiple_modem'][1]['value'] = array(3, 4);
Other strategy that not been implemented yet is failover
.
Combine two strategies
You can also use two strategies at the same time as long as it's valid. For example scheduled_time:round_robin
(stategy name is divided by :
).
This combination allows you to select multiple modems for a same time range, and those available/valid modems will be selected again with round robin strategy.
Valid combination format: (First:Second
)
Example:
- Valid combination
phone_number_prefix:round_robin
scheduled_day:recent
- Invalid/wrong combination
round_robin:phone_number_prefix
round_robin:recent
What happens if no criteria matched on the strategy?
Kalkun will use first modem listed as default value, in this case sierra.
How to proceed with the configuration file?
Again, open up the configuration file, and find section about Multiple phone/modem support.
Is this feature enabled by default?
No, you have to enabled it manually.
$config['multiple_modem_state'] = FALSE;
Change it to TRUE
.