Remove default_filter from Twilio TaskRouter - twilio

I've set up my workflows and taskqueues.
Workflow looks like this.
{
"task_routing": {
"filters": [
{
"filter_friendly_name": "Dialpad",
"expression": "flexOutboundDialerTargetWorker != null",
"targets": [
{
"expression": "task.flexOutboundDialerTargetWorker == worker.contact_uri",
"queue": "WQ044385bd3c00a98cc63c092d02e5b571",
"timeout": 10
}
]
}
],
"default_filter": {
"queue": "WQ044385bd3c00a98cc63c092d02e5b571"
}
}
}
Task queue and workers are configured so that WQ044385bd3c00a98cc63c092d02e5b571 has available workers.
However, when I call the number, a task gets created, a reservation is made, but in the case that nobody os available, the task moves to the default_filterand it stays there forever.
What I want to do?
Remove the default_filter or set a timeout on it (can't really figure out how to edit the default filter)
Handle the canceled task myself using Event Callbacks

Turns out there's a visual option I missed located at:
https://www.twilio.com/console/taskrouter/workspaces/WSXXX/workflows
Scroll to bottom and set the DEFAULT QUEUE to None.

Related

Google Actions Account Linking: doesn't work in testing

I have to develop a Google Action with a mandatory Account Linking phase that I have configured with an OAuth2 server. I'm using the online console at https://console.actions.google.com/ to develop the action.
I have set up the Start scene where the condition is user.validationStatus != "VERIFIED" . Based on the result of the condition I will go to 2 different scenes.
Here the screen of the Start scene where is checked the account linking status.
Here the Start_AccountLinking scene
But when I try to go in the "Test" section of the console after I open the action with the invocation, It doesn't pass any of the conditions and stays in the Start scene. In the log on the right, I can see that it failed both the conditions.
{
"conditionsEvaluated": {
"failedConditions": [
{
"expression": "user.validationStatus != \"VERIFIED\"",
"nextSceneId": "Start_AccountLinking"
},
{
"expression": "user.validationStauts == \"VERIFIED\"",
"nextSceneId": "AuthenticatedScene"
}
]
},
"responses": [
{
"firstSimple": {
"speech": "Benvenuto in Semiperdo",
"text": "Benvenuto in Semiperdo"
}
}
]
}
Instead of user.validationStatus use user.accountLinkingStatus. It will work!

How to use 2 conditions inside the elastic watcher

I'm new to ELK, can i use 2 conditions in Elastic watchers. I am getting a field from logs like data = 0 and data = 1 so i need to use that "data" as condition inside my watcher to elobarate the events.
Thanks in advance
There's many solutions. Here's one using painless script:
[query sections...]
},
"condition": {
"script": {
"source": """
def obj = ctx.payload.hits.hits.0;
if (obj.data.value == 0 || obj.data.value == 1) {
return true;
}
return false;
""",
"lang": "painless"
}
},
"actions": {
[actions sections to follow...]
Of course I'm only making up the CTX context data path. In the example, I am referring to the "data" field of the first returned record. You will have to figure out what you want to check. One common piece of data is from aggregations, then you will have a to access ctx.payload.aggregations.*

Aws step function timeout not catched by error handler

I have the following state where the timeout is not catch nevertheless there is the catch with "States.ALL". According to here https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
it should be. Can you tell me what is wrong?
"PublishIotCmd&WaitTask": {
"Next": "SuccedTask",
"Retry": [
{
[..]
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"ResultPath": "$.error",
"Next": "ErrorHandlerTask"
}
],
"Type": "Task",
"TimeoutSeconds": 600,
"ResultPath": "$.cmdResult",
"Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken",
"Parameters": {
"FunctionName": "xx",
"Payload": {
"token.$": "$$.Task.Token",
"request.$": "$.detail"
}
}
},
On the specific case the timeout is due to the task not getting the token with sendTaskSuccess. The error is, of course, this one but "ErrorHandlerTask" is not called, the state machine just hangs.
const publishIot = new tasks.LambdaInvoke(this, 'PublishIotCmd&WaitTask', {
lambdaFunction: iotSendCommandFn,
payload: sfn.TaskInput.fromObject({
token: sfn.JsonPath.taskToken,
//request: sfn.JsonPath.entirePayload,
request: sfn.JsonPath.stringAt('$.detail'),
}),
resultPath: '$.cmdResult',
integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
timeout: Duration.minutes(TIMEOUT_WAIT_REPLY_SECONDS),
Thank you in advance
With task tokens, I believe you're supposed to use the Heartbeat timeout rather than a general timeout.
In the docs it calls out "The "HeartbeatSeconds": 600 field sets the heartbeat timeout interval to 10 minutes." and that "If the waiting task doesn't receive a valid task token within that 10-minute period, the task fails with a States.Timeout error name."
I think since it's a different service integration Heartbeat works here.
https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token

Autopilot and Studio integration

The memory is giving null("") after the task is completed.
can i access the autopilot collected answer again back in studio ?
i just have a task which asks the app date and the im trying to sent the interpreted value to HTTP in studio
{
"collected_data": {
"status": "complete",
"answers": {
"answer": "2020-01-22",
"filled": true,
"attempts": 1,
"validate_attempts": 1,
"confirm_attempts": 0,
"confirmed": false
}
}
}
}
},
but the memory shows empty
is this for Voice?
Check in the Autopilot payload if the variable is directly under the widget i.e. instead of widget.memory.VARIABLE_NAME, if you can find it as widget.VARIABLE_NAME

Listing All JIRA Transitions via API

I'm looking to set up smart commits in JIRA, but my developers want to know all the options for their transitions. In order to help them, I'd like to print a cheat-sheet of all transition names (I trust they are smart enough to figure out what does what from there).
But when I look through the REST API documentation, I can only find a way to get the list of transitions for a particular issue (presumably via its status). Is there a way to get the list of all transitions that any ticket can take at any point in its workflow?
You can list the transitions of a given ticket via this endpoint:
/rest/api/2/issue/${issueIdOrKey}/transitions
For a more in depth explanation take a look here:
Does the JIRA REST API require submitting a transition ID when transitioning an issue?
You can get all transitions for project with /rest/api/2/project/{projectIdOrKey}/statuses endpoint. Here is response example, look at "statuses" array:
[
{
"self": "http://localhost:8090/jira/rest/api/2.0/issueType/3",
"id": "3",
"name": "Task",
"subtask": false,
"statuses": [
{
"self": "http://localhost:8090/jira/rest/api/2.0/status/10000",
"description": "The issue is currently being worked on.",
"iconUrl": "http://localhost:8090/jira/images/icons/progress.gif",
"name": "In Progress",
"id": "10000"
},
{
"self": "http://localhost:8090/jira/rest/api/2.0/status/5",
"description": "The issue is closed.",
"iconUrl": "http://localhost:8090/jira/images/icons/closed.gif",
"name": "Closed",
"id": "5"
}
]
}
]
But it doesn't give you exactly list of transitions that any issue can take at any time, and I'm not sure that such method exist in API.
public void changeStatus(IssueRestClient iRestClient,
List<Statuses> JiraStatuses, String key) {
String status = "To Do";
for (Statuses statuses : vOneToJiraStatuses) {
if (1 == statuses.compareTo(status)) {
try {
String _transition = statuses.getTransition();
Issue issue = iRestClient.getIssue(key).get();
Transition transition = getTransition(iRestClient, issue,
_transition);
if (!(isBlankOrNull(transition))) {
if (!(issue.getStatus().getName()
.equalsIgnoreCase(_transition)))
transition(transition, issue, null, iRestClient,
status);
}
} catch (Exception e) {
Constants.ERROR.info(Level.INFO, e);
}
break;
}
}
}
List is a pojo implementation where statuses and transitions defined in xml are injected through setter/constructor.
private void transition(Transition transition, Issue issue,
FieldInput fieldInput, IssueRestClient issueRestClient,
String status) throws Exception {
if (isBlankOrNull(fieldInput)) {
TransitionInput transitionInput = new TransitionInput(
transition.getId());
issueRestClient.transition(issue, transitionInput).claim();
Constants.REPORT.info("Status Updated for : " + issue.getKey());
} else {
TransitionInput transitionInput = new TransitionInput(
transition.getId());
issueRestClient.transition(issue, transitionInput).claim();
Constants.REPORT.info("Status Updated for : " + issue.getKey());
}
}
public Transition getTransition(IssueRestClient issueRestClient,
Issue issue, String _transition) {
Promise<Iterable<Transition>> ptransitions = issueRestClient
.getTransitions(issue);
Iterable<Transition> transitions = ptransitions.claim();
for (Transition transition : transitions) {
if (transition.getName().equalsIgnoreCase(_transition)) {
return transition;
}
}
return null;
}
In Short using Transition API of JIRA we can fetch all the transitions to set statuses

Resources