Действие connect
NCCO имеет опцию onAnswer
. Из документации:
onAnswer - A JSON object containing a required url key. The URL serves an NCCO to execute in the number being connected to, before that call is joined to your existing conversation. Optionally, the ringbackTone key can be specified with a URL value that points to a ringbackTone to be played back on repeat to the caller, so they do not hear just silence. The ringbackTone will automatically stop playing when the call is fully connected. Example: {"url":"https://example.com/answer", "ringbackTone":"http://example.com/ringbackTone.wav" }. Please note, the key ringback is still supported.
Таким образом, если вы измените свой NCCO, чтобы он выглядел примерно так, продавец услышит разговорное действие во втором NCCO, в то время как вызывающий абонент услышит musi c.
[
{
"action": "talk",
"text": "Hello customer, please wait while we connect you."
},
{
"action": "connect",
"timeout": 20,
"from": "MY_NEXMO_PHONE_NUMBER",
"endpoint": [
{
"type": "phone",
"number": "SALESPERSON_PHONE_NUMBER",
"onAnswer": {
"url":"https://example.com/answer",
"ringbackTone":"http://example.com/ringbackTone.wav"
}
}
]
}
]
https://example.com/answer
должно быть
[{
"action": "talk",
"text": "Hello salesperson, please wait while we connect you."
}]