Latest Legacy

Create a number masking session

You create a number masking session using the real phone numbers of the two parties that need to be connected. VTS returns a virtual number from your account in response to the API request.

  • If one party makes a call to the virtual number, the call is connected to the other party.
  • The caller ID of the outbound call to the second party is the VTS virtual number.

This method creates a session to anonymously connect two participants.

POST https://api.vtscom.net/v1/Account/{Auth ID}/Masking/Session

Attributes

first_party stringRequired

The actual phone number of the first participant.

second_party stringRequired

The actual phone number of the second participant.

record boolean

Recording status for a phone call.
Defaults to false.
If set to true:

  • Call recording starts only when both participants have answered their calls.
  • Multiple calls within a session generate multiple recording files.

recording_callback_url string

URL to which the call recording is sent.

record_file_format string

Audio format for the recording.
Allowed values: mp3, wav Defaults to mp3.

recording_callback_method string

HTTP verb to invoke the URL configured as recording_callback_url.
Allowed values: GET, POST Defaults to POST.

session_expiry integer

Time in seconds after which the session mapping will expire.
Calls made to the virtual phone number after the session expiry are not forwarded to the other participant; the default answer_url or application_url associated with the virtual number will be activated.
Defaults to 3,600.

call_time_limit integer

Time in seconds after which the call should be disconnected.
This applies to all call legs within a session.
Default: 3,600

initiate_call_to_first_party boolean

If set to true, VTS will immediately make a call to the first party number. If the call is answered, it will be bridged with the second party.
Defaults to false.

callback_url string

URL to receive important session events and status updates.

callback_method string

HTTP verb to invoke the URL configured as callback_url.
Allowed values: GET, POST Defaults to POST.

ring_timeout integer

Time in seconds after which the ring should be disconnected.
Applies to both call legs.
Defaults to 120.

first_party_play_url string

URL that returns an MP3 or WAV file to be played to the first party before connecting to the second party.

second_party_play_url string

URL that returns an MP3 or WAV file to be played to the second party before connecting to the first party.

Response

{
"session_uuid": "abcd-1234-ab12-cd34",
"virtual_number": "+12205550020",
"status": "active",
"first_party": "+14155552345",
"second_party": "+12165554567",
"record": "false",
"recording_callback_url":"null",
"record_file_format": null, 
"session_expiry": "3600",
"call_time_limit": "3600",
"initiate_call_to_first_party": "false",
"callback_url": "null",
"ring_timeout": "120",
"first_party_play_url": "null",
"second_party_play_url": "null", 
"created_time": "2023-08-17 21:26:44",
"modified_time": "null",
"expiry_time": "null",
"last_interaction_time": "null",
"total_call_count": "0",
"total_call_amount": "0",
"total_call_billed_duration": "0",
"interaction": "{}"
}

Example Request

1
2
3
4
5
6
7
import vts

client = vts.RestClient(auth_id='<auth_id>', auth_token='<auth_token>')
response = client.masking_sessions.create_masking_session(
                                                      first_party="+12025550XXX",
                                                      second_party="+12025551XXX")
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var vts = require('vts');

(function main() {
    'use strict';

    var client = new vts.Client("<auth_id>", "<auth_token>");
    client.maskingSession.createMaskingSession(
        "+12025550XXX", "+12025551XXX",
        {
            callTimeLimit:600
        }
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for Create Session
 */
require 'vendor/autoload.php';
use vts\RestClient;
use vts\Exceptions\VTSRestException;
$client = new RestClient("<auth_id>", "<auth_token>");
try {
    $response = $client->maskingSessions->createMaskingSession(
        '+12025550XXX',
        '12025551XXX')
    );

    print_r($response);
}
catch (VTSRestException $ex) {
    print_r($ex);
}
1
2
3
4
5
6
curl -X POST "https://api.vtscom.net/v1/Account/{Auth ID}/Masking/Session" \
-H "Content-Type: application/json" \
-d '{
  "first_party": "+14155552345",
  "second_party": "+12165554567",
  }'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
       "fmt"

       "github.com/vts/vts-go/v7"
)

func main() {
       client, err := vts.NewClient("<auth_id>", "<auth_token>", &vts.ClientOptions{})
       if err != nil {
               fmt.Print("Error", err.Error())
               return
       }
       response, err := client.MaskingSession.CreateMaskingSession(
               vts.CreateMaskingSessionParams{
                       FirstParty: "+12025550XXX",
                       SecondParty : "+12025551XX"},
       )
       if err != nil {
               fmt.Print("Error", err.Error())
               return
       }
       fmt.Printf("Response: %#v\n", response)
}