I want to set also the caller id when I make a call not only the destination number and I can't find anything in the documentation about it for Android SDK.
Thanks.
To set the callerID in Plivo Android SDK, we must use the SIP Headers. Have a look at the instructions that I got from Plivo support team:
" We can send custom SIP header in the Android SDK by following the below steps, 1. Load the example application in Android studio. Link: 2. Now Navigate to Voice activity section under "com.plivo.voicecalling". Permalink of the referenced line: permalink Add the below code in the "onOutgoingCall" method. public void onOutgoingCall(Outgoing outgoing) {
Map extraHeaders = new HashMap<>();
extraHeaders.put("X-PH-Header1", "12345"); extraHeaders.put("X-PH-Header2", "34567");
outgoing.callH(phoneNumberText.getText().toString(),extraHeaders);
}
Also, do not forget to import java.util.HashMap , java.util.Map while importing other packages.
Request-Line: INVITE sip:XYXYXYXYXYXY@production-mediaserver:5060 SIP/2.0 Message Header Record-Route: Record-Route: Via: SIP/2.0/TCP Media server IP:5060;branch=z9hG4bKfab6.a38be8f72872a8c2cd9e747289f2212d.0;i=cef422 Via: SIP/2.0/TLS IP:38242;received=IP;rport=38242;branch=z9hG4bKPj1e4bc7fc-3fa9-4439-a2e0-dacd6696b118;alias Max-Forwards: 69 From: sip:xyxyxyxyxyx@phone.plivo.com;tag=73b5b6fe-c1a7-4744-b3b1-a68409840c83 To: sip:xnxnxnxnx@phone.plivo.com Contact: Call-ID: d50f1995-82ad-4bdc-8a3d-3f13bc2edf1d CSeq: 14979 INVITE Route: Supported: replaces, 100rel, timer, norefersub Session-Expires: 1800 Min-SE: 90 User-Agent: PlivoAndroidSDK-v2.0 X-PH-Header2: 34567 X-PH-Header1: 12345 Content-Type: application/sdp Content-Length: 351 P-hint: inbound X-PlivoSIPDestination: sip:XXXXXXXXXXX@phone.plivo.com X-PlivoFromSIPUser: sip:dXYXYXYXYXYX@phone.plivo.com X-PlivoInboundGateway: phone.plivo.com X-PlivoMediaServer: sip:XXXXXXXXXXX@production-mediaserver:5060
Note: The special characters allowed in the SIP extra headers are +-_() "X-PH" is a must in Extra Header keys, otherwise it will be ignored at the server side. "