Two factor authentication API with phone call
Back to Articles
News VoIP SIP API Security Two Factor Authentication Howto

Two factor authentication API with phone call

May 15, 2018 3 min
Aivis Olsteins

Aivis Olsteins

Two factor authentication (2FA) using telephone can be made in several different ways. One, most popular is of course by sending a text message. It is fast and easy way to verify the authenticity of the other party. However, there are cases when SMS is not the best option or even not possible at all, like;

  1. if the remote party is unable to receive text messages, like fixed lang line phones;
  2. if increased security is needed: short messages might be stored on users phones and their contents viewed by third parties, whereas voice message does not persist after once spoken;
  3. accessibility: for persons who may have difficulties to read;
  4. cost issues: for many destinations a cost of the voice call of halt a minute is still lower than sending a text message

In these cases sending a voice call with prerecorded or text-to-speech message is an alternative solution.

There are two main ways to send authorization code over a phone call: either by a prerecorded voice message or by text-to-speech. The advantages of each method include:

  1. for text-to-speech:much easier and faster deployment: no need to prerecord voice messages;
  2. no additional third-party costs for text to speech conversion;
  3. no need to worry about language constructs if sending multi-digit numbers;
  4. for prerecorded messages:larger langauge coverage: may record messages in the languages where text to speech is not available;
  5. higher reliability: text-to-speech engine more probable to be unavailable than an audio file stored locally;

Here are examples of API call for the methods described above.

First example is for a text-to-speech message which will send authentication code 123456 in English. For better user experience it will repeat the message two times:

POST /voice/call/play


{
"to": "12125551212",
"from": "me",
"playlist":
[
{
"play": "Your code is 123456",
"type": "tts",
"options":
{
"language": "en-US",
"gender": "female",
"say-as": "digits"
}
},
{
"play": "Your code is 123456",
"type": "tts",
"options":
{
"language": "en-US",
"gender": "female",
"say-as": "digits"
}
}
],
"carrier_id": "74445609"
}

 

The other example uses files stored at the location http://server.domain.com/voices/ . Here also they speak the same code two times:

 

POST /voice/call/play

{
"to": "12125551212",
"from": "me",
"playlist":
[
{
"play": "http://server.domain.com/voices/your-code-is.wav"
},
{
"play": "http://server.domain.com/voices/1.wav"
},
{
"play": "http://server.domain.com/voices/2.wav"
},
{
"play": "http://server.domain.com/voices/3.wav"
},
{
"play": "http://server.domain.com/voices/4.wav"
},
{
"play": "http://server.domain.com/voices/5.wav"
},
{
"play": "http://server.domain.com/voices/6.wav"
},
{
"play": "http://server.domain.com/voices/your-code-is.wav"
},
{
"play": "http://server.domain.com/voices/1.wav"
},
{
"play": "http://server.domain.com/voices/2.wav"
},
{
"play": "http://server.domain.com/voices/3.wav"
},
{
"play": "http://server.domain.com/voices/4.wav"
},
{
"play": "http://server.domain.com/voices/5.wav"
},
{
"play": "http://server.domain.com/voices/6.wav"
}
],
"carrier_id": "74445609"
}

Notes regarding above examples:

  1. carrier_id tag is described in a previous post entry about SIP routing.
  2. there is a say-as tag in the text to speech example. It is needed to indicate to text to speech engine to say digits individually instead of pronouncing a six-digit number as a whole.

Share this article

Aivis Olsteins

Aivis Olsteins

An experienced telecommunications professional with expertise in network architecture, cloud communications, and emerging technologies. Passionate about helping businesses leverage modern telecom solutions to drive growth and innovation.

Related Articles

How Voice AI Reduces Agent Burnout and Boosts Satisfaction

How Voice AI Reduces Agent Burnout and Boosts Satisfaction

Reduce Burnout with Voice AI: Offload Repetitive Calls, Real‑Time Agent Assist, 40–80% Less ACW, Calmer Escalations, Healthier Occupancy, Proactive Deflection & PCI‑Safe Flows—Happier Agents, Faster Resolutions, Better Coaching, Faster Ramp

Read Article
Seamless Voice AI Integrations: Salesforce, HubSpot, and ERP Systems

Seamless Voice AI Integrations: Salesforce, HubSpot, and ERP Systems

Seamless Voice AI Integrations with Your Stack: Salesforce & HubSpot CRM + SAP/Oracle/NetSuite/Dynamics ERP; OAuth2 & mTLS Security; Real‑Time Read/Write (Cases, Orders, Payments, Scheduling); Warm Transfers, Context; Audit Logs, SLAs, iPaaS Support

Read Article
Measuring Voice AI Success: The KPIs That Matter—CSAT, Containment, Speed, Accuracy, Reliability, and ROI

Measuring Voice AI Success: The KPIs That Matter—CSAT, Containment, Speed, Accuracy, Reliability, and ROI

Voice AI KPI Scorecard: CSAT/NPS, FCR & Containment, Time‑to‑First‑Word & p95 Latency, Intent/Slot Accuracy & ASR WER, Groundedness, Tool Success (Payments/IDV/Scheduling), Warm Xfers, Uptime/Reliability, Consent/Redact, Cost per Resolution & ROI

Read Article
Sensitive Data in Voice AI: PCI‑Safe Payments, HIPAA‑Compliant PHI, Redaction & Tokenization

Sensitive Data in Voice AI: PCI‑Safe Payments, HIPAA‑Compliant PHI, Redaction & Tokenization

Managing Sensitive Data in Voice AI: PCI‑Safe Payments (DTMF Masking, Tokenization), HIPAA‑Compliant PHI Segregation, Redaction/De‑Identification, End‑to‑End Encryption, Zero‑Trust Access, Residency/Retention, DSAR Deletion, SIEM‑Audited Trails

Read Article

SUBSCRIBE TO OUR NEWSLETTER

Stay up to date with the latest news and updates from our telecom experts