<< Click to Display Table of Contents >> Navigation: Use Cases > API calls, GPIO and Audio |
SIP
http://192.168.1.99:8586/api/call
Where IP - address of the RPI
POST or GET method
If POST then in format JSON, if GET then parameters separated by &
There are 4 type of actions: call, answer, hangup, media
call:
{'account':1,'action':'call','to':'123456','speaker':'on','mic':'off'}
?account=1&action=call&to=123456&speaker=on&mic=off
account - id of the account from who to make a call
to - number where to call
speaker and mic - ON or OFF- to mute or un-mute during the call
answer:
{'account':1,'action':'answer'}
?account=1&action=answer
to answer the call on particular account
hangup:
{'account':1,'action':'hangup'
?account=1&action=hangup
to kill the call
media:
{'account':1,'action':'media','speaker':'on','mic':'off'}
?account=1&action=media&speaker=on&mic=off
way to control Microphone and speaker on specific account
during the active call
GPIO
http://192.168.1.99:8585/api/remote
Where IP - RPI address
POST or GET request
If POST then JSON format, if GET then parameters separated by &
Control Inputs / Outputs
{'auth':'12345abdcd','cmd':'onoff','gpio':'P1Pin7','duration':1000}
?auth=12345abcd&cmd=on&gpio=P1Pin7
where auth - authentification string under field 'EMS'
gpio - this is ID of the required GPIOor of the MCP
duration - in milliseconds
If gpio is set as an Output:
cmd=on -turn On output (LED On)
cmd=off - turn Off output (LED Off)
cmd=onoff - turn On, wait duration x milliseconds and turn Off
If gpio configured as an Input:
cmd=on -emulare a unui signal aplicat gpio (pressed and Hold)
cmd=off - emulare a disparitiei unui signal pe gpio (Released)
cmd=onoff - emulare unui impuls pe gpio (Pressed and Released)
cu impuls lung = duration in milliseconds
parametrul duration e necesar numai chind avem cmd=onoff
Exemplu:
http://172.16.16.205:8585/api/remote?auth=12345abdcd&cmd=onoff&gpio=P1Pin40&duration=5000
Audio will play on any trigger if seleced.
http://172.16.16.107:8585/api/remote?auth=555666777&cmd=on&gpio=P1Pin36
http://172.16.16.107:8585/api/remote?auth=555666777&cmd=off&gpio=P1Pin36