使用python esl 实现FreeSWITCH自动外呼
tags:FreeSWITCH python 自动外呼 创建时间:2016-03-19 09:37:39
以下项目开源于:
https://github.com/nwaycn/nway_ac
代码:
```python
# coding=utf-8
__author__ = 'lihao,18621575908'
''
版权所有:上海宁卫信息技术有限公司
功能说明:本程序只适用于落地与落地间消化话费,而不适用于其它骚扰类型的应用
授权模式:GPL
bug report:lihao@nway.com.cn
''
import time
import thread
import os,sys
import psycopg2
from ESL import *
import string
import datetime
import random
mylock = thread.allocate_lock()
#global var
fs_ip = '127.0.0.1'
fs_esl_port = '8021'
fs_esl_auth = 'ClueCon'
rings = []
global ring_count
ring_count = 0
max_call = 30
base_path = '/usr/local/src/nway_ac/nway_ac/'
gateway_url = 'sofia/gateway/tojp/'
#//global var
def GetDbConn():
conn = psycopg2.connect(database="nway_ac", user="postgres", password="nway_2398488485And", host="127.0.0.1", port="5432")
return conn
def GetCurrentPath():
return os.getcwd()
def SetAllIdle():
conn = GetDbConn()
querysql = 'UPDATE callout_numbers SET cal