First you need to install the MVoIPSDK. For this just run the MVoIPSDKService_Install.exe which will install the SDK as service and will start it in the background.
Once the SIP SDK is running you can connect to its 18520 TCP port and start to send command and receive answers and other notifications.
Pseudocode:
//connect via TCP
tcpclient->Connect("127.0.0.1", 18520);
//…once connected, start the SIP stack
tcpclient->Send("API_Start");
//wait 1-2 seconds here to let the sip stack to initialize (or wait for the "START,api" notification)
//set parameters (all parameters have to be separated by “CRLF” -\r\n)
tcpclient->Send("API_SetParameters,serveraddress=YOURSIPSERVER CRLF username=SIPUSERNAME CRLF password=SIPPASSWORD CRLF loglevel=5\r\n")
//make outgoing call
tcpclient->Send("API_Call,-1, DESTINATION\r\n");
//hangup
tcpclient->Send("API_Hangup\r\n");
//send IM
tcpclient->Send("API_SendChat,-1,DESTINATION,MESSAGE\r\n")
//on close:
//api_stop is optional, because the engine will time-out on no usage anyway after 3 minutes
tcpclient->Send("API_Stop\r\n");
//TCP disconnect
tcpclient->Disconnect();
//handle incoming messages
OnSocketReceivedCallback()
String recv = tcpclient->ReceiveString();
//parse line-by-line (split by \r\n)
//adjust your GUI based on the sip stack state machine received in STATUS messages
Answer for API requests are received in the following format:
APIREQUEST:API_SetParametersAPIRESULT:true
So in the APIRESULT value you can have true/false for boolean return values, a number for int return values or a string, exactly as the API functions are defined.
Notifications are received in the following format:
WPNOTIFICATION,STATUS,-1,Registered.,NEOL //successfully registered to SIP server
WPNOTIFICATION,STATUS,1,Ringing,2222,1111,2,Katie,callid,NEOL //incoming call on first line
You will need to parse the STATUS messages and adjust your app (logic/GUI) accordingly (such as displaying a green "Accept" and red "Reject" button on incoming calls).
See the documentation and the examples for more details.