The goal was to, having already manually configured server with its respective IVR menus, voicemail, MySQL database (with OBDCconnector), connection to another PBX, group calls, music on hold, call forwarding, and TTS system, implement an emergency call button that would allow a free agent from the call queue to receive it as if it were an emergency service.

To achieve this, the ArduinoSIP.h and ESP8266WiFi.h libraries were used. The most important part of the code would be as follows:

aSip.Init(SipIP, SipPORT, WiFiIP, SipPORT, SipUSER, SipPW, 15);
...
// SIP processing
aSip.Processing(acSipIn, sizeof(acSipIn));
delay(200);
if ( digitalRead(5) == LOW )
{
Serial.print("Calling\n");
aSip.Dial(SipDIAL, SipTEXT_2);
}

The server configuration includes modifying the sip.conf and extensions.conf files.

//sip.conf
[nodemcu]
type = friend
host = 'nodemcuIP'
context = test
username = nodemcu
secret =123

//extensions.conf
[test]
exten => 5,1,Goto(menu,1,1)