Show me some code how you subscribe for voicemail notification.
BTW, you should read voicemail from the message-store, not from the call log.
var endpoint = '/restapi/v1.0/account/~/extension/~/message-store'
var params = {
messageType: 'VoiceMail'
}
If you want to read voicemail using the call-log endpoint, you have to make a GET call to the message.uri to get the message metadata then parse the response to get the uri of the binary attachment.
https://platform.ringcentral.com/restapi/v1.0/account/xxxxxx/extension/yyyyyy/message-store/9152177004
{
uri: 'https://platform.ringcentral.com/restapi/v1.0/account/xxxxxx/extension/yyyyyy/message-store/9152177004',
id: 9152177004,
to: [
{
phoneNumber: '+1312982xxxx',
extensionNumber: '101',
name: 'Gerard'
}
],
from: {
phoneNumber: '+1650513xxxx',
name: 'Francisco',
location: 'San Mateo, CA'
},
type: 'VoiceMail',
creationTime: '2021-03-05T20:10:35.000Z',
readStatus: 'Unread',
priority: 'Normal',
attachments: [
{
id: 9152177004,
uri: 'https://media.devtest.ringcentral.com/restapi/v1.0/account/xxxxxx/extension/yyyyyy/message-store/9152177004/content/9152177004',
type: 'AudioRecording',
contentType: 'audio/mpeg',
vmDuration: 1
}
],
direction: 'Inbound',
availability: 'Alive',
messageStatus: 'Received',
lastModifiedTime: '2021-03-05T20:10:35.594Z',
vmTranscriptionStatus: 'NotAvailable'
}
Here is the event we are subscribing to:
/restapi/v1.0/account/59721889/extension/59721889/voicemail
We notice that the voicemails webhook only get sent out to us after the user reads the voicemail (which is a few hours after the voicemail was recorded)
We have a backfill script that polls the call logs for missed calls, and in addition to that if there are calls that results in voicemails, we want to pull them into our system to log them.
Here is a sample call log:
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/377098040/call-log/B5TOIqqWARrHzUA?view=Detailed",
"id": "B5TOIqqWARrHzUA",
"sessionId": "91651935040",
"startTime": "2021-04-02T16:22:36.750Z",
"duration": 88,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Voicemail",
"to": {
"phoneNumber": "+1888..."
},
"from": {
"name": "L...",
"phoneNumber": "+1618...",
},
"telephonySessionId": "s-ec6115b764294caf80078e7ecf4c1934",
"transport": "PSTN",
"lastModifiedTime": "2021-04-02T16:24:14.111Z",
"billing": {
"costIncluded": 0.059,
"costPurchased": 0
},
"legs": ,
{
"startTime": "2021-04-02T16:22:36.750Z",
"duration": 88,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Voicemail",
"to": {
"phoneNumber": "+1888..."
},
"from": {
"name": "L...",
"phoneNumber": "+1618..."
},
"telephonySessionId": "s-ec6115b764294caf80078e7ecf4c1934",
"transport": "PSTN",
"billing": {
"costIncluded": 0.059,
"costPurchased": 0
},
"legType": "Accept",
"master": true
},
{
"startTime": "2021-04-02T16:22:36.766Z",
"duration": 27,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Accepted",
"to": {
"name": "IVR Menu 1001",
"phoneNumber": "+1888",
"extensionId": "386022040"
},
"from": {
"name": "L...",
"phoneNumber": "+1618...",
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/377098040/extension/386022040",
"id": 386022040
},
"reason": "Accepted",
"reasonDescription": "The call connected to and was accepted by this number.",
"telephonySessionId": "s-ec6115b764294caf80078e7ecf4c1934",
"transport": "PSTN",
"legType": "Accept"
},
{
"startTime": "2021-04-02T16:23:04.119Z",
"duration": 61,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Voicemail",
"to": {
"name": "Returns",
"phoneNumber": "+1888...",
"extensionId": "386009040"
},
"from": {
"name": "L...",
"phoneNumber": "+1618...",
},
"message": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/377098040/extension/386009040/message-store/1401140377040",
"id": "1401140377040",
"type": "VoiceMail"
},
"extension": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/377098040/extension/386009040",
"id": 386009040
},
"telephonySessionId": "s-ec6115b764294caf80078e7ecf4c1934",
"transport": "PSTN",
"legType": "Accept"
}
]
}
When I fetch the voicemail message, which is
https://platform.ringcentral.com/restapi/v1.0/account/377098040/extension/386009040/message-store/1401140377040
it gives me a 404
This is because for some reason, the voicemail is actually in a different extension:
https://platform.ringcentral.com/restapi/v1.0/account/377098040/extension/377100040/message-store/1401140377040
So couple issues:
1. Why does the call log say the voicemail message is in one extension, but is actually in another?
2. Why does the voicemail webhook only get sent out after it was read even though it was received a few hours prior?
Hang on there. I just test /voicemail notification on Webhooks and observe the same issue as you reported. I will let the engineering team know to fix this asap.
Hi Phong - has this been resolved?
It is working as normal as I just run my test. Can you clear all active subscription (if any) and subscribe a new one, print out the re request id (from the headers) and the subscription id. I will ask the engineer to have a look at your subscription.