1
votes

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!

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

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

here is my makeCall code :

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:[email protected]: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--
1

1 Answers

1
votes

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

accountConfigurationg.getNatConfig().setIceEnabled(true);

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); This wil stop sending so much of data and hence the call will be successfully established.