Skip to content

Commit

Permalink
Using calling.X instead of call.X (#161)
Browse files Browse the repository at this point in the history
* use calling.X instead of call.X for calling payloads

* node CHANGELOG entry
  • Loading branch information
Edoardo Gallo authored Aug 20, 2019
1 parent e7fdebd commit 822bd00
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Answer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Answer extends BaseComponent {
public controlId: string = this.call.tag

get method(): string {
return 'call.answer'
return 'calling.answer'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Connect extends BaseComponent {
}

get method(): string {
return 'call.connect'
return 'calling.connect'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class Detect extends Controllable {
}

get method(): string {
return 'call.detect'
return 'calling.detect'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Dial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Dial extends BaseComponent {
public controlId: string = this.call.tag

get method(): string {
return 'call.begin'
return 'calling.begin'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/FaxReceive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BaseFax from './BaseFax'
export default class FaxReceive extends BaseFax {

get method(): string {
return 'call.receive_fax'
return 'calling.receive_fax'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/FaxSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class FaxSend extends BaseFax {
}

get method(): string {
return 'call.send_fax'
return 'calling.send_fax'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Hangup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Hangup extends BaseComponent {
}

get method(): string {
return 'call.end'
return 'calling.end'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Play extends Controllable {
}

get method(): string {
return 'call.play'
return 'calling.play'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class Prompt extends Controllable {
}

get method(): string {
return 'call.play_and_collect'
return 'calling.play_and_collect'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Record extends Controllable {
}

get method(): string {
return 'call.record'
return 'calling.record'
}

get payload(): any {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/relay/calling/components/Tap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Tap extends Controllable {
}

get method(): string {
return 'call.tap'
return 'calling.tap'
}

get payload(): any {
Expand Down
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixed
- Avoid `Unhandled promise rejection` error in case of Relay errors while registering contexts.

### Changed
- Minor change at the lower level APIs: using `calling.` instead of `call.` prefix for calling methods.

## [2.1.0] - 2019-07-30
### Added
- Create your own Relay Tasks and enable `onTask` method on RelayConsumer to receive/handle them.
Expand Down
44 changes: 22 additions & 22 deletions packages/node/tests/relay/Call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('Call', () => {
it('.dial() should wait for "answered" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.begin',
method: 'calling.begin',
params: { tag: 'mocked-uuid', device: call.device }
})
call.dial().then(result => {
Expand All @@ -151,7 +151,7 @@ describe('Call', () => {
it('.answer() should wait for "answered" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.answer',
method: 'calling.answer',
params: { node_id: call.nodeId, call_id: call.id }
})
call.answer().then(result => {
Expand All @@ -167,7 +167,7 @@ describe('Call', () => {
it('.hangup() should wait for "ended" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.end',
method: 'calling.end',
params: { node_id: call.nodeId, call_id: call.id, reason: 'busy' }
})
call.hangup('busy').then(result => {
Expand All @@ -185,7 +185,7 @@ describe('Call', () => {
const record = { audio: { format: 'mp3', beep: true } }
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.record',
method: 'calling.record',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', record }
})

Expand Down Expand Up @@ -235,7 +235,7 @@ describe('Call', () => {
}
return new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.connect',
method: 'calling.connect',
params: { node_id: call.nodeId, call_id: call.id, devices }
})
}
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('Call', () => {

const getMsg = (...play: ICallingPlay[]) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.play',
method: 'calling.play',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', play }
})

Expand Down Expand Up @@ -396,7 +396,7 @@ describe('Call', () => {

const getMsg = (...play: ICallingPlay[]) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.play_and_collect',
method: 'calling.play_and_collect',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', collect, play }
})

Expand Down Expand Up @@ -508,7 +508,7 @@ describe('Call', () => {
describe('faxReceive methods', () => {
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.receive_fax',
method: 'calling.receive_fax',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid' }
})

Expand Down Expand Up @@ -537,7 +537,7 @@ describe('Call', () => {
describe('faxSend methods', () => {
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.send_fax',
method: 'calling.send_fax',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', document: 'document.pdf', header_info: 'custom' }
})

Expand Down Expand Up @@ -577,7 +577,7 @@ describe('Call', () => {
const _notificationDigitFinished = JSON.parse('{"event_type":"calling.call.detect","params":{"control_id":"mocked-uuid","call_id":"call-id","node_id":"node-id","detect":{"type":"digit","params":{"event":"finished"}}}}');
const getMsg = (type: string, params: any, timeout = 30) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.detect',
method: 'calling.detect',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', detect: { type, params }, timeout }
})

Expand Down Expand Up @@ -711,7 +711,7 @@ describe('Call', () => {
const device: ICallingTapDeviceArg = { type: 'rtp', addr: '127.0.0.1', port: 1234 }
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.tap',
method: 'calling.tap',
params: {
node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', tap: { type: 'audio', params: { direction: 'listen' } }, device: { type: 'rtp', params: { addr: '127.0.0.1', port: 1234 } }
}
Expand Down Expand Up @@ -756,7 +756,7 @@ describe('Call', () => {
it('.dial() should wait for "answered" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.begin',
method: 'calling.begin',
params: { tag: 'mocked-uuid', device: call.device }
})
call.dial().then(result => {
Expand All @@ -771,7 +771,7 @@ describe('Call', () => {
it('.answer() should wait for "answered" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.answer',
method: 'calling.answer',
params: { node_id: call.nodeId, call_id: call.id }
})
call.answer().then(result => {
Expand All @@ -785,7 +785,7 @@ describe('Call', () => {
it('.hangup() should wait for "ended" event', done => {
const msg = new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.end',
method: 'calling.end',
params: { node_id: call.nodeId, call_id: call.id, reason: 'busy' }
})
call.hangup('busy').then(result => {
Expand All @@ -801,7 +801,7 @@ describe('Call', () => {
const record = { audio: { format: 'mp3', beep: true } }
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.record',
method: 'calling.record',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', record }
})

Expand Down Expand Up @@ -848,7 +848,7 @@ describe('Call', () => {
}
return new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.connect',
method: 'calling.connect',
params: { node_id: call.nodeId, call_id: call.id, devices }
})
}
Expand Down Expand Up @@ -901,7 +901,7 @@ describe('Call', () => {

const getMsg = (...play: ICallingPlay[]) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.play',
method: 'calling.play',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', play }
})

Expand Down Expand Up @@ -930,7 +930,7 @@ describe('Call', () => {

const getMsg = (...play: ICallingPlay[]) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.play_and_collect',
method: 'calling.play_and_collect',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', collect, play }
})

Expand Down Expand Up @@ -958,7 +958,7 @@ describe('Call', () => {
describe('faxReceive methods', () => {
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.receive_fax',
method: 'calling.receive_fax',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid' }
})

Expand All @@ -984,7 +984,7 @@ describe('Call', () => {
describe('faxSend methods', () => {
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.send_fax',
method: 'calling.send_fax',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', document: 'document.pdf', header_info: 'custom' }
})

Expand All @@ -1010,7 +1010,7 @@ describe('Call', () => {
describe('detect methods', () => {
const getMsg = (type: string, params: any, timeout = 30) => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.detect',
method: 'calling.detect',
params: { node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', detect: { type, params }, timeout }
})

Expand Down Expand Up @@ -1101,7 +1101,7 @@ describe('Call', () => {
const device: ICallingTapDeviceArg = { type: 'rtp', addr: '127.0.0.1', port: 1234 }
const getMsg = () => new Execute({
protocol: 'signalwire_service_random_uuid',
method: 'call.tap',
method: 'calling.tap',
params: {
node_id: call.nodeId, call_id: call.id, control_id: 'mocked-uuid', tap: { type: 'audio', params: { direction: 'listen' } }, device: { type: 'rtp', params: { addr: '127.0.0.1', port: 1234 } }
}
Expand Down

0 comments on commit 822bd00

Please sign in to comment.