使用opensips的Asterisk Media服务

时间:2013-09-02 23:05:21

标签: linux voip

您好我正在将Asterisk与OpenSIPS整合为媒体服务,我正在使用Asterisk会议和语音邮件进行测试,但是当我拨打电话会议30秒后我就会出现问题。

同一个框中的Opensips和星号

Opensips 5060 星号5080

My logs 在日志中看起来像NAT问题,但两者都在同一个框中,我所有的本地客户UA都不是远程

我的配置opensips.cfg

http://www.netsoluciones.com/opensip.txt

任何帮助表示赞赏!

3 个答案:

答案 0 :(得分:0)

我无法看到它抱怨哪个数据包,但我假设服务器没有看到来自客户端的ACK - 如果是呼叫者将发送的会议服务INVITE ,Asterisk将回答200/OK,并且来电者应该发送ACK200/OK将成为日志中提到的“关键数据包”。

尝试单独跟踪所有连接。确保OpenSips正确传输ACK(实现起来可能很棘手,确保处理严格和松散的路由变体)。如果是本地网络方案,请确保OpenSips不会尝试重写联系人字段。

答案 1 :(得分:0)

这实际上是一个常见问题。

问题在于您的RTP传输 - 与您在端口5060或5080上的信令无关。虽然我看不到数据包本身,但您获得RTP超时 - 并且星号默认RTP超时为30秒。

要检查一下。

  1. 确保远程防火墙中允许您发送媒体的端点(RTP流本身 - UDP端口10000 - 60000)。
  2. 确保您接受来自远程系统的所有UDP RTP端口 - 这可能很棘手,我通常建议在SBC上允许所有UDP端口从1025到60000,例如您拥有的端口 - 它没有风险您无法在没有信号的情况下拨打或接听电话(您已在端口5060-5080上受到保护)。
  3. 正如之前的评论者所说,检查NAT并确保外部IP正确地在SIP数据包中。如果您愿意,请在星号CLI中键入以下内容:

  4. 上sip set debug

    然后粘贴调试内容以回复此问题,我可以进一步协助。

    1. 您还可以在星号中设置rtpignoreversion属性。但我只会建议这作为最后的手段。最好按照上面的说明粘贴SIP跟踪,以找到问题的根源。
    2. 如果我是一个男人 - 有时我是:-) - 我会向DOT(媒体)流在该服务器与其正在与之通信的端点之间正常传递的甜甜圈下注。 SIP跟踪将向您显示问题IP地址,我敢打赌,允许您打开防火墙以允许所述端点和/或通过打开上面引用的UDP端口说服您打开RTP到该服务器。如果IPTABLES已打开,请尝试禁用它并进行测试。同样,SIP跟踪将告诉我们需要知道的一切,以便给出确切的答案。

      查看日志后的更新----

      对我来说,您的路由脚本没有以您想要的方式绑定星号所需的钩子...

      看看这个脚本 - 我过去曾经使用过它。它需要你做一些修改,但它应该让你去...

      显然这不是一个完整的路由脚本 - 它会放在脚本底部附近的路径定义之前......

      另外 - 你确实发现了星号无法验证用户3012的事实,对吧?我假设你做了,并且它与你的问题无关,但我想我应该问......

      # ASTERISK HOOK - BEGIN
              # media service number? (digits starting with *)
          if ($rU=~"^\*[1-9]+") {
              # we do provide access to media services only to our
              # subscribers, who were previously authenticated 
              if (!is_from_local()) {
                  send_reply("403","Forbidden access to media service");
                  exit;
              }
              #identify the services and translate to Asterisk extensions
              if ($rU=="*1111") {
                  # access to own voicemail IVR
                  seturi("sip:VM_pickup@ASTERISK_IP:ASTERISK_PORT");
              } else
              if ($rU=="*2111") {
                  # access to the "say time" announcement 
                  seturi("sip:AN_time@ASTERISK_IP:ASTERISK_PORT");
              } else
              if ($rU=="*2112") {
                  # access to the "say date" announcement 
                  seturi("sip:AN_date@ASTERISK_IP:ASTERISK_PORT");
              } else
              if ($rU=="*2113") {
                  # access to the "echo" service
                  seturi("sip:AN_echo@ASTERISK_IP:ASTERISK_PORT");
              } else
              if ($rU=~"\*3[0-9]{3}") {
                  # access to the conference service 
                  # remove the "*3" prefix and place the "CR_" prefix
                  strip(2);
                  prefix("CR_");
                  rewritehostport("ASTERISK_IP:ASTERISK_PORT");
              } else {
                  # unknown service
                  seturi("sip:AN_notavailable@ASTERISK_IP:ASTERISK_PORT");
              }
              # after setting the proper RURI (to point to corresponding ASTERISK     extension),
              # simply forward the call
              t_relay();
              exit;
          }
          # ASTERISK HOOK - END
      
          # do lookup
          if (!lookup("location")) {
              # ASTERISK HOOK - BEGIN
              # callee is not registered, so different to Voicemail
              # First add the VM recording prefix to the RURI
              prefix("VMR_");
              # forward to the call to Asterisk (replace below with real IP and port)
              rewritehostport("ASTERISK_IP:ASTERISK_PORT");
              route(1);
              # ASTERISK HOOK - END
              exit;
          }
      
          # when routing via usrloc, log the missed calls also
          setflag(2);
      
          # arm a failure route in order to catch failed calls
          # targeting local subscribers; if we fail to deliver
          # the call to the user, we send the call to voicemail
          t_on_failure("1");
      
          route(1);
      }
      
      
      route[1] {
          if (!t_relay()) {
              sl_reply_error();
          };
          exit;
      }
      
      
      failure_route[1] {
          if (t_was_cancelled()) {
              exit;
          }
      
          # if the failure code is "408 - timeout" or "486 - busy",
          # forward the calls to voicemail recording
          if (t_check_status("486|408")) {
              # ASTERISK HOOK - BEGIN
              # First revert the RURI to get the original user in RURI
              # Then add the VM recording prefix to the RURI
              revert_uri();
              prefix("VMR_");
              # forward to the call to Asterisk (replace below with real IP and port)
              rewritehostport("ASTERISK_IP:ASTERISK_PORT");
              t_relay();
              # ASTERISK HOOK - END
              exit;
          }
      

答案 2 :(得分:0)

有几件事可能会让电话掉线。

我会列出3,所以你可以看看:

1)来自Callee的未接收的ACK将使其连续生成200 OK然后退出并发送BYE。

2)RTP超时

3)Opensips的SIP ping mecanism

由于你有一个重传超时,我会选择1号,威廉回答是一个很好的起点。

我过去在本地IP地址上运行Opensips时遇到了几个问题......可能有点棘手。 另外,不要忘记在Opensips的主路线上使用record_routing(),以确保它保持在对话的中间。