@@ -207,6 +207,19 @@ class VoiceTest : AbstractTest() {
207207 assertEquals(conversationId, callEvent.conversationUuid)
208208 }
209209
210+ private fun testCreateCallToSingleEndpoint (toParams : Map <String , Any >,
211+ toBuilder : Call .Builder .() -> Call .Builder ) {
212+ testCreateCall(mapOf (
213+ " random_from_number" to true ,
214+ " answer_url" to listOf (onAnswerUrl),
215+ " answer_method" to " GET" ,
216+ " to" to listOf (toParams)
217+ )) {
218+ fromRandomNumber(true ); answerUrl(onAnswerUrl)
219+ toBuilder()
220+ }
221+ }
222+
210223 private fun testSingleNcco (additionalParams : Map <String , Any > = mapOf(), ncco : Action ) {
211224 val requestParams = mapOf (
212225 " random_from_number" to true ,
@@ -392,6 +405,60 @@ class VoiceTest : AbstractTest() {
392405 }
393406 }
394407
408+ @Test
409+ fun `create call to PSTN` () {
410+ val baseMap = mapOf (" type" to phoneType, " number" to toNumber)
411+ testCreateCallToSingleEndpoint(baseMap) {
412+ toPstn(toNumber)
413+ }
414+
415+ testCreateCallToSingleEndpoint(baseMap + mapOf (" dtmfAnswer" to dtmf)) {
416+ toPstn(toNumber, dtmf)
417+ }
418+ }
419+
420+ @Test
421+ fun `create call to App` () {
422+ testCreateCallToSingleEndpoint(mapOf (" type" to " app" , " user" to user)) {
423+ toApp(user)
424+ }
425+ }
426+
427+ @Test
428+ fun `create call to VBC` () {
429+ testCreateCallToSingleEndpoint(mapOf (" type" to " vbc" , " extension" to vbcExt)) {
430+ toVbc(vbcExt)
431+ }
432+ }
433+
434+ @Test
435+ fun `create call to SIP` () {
436+ val baseMap = mapOf (" type" to " sip" , " uri" to sipUri)
437+ testCreateCallToSingleEndpoint(baseMap) {
438+ toSip(sipUri)
439+ }
440+
441+ testCreateCallToSingleEndpoint(baseMap + mapOf (
442+ " headers" to customHeaders, " standard_headers" to mapOf (" User-to-User" to userToUserHeader)
443+ )) {
444+ toSip(sipUri, customHeaders, userToUserHeader)
445+ }
446+ }
447+
448+ @Test
449+ fun `create call to WebSocket` () {
450+ val baseMap = mapOf (" type" to " websocket" , " uri" to websocketUri)
451+ testCreateCallToSingleEndpoint(baseMap) {
452+ toWebSocket(websocketUri)
453+ }
454+
455+ testCreateCallToSingleEndpoint(baseMap + mapOf (
456+ " content-type" to wsContentType, " headers" to customHeaders
457+ )) {
458+ toWebSocket(websocketUri, wsContentType, customHeaders)
459+ }
460+ }
461+
395462 @Test
396463 fun `create call to all endpoint types with all fields and answer url` () {
397464 val answerUrl = " https://example.com/answer"
0 commit comments