示例#1
0
 def send_direct(self, to, fromm, body, empty=False):
     """Send a message directly via the BTS addressed using IMSIs"""
     for chunk in chunk_sms(body):
         imsi = to[0]
         ipaddr = to[1]
         port = to[2]
         body = (sms_utilities.SMS_Deliver.gen_msg(
             to, fromm, chunk, empty).upper())
         freeswitch.consoleLog(
             'info', 'Message body is: \'' + str(chunk) + '\'\n')
         event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE")
         event.addHeader("proto", "sip")
         event.addHeader("dest_proto", "sip")
         event.addHeader("from", fromm)
         from_full = ("sip:" + fromm + "@" +
                      freeswitch.getGlobalVariable("domain"))
         event.addHeader("from_full", from_full)
         to_full = str(freeswitch.getGlobalVariable("smqueue_profile") +
                       "/sip:"+ str(imsi) + "@" + ipaddr + ":" + str(port))
         event.addHeader("to", to_full)
         event.addHeader("subject", "SIMPLE_MESSAGE")
         event.addHeader("type", "application/vnd.3gpp.sms")
         event.addHeader("hint", "the hint")
         event.addHeader("replying", "false")
         event.addBody(body)
         event.fire()
示例#2
0
 def send(self, to, fromm, body, empty=False):
     """Send a message via the SMSC addressed using MSISDNs"""
     for chunk in chunk_sms(body):
         event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE")
         event.addHeader("proto", "sip")
         event.addHeader("dest_proto", "sip")
         event.addHeader("from", fromm)
         from_full = ("sip:" + fromm + "@" +
                      freeswitch.getGlobalVariable("domain"))
         event.addHeader("from_full", from_full)
         sip_my_ip = self.smqueue.read_config('SIP.myIP').data['value']
         sip_my_port = self.smqueue.read_config('SIP.myPort').data['value']
         to_full = str(freeswitch.getGlobalVariable("smqueue_profile") +
                       "/sip:smsc@" + sip_my_ip + ":" + sip_my_port)
         event.addHeader("to", to_full)
         event.addHeader("subject", "SIMPLE_MESSAGE")
         event.addHeader("type", "application/vnd.3gpp.sms")
         event.addHeader("hint", "the hint")
         event.addHeader("replying", "false")
         event.addBody(sms_utilities.SMS_Submit.gen_msg(to, chunk, empty))
         event.fire()
示例#3
0
#!/usr/bin/python
##Random single concurrency
import freeswitch
import re
import random

rootdir = freeswitch.getGlobalVariable("base_dir")
api = freeswitch.API()

file_path = rootdir + "/scripts/pyscripts/sipnumber/number"


def file_list(filename):
    num_list = []
    file = open(filename, "r")
    for line in file.readlines():
        line = line.strip('\n')
        num_list.append(line)
    file.close()
    return num_list


def handler(session, args):
    pass


def fsapi(session, stream, env, args):
    count, fullgw, count, loop = 0, 0, 0, 0
    upgw = []
    upgw_list = file_list(file_path)
    for gw in range(len(upgw_list)):