【问题标题】:pjsua2 sample app outgoing calls getting 403 Forbidden response with TCP connectionpjsua2 示例应用程序传出呼叫通过 TCP 连接获得 403 禁止响应
【发布时间】:2019-08-07 19:14:04
【问题描述】:

我已在 pjsua 示例应用程序中成功注册了我的 sip 客户端,并且正在通过 UDP 接收来电。但是,当我尝试拨打电话时,它会因 403 FORBIDDEN 错误而断开连接。并且创建的连接是 TCP!

我验证了目标 uri。它的格式为

sip:mobile-number@sip-server-ip:port

这是我的 makeCall 代码:

public void makeCall(查看视图) {

    //some code here..

    MyCall call = new MyCall(account, id);
    CallOpParam prm = new CallOpParam(true);

    try {

        call.makeCall(buddy_uri, prm);
    } catch (Exception e) {
        call.delete();
        return;
    }

    currentCall = call;
    showCallActivity();
    }

呼叫活动出现。日志如下

  --------- beginning of system
some media and call related initializations
I/System.out: 17:52:37.581 tcpc0x93d09414  ...TCP client transport created
I/System.out: 17:52:37.583 tcpc0x93d09414  ...TCP transport 192.168.43.167:58160 is connecting to <sip-server-ip>:5060...
I/System.out: 17:52:37.584   pjsua_core.c  ...TX 1443 bytes Request msg INVITE/cseq=20547 (tdta0xa8dc0064) to TCP <sip-server-ip>:5060:
I/System.out: INVITE sip:<mobile-number>@<sip-server-ip> SIP/2.0
I/System.out: Via: SIP/2.0/TCP 192.168.43.167:58160;rport;branch=z9hG4bKPj3f2aec57-9f79-46f5-bf03-9f9cb9d482ca;alias
I/System.out: Max-Forwards: 70
I/System.out: From: sip:<sip-account-number>@<sip-server-ip>;tag=90b152c8-fd44-41a3-9851-482da18ee67a
I/System.out: To: sip:<mobile-number>@<sip-server-ip>
I/System.out: Contact: <sip:sip-account-number@25.16.198.109:6000;ob>
I/System.out: Call-ID: c891a91e-054f-426d-810e-3ac2ba55e4f5
I/System.out: CSeq: 20547 INVITE
I/System.out: Route: <sip:sip-server-ip;lr>
I/System.out: Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I/System.out: Supported: replaces, 100rel, timer, norefersub
I/System.out: Session-Expires: 1800

**some more logs here**

I/System.out: 17:52:37.762   pjsua_core.c  .RX 374 bytes Response msg 100/INVITE/cseq=20547 (rdata0x93d095e0) from TCP <sip-server-ip>:5060:

I/System.out: SIP/2.0 100 Trying

I/System.out: Via: SIP/2.0/TCP 192.168.43.167:58160;branch=z9hG4bKPj3f2aec57-9f79-46f5-bf03-9f9cb9d482ca;received=137.97.99.211;rport=58160;alias

I/System.out: Call-ID: c891a91e-054f-426d-810e-3ac2ba55e4f5

I/System.out: From: <sip:sip-account-number>@sip-server-ip>;tag=90b152c8-fd44-41a3-9851-482da18ee67a

I/System.out: To: <sip:mobile-number@sip-server-ip>

I/System.out: CSeq: 20547 INVITE

I/System.out: Content-Length: 0

I/System.out: --end msg--

I/System.out: 17:52:37.766   pjsua_core.c  .RX 368 bytes Response msg 403/INVITE/cseq=20547 (rdata0x93d095e0) from TCP <sip-server-ip>:5060:

I/System.out: SIP/2.0 403 Forbidden

I/System.out: Via: SIP/2.0/TCP 192.168.43.167:58160;branch=z9hG4bKPj3f2aec57-9f79-46f5-bf03-9f9cb9d482ca;rport;alias

I/System.out: Call-ID: c891a91e-054f-426d-810e-3ac2ba55e4f5

I/System.out: From: <sip:sip-account-number@sip-server-ip>;tag=90b152c8-fd44-41a3-9851-482da18ee67a

I/System.out: To: <sip:sip-account-number@sip-server-ip>;tag=sbc0909b28y79co

I/System.out: CSeq: 20547 INVITE

I/System.out: Content-Length: 0

I/System.out: --end msg--

【问题讨论】:

    标签: android sip pjsip pjsua2


    【解决方案1】:

    经过不断的尝试,我自己解决了。在 pjsip-pjsua 中我们设置的账号配置

    accountConfigurationg.getNatConfig().setIceEnabled(true);

    因此,许多数据都被传递到服务器,例如 rtcp 有效负载等。因此,该库自动使用更可靠的 TCP 连接。

    accountConfigurationg.getNatConfig().setIceEnabled(false); 这将停止发送如此多的数据,因此呼叫将成功建立。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-30
      • 1970-01-01
      相关资源
      最近更新 更多