rya
rya

Reputation: 1506

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

Upvotes: 4

Views: 1494

Answers (2)

solideo
solideo

Reputation: 127

with PJSUA2, try this:

SipHeader sipHeader = SipHeader();
sipHeader.hName = "Subject";
sipHeader.hValue = "34020000001320000001:0,34020000002000000001:0";

SipHeaderVector sipHeaderVector = SipHeaderVector();
sipHeaderVector.push_back(sipHeader);
SipTxOption sipTxOption = SipTxOption();
sipTxOption.headers = sipHeaderVector;
prm.txOption = sipTxOption;

Upvotes: 1

rya
rya

Reputation: 1506

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

Upvotes: 6

Related Questions