├── .gitattributes ├── .gitignore ├── CONTRIBUTING.md ├── app ├── commands │ └── .gitkeep ├── config │ ├── .view.php.swp │ ├── app.php │ ├── auth.php │ ├── cache.php │ ├── compile.php │ ├── local │ │ ├── app.php │ │ └── database.php │ ├── mail.php │ ├── packages │ │ └── .gitkeep │ ├── queue.php │ ├── remote.php │ ├── services.php │ ├── session.php │ ├── testing │ │ ├── cache.php │ │ └── session.php │ ├── view.php │ └── workbench.php ├── controllers │ ├── .gitkeep │ ├── BaseController.php │ ├── DialerController.php │ ├── HomeController.php │ ├── ReportsController.php │ ├── Settings │ │ ├── AsteriskController.php │ │ ├── CallerIDController.php │ │ └── SettingsController.php │ └── UsersController.php ├── database │ ├── migrations │ │ ├── .gitkeep │ │ └── create_migrations_rev1.php │ ├── production.sqlite │ └── seeds │ │ ├── .gitkeep │ │ └── DatabaseSeeder.php ├── filters.php ├── lang │ └── en │ │ ├── pagination.php │ │ ├── reminders.php │ │ └── validation.php ├── models │ ├── Asterisk.balde.php │ ├── CallerIDs.php │ └── User.php ├── routes.php ├── start │ ├── artisan.php │ ├── global.php │ └── local.php ├── storage │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── debugbar │ │ └── .gitignore │ ├── logs │ │ └── .gitignore │ ├── meta │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── tests │ ├── ExampleTest.php │ └── TestCase.php └── views │ ├── admin_nav.blade.php │ ├── dialer │ ├── index.blade.php │ └── session.blade.php │ ├── emails │ └── auth │ │ └── reminder.blade.php │ ├── hello.php │ ├── home.blade.php │ ├── index.blade.php │ ├── layout.blade.php │ ├── login.blade.php │ ├── register.blade.php │ ├── reports │ └── index.blade.php │ └── settings │ ├── asterisk.blade.php │ ├── asterisk_edit.blade.php │ ├── caller_id.blade.php │ ├── caller_id_edit.blade.php │ ├── system.blade.php │ └── system_edit.blade.php ├── artisan ├── bootstrap ├── autoload.php ├── paths.php └── start.php ├── composer.json ├── phpunit.xml ├── public ├── .htaccess ├── favicon.ico ├── img │ ├── stardust.png │ └── stardust_@2X.png ├── index.php ├── js │ └── charts.js ├── packages │ └── .gitkeep └── robots.txt ├── readme.md ├── scripts ├── caller.php └── sleep.php └── server.php /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /bootstrap/compiled.php 3 | /vendor 4 | composer.phar 5 | composer.lock 6 | .env.*.php 7 | *.swp 8 | .env.php 9 | .DS_Store 10 | Thumbs.db 11 | /app/config/database.php 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | Please submit all issues and pull requests to the [laravel/framework](http://github.com/laravel/framework) repository! 4 | -------------------------------------------------------------------------------- /app/commands/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/commands/.gitkeep -------------------------------------------------------------------------------- /app/config/.view.php.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/config/.view.php.swp -------------------------------------------------------------------------------- /app/config/app.php: -------------------------------------------------------------------------------- 1 | false, 17 | //'debug' => true, 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | Application URL 22 | |-------------------------------------------------------------------------- 23 | | 24 | | This URL is used by the console to properly generate URLs when using 25 | | the Artisan command line tool. You should set this to the root of 26 | | your application so that it is used when running Artisan tasks. 27 | | 28 | */ 29 | 30 | 'url' => 'http://localhost', 31 | 32 | /* 33 | |-------------------------------------------------------------------------- 34 | | Application Timezone 35 | |-------------------------------------------------------------------------- 36 | | 37 | | Here you may specify the default timezone for your application, which 38 | | will be used by the PHP date and date-time functions. We have gone 39 | | ahead and set this to a sensible default for you out of the box. 40 | | 41 | */ 42 | 43 | 'timezone' => 'UTC', 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | Application Locale Configuration 48 | |-------------------------------------------------------------------------- 49 | | 50 | | The application locale determines the default locale that will be used 51 | | by the translation service provider. You are free to set this value 52 | | to any of the locales which will be supported by the application. 53 | | 54 | */ 55 | 56 | 'locale' => 'en', 57 | 58 | /* 59 | |-------------------------------------------------------------------------- 60 | | Application Fallback Locale 61 | |-------------------------------------------------------------------------- 62 | | 63 | | The fallback locale determines the locale to use when the current one 64 | | is not available. You may change the value to correspond to any of 65 | | the language folders that are provided through your application. 66 | | 67 | */ 68 | 69 | 'fallback_locale' => 'en', 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Encryption Key 74 | |-------------------------------------------------------------------------- 75 | | 76 | | This key is used by the Illuminate encrypter service and should be set 77 | | to a random, 32 character string, otherwise these encrypted strings 78 | | will not be safe. Please do this before deploying an application! 79 | | 80 | */ 81 | 82 | 'key' => '5Lov7Cvn1S4xlgHSSKi0zbtjBKzbnrko', 83 | 84 | 'cipher' => MCRYPT_RIJNDAEL_128, 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | Autoloaded Service Providers 89 | |-------------------------------------------------------------------------- 90 | | 91 | | The service providers listed here will be automatically loaded on the 92 | | request to your application. Feel free to add your own services to 93 | | this array to grant expanded functionality to your applications. 94 | | 95 | */ 96 | 97 | 'providers' => array( 98 | 99 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 100 | 'Illuminate\Auth\AuthServiceProvider', 101 | 'Illuminate\Cache\CacheServiceProvider', 102 | 'Illuminate\Session\CommandsServiceProvider', 103 | 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 104 | 'Illuminate\Routing\ControllerServiceProvider', 105 | 'Illuminate\Cookie\CookieServiceProvider', 106 | 'Illuminate\Database\DatabaseServiceProvider', 107 | 'Illuminate\Encryption\EncryptionServiceProvider', 108 | 'Illuminate\Filesystem\FilesystemServiceProvider', 109 | 'Illuminate\Hashing\HashServiceProvider', 110 | 'Illuminate\Html\HtmlServiceProvider', 111 | 'Illuminate\Log\LogServiceProvider', 112 | 'Illuminate\Mail\MailServiceProvider', 113 | 'Illuminate\Database\MigrationServiceProvider', 114 | 'Illuminate\Pagination\PaginationServiceProvider', 115 | 'Illuminate\Queue\QueueServiceProvider', 116 | 'Illuminate\Redis\RedisServiceProvider', 117 | 'Illuminate\Remote\RemoteServiceProvider', 118 | 'Illuminate\Auth\Reminders\ReminderServiceProvider', 119 | 'Illuminate\Database\SeedServiceProvider', 120 | 'Illuminate\Session\SessionServiceProvider', 121 | 'Illuminate\Translation\TranslationServiceProvider', 122 | 'Illuminate\Validation\ValidationServiceProvider', 123 | 'Illuminate\View\ViewServiceProvider', 124 | 'Illuminate\Workbench\WorkbenchServiceProvider', 125 | 'Barryvdh\Debugbar\ServiceProvider', 126 | 127 | ), 128 | 129 | /* 130 | |-------------------------------------------------------------------------- 131 | | Service Provider Manifest 132 | |-------------------------------------------------------------------------- 133 | | 134 | | The service provider manifest is used by Laravel to lazy load service 135 | | providers which are not needed for each request, as well to keep a 136 | | list of all of the services. Here, you may set its storage spot. 137 | | 138 | */ 139 | 140 | 'manifest' => storage_path().'/meta', 141 | 142 | /* 143 | |-------------------------------------------------------------------------- 144 | | Class Aliases 145 | |-------------------------------------------------------------------------- 146 | | 147 | | This array of class aliases will be registered when this application 148 | | is started. However, feel free to register as many as you wish as 149 | | the aliases are "lazy" loaded so they don't hinder performance. 150 | | 151 | */ 152 | 153 | 'aliases' => array( 154 | 155 | 'App' => 'Illuminate\Support\Facades\App', 156 | 'Artisan' => 'Illuminate\Support\Facades\Artisan', 157 | 'Auth' => 'Illuminate\Support\Facades\Auth', 158 | 'Blade' => 'Illuminate\Support\Facades\Blade', 159 | 'Cache' => 'Illuminate\Support\Facades\Cache', 160 | 'ClassLoader' => 'Illuminate\Support\ClassLoader', 161 | 'Config' => 'Illuminate\Support\Facades\Config', 162 | 'Controller' => 'Illuminate\Routing\Controller', 163 | 'Cookie' => 'Illuminate\Support\Facades\Cookie', 164 | 'Crypt' => 'Illuminate\Support\Facades\Crypt', 165 | 'DB' => 'Illuminate\Support\Facades\DB', 166 | 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 167 | 'Event' => 'Illuminate\Support\Facades\Event', 168 | 'File' => 'Illuminate\Support\Facades\File', 169 | 'Form' => 'Illuminate\Support\Facades\Form', 170 | 'Hash' => 'Illuminate\Support\Facades\Hash', 171 | 'HTML' => 'Illuminate\Support\Facades\HTML', 172 | 'Input' => 'Illuminate\Support\Facades\Input', 173 | 'Lang' => 'Illuminate\Support\Facades\Lang', 174 | 'Log' => 'Illuminate\Support\Facades\Log', 175 | 'Mail' => 'Illuminate\Support\Facades\Mail', 176 | 'Paginator' => 'Illuminate\Support\Facades\Paginator', 177 | 'Password' => 'Illuminate\Support\Facades\Password', 178 | 'Queue' => 'Illuminate\Support\Facades\Queue', 179 | 'Redirect' => 'Illuminate\Support\Facades\Redirect', 180 | 'Redis' => 'Illuminate\Support\Facades\Redis', 181 | 'Request' => 'Illuminate\Support\Facades\Request', 182 | 'Response' => 'Illuminate\Support\Facades\Response', 183 | 'Route' => 'Illuminate\Support\Facades\Route', 184 | 'Schema' => 'Illuminate\Support\Facades\Schema', 185 | 'Seeder' => 'Illuminate\Database\Seeder', 186 | 'Session' => 'Illuminate\Support\Facades\Session', 187 | 'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait', 188 | 'SSH' => 'Illuminate\Support\Facades\SSH', 189 | 'Str' => 'Illuminate\Support\Str', 190 | 'URL' => 'Illuminate\Support\Facades\URL', 191 | 'Validator' => 'Illuminate\Support\Facades\Validator', 192 | 'View' => 'Illuminate\Support\Facades\View', 193 | 'Debugbar' => 'Barryvdh\Debugbar\Facade', 194 | 195 | ), 196 | 197 | ); 198 | -------------------------------------------------------------------------------- /app/config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => 'User', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reminder Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the settings for password reminders, including a view 52 | | that should be used as your password reminder e-mail. You will also 53 | | be able to set the name of the table that holds the reset tokens. 54 | | 55 | | The "expire" time is the number of minutes that the reminder should be 56 | | considered valid. This security feature keeps tokens short-lived so 57 | | they have less time to be guessed. You may change this as needed. 58 | | 59 | */ 60 | 61 | 'reminder' => array( 62 | 63 | 'email' => 'emails.auth.reminder', 64 | 65 | 'table' => 'password_reminders', 66 | 67 | 'expire' => 60, 68 | 69 | ), 70 | 71 | ); 72 | -------------------------------------------------------------------------------- /app/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | File Cache Location 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "file" cache driver, we need a location where the cache 26 | | files may be stored. A sensible default has been specified, but you 27 | | are free to change it to any other place on disk that you desire. 28 | | 29 | */ 30 | 31 | 'path' => storage_path().'/cache', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Database Cache Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "database" cache driver you may specify the connection 39 | | that should be used to store the cached items. When this option is 40 | | null the default database connection will be utilized for cache. 41 | | 42 | */ 43 | 44 | 'connection' => null, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Database Cache Table 49 | |-------------------------------------------------------------------------- 50 | | 51 | | When using the "database" cache driver we need to know the table that 52 | | should be used to store the cached items. A default table name has 53 | | been provided but you're free to change it however you deem fit. 54 | | 55 | */ 56 | 57 | 'table' => 'cache', 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Memcached Servers 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Now you may specify an array of your Memcached servers that should be 65 | | used when utilizing the Memcached cache driver. All of the servers 66 | | should contain a value for "host", "port", and "weight" options. 67 | | 68 | */ 69 | 70 | 'memcached' => array( 71 | 72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 73 | 74 | ), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Cache Key Prefix 79 | |-------------------------------------------------------------------------- 80 | | 81 | | When utilizing a RAM based store such as APC or Memcached, there might 82 | | be other applications utilizing the same cache. So, we'll specify a 83 | | value to get prefixed to all our keys so we can avoid collisions. 84 | | 85 | */ 86 | 87 | 'prefix' => 'laravel', 88 | 89 | ); 90 | -------------------------------------------------------------------------------- /app/config/compile.php: -------------------------------------------------------------------------------- 1 | true, 17 | 18 | ); 19 | -------------------------------------------------------------------------------- /app/config/local/database.php: -------------------------------------------------------------------------------- 1 | array( 22 | 23 | 'mysql' => array( 24 | 'driver' => 'mysql', 25 | 'host' => 'localhost', 26 | 'database' => 'ting', 27 | 'username' => 'homestead', 28 | 'password' => 'secret', 29 | 'charset' => 'utf8', 30 | 'collation' => 'utf8_unicode_ci', 31 | 'prefix' => '', 32 | ), 33 | 34 | 'pgsql' => array( 35 | 'driver' => 'pgsql', 36 | 'host' => 'localhost', 37 | 'database' => 'homestead', 38 | 'username' => 'homestead', 39 | 'password' => 'secret', 40 | 'charset' => 'utf8', 41 | 'prefix' => '', 42 | 'schema' => 'public', 43 | ), 44 | 45 | ), 46 | 47 | ); 48 | -------------------------------------------------------------------------------- /app/config/mail.php: -------------------------------------------------------------------------------- 1 | 'smtp', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Mailgun mail service which will provide reliable deliveries. 28 | | 29 | */ 30 | 31 | 'host' => 'smtp.mailgun.org', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to deliver e-mails to 39 | | users of the application. Like the host we have set this value to 40 | | stay compatible with the Mailgun e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => 587, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => array('address' => null, 'name' => null), 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => 'tls', 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => null, 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => null, 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Mail "Pretend" 114 | |-------------------------------------------------------------------------- 115 | | 116 | | When this option is enabled, e-mail will not actually be sent over the 117 | | web and will instead be written to your application's logs files so 118 | | you may inspect the message. This is great for local development. 119 | | 120 | */ 121 | 122 | 'pretend' => false, 123 | 124 | ); 125 | -------------------------------------------------------------------------------- /app/config/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/config/packages/.gitkeep -------------------------------------------------------------------------------- /app/config/queue.php: -------------------------------------------------------------------------------- 1 | 'sync', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => array( 32 | 33 | 'sync' => array( 34 | 'driver' => 'sync', 35 | ), 36 | 37 | 'beanstalkd' => array( 38 | 'driver' => 'beanstalkd', 39 | 'host' => 'localhost', 40 | 'queue' => 'default', 41 | 'ttr' => 60, 42 | ), 43 | 44 | 'sqs' => array( 45 | 'driver' => 'sqs', 46 | 'key' => 'your-public-key', 47 | 'secret' => 'your-secret-key', 48 | 'queue' => 'your-queue-url', 49 | 'region' => 'us-east-1', 50 | ), 51 | 52 | 'iron' => array( 53 | 'driver' => 'iron', 54 | 'host' => 'mq-aws-us-east-1.iron.io', 55 | 'token' => 'your-token', 56 | 'project' => 'your-project-id', 57 | 'queue' => 'your-queue-name', 58 | 'encrypt' => true, 59 | ), 60 | 61 | 'redis' => array( 62 | 'driver' => 'redis', 63 | 'queue' => 'default', 64 | ), 65 | 66 | ), 67 | 68 | /* 69 | |-------------------------------------------------------------------------- 70 | | Failed Queue Jobs 71 | |-------------------------------------------------------------------------- 72 | | 73 | | These options configure the behavior of failed queue job logging so you 74 | | can control which database and table are used to store the jobs that 75 | | have failed. You may change them to any database / table you wish. 76 | | 77 | */ 78 | 79 | 'failed' => array( 80 | 81 | 'database' => 'mysql', 'table' => 'failed_jobs', 82 | 83 | ), 84 | 85 | ); 86 | -------------------------------------------------------------------------------- /app/config/remote.php: -------------------------------------------------------------------------------- 1 | 'production', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Remote Server Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | These are the servers that will be accessible via the SSH task runner 24 | | facilities of Laravel. This feature radically simplifies executing 25 | | tasks on your servers, such as deploying out these applications. 26 | | 27 | */ 28 | 29 | 'connections' => array( 30 | 31 | 'production' => array( 32 | 'host' => '', 33 | 'username' => '', 34 | 'password' => '', 35 | 'key' => '', 36 | 'keyphrase' => '', 37 | 'root' => '/var/www', 38 | ), 39 | 40 | ), 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Remote Server Groups 45 | |-------------------------------------------------------------------------- 46 | | 47 | | Here you may list connections under a single group name, which allows 48 | | you to easily access all of the servers at once using a short name 49 | | that is extremely easy to remember, such as "web" or "database". 50 | | 51 | */ 52 | 53 | 'groups' => array( 54 | 55 | 'web' => array('production') 56 | 57 | ), 58 | 59 | ); 60 | -------------------------------------------------------------------------------- /app/config/services.php: -------------------------------------------------------------------------------- 1 | array( 18 | 'domain' => '', 19 | 'secret' => '', 20 | ), 21 | 22 | 'mandrill' => array( 23 | 'secret' => '', 24 | ), 25 | 26 | 'stripe' => array( 27 | 'model' => 'User', 28 | 'secret' => '', 29 | ), 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/session.php: -------------------------------------------------------------------------------- 1 | 'file', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session File Location 39 | |-------------------------------------------------------------------------- 40 | | 41 | | When using the native session driver, we need a location where session 42 | | files may be stored. A default has been set for you but a different 43 | | location may be specified. This is only needed for file sessions. 44 | | 45 | */ 46 | 47 | 'files' => storage_path().'/sessions', 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session Database Connection 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the "database" or "redis" session drivers, you may specify a 55 | | connection that should be used to manage these sessions. This should 56 | | correspond to a connection in your database configuration options. 57 | | 58 | */ 59 | 60 | 'connection' => null, 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Table 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" session driver, you may specify the table we 68 | | should use to manage the sessions. Of course, a sensible default is 69 | | provided for you; however, you are free to change this as needed. 70 | | 71 | */ 72 | 73 | 'table' => 'sessions', 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Sweeping Lottery 78 | |-------------------------------------------------------------------------- 79 | | 80 | | Some session drivers must manually sweep their storage location to get 81 | | rid of old sessions from storage. Here are the chances that it will 82 | | happen on a given request. By default, the odds are 2 out of 100. 83 | | 84 | */ 85 | 86 | 'lottery' => array(2, 100), 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Cookie Name 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Here you may change the name of the cookie used to identify a session 94 | | instance by ID. The name specified here will get used every time a 95 | | new session cookie is created by the framework for every driver. 96 | | 97 | */ 98 | 99 | 'cookie' => 'laravel_session', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Cookie Path 104 | |-------------------------------------------------------------------------- 105 | | 106 | | The session cookie path determines the path for which the cookie will 107 | | be regarded as available. Typically, this will be the root path of 108 | | your application but you are free to change this when necessary. 109 | | 110 | */ 111 | 112 | 'path' => '/', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Domain 117 | |-------------------------------------------------------------------------- 118 | | 119 | | Here you may change the domain of the cookie used to identify a session 120 | | in your application. This will determine which domains the cookie is 121 | | available to in your application. A sensible default has been set. 122 | | 123 | */ 124 | 125 | 'domain' => null, 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | HTTPS Only Cookies 130 | |-------------------------------------------------------------------------- 131 | | 132 | | By setting this option to true, session cookies will only be sent back 133 | | to the server if the browser has a HTTPS connection. This will keep 134 | | the cookie from being sent to you if it can not be done securely. 135 | | 136 | */ 137 | 138 | 'secure' => false, 139 | 140 | ); 141 | -------------------------------------------------------------------------------- /app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); 22 | -------------------------------------------------------------------------------- /app/config/view.php: -------------------------------------------------------------------------------- 1 | array(__DIR__.'/../views'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Pagination View 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This view will be used to render the pagination link output, and can 24 | | be easily customized here to show any view you like. A clean view 25 | | compatible with Twitter's Bootstrap is given to you by default. 26 | | 27 | */ 28 | 29 | 'pagination' => 'pagination::slider-3', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/workbench.php: -------------------------------------------------------------------------------- 1 | '', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Workbench Author E-Mail Address 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Like the option above, your e-mail address is used when generating new 24 | | workbench packages. The e-mail is placed in your composer.json file 25 | | automatically after the package is created by the workbench tool. 26 | | 27 | */ 28 | 29 | 'email' => '', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/controllers/.gitkeep -------------------------------------------------------------------------------- /app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/controllers/DialerController.php: -------------------------------------------------------------------------------- 1 | orderBy('id','desc')->paginate(50); 13 | 14 | $caller_ids = array('' => 'Select a Caller ID') + 15 | DB::table('caller_ids')->lists('full_number', 'id'); 16 | 17 | return View::make('dialer.index') 18 | ->with([ 19 | 'dialing_sessions' => $dialing_sessions, 20 | 'caller_ids' => $caller_ids, 21 | ]); 22 | } 23 | 24 | 25 | /** 26 | * Show the form for creating a new resource. 27 | * 28 | * @return Response 29 | */ 30 | public function session_create() 31 | { 32 | // validate the info, create rules for the inputs 33 | $rules = array( 34 | 'caller_id_id' => 'required|numeric', 35 | 'area_code' => 'required|numeric|min:3', 36 | 'prefix' => 'required|numeric|min:3', 37 | 'starting' => 'required|numeric|min:4', 38 | 'ending' => 'required|numeric|min:4' 39 | ); 40 | 41 | // run the validation rules on the inputs from the form 42 | $validator = Validator::make(Input::all(), $rules); 43 | // if the validator fails, redirect back to the form 44 | if ($validator->fails()) { 45 | return Redirect::to('/dialer') 46 | ->withErrors($validator) 47 | ->withInput(Input::except('password')); 48 | } else { 49 | 50 | // create session in database 51 | $caller_id_id = Input::get('caller_id_id'); 52 | $area_code = Input::get('area_code'); 53 | $prefix = Input::get('prefix'); 54 | $starting = Input::get('starting'); 55 | $ending = Input::get('ending'); 56 | 57 | if ($starting > $ending) { 58 | Session::flash('message', 'Starting number ('.$starting.') cannot be greater than Ending number ('.$ending .')'); 59 | return Redirect::to('/dialer'); 60 | } 61 | 62 | $session_id = DB::table('dialing_sessions')->insertGetId( 63 | array( 64 | 'caller_id_id' => $caller_id_id, 65 | 'area_code' => $area_code, 66 | 'prefix' => $prefix, 67 | 'starting' => $starting, 68 | 'ending' => $ending, 69 | 'status' => 'Incomplete', 70 | 'created_by_id' => Auth::user()->id, 71 | 'updated_by_id' => Auth::user()->id 72 | ) 73 | ); 74 | 75 | // insert each number in database 76 | $phone_numbers = []; 77 | $number = $starting; 78 | $counter = 0; 79 | for ($i = $starting; $i <= $ending; $i++) { 80 | 81 | 82 | $phone_number = array( 83 | 'area_code' => $area_code, 84 | 'prefix' => $prefix, 85 | 'number' => $number, 86 | 'status' => 'Queued', 87 | 'session_id' => $session_id 88 | ); 89 | 90 | array_push($phone_numbers, $phone_number); 91 | 92 | //echo $number."
"; 93 | $number++; 94 | $counter++; 95 | } 96 | 97 | DB::table('phone_numbers')->insert($phone_numbers); 98 | 99 | DB::table('dialing_sessions')->where('id',$session_id)->update(['total' => $counter]); 100 | 101 | // return to dialers page 102 | Session::flash('message', 'Dialing Session has started. Session ID: '. $session_id); 103 | return Redirect::to('/dialer'); 104 | 105 | } 106 | 107 | } 108 | 109 | public function getSession($id) 110 | { 111 | // 112 | $call_session = DB::table('dialing_sessions')->find($id); 113 | $phone_numbers = DB::table('phone_numbers')->where('session_id',$id)->get(); 114 | 115 | return View::make('dialer.session') 116 | ->with([ 117 | 'call_session' => $call_session, 118 | 'phone_numbers' => $phone_numbers, 119 | ]); 120 | 121 | } 122 | 123 | public function update_status() 124 | { 125 | 126 | $numbers = DB::table('phone_numbers')->where('status','!=','Completed')->get(); 127 | 128 | $path = "/var/spool/asterisk/outgoing_done/"; 129 | ////echo "path: $path
"; 130 | 131 | foreach( $numbers as $key => $value ) { 132 | 133 | $phone_number = $value->area_code.$value->prefix.$value->number; 134 | $file = $path.$phone_number."-SID".$value->session_id.".call"; 135 | ////echo "phone_number: $phone_number
"; 136 | ////echo "file: $file
"; 137 | 138 | //check if exists in outgoing_done 139 | if (file_exists($file)) { 140 | 141 | //open file and search for status line 142 | $lines = file($file); 143 | 144 | foreach ($lines as $line_num => $line) { 145 | $file_lines = explode(": ", $line); 146 | 147 | if (count($file_lines) > 1) { 148 | 149 | if ($file_lines[0] == "Status") { 150 | $phone_number = DB::table('phone_numbers') 151 | ->where('id',$value->id) 152 | ->update(['status' => trim($file_lines[1])]) 153 | ; 154 | 155 | $cmd = "sudo rm -Rf $file"; 156 | //exec($cmd. " > /dev/null &"); 157 | 158 | } 159 | 160 | } else { 161 | //echo " - not empty - "; 162 | } 163 | 164 | } 165 | 166 | 167 | //read actual status and save to database 168 | 169 | } else { 170 | 171 | //echo $file ."- doesnt exists
"; 172 | 173 | } 174 | } 175 | 176 | // update sessions status count 177 | 178 | $dialing_sessions = DB::table('dialing_sessions') 179 | ->where('status','!=','Completed') 180 | ->get() 181 | ; 182 | 183 | //echo "updating session status
"; 184 | foreach($dialing_sessions as $key => $value) { 185 | $id = $value->id; 186 | //echo "session id: $id
"; 187 | 188 | //echo "updating status count
"; 189 | $this->update_status_count($value->id,'Completed','completed'); 190 | $this->update_status_count($value->id,'Queued','queued'); 191 | $this->update_status_count($value->id,'Call File Generated','calling'); 192 | $this->update_status_count($value->id,'Expired','expired'); 193 | $this->update_status_count($value->id,'Failed','failed'); 194 | 195 | //check if all numbers in dial session are completed... then mark session completed. 196 | $phone_numbers_count = DB::table('phone_numbers') 197 | ->where('session_id',$value->id) 198 | ->where(function ($query) { 199 | $query->where('status','=','Call File Created') 200 | ->orWhere('status','=','Queued'); 201 | }) 202 | ->count() 203 | ; 204 | //echo $phone_numbers_count ."
"; 205 | 206 | if ($phone_numbers_count == 0) { 207 | DB::table('dialing_sessions')->where('id',$value->id)->update(['status' => 'Completed']); 208 | } else { 209 | //echo "not completed: ". $phone_numbers_count ."
"; 210 | } 211 | } 212 | 213 | return Redirect::to('dialer'); 214 | 215 | } 216 | 217 | public function session_update_status1($id) 218 | { 219 | $numbers = DB::table('phone_numbers')->where('session_id',$id)->get(); 220 | 221 | $path = "/var/spool/asterisk/outgoing_done/"; 222 | 223 | //var_dump($numbers); 224 | 225 | //loop through each number 226 | foreach( $numbers as $key => $value ) { 227 | 228 | $phone_number = $value->area_code.$value->prefix.$value->number; 229 | $file = $path.$phone_number."-SID".$id.".call"; 230 | 231 | //check if exists in outgoing_done 232 | if (file_exists($file)) { 233 | 234 | //open file and search for status line 235 | $lines = file($file); 236 | 237 | foreach ($lines as $line_num => $line) { 238 | $file_lines = explode(": ", $line); 239 | 240 | if (count($file_lines) > 1) { 241 | 242 | if ($file_lines[0] == "Status") { 243 | $phone_number = DB::table('phone_numbers') 244 | ->where('id',$value->id) 245 | ->update(['status' => $file_lines[1]]) 246 | ; 247 | 248 | $cmd = "sudo rm -Rf $file"; 249 | exec($cmd. " > /dev/null &"); 250 | 251 | } 252 | 253 | } else { 254 | //echo " - not empty - "; 255 | } 256 | 257 | } 258 | 259 | 260 | //read actual status and save to database 261 | 262 | } else { 263 | 264 | //echo $file ."- doesnt exists
"; 265 | 266 | } 267 | } 268 | 269 | //check if all numbers in dial session are completed... then mark session completed. 270 | $phone_numbers_count = DB::table('phone_numbers') 271 | ->where('session_id',$id) 272 | ->where('status','=','Call File Created') 273 | ->count() 274 | ; 275 | //echo $phone_numbers_count ."
"; 276 | 277 | if ($phone_numbers_count == 0) { 278 | DB::table('dialing_sessions')->where('id',$id)->update(['status' => 'Completed']); 279 | } 280 | 281 | $call_session = DB::table('dialing_sessions')->find($id); 282 | $phone_numbers = DB::table('phone_numbers')->where('session_id',$id)->get(); 283 | 284 | return View::make('dialer.session') 285 | ->with([ 286 | 'call_session' => $call_session, 287 | 'phone_numbers' => $phone_numbers, 288 | ]); 289 | 290 | } 291 | 292 | 293 | protected function generate_call_files($session_id,$phone_number,$caller_id) 294 | { 295 | $asterisk = DB::table('asterisk')->where('name','MaxRetries')->first(); 296 | $max_retries = $asterisk->value; 297 | $asterisk = DB::table('asterisk')->where('name','RetryTime')->first(); 298 | $retry_time = $asterisk->value; 299 | $asterisk = DB::table('asterisk')->where('name','WaitTime')->first(); 300 | $wait_time = $asterisk->value; 301 | 302 | $file_path = "/tmp/".$phone_number."-SID".$session_id.".call"; 303 | $handle = fopen($file_path,"w"); 304 | 305 | $contents = "Channel: SIP/" . $phone_number . "@AlcazarNetDialer\n". 306 | "Callerid: ".$caller_id."\n". 307 | "MaxRetries: $max_retries\n". 308 | "RetryTime: $retry_time\n". 309 | "WaitTime: $wait_time\n". 310 | "Application: hangup\n". 311 | "Archive: Yes\n"; 312 | 313 | fwrite($handle,$contents); 314 | 315 | fclose($handle); 316 | 317 | echo $file_path."
"; 318 | exec("mv $file_path /var/spool/asterisk/outgoing"); 319 | } 320 | 321 | protected function update_status_count($session_id,$phone_status,$session_status) 322 | { 323 | 324 | //echo "updating status count: $session_id - $phone_status
"; 325 | $calls = DB::table('phone_numbers') 326 | ->select('session_id',DB::raw('COUNT(*) as count')) 327 | ->where('session_id',$session_id) 328 | ->where('status',$phone_status) 329 | ->get() 330 | ; 331 | 332 | if ($calls) { 333 | foreach ($calls as $key => $value) { 334 | DB::table('dialing_sessions')->where('id',$session_id)->update( 335 | [$session_status => $value->count] 336 | ); 337 | } 338 | } else { 339 | 340 | DB::table('dialing_sessions')->where('id',$session_id)->update( 341 | [$session_status => 0] 342 | ); 343 | 344 | } 345 | 346 | return; 347 | } 348 | 349 | } 350 | -------------------------------------------------------------------------------- /app/controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | orderBy('id','asc')->get(); 8 | 9 | return View::make('settings.asterisk') 10 | ->with(['asterisk' => $asterisk]); 11 | } 12 | 13 | public function create() 14 | { 15 | // validate the info, create rules for the inputs 16 | $rules = array( 17 | 'name' => 'required', 18 | 'value' => 'required', 19 | ); 20 | 21 | // run the validation rules on the inputs from the form 22 | $validator = Validator::make(Input::all(), $rules); 23 | // if the validator fails, redirect back to the form 24 | if ($validator->fails()) { 25 | return Redirect::to('/system/asterisk') 26 | ->withErrors($validator) 27 | ->withInput(Input::except('password')); 28 | } else { 29 | 30 | // create session in database 31 | $name = Input::get('name'); 32 | $value = Input::get('value'); 33 | 34 | $asterisk = DB::table('asterisk')->insertGetId( 35 | array( 36 | 'name' => $name, 37 | 'value' => $value, 38 | 'created_by_id' => Auth::user()->id 39 | ) 40 | ); 41 | } 42 | 43 | Session::flash('message', 'Asterisk setting was added.'); 44 | return Redirect::to('/settings/asterisk'); 45 | 46 | } 47 | 48 | public function edit($id) 49 | { 50 | $asterisk = DB::table('asterisk')->where('id',$id)->first(); 51 | 52 | return View::make('settings.asterisk_edit') 53 | ->with(['asterisk' => $asterisk]); 54 | } 55 | 56 | public function update($id) 57 | { 58 | // validate the info, create rules for the inputs 59 | $rules = array( 60 | 'name' => 'required', 61 | 'value' => 'required', 62 | ); 63 | 64 | // run the validation rules on the inputs from the form 65 | $validator = Validator::make(Input::all(), $rules); 66 | // if the validator fails, redirect back to the form 67 | if ($validator->fails()) { 68 | return Redirect::to('/system/asterisk/'.$id.'/edit') 69 | ->withErrors($validator) 70 | ->withInput(Input::except('password')); 71 | } else { 72 | 73 | // create session in database 74 | $name = Input::get('name'); 75 | $value = Input::get('value'); 76 | 77 | $asterisk = DB::table('asterisk')->where('id',$id); 78 | $asterisk->update( 79 | array( 80 | 'name' => $name, 81 | 'value' => $value, 82 | 'updated_by_id' => Auth::user()->id 83 | ) 84 | ); 85 | } 86 | 87 | Session::flash('message', 'Asterisk Setting was updated.'); 88 | return Redirect::to('/settings/asterisk'); 89 | 90 | } 91 | 92 | public function delete($id) 93 | { 94 | $asterisk = Asterisk::find($id); 95 | $asterisk->delete(); 96 | 97 | Session::flash('message', 'Asterisk Setting was deleted.'); 98 | return Redirect::to('/settings/asterisk'); 99 | } 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /app/controllers/Settings/CallerIDController.php: -------------------------------------------------------------------------------- 1 | orderBy('id','desc')->get(); 8 | 9 | return View::make('settings.caller_id') 10 | ->with(['caller_ids' => $caller_ids]); 11 | } 12 | 13 | public function postCreate() 14 | { 15 | // validate the info, create rules for the inputs 16 | $rules = array( 17 | 'area_code' => 'required|numeric|min:3', 18 | 'prefix' => 'required|numeric|min:3', 19 | 'number' => 'required|numeric|min:4', 20 | ); 21 | 22 | // run the validation rules on the inputs from the form 23 | $validator = Validator::make(Input::all(), $rules); 24 | // if the validator fails, redirect back to the form 25 | if ($validator->fails()) { 26 | return Redirect::to('/system/caller_id') 27 | ->withErrors($validator) 28 | ->withInput(Input::except('password')); 29 | } else { 30 | 31 | // create session in database 32 | $area_code = Input::get('area_code'); 33 | $prefix = Input::get('prefix'); 34 | $number = Input::get('number'); 35 | 36 | $caller_id = DB::table('caller_ids')->insertGetId( 37 | array( 38 | 'area_code' => $area_code, 39 | 'prefix' => $prefix, 40 | 'number' => $number, 41 | 'full_number' => $area_code.$prefix.$number, 42 | 'status' => 'Not Used', 43 | 'created_by_id' => Auth::user()->id 44 | ) 45 | ); 46 | } 47 | 48 | Session::flash('message', 'Caller ID was added.'); 49 | return Redirect::to('/settings/caller_id'); 50 | 51 | } 52 | 53 | public function edit($id) 54 | { 55 | $caller_id = CallerID::find($id); 56 | 57 | return View::make('settings.caller_id_edit') 58 | ->with(['caller_id' => $caller_id]); 59 | } 60 | 61 | public function update($id) 62 | { 63 | // validate the info, create rules for the inputs 64 | $rules = array( 65 | 'area_code' => 'required|numeric|min:3', 66 | 'prefix' => 'required|numeric|min:3', 67 | 'number' => 'required|numeric|min:4', 68 | ); 69 | 70 | // run the validation rules on the inputs from the form 71 | $validator = Validator::make(Input::all(), $rules); 72 | // if the validator fails, redirect back to the form 73 | if ($validator->fails()) { 74 | return Redirect::to('/system/caller_id/'.$id.'/edit') 75 | ->withErrors($validator) 76 | ->withInput(Input::except('password')); 77 | } else { 78 | 79 | // create session in database 80 | $area_code = Input::get('area_code'); 81 | $prefix = Input::get('prefix'); 82 | $number = Input::get('number'); 83 | 84 | $caller_id = CallerID::find($id); 85 | $caller_id->update( 86 | array( 87 | 'area_code' => $area_code, 88 | 'prefix' => $prefix, 89 | 'number' => $number, 90 | 'full_number' => $area_code . $prefix . $number, 91 | 'status' => 'Not Used', 92 | 'updated_by_id' => Auth::user()->id 93 | ) 94 | ); 95 | } 96 | 97 | Session::flash('message', 'Caller ID was updated.'); 98 | return Redirect::to('/settings/caller_id'); 99 | 100 | } 101 | 102 | public function delete($id) 103 | { 104 | $caller_id = CallerID::find($id); 105 | $caller_id->delete(); 106 | 107 | Session::flash('message', 'Caller ID was deleted.'); 108 | return Redirect::to('/settings/caller_id'); 109 | } 110 | 111 | 112 | } 113 | -------------------------------------------------------------------------------- /app/controllers/Settings/SettingsController.php: -------------------------------------------------------------------------------- 1 | orderBy('id','desc')->get(); 13 | 14 | return View::make('dialer.index') 15 | ->with(['dialing_sessions' => $dialing_sessions]); 16 | } 17 | 18 | public function getSystem() 19 | { 20 | $settings = DB::table('settings')->orderBy('id','desc')->get(); 21 | 22 | return View::make('settings.system') 23 | ->with(['settings' => $settings]); 24 | } 25 | 26 | public function settings_system_edit($id) 27 | { 28 | $setting = DB::table('settings')->find($id); 29 | 30 | return View::make('settings.system_edit') 31 | ->with(['setting' => $setting]); 32 | } 33 | 34 | 35 | 36 | /** 37 | * Show the form for creating a new resource. 38 | * 39 | * @return Response 40 | */ 41 | public function session_create() 42 | { 43 | // validate the info, create rules for the inputs 44 | $rules = array( 45 | 'caller_id' => 'required|numeric|min:3', 46 | 'area_code' => 'required|numeric|min:3', 47 | 'prefix' => 'required|numeric|min:3', 48 | 'starting' => 'required|numeric|min:4', 49 | 'ending' => 'required|numeric|min:4' 50 | ); 51 | 52 | // run the validation rules on the inputs from the form 53 | $validator = Validator::make(Input::all(), $rules); 54 | // if the validator fails, redirect back to the form 55 | if ($validator->fails()) { 56 | return Redirect::to('/dialer') 57 | ->withErrors($validator) 58 | ->withInput(Input::except('password')); 59 | } else { 60 | 61 | // create session in database 62 | $caller_id = Input::get('caller_id'); 63 | $area_code = Input::get('area_code'); 64 | $prefix = Input::get('prefix'); 65 | $starting = Input::get('starting'); 66 | $ending = Input::get('ending'); 67 | 68 | $session_id = DB::table('dialing_sessions')->insertGetId( 69 | array( 70 | 'caller_id' => Input::get('caller_id'), 71 | 'area_code' => Input::get('area_code'), 72 | 'prefix' => Input::get('prefix'), 73 | 'starting' => $starting, 74 | 'ending' => $ending, 75 | 'status' => 'Incomplete', 76 | 'created_by_id' => Auth::user()->id, 77 | 'updated_by_id' => Auth::user()->id 78 | ) 79 | ); 80 | 81 | // insert each number in database 82 | $phone_numbers = []; 83 | $number = $starting; 84 | for ($i = $starting; $i <= $ending; $i++) { 85 | 86 | 87 | $phone_number = array( 88 | 'area_code' => $area_code, 89 | 'prefix' => $prefix, 90 | 'number' => $number, 91 | 'status' => 'Not Called', 92 | 'session_id' => $session_id 93 | ); 94 | 95 | array_push($phone_numbers, $phone_number); 96 | 97 | //echo $number."
"; 98 | $number++; 99 | } 100 | 101 | DB::table('phone_numbers')->insert($phone_numbers); 102 | 103 | 104 | $not_called_count = DB::table('phone_numbers') 105 | ->where('session_id',$session_id) 106 | ->where('status','Not Called') 107 | ->count(); 108 | 109 | 110 | while ($not_called_count != 0 ) { 111 | 112 | echo $not_called_count."

"; 113 | 114 | $phone_number = DB::table('phone_numbers') 115 | ->where('session_id',$session_id) 116 | ->where('status','Not Called') 117 | ->orderBy(DB::raw('RAND()')) 118 | //->take(1) 119 | ->first(); 120 | ; 121 | echo $phone_number->number ."
"; 122 | 123 | $call_number = $phone_number->area_code.$phone_number->prefix.$phone_number->number; 124 | 125 | $this->generate_call_files($call_number); 126 | 127 | DB::table('phone_numbers') 128 | ->where('id',$phone_number->id) 129 | ->update(['Status' => 'Call File Created']); 130 | 131 | $not_called_count = DB::table('phone_numbers') 132 | ->where('session_id',$session_id) 133 | ->where('status','Not Called') 134 | ->count() 135 | ; 136 | 137 | } 138 | 139 | 140 | // return to dialers page 141 | Session::flash('message', 'Dialing Session has started. Session ID: '. $session_id); 142 | //return Redirect::to('/dialer'); 143 | 144 | } 145 | 146 | } 147 | 148 | 149 | /** 150 | * Store a newly created resource in storage. 151 | * 152 | * @return Response 153 | */ 154 | public function store() 155 | { 156 | // 157 | } 158 | 159 | 160 | /** 161 | * Display the specified resource. 162 | * 163 | * @param int $id 164 | * @return Response 165 | */ 166 | public function show($id) 167 | { 168 | // 169 | } 170 | 171 | public function getSession($id) 172 | { 173 | // 174 | $call_session = DB::table('dialing_sessions')->find($id); 175 | $phone_numbers = DB::table('phone_numbers')->where('session_id',$id)->get(); 176 | 177 | return View::make('dialer.session') 178 | ->with([ 179 | 'call_session' => $call_session, 180 | 'phone_numbers' => $phone_numbers, 181 | ]); 182 | 183 | 184 | } 185 | 186 | 187 | 188 | /** 189 | * Show the form for editing the specified resource. 190 | * 191 | * @param int $id 192 | * @return Response 193 | */ 194 | public function edit($id) 195 | { 196 | // 197 | } 198 | 199 | 200 | /** 201 | * Update the specified resource in storage. 202 | * 203 | * @param int $id 204 | * @return Response 205 | */ 206 | public function update($id) 207 | { 208 | // 209 | } 210 | 211 | 212 | /** 213 | * Remove the specified resource from storage. 214 | * 215 | * @param int $id 216 | * @return Response 217 | */ 218 | public function destroy($id) 219 | { 220 | // 221 | } 222 | 223 | protected function generate_call_files($phone_number) 224 | { 225 | $file_path = "/tmp/".$phone_number.".call"; 226 | $handle = fopen($file_path,"w"); 227 | 228 | $contents = "Channel: SIP/" . $phone_number . "@vitel-outbound 229 | Callerid: 7861234567 230 | MaxRetries: 5 231 | RetryTime: 600 232 | WaitTime: 15 233 | Application: hangup 234 | Archive: yes 235 | "; 236 | 237 | fwrite($handle,$contents); 238 | 239 | fclose($handle); 240 | 241 | echo $file_path."
"; 242 | exec("mv $file_path /var/spool/asterisk/outgoing2"); 243 | } 244 | 245 | } 246 | -------------------------------------------------------------------------------- /app/controllers/UsersController.php: -------------------------------------------------------------------------------- 1 | 'required', 34 | 'email' => 'required|email', 35 | 'username' => 'required', 36 | 'password' => 'required|confirmed' 37 | ]; 38 | 39 | $validator = Validator::make(Input::all(), $rules); 40 | 41 | if ($validator->fails()) 42 | { 43 | return Redirect::to('register')->withInput()->withErrors($validator); 44 | } 45 | else 46 | { 47 | DB::table('users')->insert( 48 | array( 49 | 'first_name' => Input::get('first_name'), 50 | 'last_name' => Input::get('last_name'), 51 | 'email' => Input::get('email'), 52 | 'username' => Input::get('username'), 53 | 'password' => Hash::make(Input::get('password')), 54 | ) 55 | ); 56 | } 57 | 58 | return Redirect::to('/login'); 59 | } 60 | 61 | 62 | /** 63 | * Store a newly created resource in storage. 64 | * 65 | * @return Response 66 | */ 67 | public function store() 68 | { 69 | // 70 | } 71 | 72 | 73 | /** 74 | * Display the specified resource. 75 | * 76 | * @param int $id 77 | * @return Response 78 | */ 79 | public function show($id) 80 | { 81 | // 82 | } 83 | 84 | 85 | /** 86 | * Show the form for editing the specified resource. 87 | * 88 | * @param int $id 89 | * @return Response 90 | */ 91 | public function edit($id) 92 | { 93 | // 94 | } 95 | 96 | 97 | /** 98 | * Update the specified resource in storage. 99 | * 100 | * @param int $id 101 | * @return Response 102 | */ 103 | public function update($id) 104 | { 105 | // 106 | } 107 | 108 | 109 | /** 110 | * Remove the specified resource from storage. 111 | * 112 | * @param int $id 113 | * @return Response 114 | */ 115 | public function destroy($id) 116 | { 117 | // 118 | } 119 | 120 | public function getLogin() { 121 | return View::make('login'); 122 | } 123 | 124 | public function postLogin() 125 | { 126 | // validate the info, create rules for the inputs 127 | $rules = array( 128 | 'username' => 'required', 129 | 'password' => 'required|alphaNum|min:3' 130 | ); 131 | // run the validation rules on the inputs from the form 132 | $validator = Validator::make(Input::all(), $rules); 133 | // if the validator fails, redirect back to the form 134 | if ($validator->fails()) { 135 | return Redirect::to('login') 136 | ->withErrors($validator) 137 | ->withInput(Input::except('password')); 138 | } else { 139 | // create our user data for the authentication 140 | $userdata = array( 141 | 'username' => Input::get('username'), 142 | 'password' => Input::get('password') 143 | ); 144 | // attempt to do the login 145 | if (Auth::attempt($userdata)) { 146 | // validation successful! 147 | return Redirect::intended('/home'); 148 | } else { 149 | // validation not successful, send back to form 150 | return Redirect::to('login'); 151 | } 152 | } 153 | } 154 | public function doLogout() 155 | { 156 | Auth::logout(); // log the user out of our application 157 | return Redirect::to('login'); // redirect the user to the login screen 158 | } 159 | 160 | 161 | } 162 | -------------------------------------------------------------------------------- /app/database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/database/migrations/.gitkeep -------------------------------------------------------------------------------- /app/database/migrations/create_migrations_rev1.php: -------------------------------------------------------------------------------- 1 | increments("id"); 18 | $table->string('name'); 19 | $table->string("username"); 20 | $table->string("password"); 21 | $table->string("email"); 22 | $table->string('address_1')->nullable(); 23 | $table->string('address_2')->nullable(); 24 | $table->string('city')->nullable(); 25 | $table->string('state')->nullable(); 26 | $table->string('zip')->nullable(); 27 | $table->string('phone')->nullable(); 28 | $table->string('fax')->nullable(); 29 | $table->string("remember_token")->nullable(); 30 | $table->boolean('active')->default('1'); 31 | $table->timestamps(); 32 | }); 33 | 34 | Schema::create('token', function(Blueprint $table) 35 | { 36 | $table->string('email')->index(); 37 | $table->string('token')->index(); 38 | $table->timestamp('created_at'); 39 | }); 40 | } 41 | 42 | /** 43 | * Reverse the migrations. 44 | * 45 | * @return void 46 | */ 47 | public function down() 48 | { 49 | Schema::table('users', function(Blueprint $table) 50 | { 51 | // 52 | }); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/database/production.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/database/production.sqlite -------------------------------------------------------------------------------- /app/database/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/app/database/seeds/.gitkeep -------------------------------------------------------------------------------- /app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call('UserTableSeeder'); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/filters.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /app/lang/en/reminders.php: -------------------------------------------------------------------------------- 1 | "Passwords must be at least six characters and match the confirmation.", 17 | 18 | "user" => "We can't find a user with that e-mail address.", 19 | 20 | "token" => "This password reset token is invalid.", 21 | 22 | "sent" => "Password reminder sent!", 23 | 24 | ); 25 | -------------------------------------------------------------------------------- /app/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | "The :attribute must be accepted.", 17 | "active_url" => "The :attribute is not a valid URL.", 18 | "after" => "The :attribute must be a date after :date.", 19 | "alpha" => "The :attribute may only contain letters.", 20 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", 21 | "alpha_num" => "The :attribute may only contain letters and numbers.", 22 | "array" => "The :attribute must be an array.", 23 | "before" => "The :attribute must be a date before :date.", 24 | "between" => array( 25 | "numeric" => "The :attribute must be between :min and :max.", 26 | "file" => "The :attribute must be between :min and :max kilobytes.", 27 | "string" => "The :attribute must be between :min and :max characters.", 28 | "array" => "The :attribute must have between :min and :max items.", 29 | ), 30 | "confirmed" => "The :attribute confirmation does not match.", 31 | "date" => "The :attribute is not a valid date.", 32 | "date_format" => "The :attribute does not match the format :format.", 33 | "different" => "The :attribute and :other must be different.", 34 | "digits" => "The :attribute must be :digits digits.", 35 | "digits_between" => "The :attribute must be between :min and :max digits.", 36 | "email" => "The :attribute must be a valid email address.", 37 | "exists" => "The selected :attribute is invalid.", 38 | "image" => "The :attribute must be an image.", 39 | "in" => "The selected :attribute is invalid.", 40 | "integer" => "The :attribute must be an integer.", 41 | "ip" => "The :attribute must be a valid IP address.", 42 | "max" => array( 43 | "numeric" => "The :attribute may not be greater than :max.", 44 | "file" => "The :attribute may not be greater than :max kilobytes.", 45 | "string" => "The :attribute may not be greater than :max characters.", 46 | "array" => "The :attribute may not have more than :max items.", 47 | ), 48 | "mimes" => "The :attribute must be a file of type: :values.", 49 | "min" => array( 50 | "numeric" => "The :attribute must be at least :min.", 51 | "file" => "The :attribute must be at least :min kilobytes.", 52 | "string" => "The :attribute must be at least :min characters.", 53 | "array" => "The :attribute must have at least :min items.", 54 | ), 55 | "not_in" => "The selected :attribute is invalid.", 56 | "numeric" => "The :attribute must be a number.", 57 | "regex" => "The :attribute format is invalid.", 58 | "required" => "The :attribute field is required.", 59 | "required_if" => "The :attribute field is required when :other is :value.", 60 | "required_with" => "The :attribute field is required when :values is present.", 61 | "required_with_all" => "The :attribute field is required when :values is present.", 62 | "required_without" => "The :attribute field is required when :values is not present.", 63 | "required_without_all" => "The :attribute field is required when none of :values are present.", 64 | "same" => "The :attribute and :other must match.", 65 | "size" => array( 66 | "numeric" => "The :attribute must be :size.", 67 | "file" => "The :attribute must be :size kilobytes.", 68 | "string" => "The :attribute must be :size characters.", 69 | "array" => "The :attribute must contain :size items.", 70 | ), 71 | "unique" => "The :attribute has already been taken.", 72 | "url" => "The :attribute format is invalid.", 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Custom Validation Language Lines 77 | |-------------------------------------------------------------------------- 78 | | 79 | | Here you may specify custom validation messages for attributes using the 80 | | convention "attribute.rule" to name the lines. This makes it quick to 81 | | specify a specific custom language line for a given attribute rule. 82 | | 83 | */ 84 | 85 | 'custom' => array( 86 | 'attribute-name' => array( 87 | 'rule-name' => 'custom-message', 88 | ), 89 | ), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Custom Validation Attributes 94 | |-------------------------------------------------------------------------- 95 | | 96 | | The following language lines are used to swap attribute place-holders 97 | | with something more reader friendly such as E-Mail Address instead 98 | | of "email". This simply helps us make messages a little cleaner. 99 | | 100 | */ 101 | 102 | 'attributes' => array(), 103 | 104 | ); 105 | -------------------------------------------------------------------------------- /app/models/Asterisk.balde.php: -------------------------------------------------------------------------------- 1 | 'required' 6 | ]; 7 | // Don't forget to fill this array 8 | //protected $fillable = []; 9 | protected $fillable = array('name', 'value', 'updated_by_id'); 10 | 11 | } -------------------------------------------------------------------------------- /app/models/CallerIDs.php: -------------------------------------------------------------------------------- 1 | 'required' 6 | ]; 7 | // Don't forget to fill this array 8 | //protected $fillable = []; 9 | protected $fillable = array('area_code', 'prefix', 'number','status','full_number','updated_by_id'); 10 | 11 | } -------------------------------------------------------------------------------- /app/models/User.php: -------------------------------------------------------------------------------- 1 | 'auth' ], function() { 15 | //Route::get('/',function() { 16 | // return "Hello World"; 17 | //}); 18 | 19 | Route::get('/', 'HomeController@getHome'); 20 | Route::get('/home', 'HomeController@getHome'); 21 | 22 | Route::get('/reports', 'ReportsController@getReport'); 23 | 24 | Route::get('/dialer/update_status','DialerController@update_status'); 25 | Route::get('/dialer/session/{id}/update_status','DialerController@session_update_status'); 26 | Route::post('/dialer/session/create','DialerController@session_create'); 27 | Route::controller('dialer','DialerController'); 28 | 29 | 30 | }); 31 | 32 | Route::group(['prefix' => 'settings','before'=>'auth'], function(){ 33 | Route::get('/caller_id', 'CallerIDController@getIndex'); 34 | Route::post('/caller_id/create', 'CallerIDController@postCreate'); 35 | Route::get('/caller_id/{id}/edit', 'CallerIDController@edit'); 36 | Route::put('/caller_id/{id}/update', 37 | array('as' => 'caller_id.update', 38 | 'uses' => 'CallerIDController@update')); 39 | Route::get('/caller_id/{id}/delete', 'CallerIDController@delete'); 40 | 41 | Route::get('/asterisk', 'AsteriskController@index'); 42 | Route::post('/asterisk/create', 'AsteriskController@create'); 43 | Route::get('/asterisk/{id}/edit', 'AsteriskController@edit'); 44 | Route::put('/asterisk/{id}/update', 45 | array('as' => 'asterisk.update', 46 | 'uses' => 'AsteriskController@update')); 47 | Route::get('/asterisk/{id}/delete', 'AsteriskController@delete'); 48 | 49 | Route::get('/settings/system/{id}/edit', 'SettingsController@settings_system_edit'); 50 | //Route::controller('settings','SettingsController'); 51 | }); 52 | 53 | 54 | Route::get('/register','UsersController@getRegister'); 55 | Route::post('/register','UsersController@create'); 56 | Route::get('/login','UsersController@getLogin'); 57 | Route::post('/login','UsersController@postLogin'); 58 | Route::get('/logout',function() { 59 | Auth::logout(); 60 | return Redirect::to('login'); 61 | }); 62 | 63 | -------------------------------------------------------------------------------- /app/start/artisan.php: -------------------------------------------------------------------------------- 1 | client->request('GET', '/'); 13 | 14 | $this->assertTrue($this->client->getResponse()->isOk()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 41 | @show 42 | -------------------------------------------------------------------------------- /app/views/dialer/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
7 |

Dialer

8 | 9 |

Create a Dialing Sessions

10 |

Enter the area code, prefix, starting and ending range to create a dialing session

11 | 12 | {{ Form::open(array('url'=>'/dialer/session/create','class'=>'form-inline')) }} 13 | 14 |

Enter Caller ID:

15 |
16 |
17 |
18 |
19 | {{ Form::select('caller_id_id', $caller_ids , Input::old('caller_id_id'), array('class' => 'form-control')) }} 20 |
21 |
22 |
23 |
24 |

25 | 26 |

Enter Calling Range:

27 |
28 |
29 |
30 |
31 | 32 |
33 |
34 | 35 |
36 |
37 | 38 |
39 |
40 | 41 |
42 |
43 |
44 |
45 |
46 |
47 | 48 |
49 |
50 |
51 | 52 |
53 |

Active Sessions

54 |
55 |
56 | Update Status » 57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | @foreach ($dialing_sessions as $c) 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 100 | 101 | @endforeach 102 | 103 |
IDArea/PrefixStartingEndingStatusTotalCalledCompletedQueuedCallingExpiredFailedCreated ByCreated AtAction
{{ $c->id }}{{ $c->area_code }}-{{ $c->prefix }}{{ $c->starting }}{{ $c->ending }}{{ $c->status }}{{ $c->total }}{{ $c->completed + $c->expired + $c->failed }}{{ $c->completed }}{{ $c->queued }}{{ $c->calling }}{{ $c->expired }}{{ $c->failed }}{{ $c->created_by_id }}{{ $c->created_at }} 97 | 98 | 99 |
104 | {{ $dialing_sessions->links() }} 105 | 106 | @stop 107 | -------------------------------------------------------------------------------- /app/views/dialer/session.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
7 |

Dialer :: Session

8 | 9 |

Sessions ID: {{ $call_session->id }}

10 | 11 |

Phone Numbers

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach ($phone_numbers as $c) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | @endforeach 37 | 38 |
IDPhoneStatusCreated AtUpdated AtAction
{{ $c->id }}{{ $c->area_code }}-{{ $c->prefix }}-{{ $c->number }}{{ $c->status }}{{ $c->created_at }}{{ $c->updated_at }} 32 | 33 | 34 |
39 | 40 | 41 | 42 | 43 | @stop 44 | -------------------------------------------------------------------------------- /app/views/emails/auth/reminder.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Password Reset

8 | 9 |
10 | To reset your password, complete this form: {{ URL::to('password/reset', array($token)) }}.
11 | This link will expire in {{ Config::get('auth.reminder.expire', 60) }} minutes. 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /app/views/hello.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Laravel PHP Framework 6 | 35 | 36 | 37 |
38 | Laravel PHP Framework 39 |

You have arrived.

40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /app/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
7 |

Home

8 |

Dialers

9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 |

Trunks

17 |
18 |
19 |
20 |
21 |
22 |
23 | 24 |
25 | 26 | @stop -------------------------------------------------------------------------------- /app/views/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tingaso 8 | 9 | 10 | 11 | 12 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |

Tingaso

36 | 37 |
38 |
39 |
40 |
41 |

Please Login

42 |
43 |
44 |
45 | 46 |
47 | 48 |
49 | 50 |
51 | 52 |
53 | 54 |
55 | 59 |
60 | 61 | 62 | 63 |
64 |
65 |
66 | 69 |
70 |
71 | 72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /app/views/layout.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tingao - El dialer mas enpingao! 8 | 9 | 10 | 11 | 12 | 28 | 29 | 30 | 31 | 32 | @if (Auth::check()) 33 | @include('admin_nav') 34 | @endif 35 | 36 |
37 | @if(Session::get('errors')) 38 |
39 | 40 |
The following errors occurred:
41 | @foreach($errors->all('
  • :message
  • ') as $message) 42 | {{$message}} 43 | @endforeach 44 |
    45 | @endif 46 | 47 | @if(Session::has('message')) 48 |

    {{ Session::get('message') }}

    49 | @endif 50 |
    51 | 52 |
    53 | @yield('content') 54 |
    55 | 56 | 57 | 58 | 59 | 60 | {{ HTML::script('js/charts.js') }} 61 | 62 | -------------------------------------------------------------------------------- /app/views/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |

    Please Login

    9 |
    10 |
    11 | 12 | {{ Form::open() }} 13 | 14 |
    15 | 16 |
    17 | 18 |
    19 | 20 |
    21 | 22 |
    23 | 27 |
    28 | 29 | 30 | 31 | {{ Form::close() }} 32 |
    33 |
    34 | 37 |
    38 |
    39 | @stop -------------------------------------------------------------------------------- /app/views/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 |
    6 |
    7 |
    8 |
    9 |

    Registration!

    10 |
    11 |
    12 | 13 | {{ Form::open() }} 14 |
    15 |
    16 |
    17 | {{ Form::text('first_name', null, array('class'=>'form-control input-sm','placeholder'=>'First Name')) }} 18 |
    19 |
    20 |
    21 |
    22 | {{ Form::text('last_name', null, array('class'=>'form-control input-sm','placeholder'=>'Last Name')) }} 23 |
    24 |
    25 |
    26 | 27 |
    28 | {{ Form::email('email', null, array('class'=>'form-control input-sm','placeholder'=>'Email Address')) }} 29 |
    30 | 31 |
    32 | {{ Form::text('username', null, array('class'=>'form-control input-sm','placeholder'=>'Username')) }} 33 |
    34 | 35 |
    36 |
    37 |
    38 | {{ Form::password('password', array('class'=>'form-control input-sm','placeholder'=>'Password')) }} 39 |
    40 |
    41 |
    42 |
    43 | {{ Form::password('password_confirmation', array('class'=>'form-control input-sm','placeholder'=>'Confirm Password')) }} 44 |
    45 |
    46 |
    47 | 48 | {{ Form::submit('Register', array('class'=>'btn btn-info btn-block')) }} 49 | 50 | {{ Form::close() }} 51 |
    52 |
    53 |
    54 |
    55 | 56 | @stop -------------------------------------------------------------------------------- /app/views/reports/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
    7 |

    Reports

    8 |

    Library of reports.

    9 |
    10 | 11 | 12 | 13 | @stop -------------------------------------------------------------------------------- /app/views/settings/asterisk.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
    7 |

    Asterisk Settings

    8 | 9 |

    Enter numbers to be added as caller ids and manage them.

    10 | 11 | {{ Form::open(array('url'=>'/settings/asterisk/create','class'=>'form-inline')) }} 12 |

    Create Settings:

    13 |
    14 |
    15 |
    16 |
    17 | 18 |
    19 |
    20 | 21 |
    22 |
    23 |
    24 |
    25 |
    26 |
    27 | 28 |
    29 |
    30 |
    31 | {{ Form::close() }} 32 | 33 |
    34 |

    IDs

    35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | @foreach ($asterisk as $c) 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 66 | 67 | @endforeach 68 | 69 |
    IDNameValueCreated ByUpdated ByCreated AtUpdated AtAction
    {{ $c->id }}{{ $c->name }}{{ $c->value }}{{ $c->created_by_id }}{{ $c->updated_by_id }}{{ $c->created_at }}{{ $c->updated_at }} 59 | 60 | 61 | 62 | 63 | 64 | 65 |
    70 | 71 | @stop 72 | -------------------------------------------------------------------------------- /app/views/settings/asterisk_edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 |

    Edit {{ $asterisk->name }}

    6 | 7 | 8 | {{ HTML::ul($errors->all()) }} 9 | 10 | {{ Form::model($asterisk, array('route' => array('asterisk.update', $asterisk->id), 'method' => 'PUT')) }} 11 | 12 |
    13 | {{ Form::label('name', 'Name') }} 14 | {{ Form::text('name', null, array('class' => 'form-control')) }} 15 |
    16 | 17 |
    18 | {{ Form::label('value', 'Value') }} 19 | {{ Form::text('value', null, array('class' => 'form-control')) }} 20 |
    21 | 22 | {{ Form::submit('Edit Asterisk Setting!', array('class' => 'btn btn-primary')) }} 23 | 24 | {{ Form::close() }} 25 | 26 | @stop 27 | -------------------------------------------------------------------------------- /app/views/settings/caller_id.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
    7 |

    Caller Id

    8 | 9 |

    Enter numbers to be added as caller ids and manage them.

    10 | 11 | {{ Form::open(array('url'=>'/settings/caller_id/create','class'=>'form-inline')) }} 12 |

    Enter Caller ID:

    13 |
    14 |
    15 |
    16 |
    17 | 18 |
    19 |
    20 | 21 |
    22 |
    23 | 24 |
    25 |
    26 |
    27 |
    28 |
    29 |
    30 | 31 |
    32 |
    33 |
    34 | {{ Form::close() }} 35 | 36 |
    37 |

    IDs

    38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | @foreach ($caller_ids as $c) 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 73 | 74 | @endforeach 75 | 76 |
    IDAreaPrefixNumberStatusCreated ByUpdated ByCreated AtUpdated AtAction
    {{ $c->id }}{{ $c->area_code }}{{ $c->prefix }}{{ $c->number }}{{ $c->status }}{{ $c->created_by_id }}{{ $c->updated_by_id }}{{ $c->created_at }}{{ $c->updated_at }} 66 | 67 | 68 | 69 | 70 | 71 | 72 |
    77 | 78 | @stop 79 | -------------------------------------------------------------------------------- /app/views/settings/caller_id_edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 |

    Edit {{ $caller_id->full_number }}

    6 | 7 | 8 | {{ HTML::ul($errors->all()) }} 9 | 10 | {{ Form::model($caller_id, array('route' => array('caller_id.update', $caller_id->id), 'method' => 'PUT')) }} 11 | 12 |
    13 | {{ Form::label('area_code', 'Area Code') }} 14 | {{ Form::text('area_code', null, array('class' => 'form-control')) }} 15 |
    16 | 17 |
    18 | {{ Form::label('prefix', 'Prefix') }} 19 | {{ Form::text('prefix', null, array('class' => 'form-control')) }} 20 |
    21 | 22 |
    23 | {{ Form::label('number', 'Number') }} 24 | {{ Form::text('number', null, array('class' => 'form-control')) }} 25 |
    26 | 27 |
    28 | {{ Form::label('status', 'Status') }} 29 | {{ Form::text('status', null, array('class' => 'form-control')) }} 30 |
    31 | 32 | {{ Form::submit('Edit Caller ID!', array('class' => 'btn btn-primary')) }} 33 | 34 | {{ Form::close() }} 35 | 36 | @stop 37 | -------------------------------------------------------------------------------- /app/views/settings/system.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 | 6 |
    7 |

    Dialer

    8 | 9 |

    Create a Dialing Sessions

    10 |

    Enter the area code, prefix, starting and ending range to create a dialing session

    11 | 12 | {{ Form::open(array('url'=>'/dialer/session/create','class'=>'form-inline')) }} 13 | 14 |
    15 |

    Settings

    16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach ($settings as $c) 27 | 28 | 29 | 30 | 31 | 37 | 38 | @endforeach 39 | 40 |
    IDNameValueAction
    {{ $c->id }}{{ $c->name }}{{ $c->value }} 32 | 33 | 34 | 35 | 36 |
    41 | 42 | 43 | 44 | 45 | @stop 46 | -------------------------------------------------------------------------------- /app/views/settings/system_edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layout') 2 | 3 | @section('content') 4 | 5 |

    Edit {{ $dealer->name }}

    6 | 7 | Create Month 8 | 9 | 10 | 11 | {{ HTML::ul($errors->all()) }} 12 | 13 | {{ Form::model($setting, array('route' => array('dealers.update', $dealer->id), 'method' => 'PUT')) }} 14 | 15 | 16 |
    17 | {{ Form::label('hours_of_operation', 'Hours Of Operation') }} 18 | {{ Form::text('hours_of_operation', null, array('class' => 'form-control')) }} 19 |
    20 | 21 |
    22 | {{ Form::label('default_rate', 'Default Rate') }} 23 | {{ Form::text('default_rate', null, array('class' => 'form-control')) }} 24 |
    25 | 26 |
    27 | {{ Form::label('default_records', 'Default Records') }} 28 | {{ Form::text('default_records', null, array('class' => 'form-control')) }} 29 |
    30 | 31 |
    32 | {{ Form::label('appt_recipients', 'Appt Recipients') }} 33 | {{ Form::text('appt_recipients', null, array('class' => 'form-control')) }} 34 |
    35 | 36 |
    37 | {{ Form::label('avg_ro', 'Averge RO') }} 38 | {{ Form::text('avg_ro', null, array('class' => 'form-control')) }} 39 |
    40 | 41 |
    42 | {{ Form::label('ro_percent', 'RO Percent') }} 43 | {{ Form::text('ro_percent', null, array('class' => 'form-control')) }} 44 |
    45 | 46 |
    47 | {{ Form::label('added_by_id', 'Added By') }} 48 | {{ Form::select('added_by_id', $added_by , null, array('class' => 'form-control')) }} 49 |
    50 | 51 |
    52 | {{ Form::label('active', 'Active') }} 53 | {{ Form::select('active', array('1' => 'Active', '2' => 'Inactive'), null, array('class' => 'form-control')) }} 54 |
    55 | 56 | {{ Form::submit('Edit Settings!', array('class' => 'btn btn-primary')) }} 57 | 58 | {{ Form::close() }} 59 | 60 | @stop 61 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | setRequestForConsoleEnvironment(); 45 | 46 | $artisan = Illuminate\Console\Application::start($app); 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Run The Artisan Application 51 | |-------------------------------------------------------------------------- 52 | | 53 | | When we run the console application, the current CLI command will be 54 | | executed in this console and the response sent back to a terminal 55 | | or another output device for the developers. Here goes nothing! 56 | | 57 | */ 58 | 59 | $status = $artisan->run(); 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Shutdown The Application 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Once Artisan has finished running. We will fire off the shutdown events 67 | | so that any final work may be done by the application before we shut 68 | | down the process. This is the last thing to happen to the request. 69 | | 70 | */ 71 | 72 | $app->shutdown(); 73 | 74 | exit($status); 75 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | __DIR__.'/../app', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Public Path 21 | |-------------------------------------------------------------------------- 22 | | 23 | | The public path contains the assets for your web application, such as 24 | | your JavaScript and CSS files, and also contains the primary entry 25 | | point for web requests into these applications from the outside. 26 | | 27 | */ 28 | 29 | 'public' => __DIR__.'/../public', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Base Path 34 | |-------------------------------------------------------------------------- 35 | | 36 | | The base path is the root of the Laravel installation. Most likely you 37 | | will not need to change this value. But, if for some wild reason it 38 | | is necessary you will do so here, just proceed with some caution. 39 | | 40 | */ 41 | 42 | 'base' => __DIR__.'/..', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Storage Path 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The storage path is used by Laravel to store cached Blade views, logs 50 | | and other pieces of information. You may modify the path here when 51 | | you want to change the location of this directory for your apps. 52 | | 53 | */ 54 | 55 | 'storage' => __DIR__.'/../app/storage', 56 | 57 | ); 58 | -------------------------------------------------------------------------------- /bootstrap/start.php: -------------------------------------------------------------------------------- 1 | detectEnvironment(array( 28 | 29 | 'local' => array('homestead'), 30 | 31 | )); 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Bind Paths 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here we are binding the paths configured in paths.php to the app. You 39 | | should not be changing these here. If you need to change these you 40 | | may do so within the paths.php file and they will be bound here. 41 | | 42 | */ 43 | 44 | $app->bindInstallPaths(require __DIR__.'/paths.php'); 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Load The Application 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here we will load this Illuminate application. We will keep this in a 52 | | separate location so we can isolate the creation of an application 53 | | from the actual running of the application with a given request. 54 | | 55 | */ 56 | 57 | $framework = $app['path.base']. 58 | '/vendor/laravel/framework/src'; 59 | 60 | require $framework.'/Illuminate/Foundation/start.php'; 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Return The Application 65 | |-------------------------------------------------------------------------- 66 | | 67 | | This script returns the application instance. The instance is given to 68 | | the calling script so we can separate the building of the instances 69 | | from the actual running of the application and sending responses. 70 | | 71 | */ 72 | 73 | return $app; 74 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "require": { 7 | "laravel/framework": "4.2.*", 8 | "barryvdh/laravel-debugbar": "~1.8" 9 | }, 10 | "autoload": { 11 | "classmap": [ 12 | "app/commands", 13 | "app/controllers", 14 | "app/models", 15 | "app/database/migrations", 16 | "app/database/seeds", 17 | "app/tests/TestCase.php" 18 | ] 19 | }, 20 | "scripts": { 21 | "post-install-cmd": [ 22 | "php artisan clear-compiled", 23 | "php artisan optimize" 24 | ], 25 | "post-update-cmd": [ 26 | "php artisan clear-compiled", 27 | "php artisan optimize" 28 | ], 29 | "post-create-project-cmd": [ 30 | "php artisan key:generate" 31 | ] 32 | }, 33 | "config": { 34 | "preferred-install": "dist" 35 | }, 36 | "minimum-stability": "stable" 37 | } 38 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./app/tests/ 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes... 9 | RewriteRule ^(.*)/$ /$1 [L,R=301] 10 | 11 | # Handle Front Controller... 12 | RewriteCond %{REQUEST_FILENAME} !-d 13 | RewriteCond %{REQUEST_FILENAME} !-f 14 | RewriteRule ^ index.php [L] 15 | 16 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/public/favicon.ico -------------------------------------------------------------------------------- /public/img/stardust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/public/img/stardust.png -------------------------------------------------------------------------------- /public/img/stardust_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/public/img/stardust_@2X.png -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader 15 | | for our application. We just need to utilize it! We'll require it 16 | | into the script here so that we do not have to worry about the 17 | | loading of any our classes "manually". Feels great to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let's turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight these users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/start.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can simply call the run method, 43 | | which will execute the request and send the response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful application we have whipped up for them. 46 | | 47 | */ 48 | 49 | $app->run(); 50 | -------------------------------------------------------------------------------- /public/js/charts.js: -------------------------------------------------------------------------------- 1 | new Morris.Line({ 2 | // ID of the element in which to draw the chart. 3 | element: 'line-chart', 4 | // Chart data records -- each entry in this array corresponds to a point on 5 | // the chart. 6 | data: [ 7 | { year: '2008', value: 20 }, 8 | { year: '2009', value: 10 }, 9 | { year: '2010', value: 5 }, 10 | { year: '2011', value: 5 }, 11 | { year: '2012', value: 20 } 12 | ], 13 | // The name of the data record attribute that contains x-values. 14 | xkey: 'year', 15 | // A list of names of data record attributes that contain y-values. 16 | ykeys: ['value'], 17 | // Labels for the ykeys -- will be displayed when you hover over the 18 | // chart. 19 | labels: ['Value'] 20 | }); 21 | 22 | new Morris.Area({ 23 | element: 'area-chart', 24 | data: [ 25 | { y: '2006', a: 100, b: 90 }, 26 | { y: '2007', a: 75, b: 65 }, 27 | { y: '2008', a: 50, b: 40 }, 28 | { y: '2009', a: 75, b: 65 }, 29 | { y: '2010', a: 50, b: 40 }, 30 | { y: '2011', a: 75, b: 65 }, 31 | { y: '2012', a: 100, b: 90 } 32 | ], 33 | xkey: 'y', 34 | ykeys: ['a', 'b'], 35 | labels: ['Series A', 'Series B'] 36 | }); 37 | 38 | new Morris.Bar({ 39 | element: 'bar-chart', 40 | data: [ 41 | { y: '2006', a: 100, b: 90 }, 42 | { y: '2007', a: 75, b: 65 }, 43 | { y: '2008', a: 50, b: 40 }, 44 | { y: '2009', a: 75, b: 65 }, 45 | { y: '2010', a: 50, b: 40 }, 46 | { y: '2011', a: 75, b: 65 }, 47 | { y: '2012', a: 100, b: 90 } 48 | ], 49 | xkey: 'y', 50 | ykeys: ['a', 'b'], 51 | labels: ['Series A', 'Series B'] 52 | 53 | }); 54 | 55 | new Morris.Donut({ 56 | element: 'donut-chart', 57 | data: [ 58 | {label: "Download Sales", value: 12}, 59 | {label: "In-Store Sales", value: 30}, 60 | {label: "Mail-Order Sales", value: 20} 61 | ] 62 | }); 63 | -------------------------------------------------------------------------------- /public/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mazpe/tingaso/02d070449cbc71f6d39a756f4cfc48d30106cf0c/public/packages/.gitkeep -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## TINGASO 2 | ## Author: Lester Ariel Mesa 3 | 4 | A Laravel PHP Project that integrates with Asterisk PBX to create a flexible dialer that allows its users/admin to dial based on phone number ranges. 5 | 6 | It currently uses the following technologies: 7 | - Laravel - MVC PHP Framework 8 | - MySQL - Backend database 9 | - Charts.js - simple, clean and appealing charts and graphs generation 10 | - Bootstrap - served from CDN for HTML, CSS layout and responsiveness 11 | - jQuery - JavaScript voodoo 12 | - Asterisk - PBX and VoIP phone calls interaction 13 | 14 | Also theres a script that actually generates the call files that is executed by a cronjob 15 | * * * * * /usr/bin/php /home/ubuntu/tingaso/scripts/caller.php 16 | * * * * * ( sleep 30; /usr/bin/php /home/ubuntu/tingaso/scripts/caller.php ) 17 | with a little trick to run every 30 seconds since cron does now go into subminutes. 18 | -------------------------------------------------------------------------------- /scripts/caller.php: -------------------------------------------------------------------------------- 1 | connect_errno) { 19 | printf("Connect failed: %s\n", $conn->connect_error); 20 | exit(); 21 | } 22 | 23 | $limit = 25; 24 | 25 | $sql = "SELECT a.id,a.area_code,a.prefix,a.number,a.status,session_id,c.full_number ". 26 | "FROM phone_numbers AS a ". 27 | "LEFT JOIN dialing_sessions AS b ". 28 | "ON a.session_id = b.id ". 29 | "LEFT JOIN caller_ids AS c ". 30 | "ON b.caller_id_id = c.id ". 31 | "WHERE a.status = 'Queued' ORDER BY RAND() LIMIT ". $limit; 32 | $result = $conn->query($sql); 33 | 34 | if ($result) { 35 | echo "Main query was successful: ". $result->num_rows ."\n"; 36 | if ($result->num_rows == "0") { 37 | echo "No records found\n"; 38 | exit(); 39 | } 40 | 41 | } else { 42 | printf("Errormessage: %s\n", $conn->error); 43 | exit(); 44 | } 45 | 46 | 47 | if ($result->num_rows > 0) { 48 | 49 | $sql1 = "SELECT value FROM asterisk WHERE name = 'MaxRetries' LIMIT 1"; 50 | $result1 = mysqli_query($conn,$sql1); 51 | $row1 = mysqli_fetch_assoc($result1); 52 | 53 | $sql2 = "SELECT value FROM asterisk WHERE name = 'RetryTime' LIMIT 1"; 54 | $result2 = mysqli_query($conn,$sql2); 55 | $row2 = mysqli_fetch_assoc($result2); 56 | 57 | $sql3 = "SELECT value FROM asterisk WHERE name = 'WaitTime' LIMIT 1"; 58 | $result3 = mysqli_query($conn,$sql3); 59 | $row3 = mysqli_fetch_assoc($result3); 60 | 61 | $settings = array( 62 | 'max_retries' => $row1['value'], 63 | 'retry_time' => $row2['value'], 64 | 'wait_time' => $row3['value'] 65 | ); 66 | 67 | echo "MaxRetries: ". $settings['max_retries']."\n"; 68 | echo "RetryTime: ". $settings['retry_time']."\n"; 69 | echo "WaitTime: ". $settings['wait_time']."\n"; 70 | 71 | // output data of each row 72 | while($row = $result->fetch_assoc()) { 73 | $phone_number = $row['area_code'].$row['prefix'].$row['number']; 74 | echo "id: " . $row["id"]. " - ". $phone_number . "\n"; 75 | $caller_id = "3053051001"; 76 | $caller_id = $row["full_number"]; 77 | 78 | // create call file 79 | generate_call_files($phone_number,$caller_id,$row['session_id'],$settings); 80 | 81 | // update database 82 | $sql_update = "UPDATE phone_numbers SET status = 'Call File Generated' WHERE id = ".$row['id']; 83 | if ($conn->query($sql_update) === TRUE) { 84 | echo "Record updated successfully\n"; 85 | } else { 86 | echo "Error updating record: " . $conn->error. "\n"; 87 | } 88 | 89 | } 90 | 91 | mysqli_free_result($result1); 92 | mysqli_free_result($result2); 93 | mysqli_free_result($result3); 94 | 95 | } 96 | 97 | $conn->close(); 98 | 99 | //} 100 | 101 | function generate_call_files($phone_number,$caller_id,$session_id,$settings) { 102 | 103 | echo "-----generating call file\n"; 104 | $max_retries = $settings['max_retries']; 105 | $retry_time = $settings['retry_time']; 106 | $wait_time = $settings['wait_time']; 107 | 108 | $file_path = "/tmp/".$phone_number."-SID".$session_id.".call"; 109 | $handle = fopen($file_path,"w"); 110 | 111 | $contents = "Channel: SIP/" . $phone_number . "@AlcazarNetDialer\n"; 112 | $contents .= "Callerid: ".$caller_id."\n"; 113 | $contents .= "MaxRetries: $max_retries\n"; 114 | if ($retry_time > 0) $contents .= "RetryTime: $retry_time\n"; 115 | $contents .= "WaitTime: $wait_time\n"; 116 | $contents .= "Application: hangup\n"; 117 | $contents .= "Archive: Yes\n"; 118 | 119 | fwrite($handle,$contents); 120 | 121 | fclose($handle); 122 | 123 | //echo $file_path."
    "; 124 | exec("mv $file_path /var/spool/asterisk/outgoing"); 125 | 126 | } 127 | 128 | ?> 129 | -------------------------------------------------------------------------------- /scripts/sleep.php: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 |