Skip to content

Commit

Permalink
Merge pull request #149 from jbubik/master
Browse files Browse the repository at this point in the history
Database handling improved for Alternate Gateways
  • Loading branch information
back2arie committed Jun 7, 2014
2 parents eb88d73 + 0bbff24 commit c07d04c
Show file tree
Hide file tree
Showing 16 changed files with 2,355 additions and 1,316 deletions.
31 changes: 31 additions & 0 deletions application/config/kalkun_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@
$config['kalkun_upgradeable'] = TRUE;
$config['kalkun_previous_version'] = '0.6';

/*
|--------------------------------------------------------------------------
| Gateway Engine (Default to Gammu)
|--------------------------------------------------------------------------
|
| Valid engine are:
| gammu <http://wammu.eu>
| kannel <http://kannel.org> - Experimental
| clickatell <http://clickatell.com> - Experimental
| ozeking <http://ozekisms.com> - Experimental
| nowsms <http://nowsms.com> - Experimental
| way2sms <http://way2sms.com> - Experimental
| tmobilecz <https://sms.t-mobile.cz/closed.jsp> - Experimental
*/
$config['gateway']['engine'] = 'gammu';
$config['gateway']['url'] = 'http://localhost:13013';
$config['gateway']['username'] = 'username';
$config['gateway']['password'] = 'password';
$config['gateway']['api_id'] = 'xxx1234567890';
// for tmobilecz you must specify the credentials to log-in to T-Mobile CZ portal
// numeric keys - credentials for specific kalkun user (user's ID from table "user")
// key "default" - credentials for all other Kalkun users
// subkey "user" and "pass" - string - username and password for T-Mobile CZ portal
// subkey "hist" - boolean - save copies of SMS in T-Mobile CZ portal
// subkey "eml" - string - T-Mobile CZ will send copy of SMS to specified e-mail. Leave empty to switch off.
$config['gateway']['tmobileczauth'] = array(
1=>array('user'=>'admins login', 'pass'=>'his_password', 'hist'=>true, 'eml'=>''),
2=>array('user'=>'2nd users login','pass'=>'her_password', 'hist'=>true, 'eml'=>''),
'default'=>array('user'=>'all others', 'pass'=>'their_password','hist'=>true, 'eml'=>'')
);

/*
|--------------------------------------------------------------------------
| Gammu Location (currently only used if you want to send WAP link)
Expand Down
17 changes: 16 additions & 1 deletion application/controllers/daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function __construct()
// --------------------------------------------------------------------

/**
* Message routine
* Incoming Message routine
*
* Process the new/unprocessed incoming sms
* Called by shell/batch script on Gammu RunOnReceive directive
Expand Down Expand Up @@ -219,6 +219,21 @@ function server_alert_daemon()
}
}


/**
* Outbox Message routine for Alternate Gateways
*
* Process outgoing sms waiting in outbox
* Called by shell/batch script via Crontab
*
* @access public
*/
function outbox_routine()
{
$this->load->model(array('Message_model'));
// send waiting messages
$this->Message_model->process_outbox_queue();
}
}

/* End of file daemon.php */
Expand Down
61 changes: 61 additions & 0 deletions application/models/gateway/clickatell_model.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/**
* Kalkun
* An open source web based SMS Management
*
* @package Kalkun
* @author Kalkun Dev Team
* @license http://kalkun.sourceforge.net/license.php
* @link http://kalkun.sourceforge.net
*/

// ------------------------------------------------------------------------

/**
* Clickatell_model Class
*
* Handle all messages database activity
* for Clickatell <http://clickatell.com>
*
* @package Kalkun
* @subpackage Messages
* @category Models
*/
require_once('nongammu_model'.EXT);

class Clickatell_model extends nongammu_model {

/**
* Constructor
*
* @access public
*/
function __construct()
{
parent::__construct();
$this->gateway = $this->config->item('gateway');

if(empty($this->gateway['url']))
{
$this->gateway['url'] = 'http://api.clickatell.com';
}
}

// --------------------------------------------------------------------

/**
* Send Messages (Still POC)
* Using HTTP API <http://www.clickatell.com/apis-scripts/apis/http-s/>
*
* @return void
*/
function really_send_messages($data)
{
$gateway = $this->gateway;
file_get_contents($gateway['url'].'/http/sendmsg?user='.$gateway['username'].
'&password='.$gateway['password'].'&api_id='.$gateway['api_id'].'&to='.$data['dest'].'&text='.urlencode($data['message']));
}
}

/* End of file clikatell_model.php */
/* Location: ./application/models/gateway/clikatell_model.php */
Loading

0 comments on commit c07d04c

Please sign in to comment.