@minscof/node-red-contrib-asterisk-ari
Version:
Package for Controlling Asterisk via ARI
338 lines • 8.63 kB
JSON
[
{
"id": "b283eef3.e91d1",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "b6bd7bc.6bc6d88",
"type": "comment",
"z": "b283eef3.e91d1",
"name": "Example Flow",
"info": "This is an example flow\nThis flow runs each time a call is handle by the Stasis application.\nThe filter keeps StasisStart Even, then Answer and playbak a predefined sound then hangup",
"x": 150,
"y": 140,
"wires": []
},
{
"id": "5614748551709b10",
"type": "ari_answer",
"z": "b283eef3.e91d1",
"name": "ARI Answer",
"x": 630,
"y": 260,
"wires": [
[
"80e339adf7a450a2"
]
]
},
{
"id": "115ca98dd9b42a1c",
"type": "ari_continueindialplan",
"z": "b283eef3.e91d1",
"name": "",
"x": 650,
"y": 200,
"wires": [
[
"482a6587a6a49c1f"
]
]
},
{
"id": "aa365575f53d00a8",
"type": "debug",
"z": "b283eef3.e91d1",
"name": "debug 12",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1100,
"y": 200,
"wires": []
},
{
"id": "d296abd330a7ea06",
"type": "ari_hangup",
"z": "b283eef3.e91d1",
"name": "",
"x": 1180,
"y": 260,
"wires": [
[]
]
},
{
"id": "56b935fd82924cb5",
"type": "switch",
"z": "b283eef3.e91d1",
"name": "Filter",
"property": "event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "StasisStart",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 310,
"y": 260,
"wires": [
[
"ac87329e24bd07b6",
"42e747d6d298ed61"
]
]
},
{
"id": "941dedf6b4b8d1f3",
"type": "delay",
"z": "b283eef3.e91d1",
"name": "Delay ",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 470,
"y": 200,
"wires": [
[
"115ca98dd9b42a1c"
]
]
},
{
"id": "80e339adf7a450a2",
"type": "delay",
"z": "b283eef3.e91d1",
"name": "Delay",
"pauseType": "delay",
"timeout": "3",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 830,
"y": 260,
"wires": [
[
"6dcc5275f4527b7a"
]
]
},
{
"id": "ac87329e24bd07b6",
"type": "delay",
"z": "b283eef3.e91d1",
"name": "Delay",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 470,
"y": 260,
"wires": [
[
"5614748551709b10"
]
]
},
{
"id": "6dcc5275f4527b7a",
"type": "ari_playback",
"z": "b283eef3.e91d1",
"name": "",
"media2": "sound:tt-weasels",
"media2Type": "str",
"x": 1000,
"y": 260,
"wires": [
[
"d296abd330a7ea06"
],
[]
]
},
{
"id": "b2a903143f7ca68f",
"type": "debug",
"z": "b283eef3.e91d1",
"name": "Display last callers",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 320,
"wires": []
},
{
"id": "42e747d6d298ed61",
"type": "function",
"z": "b283eef3.e91d1",
"name": "List caller",
"func": "var list = context.get(\"statusList\") || [];\nvar date = new Date().toLocaleString('fr-FR', {\n timeZone: 'Europe/Paris',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n});\nvar entry = date + \" - \" + msg.payload.channel.caller.number;\nlist.push(entry);\nif (list.length > 10) {\n list = list.slice(-10);\n}\ncontext.set(\"statusList\", list);\nmsg.payload = list;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 480,
"y": 320,
"wires": [
[
"b2a903143f7ca68f"
]
]
},
{
"id": "482a6587a6a49c1f",
"type": "ari_bridgedial",
"z": "b283eef3.e91d1",
"name": "",
"destination": "toto",
"callerId": "",
"x": 850,
"y": 200,
"wires": [
[
"aa365575f53d00a8"
],
[]
]
},
{
"id": "637783170de26f60",
"type": "ari_listen",
"z": "b283eef3.e91d1",
"name": "Listen",
"server": "f8d9ef1673cd981b",
"app": "attendant",
"topics": [
"StasisStart",
"StasisEnd",
"ContactStatusChange",
"DeviceStateChanged",
"EndpointStateChange",
"Dial",
"ChannelConnectedLine",
"ChannelHangupRequest",
"ApplicationMoveFailed",
"ApplicationReplaced",
"ChannelCreated",
"ChannelDestroyed",
"ChannelEnteredBridge",
"ChannelLeftBridge",
"ChannelStateChange",
"ChannelDtmfReceived",
"ChannelDialplan",
"ChannelCallerId",
"ChannelUserevent",
"ChannelVarset",
"ChannelToneDetected",
"ChannelTalkingStarted",
"ChannelTalkingFinished",
"ChannelHold",
"ChannelUnhold",
"PeerStatusChange"
],
"x": 140,
"y": 260,
"wires": [
[
"56b935fd82924cb5"
],
[]
]
},
{
"id": "0135b2834ddba965",
"type": "ari_originate",
"z": "b283eef3.e91d1",
"name": "Originate",
"server": "f8d9ef1673cd981b",
"app": "originate",
"topics": [
"StasisStart",
"StasisEnd",
"ContactStatusChange",
"DeviceStateChanged",
"EndpointStateChange",
"Dial",
"ChannelConnectedLine",
"ChannelHangupRequest",
"ApplicationMoveFailed",
"ApplicationReplaced",
"ChannelCreated",
"ChannelDestroyed",
"ChannelEnteredBridge",
"ChannelLeftBridge",
"ChannelStateChange",
"ChannelDtmfReceived",
"ChannelDialplan",
"ChannelCallerId",
"ChannelUserevent",
"ChannelVarset",
"ChannelToneDetected",
"ChannelTalkingStarted",
"ChannelTalkingFinished",
"ChannelHold",
"ChannelUnhold",
"PeerStatusChange"
],
"destination": "",
"callerId": "",
"x": 140,
"y": 200,
"wires": [
[
"941dedf6b4b8d1f3"
],
[]
]
},
{
"id": "f8d9ef1673cd981b",
"type": "asterisk_ari",
"url": "http://localhost:8088",
"apps": "attendant,originate"
}
]