Skip to content

Commit

Permalink
SWI-4587 Add transferCallerDisplayName to Transfer Verb
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoegel committed Feb 16, 2024
1 parent f4603f4 commit 927771f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/bxml/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Verb } from './Verb'
export interface TransferOptions {
transferCallerId?: string

transferCallerDisplayName?: string

callTimeout?: number

tag?: string
Expand Down Expand Up @@ -36,6 +38,8 @@ export interface TransferOptions {
export class Transfer implements TransferOptions, Verb {
transferCallerId?: string

transferCallerDisplayName?: string

callTimeout?: number

tag?: string
Expand Down Expand Up @@ -77,6 +81,7 @@ export class Transfer implements TransferOptions, Verb {
this.username = options.username
this.tag = options.tag
this.transferCallerId = options.transferCallerId
this.transferCallerDisplayName = options.transferCallerDisplayName
this.transferCompleteFallbackMethod = options.transferCompleteFallbackMethod
this.transferCompleteFallbackUrl = options.transferCompleteFallbackUrl
this.transferCompleteMethod = options.transferCompleteMethod
Expand All @@ -90,6 +95,10 @@ export class Transfer implements TransferOptions, Verb {
attributes['transferCallerId'] = this.transferCallerId
}

if (this.transferCallerDisplayName !== undefined) {
attributes['transferCallerDisplayName'] = this.transferCallerDisplayName
}

if (this.callTimeout !== undefined) {
attributes['callTimeout'] = `${this.callTimeout}`
}
Expand Down
3 changes: 2 additions & 1 deletion tests/bxml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ describe("Transfer", () => {

var transfer = new Transfer({
transferCallerId: "+18888888888",
transferCallerDisplayName: "test",
callTimeout: 3,
tag: "tagTransfer",
transferCompleteUrl: "https://testtransfer.com",
Expand All @@ -399,7 +400,7 @@ describe("Transfer", () => {

var response = new Response(transfer);

var expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferCallerId=\"+18888888888\" callTimeout=\"3\" tag=\"tagTransfer\" transferCompleteUrl=\"https://testtransfer.com\" transferCompleteMethod=\"GET\" username=\"usertransfer\" password=\"passtransfer\" diversionTreatment=\"none\" diversionReason=\"away\" transferCompleteFallbackUrl=\"https://test.com\" transferCompleteFallbackMethod=\"POST\" fallbackUsername=\"fusern\" fallbackPassword=\"fpassw\"><PhoneNumber transferAnswerUrl=\"https://test.com\" transferAnswerMethod=\"GET\" username=\"user\" password=\"pass\" tag=\"tag\" transferAnswerFallbackUrl=\"https://test2.com\" transferAnswerFallbackMethod=\"GET\" fallbackUsername=\"fuser\" fallbackPassword=\"fpass\">+17777777777</PhoneNumber><SipUri uui=\"uui\" transferAnswerUrl=\"https://test3.com\" transferAnswerMethod=\"POST\" transferAnswerFallbackUrl=\"https://test4.com\" transferAnswerFallbackMethod=\"POST\" username=\"user2\" password=\"pass2\" fallbackUsername=\"fuser2\" fallbackPassword=\"fpass4\" tag=\"tag2\">sip-uri</SipUri></Transfer></Response>";
var expectedString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Transfer transferCallerId=\"+18888888888\" transferCallerDisplayName=\"test\" callTimeout=\"3\" tag=\"tagTransfer\" transferCompleteUrl=\"https://testtransfer.com\" transferCompleteMethod=\"GET\" username=\"usertransfer\" password=\"passtransfer\" diversionTreatment=\"none\" diversionReason=\"away\" transferCompleteFallbackUrl=\"https://test.com\" transferCompleteFallbackMethod=\"POST\" fallbackUsername=\"fusern\" fallbackPassword=\"fpassw\"><PhoneNumber transferAnswerUrl=\"https://test.com\" transferAnswerMethod=\"GET\" username=\"user\" password=\"pass\" tag=\"tag\" transferAnswerFallbackUrl=\"https://test2.com\" transferAnswerFallbackMethod=\"GET\" fallbackUsername=\"fuser\" fallbackPassword=\"fpass\">+17777777777</PhoneNumber><SipUri uui=\"uui\" transferAnswerUrl=\"https://test3.com\" transferAnswerMethod=\"POST\" transferAnswerFallbackUrl=\"https://test4.com\" transferAnswerFallbackMethod=\"POST\" username=\"user2\" password=\"pass2\" fallbackUsername=\"fuser2\" fallbackPassword=\"fpass4\" tag=\"tag2\">sip-uri</SipUri></Transfer></Response>";
expect(response.toBxml()).toEqual(expectedString);
});
});
Expand Down

0 comments on commit 927771f

Please sign in to comment.