I have a bot which should answer to calls, here's MS doc
Actually I can Answer a call but I get no response data or error. Only the bot respond but in documentation I should get data back as mentioned in Microsoft Graph SDK here ( api method right after initialisation):
client
.api('/me')
.get((err, res) => {
console.log(res); // prints info about authenticated user
});
Here's my function :
//before that initialisation is OK
Call.prototype.Answer = function Answer() {
console.log("answering __________>");
var answer = {
callbackUri: "https://ucbot.serveo.net/api/call",
acceptedModalities: ["audio"],
mediaConfig: {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
removeFromDefaultAudioGroup: false
}
};
Graph.Client.api(
"https://graph.microsoft.com/beta/app/calls/" + this.id + "/answer"
)
.post(answer, (err, res) => {
console.log(
JSON.stringify(
" err (answer) " + JSON.stringify(err, null, 1),
null,
1
)
);
console.log(
JSON.stringify("res (answer) " + JSON.stringify(res, null, 1), null, 1)
);
});
};
I think that the post request is working because I get my bot answering to call, but res is undefined
Here's how I define my workflow
function PlayWorkflow(call, event) {
// TODO: this function should be implemented in Callflow @Mefteh.
switch (event.resourceData.state) {
case "Incoming":
call.Answer();
break;
case "Establishing":
//console.log("Establishing");
break;
case "Established":
// console.log("Established");
// call.Prompt();
// call.SubscribeToTones();
break;
case "Deleted":
console.log("Deleted");
break;
default:
console.log(" default");
}
}
Should I move answer() function istablished case ? If yes what should I put in incoming ? Because if I let it empty graph api will not pass to next states ( Establishing, esteblished)
from MS graph API don't send payload when answering to a call
No comments:
Post a Comment