Hello @Ramblin,
Thank you for this thread. to open your mind with a different approach and because we are working to have a different vision in wazo about writing feature as little as possible without dialplan, i did the same sub routine but connected to a node-red. The really nice feature is you have the choice to do many options to play with your call. The example is for blacklisting a call, but you can imagine what you want.
[xivo-subrgbl-did]
exten = s,1,NoOp(Check if incoming calls is blacklisted in node-red)
same = n,Set(CURLOPT(ssl_verifypeer)=0)
same = n,Set(CURLOPT(header)=1)
same = n,Set(CURLOPT(httptimeout)=10)
same = n,Set(CURLOPT(httpheader)=X_CHANNEL_ID:${CHANNEL(uniqueid)})
same = n,Set(CURLOPT(httpheader)=X_EXTEN:${XIVO_BASE_EXTEN})
same = n,Set(CURLOPT(httpheader)=X_CALLERID:${CALLERID(num)})
same = n,Set(CURLOPT(useragent)=wazo)
same = n,Set(CURL_RESULT=${CURL(http://**your_node_red**/blacklist)})
same = n,Set(RESPONSE=${CUT(CURL_RESULT, ,2)})
same = n,GotoIf($["${RESPONSE}" = "404"]?blacklisted)
same = n,Return()
same = n(blacklisted),Playback(bye)
same = n,Hangup()
This dialplan just make an http request to a node-red, and it decide to accept call or not depending of the HTTP result of your request. So basically 200 is, ok call is not blacklisted, and 404 is call is blacklisted.
In my node red i just created an http endpoint /blacklist and i wrote a very small function for the exemple to accept or not the call. If the call is accepted, i just go to the 200 and if not go to 404.
In my function, i just get the information like this:
const callerid = msg.req.headers.x_callerid;
const channel_id = msg.req.headers.x_channel_id;
const exten = msg.req.headers.exten;
if (callerid == '8000') {
return [null,msg]
}
return [msg,null];
So this is a really simple exemple, but you can imagine for exemple to get your blacklist from a google sheet, or any databases you want. The possibility is clearly very big ;).
I know the approach is very different to make dialplan, but i think the approach with node-red if very funny and more powerful. There is some examples i wrote in this forum check here :
Hope this help you to continue to play with wazo-platform and help people to create lot of really fun applications!
Sylvain