def create_relays(): number = db.Number() number.number = "1111" number.country = "US" number.save() number = db.Number() number.number = "2222" number.country = "US" number.save() return list(db.Number.select())
def create_relays(): number = db.Number() number.number = "1111" number.country = "US" number.features = "" number.pool = db.NumberPool.SMS_RELAY number.save() number = db.Number() number.number = "2222" number.country = "US" number.features = "" number.pool = db.NumberPool.SMS_RELAY number.save() return list(db.Number.select())
def rent(): number = hotline.telephony.lowlevel.rent_number( sms_callback_url=flask.url_for("telephony.inbound_sms", _external=True)) number_record = models.Number() number_record.number = number["msisdn"] number_record.country = number["country"] number_record.save() return flask.redirect(flask.url_for(".list"))
def manual_add_number(number, country, sms_callback_url): import hotline.telephony.lowlevel from hotline.database import models hotline.telephony.lowlevel.setup_number(number, country, sms_callback_url) with models.db: number_entry = models.Number() number_entry.number = number number_entry.country = country number_entry.save()
def manual_add_number(number, sms_callback_url): import hotline.telephony.lowlevel from hotline.database import models hotline.telephony.lowlevel.setup_number(number, "US", sms_callback_url) with models.db: number_entry = models.Number() number_entry.number = hotline.telephony.lowlevel.normalize_number( number) number_entry.country = "US" number_entry.save()
def manual_add_number(number, country, features, sms_callback_url): import hotline.telephony.lowlevel from hotline.database import models hotline.telephony.lowlevel.setup_number(number, country, sms_callback_url) with models.db: number_entry = models.Number() number_entry.number = hotline.telephony.lowlevel.normalize_e164_number( number) number_entry.country = country number_entry.features = features number_entry.save()
def create_event(): number = db.Number() number.number = "5678" number.country = "US" number.save() event = db.Event() event.name = "Test event" event.slug = "test" event.owner_user_id = "abc123" event.primary_number = number.number event.primary_number_id = number event.save() return event
def create_event(name=EVENT_NAME, number=EVENT_NUMBER): number_ = db.Number() number_.number = number number_.country = "US" number_.features = "" number_.save() event = db.Event() event.name = name event.slug = name event.owner_user_id = "abc123" event.primary_number = number_.number event.primary_number_id = number_ event.save() return event
def rent(): country = flask.request.values["country"] if not country: return flask.abort(400, "Missing country.") number = hotline.telephony.lowlevel.rent_number( country_code=country, sms_callback_url=flask.url_for("telephony.inbound_sms", _external=True), ) number_record = models.Number() number_record.number = number["msisdn"] number_record.country = number["country"] number_record.features = ",".join(number.get("features", [])) number_record.save() return flask.redirect(flask.url_for(".list"))