Daimon Blog

山在那里

freeswitch Cheatsheet

freeswitch是很好的软交换网关。但是其中涉及的各种网络概念实在太多。其实,配置fs的过程,很像是解决各种路由器兼容问题的过程。这里记下我的使用笔记。

  • 通过网关呼叫

    originate user/1005 &bridge(sofia/gateway/gd1/2001)
    
  • 直接通过ip呼叫

    originate user/1005 &bridge(sofia/external/sip:2001@192.168.42.244;transport=tcp)
    

注意这里的external,是指sip_profile中的配置文件

  • 网关注册、删除、重新检测等

    sofia status
    sofia profile external register gd1
    sofia profile external unregister gd1
    sofia profile external killgw gd1
    sofia profile external restart
    sofia profile external start
    sofia profile external stop
    
    # 看网关状态
    sofia status gateway gd1
    
    # 看有哪些服务
    sofia_dig 192.168.42.244
    
    # 打开sip trace
    sofia profile external siptrace on
    sofia global siptrace on
    
  • 拨叫相关

    # 看看是否能正常工作
    originate user/1001 &echo
    
    # 呼叫对方
    originate user/1001 &bridge(user/1002)
    
    originate {ignore_early_media=false}sofia/gateway/huawei/62022 &bridge(sofia/gateway/dongxin/013661106244)
    
    originate {sip_h_X-version='v3',sip_from_display=01053505375,sip_invite_params=user=phone}sofia/gateway/huawei/62022 &playback(/tmp/test.wav)
    
  • 拨叫时动态改变网关 sip_from_user 值

http://lists.freeswitch.org/pipermail/freeswitch-users/2012-April/082718.html

# 编辑网关配置文件
<param name="caller-id-in-from" value="true"/>

# 拨叫
originate {origination_caller_id_number=100043}sofia/gateway/goip/9999 &echo
  • sip_h_<xxx>:自定义头
  • 其它字段参见 fs 官方文档

调试

tcpdump -nnp -s 0  -A -i ppp0
tcpdump -nnp -s 0 -A host xxxx -w xxxx.pcap

网关重加载

sofia profile external restart

参考

  • 网关操作官方文档

https://freeswitch.org/confluence/display/FREESWITCH/Sofia+SIP+Stack

  • 通道变量

https://freeswitch.org/confluence/display/FREESWITCH/sip_from_display

文章分类目录