Last active
August 29, 2015 14:01
-
-
Save Joseph-N/1e339d9655d902a8f422 to your computer and use it in GitHub Desktop.
code snippets for sms messages with rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modems configuration | |
# | |
# Example and default values | |
# | |
# group = modems | |
# id = "my-id" | |
# name = "my-name" | |
# detect-string = "MODEM" | |
# detect-string2 = "" [Default] | |
# init-string = "AT+CNMI=1,2,0,0,0" [Default] | |
# speed = 9600 [Default] | |
# enable-hwhs = "AT+IFC=2,2" [Default] | |
# need-sleep = false [Default] | |
# no-pin = false [Default] | |
# no-smsc = false [Default] | |
# sendline-sleep = 100 [Default, miliseconds] | |
# keepalive-cmd = "AT" [Default] | |
# broken = false [Default] | |
# message-storage = "SM" | |
# enable-mms = false [Default] | |
# If modemtype=auto, try everyone and defaults to this one | |
group = modems | |
id = generic | |
name = "Generic Modem" | |
group = modems | |
id = wavecom | |
name = Wavecom | |
detect-string = "WAVECOM" | |
init-string = "AT+CNMI=1,2,0,0,0" | |
group = modems | |
id = premicell | |
name = Premicell | |
detect-string = "PREMICEL" | |
no-pin = true | |
no-smsc = true | |
group = modems | |
id = siemens_tc35 | |
name = "Siemens TC35" | |
detect-string = "SIEMENS" | |
detect-string2 = "TC35" | |
init-string = "AT+CNMI=3,2,0,1,1" | |
speed = 19200 | |
enable-hwhs = "AT\\Q3" | |
need-sleep = true | |
reset-string = "AT+CFUN=1" | |
keepalive-cmd = "AT+CSQ" | |
group = modems | |
id = siemens_m20 | |
name = "Siemens M20" | |
detect-string = "SIEMENS" | |
detect-string2 = "M20" | |
speed = 19200 | |
enable-hwhs = "AT\\Q3" | |
keepalive-cmd = "AT+CBC;+CSQ" | |
need-sleep = true | |
group = modems | |
id = siemens_sl45 | |
name = "Siemens SL45" | |
detect-string = "SIEMENS" | |
detect-string2 = "SL45" | |
init-string = "AT+CNMI=1,2,2,2,1" | |
keepalive-cmd = "AT+CBC;+CSQ" | |
speed = 19200 | |
enable-hwhs = "AT\\Q3" | |
need-sleep = true | |
message-storage = "SM" | |
group = modems | |
id = nokiaphone | |
name = "Nokia Phone" | |
detect-string = "Nokia Mobile Phone" | |
need-sleep = true | |
keepalive-cmd = "AT+CBC;+CSQ" | |
enable-mms = true | |
group = modems | |
id = falcom | |
name = "Falcom" | |
detect-string = "Falcom" | |
#no-smsc = true | |
group = modems | |
id = ericsson_r520m | |
name = "Ericsson R520m" | |
detect-string = "R520m" | |
init-string = "AT+CNMI=3,2,0,0" | |
group = modems | |
id = ericsson_t68 | |
name = "Ericsson T68" | |
detect-string = "T68" | |
init-string = "AT+CNMI=3,3" | |
keepalive-cmd = "AT+CBC;+CSQ" | |
broken = true | |
group = modems | |
id = sonyericsson_gr47 | |
name = "Sony Ericsson GR47" | |
detect-string = "GR47" | |
message-storage = "ME" | |
# use this init-string for non sim-buffering | |
init-string = "AT+CNMI=3,2,0,0" | |
# use this init-string for sim-buffering | |
#init-string = "AT+CNMI=3,1,0,0" | |
reset-string = "ATZ" | |
broken = true | |
group = modems | |
id = alcatel | |
name = "Alcatel" | |
detect-string = "Alcatel" | |
init-string = "AT+CNMI=3,2,0,0" | |
group = modems | |
id = sonyericsson_T630-T628 | |
name = "Sony Ericsson T630-T628? | |
init-string = "AT+CNMI=2,3,2,0,0;+CMGF=0? | |
keepalive-cmd = "AT+CBC;+CSQ;+CMGF=0? | |
broken = true | |
group = modems | |
id = sonyericsson_p1i | |
name = "Sony Ericsson P1i" | |
detect-string = "Sony Ericsson P1i" | |
init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" | |
message-storage = "SM" | |
reset-string = "ATZ" | |
broken = true | |
group = modems | |
id = huawei_e1550 | |
name = "Huawei E1550" | |
detect-string = "huawei" | |
init-string = "AT+CNMI=2,1,2,2,0" | |
init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" | |
message-storage = ME | |
need-sleep = true | |
message-start = 0 | |
#speed = 9600 | |
speed = 460800 | |
group = modems | |
id = huawei_e620 | |
name = "Huawei E620" | |
detect-string = "huawei" | |
init-string = "AT+CFUN=1" | |
message-storage = "SM" | |
need-sleep = true | |
speed = 460800 | |
no-pin = true | |
reset-string = "AT+CFUN=1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sms::Application.routes.draw do | |
root 'updates#index' | |
resources :updates | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setting up the modems | |
include = "/usr/local/kannel/modems.conf" | |
group = core | |
admin-port = 13000 | |
smsbox-port = 13001 | |
admin-password = bar | |
log-file = "/tmp/kannel.log" | |
log-level = 0 | |
box-deny-ip = "*.*.*.*" | |
box-allow-ip = "127.0.0.1" | |
group = smsc | |
smsc = at | |
modemtype = auto | |
device=/dev/ttyUSB0 | |
my-number = 25474825145 | |
connect-allow-ip = 127.0.0.1 | |
sim-buffering = true | |
log-level = 0 | |
# if sim has pin | |
# pin = 6524 | |
group = smsbox | |
bearerbox-host = 127.0.0.1 | |
sendsms-port = 13013 | |
global-sender = 25474825145 | |
log-level = 0 | |
group = sendsms-user | |
username = sms-app | |
password = app125 | |
concatenation= true | |
max-messages = 10 | |
group = sms-service | |
#keyword = | |
keyword-regex = .* | |
catch-all = yes | |
max-messages = 0 | |
post-url = "http://127.0.0.1:3000/updates?update[phone]=%p&update[message]=%a" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdatesController < ApplicationController | |
before_action :set_update, only: [:show, :edit, :update, :destroy] | |
protect_from_forgery :except => :create | |
# controller actions here | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment