freeswitch录音功能
<condition field="destination_number" expression="^(10[01][0-8])$">
下面加入以下语句即可录音。
<action application="set" data="RECORD_COPYRIGHT=(c) 2011"/>
<action application="set" data="RECORD_SOFTWARE=FreeSWITCH"/>
<action application="set" data="RECORD_ARTIST=FreeSWITCH"/>
<action application="set" data="RECORD_COMMENT=FreeSWITCH"/>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_STEREO=true"/>
<action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
function grabaEntrada(tablaGraba, tablaGrabaMod)local razon, OWNER, destino = '', '', '';local handle, k, v = nil, nil, nilOWNER = 'grabaEntrada'function mkDir(dir)local d = nillocal OWNER = 'mkDir'local tmp = ''if type(dir) == 'string' then dir = backSlash(dir)for d in string.gfind(dir, ".-/") dotmp = tmp .. denddir = tmpos.execute(string.format('MKDIR %s', string.gsub(dir, '/', '%\\') ))endendfunction onInputCBF(s, _type, obj, arg)local k, v = nil, nilif tablaGrabaMod._debug thenfor k, v in pairs(tablaGrabaMod) do print(string.format('tablaGrabaMod k-> %s v->%s\n', tostring(k), tostring(v)))end for k, v in pairs(obj) do printSessionFunctions(obj)print(string.format('obj k-> %s v->%s\n', tostring(k), tostring(v)))endif _type == 'table' thenfor k, v in pairs(_type) do print(string.format('_type k-> %s v->%s\n', tostring(k), tostring(v)))end endprint(string.format('\n(%s == dtmf) and (obj.digit [%s] == [%s] tablaGrabaMod.dtmf)\n', _type, obj.digit, tablaGrabaMod.dtmf))endif (_type == "dtmf") and (obj.digit == tablaGrabaMod.dtmf) then print(string.format('\nBREAK!!!\n'))return 'break'else print(string.format('\nCONTINUE!!!\n'))return ''endendif type(tablaGraba) ~= 'table' then razon= string.format('ERROR Parametros invalidos')return false endif type(tablaGrabaMod) ~= 'table' thentablaGrabaMod = {segundosMax = 7,umbralSilencio = 500,segundosInterrupcion = 3,dtmf = '#',_debug = false}endif type(tablaGraba.dir ) ~= 'string'then razon= string.format('ERROR tablaGraba.dir no es tipo string, Abortando')return falseendif type(tablaGraba.audioT) ~= 'table' thenrazon= string.format('ERROR tablaGraba.audioT no es tipo table, Abortando')return falseendif #tablaGraba.audioT == 0 thenrazon= string.format('WARNING tablaGraba.audioT NO tiene audios definidos, defina audios (tablaGraba.audioT = {\'aviso.wav\', \'beep.wav\' })')endif (type(tablaGraba.nombre) ~= 'string' ) or (tablaGraba.nombre == '') thentablaGraba.nombre = dameNombreUnico(CUUID)..'.wav'razon= string.format('WARNING tablaGraba.nombre NO definido e esta VACIO, valor Asignado [%s]', tablaGraba.nombre)endif type(tablaGrabaMod.dtmf) ~= 'string' or #tablaGrabaMod.dtmf == 0 thentablaGrabaMod.dtmf = '#'endif type(tablaGrabaMod._debug) ~= 'boolean' thentablaGrabaMod._debug = falseendtablaGrabaMod.segundosMax = tonumber(tablaGrabaMod.segundosMax) or 7; tablaGrabaMod.umbralSilencio = tonumber(tablaGrabaMod.umbralSilencio) or 500; tablaGrabaMod.segundosInterrupcion = tonumber(tablaGrabaMod.segundosInterrupcion) or 3;tablaGrabaMod.dtmf = tablaGrabaMod.dtmf:sub(1,1) --Solo un caracterif tablaGraba.dir:sub(#tablaGraba.dir) ~= '/' thentablaGraba.dir = tablaGraba.dir..'/'enddestino = string.format('%s%s', tablaGraba.dir, tablaGraba.nombre)handle = io.open(destino, 'w')if handle == nil then --Trata de crear el directorio sino existelocal tmp, d, dir = '', '', ''dir = destinofor d in string.gfind(dir, ".-/") dotmp = tmp .. denddir = tmpmkDir(direlsehandle:close()endsession:execute('flush_dtmf')razon= string.format('LISTO path [%s] FLUSH_DTMF EJECUTADO!!', destino)parametros = creaInforme(razon, string.format('INFO %s', razon), CONSOLE_W, OWNER)if session:ready() thenfor k, v in pairs(tablaGraba.audioT) do session:streamFile(v) end session:setInputCallback('onInputCBF', ''); session:recordFile(destino, tablaGrabaMod.segundosMax, tablaGrabaMod.umbralSilencio, tablaGrabaMod.segundosInterrupcion); endend
http://wiki.freeswitch.org.cn/wiki/Channel_Variables.html#execute_on_answer
<context name="hanguponhook"><extension name="hanguphook" continue="true"><condition><action application="set" data="api_hangup_hook=luarun rec_ins_db.lua ${uuid} ${answered_time} ${caller_id_number} ${sip_to_user} ${audiofile} "/> </condition></extension></context> <context name="audio"><extension name="audio" continue="true"><condition field="${trksno}" expression="^(\d+)$" break="on-true"><action application="set" data="session_in_hangup_hook=true"/><action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/><action application="set" data="RECORD_COPYRIGHT=(c) 2012"/><action application="set" data="RECORD_SOFTWARE=Freeswitch"/><action application="set" data="RECORD_ARTIST=Freeswitch"/>
<action application="set" data="RECORD_COMMENT=Freeswitch"/>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/><action application="set" data="RECORD_STEREO=true"/><action application="record_session" data="${audiofile}"/><action application="set" data="execute_on_answer=execute_extension hanguphook XML hanguponhook"/></condition></extension></context><context name="default"><extension name="rec"><condition field="destination_number" expression="^${REC_IC}(\d+)$"><action application="ring_ready"/><action application="lua" data="audio_rec.lua $1"/><action application="execute_extension" data="audio XML audio"/><action application="set" data="hangup_after_bridge=false"/><action application="bridge" data="sofia/internal/${REC_OG}$1@${sip_received_ip}:${sip_received_port}"/></condition></extension></context> </include>
freeswitch录音功能相关推荐
- FreeSWITCH开启录音功能
FreeSwitch录音功能默认是关闭的,需要修改配置开启录音功能. 首先备份freeswitch/conf/dialplan/default.xml . 然后编辑default.xml ,在 < ...
- 第十二章 HTTAPI – FreeSWITCH向Webserver寻问下一步操作
HTTAPI允许FreeSWITCH向webserver询问如何处理呼叫,还可以在执行之后再次询问.因此,它实际上是一种高层次的动态协议,FreeSWITCH向webserver发送呼叫的所有相关信息 ...
- SIP电话(一)之程控交换机-FreeSWITCH的使用总结
最近由于项目需要一直在研究Sip电话,Sip电话是基于sip协议的实现voip即网络电话的的功能.那么问题来了?我们打电话都是使用某动,某通,某信的电话卡,这种电话卡是在全国范围内收费的gms卡,如果 ...
- freeswitch 录音录像
freeswitch支持录音和录像功能,录音功能主要是通过mod_sndfile.mod_shout等模块实现的,录像模块是通过mod_mp4v2和mod_av模块实现. mod_sndfile录制w ...
- freeswitch录音
freeswitch 录音录像 freeswitch支持录音和录像功能,录音功能主要是通过mod_sndfile.mod_shout等模块实现的,录像模块是通过mod_mp4v2和mod_av模块实现 ...
- 使用Opensips和FreeSwitch搭建万级别的高可用软交换架构
最近因为项目的原因,需要提供一个支持万级别以上,支持多应用的软交换服务端架构,对以前的架构做了一个调整,写一篇文章总结下. 新的架构主要解决了一下几个问题: 单套要支持1w左右并发的呼叫 完全的高可用 ...
- [freeswitch]mod_dptools功能总结(updating)
mod_dptools功能总结 前言 freeSWITCH的mod_dptools模块各功能总结,这里只是整理下功能,具体用法参考官方wiki answer "接通".建立aleg ...
- Freeswitch操作基本配置
1.SIP 协议 2. hangup_after_bridge = true 设置该变量,告诉系统如果当前有一个桥接成功的通话,挂断当前通话. 3.Freeswitch 监听电话: mod_spy 是 ...
- FreeSwitch 的初始化及其模块加载过程
FS 主函数main() Freeswitch的主函数是在文件switch.c中定义的,该文件的260行是整个程序的入口,主函数主要完成的功能是包括,命令行解析,初始化apr库,构建全局内存池,模块加 ...
- FreeSWITCH快速录音
一.背景 测试人员反映FreeSWITCH录音不及时,需要大约5秒的时间才能捕获到RTP流. 二.原因及解决 查了下资料,FreeSWITCH默认的录音参数配置是开启缓冲的, 即RTP流大小到达655 ...
最新文章
- 如何解决 linux socket TIME_WAIT 过多造成的问题(SYN、ACK、FIN、MSL、RST含义)netstat查看TCP连接数命令
- python类基础知识注意点
- FileReader/FileWriter复制文件
- java标记错误_标记电子邮件Java时出错
- sql 算出下级销售总和_找出总和字符串
- easy ui dialog 关闭之后的怪异问题
- php判断绝对路径文件是否存在,php – 如何确定文件路径是否绝对?
- Python 第一章 基础知识
- IIS和Asp.Net页面运行机制
- 基于Linux下 Oracle 备份策略(RMAN)
- BZOJ3653: 谈笑风生
- 高质量网站源码_50个高质量的免费网站模板
- workgroup无法访问 您可能没有权限使用网络资源 (解决方案)
- 深入Elasticsearch:索引的创建
- 从你的全世界路过-Freedom
- yara 源码学习(三) 扫描部分
- web scraper 爬取微博粉丝性别以及微博内容
- 10月27号吃鸡服务器维护吗,10月27日正式服维护公告
- AI换脸为什么服务器没响应,AI换脸云服务器
- 卷妹带你学数据库---5天冲刺Day5
热门文章
- Python破解协议密码
- 【语言处理与Python】1.3计算语言:简单的统计
- iPhone开发之修改UINavigation Bar背景图片
- amaze ui使用简介
- Windows Server 2003 R2中的DFS复制与管理
- 代码生成的思考:MyMeta提供数据库架构,反射、Emit提供构建的提供动态创建的环境...
- Kubernetes (federation)联邦机制介绍
- 爱奇艺开播助手Flutter跨平台Hybrid实践\n
- .net reactor 学习系列(四)---.net reactor应用场景
- 团队作业7——第二次项目冲刺(Beta版本)-第一篇