Having an IP doorphone both on the external gate and the internal office door, when a call comes from external gate how can I unlock both electric doorlocks ?
Doorphones can be fanvil or hikvision ones both with the default opening * key
I was thinking about a custom url/script to be recalled by a dss key in order to send a command to both doorphones…
As latest resource I could parallel both electric doorlocks …
Well, after some search I’m ended in this:
Hikvision url :
(curl -i --digest -u user:pass -X PUT -d ‘open’ http://doorphone_IP/ISAPI/AccessControl/RemoteControl/door/1)
Fanvil url :
http://user:pass@doorphone_IP/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*
They can both be inserted into a custom_extensions.conf new context to be associated to a custom application/misc destination
The problem I have with Fanvil url is while it works if pasted into a browser, it doesn’t if passed via curl :
[root@freepbx ~]# curl -i http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*
[1] 2566
[root@freepbx ~]# HTTP/1.1 200 OK
Server: Rapid Logic/1.1
MIME-version: 1.0
Date: Thu Jul 4 10:16:36 2024 GMT
Content-Type: text/plain
Transfer-Encoding: chunkedaction: open door
Result: success
[1]+ Done curl -i http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK
I get
action: open door
Result: success
in both chrome and curl , but with curl, door opening doesn’t take place.
Why? Incomplete syntax ?
Using curl with Hikvision url is fine.
While writing I realized the string
http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*
needs to be between single quotes…
So this is the working extensions_custom.conf :
[doorsopener]
exten => 444,1,Wait(1)
exten => 444,n,System(curl -i 'http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*')
exten => 444,n,System(curl -i 'http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*')
exten => 444,n,Hangup()
that manages both Fanvil doorlocks at the same time.
Last little issue: the phone dialing this custom extension ends in a Decline “call failed” message despite doors are opened, how to get something nicer like “call ended” ??
Answer() the call and see what happens.
It happens that doorlocks open and call clears normally , nice !
But I find a more elegant solution:
With the current one, once the “featurecode_doorsopener” dss key is pressed it’s like to call another extension, thus a transfer is initiated (person at the door get MOH).
Instead I created a /var/www/html/doorsopener.php script like this:
<?php
shell_exec("curl -i 'http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*' && curl -i 'http://admin:[email protected]/cgi-bin/ConfigManApp.com?key=F_LOCK&code=*'");
?>
associated to a Yealink phone “URL” dss key (http://pbx_ip/doorsopener.php).
While talking, once key is pressed doors are opened without loosing connection with waiting person.
Of course, as-is, it could have security issue…
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.