Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
* This parameter is considered only when diversionTreatment is set to stack. Defaults is unknown.
* Defaults to None.
* @param privacy (bool, optional): A boolean value to indicate that the calling number should be hidden. Use transferCallerDisplayName to customize the name shown to the recipient. Default is false.
* @param attestationLevel (str, optional): The STIR/SHAKEN attestation level to sign the transferred call with. Can be A, B, or C. Only applies to accounts using the Hosted Signing Service. Cannot be combined with identity. Defaults to None.
* @param identity (str, optional): A SIP Identity header value (PASSporT) signed by you, sent unmodified on the transferred call. Max length 2000 characters. Cannot be combined with attestationLevel. Defaults to None.
*
*/
public class Transfer implements Verb {
Expand Down Expand Up @@ -132,6 +134,12 @@ public class Transfer implements Verb {
@XmlAttribute
protected Boolean privacy;

@XmlAttribute
protected String attestationLevel;

@XmlAttribute
protected String identity;

@Override
public String getVerbName() {
return TYPE_NAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public class TransferVerbTest {
.transferCallerDisplayName("Clark Kent")
.tag("test")
.build();
Transfer transferWithAttestationLevel = Transfer.builder()
.destinations(List.of(phonenumber))
.attestationLevel("A")
.build();
Transfer transferWithIdentity = Transfer.builder()
.destinations(List.of(phonenumber))
.identity("eyJhbGciOiJFUzI1NiJ9.eyJhdHRlc3QiOiJBIn0.c2ln;info=<https://example.com/cert.pem>;ppt=\"shaken\"")
.build();

@Test
public void transferVerbWorks() throws JAXBException {
Expand All @@ -65,4 +73,20 @@ public void transferVerbWorks() throws JAXBException {
assertThat(new Bxml().with(transfer1).toBxml(jaxbContext), is(expectedSipUriBxml));
assertThat(new Bxml().with(transfer2).toBxml(jaxbContext), is(expectedPhoneNumberBxml));
}

@Test
public void transferVerbAttestationLevelWorks() throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><Transfer callTimeout=\"300.0\" transferCompleteMethod=\"POST\" transferCompleteFallbackMethod=\"POST\" diversionTreatment=\"none\" diversionReason=\"unknown\" attestationLevel=\"A\"><PhoneNumber transferAnswerUrl=\"https://example.com/webhooks/transfer_answer\" transferAnswerMethod=\"POST\" transferAnswerFallbackMethod=\"POST\" transferDisconnectMethod=\"POST\" tag=\"test\" uui=\"test\">+19195551234</PhoneNumber></Transfer></Bxml>";

assertThat(new Bxml().with(transferWithAttestationLevel).toBxml(jaxbContext), is(expectedBxml));
}

@Test
public void transferVerbIdentityWorks() throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><Transfer callTimeout=\"300.0\" transferCompleteMethod=\"POST\" transferCompleteFallbackMethod=\"POST\" diversionTreatment=\"none\" diversionReason=\"unknown\" identity=\"eyJhbGciOiJFUzI1NiJ9.eyJhdHRlc3QiOiJBIn0.c2ln;info=&lt;https://example.com/cert.pem&gt;;ppt=&quot;shaken&quot;\"><PhoneNumber transferAnswerUrl=\"https://example.com/webhooks/transfer_answer\" transferAnswerMethod=\"POST\" transferAnswerFallbackMethod=\"POST\" transferDisconnectMethod=\"POST\" tag=\"test\" uui=\"test\">+19195551234</PhoneNumber></Transfer></Bxml>";

assertThat(new Bxml().with(transferWithIdentity).toBxml(jaxbContext), is(expectedBxml));
}
};