zoukankan      html  css  js  c++  java
  • Opensips + FreeSwitch 负载均衡

    概略:在做Opensips + FreeSwitch 负载均衡的过程中,遇到的关键问题汇总记录。

    基本配置

    请参考:https://blog.51cto.com/908405/2235934   比我整理的好,请详细阅读。

    几个问题

    1、load_balancer表配置

      字段:dst_uri ,值:sip:fs_ip_addr:fs_port
      1)fs_ip_addr:fs_port 如果有错误,实际不存在,会报错
        opensips报错:
          DBG:load_balancer:lb_route: sequential call of LB - skipping destination 1 <sip:172.18.198.123:9060> (filtered=1 , disabled=0)
          DBG:load_balancer:lb_route: sequential call of LB - no destination found

        UAC报错:All GW Are Down.

      2)fs_ip_addr:fs_port 要配置fs的公网ip,否则接听后双方都没声音


    2、CODEC NEGOTIATION ERROR问题
      fs日志
        Audio Codec Compare [PCMA:8:8000:20:64000:1] ++++ is saved as a match        #有这行说明语音编码匹配上了。
        Hangup sofia/external/_msisdn_@ip:port [CS_CONSUME_MEDIA] [INCOMPATIBLE_DESTINATION]
      官网说明:
        488 INCOMPATIBLE_DESTINATION incompatible destination [Q.850] This cause indicates that the equipment sending this cause has received a request to establish a call which has low layer compatibility, high layer compatibility or other compatibility attributes (e.g. data rate) which cannot be accommodated.

      解决:Microsip软件的账号登录信息有一项 “Media Encryption”,选择“禁用”就好了。
      原理:谁知道谁讲讲,我也不懂。


    3、自动挂断的问题
      现象:大概32秒或者36秒自动挂断,抓包发现FS发出的消息里包含“ACK Timeout
      原因:183后,fs --(200 OK)--> ops --(200 OK)--> UAC,此时UAC应该回复ops ACK,ops转发给FS,但是UAC把ACK发错地方了
        因为ops监听的是所在服务器的内网ip:port,就把内网ip在200 OK包里给了UAC,UAC会ACK时用的是ops的内网ip,所以到不了ops。
      解决:https://blog.csdn.net/commander_officer/article/details/16946781 这里有两个方法解决这个问题。
        在opensips.cfg中增加两个变量:
          advertised_address="public_ip"
          alias="public_ip"
        或者
          listen=udp:private_ip:5060 as public_ip:5060 (留意as后边没有udp,否则启动报错)

    4、登录到ops还是fs的问题
      opensips.cfg 配置决定uac的登录实际发生在哪里
        if(is_method("REGISTER")) {          ##这样登录到ops上
          if (!www_authorize("", "subscriber")) {
            www_challenge("", "0");
            exit;
          }
          save("location");
          exit;
        }

      ------------------------------------------------------------------------------
        if(is_method("REGISTER")) {          ##这样是登录到FS上
          if (!ds_select_dst("1", "0")) {
            send_reply("503","Service Unavailable");
          }
        }

      (登录与负载均衡的关系,个人理解:既然是负载均衡,就应该比较平均的负载大量呼叫的压力。如果在登录阶段,就确定登录到FS1上,那么通话也必然走FS1。那么,比如100个用户,分别登录到fs1和fs2上各50个。fs1上45个在通话,fs2上2个在通话,那就压力悬殊了。所以个人理解应该登录到ops上。)
     (疑问:既然登录到ops上能通过fs进行呼叫,那登录到fs1上,呼叫不能走fs2吗?尚未验证!)

    总结:基本上很多问题都是网络NAT导致的,比如rtp建立的问题,没声音的问题,ACK超时自动挂断等等。需要细心的在所有环节进行抓包,分析。(wireshark软件的Telephony菜单里有一个VoIP Call菜单项,可以自动发现sip呼叫,可以整理出呼叫过程中,所有消息的流程图。) 分析流程图可以找到问题所在,然后去搜索解决方案,就比较容易了。

    参考资料:

      https://www.oschina.net/translate/tutorials-loadbalancing-1-9?lang=chs&p=1

  • 相关阅读:
    document.getElementById(“id”)与$("#id")的区别
    sqlserver 无法打开备份文件a.bak
    xnconvert 图片转换工具
    基于jQuery的 h5移动端抽奖页面插件
    nodeJS 简单启动express服务器
    jquery 按钮切换插件
    微信判断手机有没有APP,有则打开,没有则跳到应用商城
    jQuery 文字向上轮播
    Node.js制作爬取简书内容的爬虫
    jquery手机端轮播图,点击放大手动轮播
  • 原文地址:https://www.cnblogs.com/zililita/p/11459211.html
Copyright © 2011-2022 走看看