pjsua2示例应用程序传出呼叫通过TCP连接获得403禁止响应 [英] pjsua2 sample app outgoing calls getting 403 Forbidden response with TCP connection

查看:505
本文介绍了pjsua2示例应用程序传出呼叫通过TCP连接获得403禁止响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I had successfully registered my sip client in pjsua sample app and is receiving incoming calls over UDP. But whenver I try to make an outgoing call it get disconnected with 403 FORBIDDEN error. And the connection created is TCP!

我验证了目的地uri.格式为

I verified the destination uri. it is in the format as

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

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

这是我的makeCall代码:

here is my makeCall code :

public void makeCall(View view){

public void makeCall(View view) {

    //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();
    }

将显示呼叫"活动.日志如下

The Call activity appears. The logs are as follows

  --------- 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--

推荐答案

在不断尝试之后,我自己解决了它.在帐户配置过程中的pjsip-pjsua中,我们设置

After continuous attempts I solved it myself. In pjsip-pjsua during the account configuration we set

accountConfigurationg.getNatConfig().setIceEnabled(true);

accountConfigurationg.getNatConfig().setIceEnabled(true);

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

So, many datas are getting passed to the server like rtcp payloads etc. So, the library use the more reliable TCP connection automatically.

accountConfigurationg.getNatConfig().setIceEnabled(false); 这样将停止发送大量数据,因此呼叫将成功建立.

accountConfigurationg.getNatConfig().setIceEnabled(false); This wil stop sending so much of data and hence the call will be successfully established.

这篇关于pjsua2示例应用程序传出呼叫通过TCP连接获得403禁止响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