Skip to content

Commit

Permalink
feat: added user-to-user headers for sip endpoint (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
manchuck committed Oct 8, 2024
1 parent 9666516 commit 6735024
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 159 deletions.
315 changes: 160 additions & 155 deletions packages/voice/__tests__/__dataSets__/calls.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Client } from '@vonage/server-client';
import { CallDetailResponse, CallPageResponse } from '../../lib';
import {
CallDetailResponse,
CallPageResponse,
CallStatus,
CallListFilter,
} from '../../lib';
import { callSip, callPhone, callWebsocket } from '../common';
import { BASE_URL } from '../common';

Expand Down Expand Up @@ -143,158 +148,158 @@ export default [
},
],
},
// {
// label: 'get a page of calls',
// requests: [['/v1/calls?', 'GET']],
// responses: [
// [
// 200,
// {
// count: 3,
// page_size: 1,
// record_index: 0,
// _embedded: {
// calls: [
// {
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
// },
// },
// },
// ],
// },
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/`,
// },
// },
// } as CallPageResponse,
// ],
// ],
// clientMethod: 'getCallsPage',
// parameters: [],
// generator: false,
// error: false,
// expected: {
// count: 3,
// page_size: 1,
// record_index: 0,
// _embedded: {
// calls: [
// {
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
// },
// },
// },
// ],
// },
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/`,
// },
// },
// },
// },
// {
// label: 'search',
// requests: [
// [
// `/v1/calls?status=${CallStatus.ANSWERED}&date_start=453168000&date_end=1302552660&page_size=1&record_index=0&order=asc&conversation_uuid=${callPhone.conversationUUID}`,
// 'GET',
// ],
// ],
// responses: [
// [
// 200,
// {
// count: 3,
// page_size: 1,
// record_index: 0,
// _embedded: {
// calls: [
// {
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
// },
// },
// },
// ],
// },
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/`,
// },
// },
// } as CallPageResponse,
// ],
// ],
// clientMethod: 'search',
// parameters: [
// {
// status: CallStatus.ANSWERED,
// date_start: '453168000',
// date_end: '1302552660',
// page_size: '1',
// record_index: '0',
// order: 'asc',
// conversation_uuid: callPhone.conversationUUID,
// } as CallListFilter,
// ],
// generator: false,
// error: false,
// expected: {
// count: 3,
// page_size: 1,
// record_index: 0,
// _embedded: {
// calls: [
// {
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
// },
// },
// },
// ],
// },
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/`,
// },
// },
// },
// },
// {
// label: 'get call',
// requests: [[`/v1/calls/${callPhone.uuid}`, 'GET']],
// responses: [
// [
// 200,
// {
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// _links: {
// self: {
// href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
// },
// },
// } as CallDetailResponse,
// ],
// ],
// clientMethod: 'getCall',
// parameters: [callPhone.uuid],
// generator: false,
// error: false,
// expected: {
// ...callPhone,
// ...Client.transformers.snakeCaseObjectKeys(callPhone),
// },
// },
{
label: 'get a page of calls',
requests: [['/v1/calls?', 'GET']],
responses: [
[
200,
{
count: 3,
page_size: 1,
record_index: 0,
_embedded: {
calls: [
{
...Client.transformers.snakeCaseObjectKeys(callPhone),
_links: {
self: {
href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
},
},
},
],
},
_links: {
self: {
href: `${BASE_URL}/v1/calls/`,
},
},
} as CallPageResponse,
],
],
clientMethod: 'getCallsPage',
parameters: [],
generator: false,
error: false,
expected: {
count: 3,
page_size: 1,
record_index: 0,
_embedded: {
calls: [
{
...Client.transformers.snakeCaseObjectKeys(callPhone),
_links: {
self: {
href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
},
},
},
],
},
_links: {
self: {
href: `${BASE_URL}/v1/calls/`,
},
},
},
},
{
label: 'search',
requests: [
[
`/v1/calls?status=${CallStatus.ANSWERED}&date_start=453168000&date_end=1302552660&page_size=1&record_index=0&order=asc&conversation_uuid=${callPhone.conversationUUID}`,
'GET',
],
],
responses: [
[
200,
{
count: 3,
page_size: 1,
record_index: 0,
_embedded: {
calls: [
{
...Client.transformers.snakeCaseObjectKeys(callPhone),
_links: {
self: {
href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
},
},
},
],
},
_links: {
self: {
href: `${BASE_URL}/v1/calls/`,
},
},
} as CallPageResponse,
],
],
clientMethod: 'search',
parameters: [
{
status: CallStatus.ANSWERED,
date_start: '453168000',
date_end: '1302552660',
page_size: '1',
record_index: '0',
order: 'asc',
conversation_uuid: callPhone.conversationUUID,
} as CallListFilter,
],
generator: false,
error: false,
expected: {
count: 3,
page_size: 1,
record_index: 0,
_embedded: {
calls: [
{
...Client.transformers.snakeCaseObjectKeys(callPhone),
_links: {
self: {
href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
},
},
},
],
},
_links: {
self: {
href: `${BASE_URL}/v1/calls/`,
},
},
},
},
{
label: 'get call',
requests: [[`/v1/calls/${callPhone.uuid}`, 'GET']],
responses: [
[
200,
{
...Client.transformers.snakeCaseObjectKeys(callPhone),
_links: {
self: {
href: `${BASE_URL}/v1/calls/${callPhone.uuid}`,
},
},
} as CallDetailResponse,
],
],
clientMethod: 'getCall',
parameters: [callPhone.uuid],
generator: false,
error: false,
expected: {
...callPhone,
...Client.transformers.snakeCaseObjectKeys(callPhone),
},
},
];
Loading

0 comments on commit 6735024

Please sign in to comment.