freeswitch的helloworld

阅读更多

########
客户端mac用yate
ios用 adore sip client



############### asr
vim  modules.con
asr_tts/mod_pocketsphinx

make mod_pocketsphinx-install


freeswitch/etc/freeswitch/autoload_configs/modules.conf.xml
 
    
    
    
    
    

如果没有这个就要手工
load mod_flite
load mod_pocketsphinx

freeswitch/etc/freeswitch/dialplan/default.xml

      
        
        
        
        
        
      
    




freeswitch/share/freeswitch/grammar/yes_no.gram
#JSGF V1.0;

/**
  * JSGF Grammar for names
  */

grammar example;


 = [ yes ];
 = [ no ];

public  = [  |  ] ;


启动拨打1235

在log中查看freeswitch/var/log/freeswitch/freeswitch.log

e0266345-e1de-4f19-9352-88d52a92f028 2019-05-23 15:09:20.530197 [INFO] switch_ivr_async.c:4460 (sofia/internal/[email protected]) START OF SPEECH
2019-05-23 15:09:21.750191 [DEBUG] mod_pocketsphinx.c:464 Recognized: no, Confidence: 100, Confidence-Threshold: 0
e0266345-e1de-4f19-9352-88d52a92f028 2019-05-23 15:09:21.770121 [INFO] switch_ivr_async.c:4450 (sofia/internal/[email protected]) DETECTED SPEECH


识别出yes或no


#########中文asr识别###########

需要的中文 tdt_sc_8k在
git clone https://github.com/skerit/cmusphinx
cd cmusphinx-master/pocketsphinx/model/hmm/zh
把tdt_sc_8k放在
/usr/local/freeswitch/share/freeswitch/grammar/model


freeswitch/etc/freeswitch/autoload_configs/pocketsphinx.conf.xml







需要字典
zh_broadcastnews_utf8.dic
参考
https://www.jianshu.com/p/f5d0b6bcea68
https://github.com/znstj/mrobot_speech

考到
freeswitch/share/freeswitch/grammar/zh_broadcastnews_utf8.dic

cp zh.gram  /usr/local/freeswitch/share/freeswitch/grammar
#JSGF V1.0;

/**
  * JSGF Grammar for names
  */

grammar names;


 = 杜;
 = 金;
 = 房;
<孙> = 孙;
<中> = 中;
<山> = 山;

public  = ;
public  = ;
public  = <孙> <中> <山>;


asr.lua 放到freeswitch/share/freeswitch/scripts





#########录音及播放
录音
originate user/1006 &record(/tmp/welcome.wav)

播放
originate user/1006 &playback(/tmp/welcome.wav)

#执行lua
把test.lua放入
/usr/local/freeswitch/share/freeswitch/scripts

originate user/1006 &lua(test.lua)

session:answer()
session:sleep(1000)
session:streamFile("/tmp/welcome.wav")
session:hangup()




如果是在命令行直接执行lua
freeswitch@bogon> lua /tmp/api.lua
api = freeswitch.API()
reply = api:execute("version", "")
freeswitch.consoleLog("INFO", "Got reply:\n\n" .. reply .. "\n")



##########javascript脚本######
brew install v8
安装目录
vim modules.conf
打开mod_v8

make mod_v8-install


#################


##################
编译tts模块
需要在源码目录的modules.conf
打开注释
#asr_tts/mod_cepstral
asr_tts/mod_flite
#asr_tts/mod_pocketsphinx
asr_tts/mod_tts_commandline

asr_tts/mod_unimrcp

freeswitch安装完之后
make install 

make mod_flite-install


进行安装

freeswitch的命令行


一定要load
load mod_flite




freeswitch>originate user/1005 &speak('flite|rms|Hello,welcome to freeswitch,haha,I am haoning')


freeswitch/etc/freeswitch/dialplan/default.xml加入

    
      
      
    



拨打1234测试
################

编译目录
vim modules.conf
#asr_tts/mod_cepstral
asr_tts/mod_flite
#asr_tts/mod_pocketsphinx
asr_tts/mod_tts_commandline



make mod_tts_commandline-install

