使用python来获得FreeSwitch送过来的来去电、摘挂机及CDR 编辑
import redis
rc = redis.Redis(host='127.0.0.1')
ps = rc.pubsub()
ps.psubscribe(['event*'])
for item in ps.listen():
print item
if item['type'] == 'pmessage':
print item['data']
data中数据说明:
//evt_name 事件名称
//callin_number: 呼入号码
//dest_number: 目标号码
//domain: 域名
//dtmf: 收到的dtmf消息
//gateway: 外线gateway_name
//originate_number: 原号码
//direction: inbound,outbound
EVENT_NAME有以下类型,依次增加:
EVENT_CALLIN = 1
EVENT_CALLOUT
EVENT_RING
EVNET_ALERT
EVENT_ANSWER
EVENT_HANGUP
EVENT_DTMF
EVENT_PLAYRING
EVENT_PLAYSTOP
EVENT_PARK
EVENT_UNPARK
EVENT_HOLD
EVENT_UNHOLD
EVENT_BRIDGED
EVENT_DESTORY
EVENT_TALKING