[英]Trying to add nexmo CallerID to voice_api script
我是 nexmo 的初學者。 使用 nexmo 語音 API。 我創建了一個執行以下操作的基本腳本:
目標:
$from number (xxx xxx 0000) // nexmo number
$to number (xxx xxx 1111) //office desk phone
$connect number (xxx xxx 2222) //destination phone
nexmo 腳本執行此操作...
1 - $from(nexmo 號碼)呼叫 $to(辦公室電話) 2 - $to 接聽並且文本顯示正在連接呼叫 3 - 然后撥打 $connect
當前問題:更改現在顯示 $from(nexmo 號碼)的 CallerID,並將 CallerID 顯示為 $to(辦公室電話)號碼。
我希望有一些簡單的事情,比如添加一個像下面這樣的“CallerID”標簽......這樣目標電話就會看到來自辦公室電話而不是nexmo電話的來電顯示......
這有可能嗎?
//ORIGINAL SCRIPT
//
$from = 'xxxxxx1111';
$to = 'xxxxxx2222';
$connect = 'xxxxxx3333';require_once "vendor/autoload.php";$keypair = new \Nexmo\Client\Credentials\Keypair(
file_get_contents('private.key'),
'xxxxxx'
);$client = new \Nexmo\Client($keypair);$ncco = [[
'action' => 'talk',
'voiceName' => 'Nicole',
'text' => 'Connecting your call now.'
],[
'action' => 'connect',
'eventUrl' => ["https://example.com/webhooks/update.php"],
'from' => 'xxxxxx1111',
// add somethinhg simple like this?
'??? CallerID ???' => $to,
//'xxxxxx2222 office phone here'
'endpoint' => [['type' => 'phone','number' => $connect]]
]];try {$call = new \Nexmo\Call\Call();$call->setTo($to)
->setFrom($from)
->setNcco($ncco);$response = $client->calls()->create($call);
echo $response->getId();
}
catch (exception $e) {
//code to handle the exception echo 'Message: ' .$e->getMessage();
}
finally {
//optional code that always runs
}
您應該能夠將 $from 數字更改為 $to 數字。 $from 參數可以設置為任何有效的電話號碼
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.