# Check conference PIN via node red

**URL:** <https://wazo-platform.discourse.group/t/check-conference-pin-via-node-red/962>\
**Category:** Development: API/Events\
**Created:** [January 12, 2022, 8:47pm UTC](https://wazo-platform.discourse.group/t/check-conference-pin-via-node-red/962 "2022-01-12T20:47:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quintana](https://yyz2.discourse-cdn.com/free1/user_avatar/wazo-platform.discourse.group/quintana/32/916_2.png) [@quintana](https://wazo-platform.discourse.group/u/quintana)\
**Post date:** [January 12, 2022, 8:47pm UTC](https://wazo-platform.discourse.group/t/check-conference-pin-via-node-red/962/1 "2022-01-12T20:47:18Z")

</div>

Hello,

Just to not lose discussion on our Mattermost.

Add a subroutine to your conference

 ![Screen Shot 2022-01-12 at 2.18.41 PM](https://global.discourse-cdn.com/free1/uploads/wazo_platform/original/1X/c37aed48a29c728fbdfa13b79ae7dd7e2f6b2300.jpeg)

Add dialplan on /etc/asterisk/extensions\_extra.d/check\_pin.conf:

WARNING: change/adapt the NODERED\_URL to yours in the dialplan.

```auto
[conference-sylvain]
exten = s,1,Noop(Conference)
same = n,Read(PIN,vm-password,4)
same = n,Set(NODERED_URL=http://your.node.red/pin)
same = n,GoSub(get-via-curl,s,1(${NODERED_URL},${PIN}))
same = n,GotoIf($[${CURL_RESPONSE} != 200]?hangup)
same = n,Return()
same = n(hangup),Playback(vm-goodbye)
same = n,Hangup()

[get-via-curl]
exten = s,1,NoOp(Get info via CURL)
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:${WAZO_ENTRY_EXTEN})
same = n,Set(CURLOPT(httpheader)=X_CALLERID:${CALLERID(num)})
same = n,Set(CURLOPT(httpheader)=X_WAZO_DATA:${ARG2})
same = n,Set(CURLOPT(useragent)=wazo)
same = n,Set(CURL_RESULT=${CURL(${ARG1})})
same = n,Set(CURL_RESPONSE=${CUT(CURL_RESULT, ,2)})
same = n,Return()

```

Reload asterisk dialplan:

`asterisk -rx 'dialplan reload'`

Add to your node-red this node:

 ![Screen Shot 2022-01-12 at 3.33.47 PM](https://global.discourse-cdn.com/free1/uploads/wazo_platform/original/1X/4868a503d4bbf1c73f10fc5a52a3ea1955d83360.png)

HTTP node:

 ![Screen Shot 2022-01-12 at 3.48.53 PM](https://global.discourse-cdn.com/free1/uploads/wazo_platform/original/1X/31568f1d76e68c6d4d32c4e03b925b932351e742.png)

The CHECK PIN function is:

```auto
const callerid = msg.req.headers.x_callerid;
const channel_id = msg.req.headers.x_channel_id;
const exten = msg.req.headers.exten;
const pin = msg.req.headers.x_wazo_data;

if (pin == '1234') {
    return [msg,null]
}

return [null,msg];

```

Now you can enhanced this feature by yourself. Feedback are welcome 🙂

Sylvain
