androidsipvoippjsip

Pjsua-2 Android- How to add custom header to INVITE request while making a call?


I need to add a Subject header to the invite request while making a call. I am using the PJSUA library.

I found this question. But I couldn't implement it. Please help.

Thanks in advance


Solution

  • i figured it out. SipTxOption should be added to CallOpParam:

        CallOpParam prm = new CallOpParam(true);
        SipHeader sipHeader = new SipHeader();
        sipHeader.setHName("Subject");
        sipHeader.setHValue("paid call");
        SipHeaderVector sipHeaderVector = new SipHeaderVector();
        sipHeaderVector.add(sipHeader);
        SipTxOption sipTxOption = new SipTxOption();
        sipTxOption.setHeaders(sipHeaderVector);
        prm.setTxOption(sipTxOption);
        call.makeCall(buddy_uri, prm);