autoload_configs/tts_commandline.conf.xml

 
    


freeswitch/etc/freeswitch/dialplan/default.xml 修改

  
    
    
    
    
  



load mod_tts_commandline

拨打1234测试

如果想不load
freeswitch/etc/freeswitch/autoload_configs/modules.conf.xml
打开tts注释

###############
vim modules.conf
asr_tts/mod_unimrcp
make mod_unimrcp-install






########################
aws上的

centos7安装


https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7
yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release
yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-*

tts:
yum list|grep freeswitch
yum install freeswitch-asrtts-flite
yum install freeswitch-asrtts-tts-commandline asrtts-unimrcp -y

systemctl enable freeswitch
systemctl start freeswitch

客户端进入
fs_cli -rRS




可能会有https://files.freeswitch.org/yum-1.6/7server/x86_64/repodata/repomd.xml 找不到的问题
可能是7Server的问题,需要修改repo,把$releasever 改成 7server小写的



由于内ip和公网ip不一样,电话通了但是没声音
公网电话通了但是没声音:
https://blog.csdn.net/hry2015/article/details/78388839

/etc/freeswitch/sip_profiles/internal.xml
    
    
    
    


启用internal配置文件
vars.xml:






internal.xml中的accept-blind-reg与accept-blind-auth 均为true!这样可以做到自注册!



ios客户端用ador sip client

两个手机登录后,用户用1001和1005
查看用户

sofia status profile internal reg


###########################

jssip:
https://blog.csdn.net/foruok/article/details/74321214


#########################

mac安装
https://freeswitch.org/confluence/display/FREESWITCH/macOS+Manual+Installation


一定要安装libtool 
brew install libtool
会有glibtool 和glibtoolize 生成


brew install autoconf automake curl jpeg ldns libsndfile libtiff libtool lua openssl opus pcre pkg-config speex speexdsp sqlite signalwire/homebrew-signalwire/flite signalwire/homebrew-signalwire/libks signalwire/homebrew-signalwire/signalwire-c


git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
./bootstrap.sh

./configure --prefix=/usr/local/freeswitch
make
make install
make sounds-install
make moh-install
make cd-sounds-install 
make cd-moh-install

lsof -i:5060


启动
freeswitch

另一个窗口打开客户端

fs_cli
关闭:
Shutdown


jssip:
https://www.bootcdn.cn/jssip/


#######################

首先介绍下什么是DID? 翻译为中文为“直接向内拨号”

https://blog.csdn.net/daitu3201/article/details/80031503

sofia status profile internal
sofia status profile internal reg

jssip
https://www.jianshu.com/p/813becfc6388

sipjs:
http://sipjs.com/download/


#############################
vars.xml:






注册新用户
https://blog.csdn.net/daitu3201/article/details/80031503
http://www.bubuko.com/infodetail-1443623.html
错误 :总提示“freeswitch You must define a domain called
internal.xml中的accept-blind-reg与accept-blind-auth 均为true!这样可以做到自注册!


/usr/local/freeswitchnew/etc/freeswitch/sip_profiles/external#

gw-DID.xml

  
      // sip provider 提供的服务器IP
    // sip provider 提供的DID账号
     // sip provider 提供的DID账号密码
      // sip provider 提供的服务器IP
    
    
    
    
  



配置拨码计划


呼入
在 /usr/local/freeswitchnew/etc/freeswitch/dialplan 中修改 public.xml,
或者在public目录下加
添加如下内容:

   
  
    
  



呼出:
/usr/local/freeswitchnew/etc/freeswitch/dialplan/default
添加call_out.xml

    
      
      
      
    




重启查看用户
sofia status profile internal reg
sofia status profile internal


originate sofia/gateway/gw-DID/88888888 &echo

originate sofia/gateway/gw-DID/88888888 &park


version

status
sofia status
sofia help
sofia status gateway gw-DID

show channes
show calls


#######
h5的客户端





    
    sipjs-webphone
    
    





sofia status profile internal reg
能看到的







  JsSIP + WebRTC + freeSWITCH
  
  
  
  
  





  

































你可能感兴趣的:(webrtc,sip,freeswitch)