Features/CSTA Support
From Snom User Wiki
Contents |
CSTA Standard
CSTA is a standard. We follow the standard as described in:
http://www.ecma-international.org/publications/standards/Ecma-269.htm
Supported Message Types
- Versions 7.1 and earlier have no CSTA support.
- Versions starting from 7.3.4 support the following CSTA message types:
- ClearConnection
- HoldCall
- RetrieveCall
- SingleStepTransferCall
- TransferCall
- AnswerCall
- ClearCall
- MakeCall
Description for these message types can be found in the CSTA standard document.
CSTA Events and Action URL
We don't support CSTA Events at the moment. Event Notification must be done with Action URLs. Therefore, we have added a new runtime variable $csta_id as an action url parameter e.g.:
http://192.168.100.100/incoming.php?Caller=$remtote&Callee=$local&csta_id=$csta_id
Additionally, you can still send the $call-id too if you need it for something else. In the XML messages you need to send the $csta_id. This value should be used whenever you see a ConnectionID type in CSTA commands described in the CSTA document. E.g. AnswerCall specification looks like:
<xsd:element name="AnswerCall">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="callToBeAnswered" type="csta:ConnectionID"/>
<xsd:element ref="csta:correlatorData" minOccurs="0"/>
<xsd:element ref="csta:userData" minOccurs="0"/>
<xsd:element ref="csta:extensions" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
In this case callToBeAnswered should have the value returned by $csta_id through action url e.g. -18.
Thus:
<csta:AnswerCall> <csta:callToBeAnswered>-18</csta:callToBeAnswered> </csta:AnswerCall>
The same holds for all other commands mentioned in the templates section below.
CSTA XML Templates
ClearConnection
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:ClearConnection> <csta:connectionToBeCleared>4711</csta:connectionToBeCleared> </csta:ClearConnection> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
HoldCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:HoldCall> <csta:callToBeHeld>4711</csta:callToBeHeld> </csta:HoldCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
RetrieveCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:RetrieveCall> <csta:callToBeRetrieved>4711</csta:callToBeRetrieved> </csta:RetrieveCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
SingleStepTransferCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:SingleStepTransferCall> <csta:activeCall>4711</csta:activeCall> <csta:transferredTo>sip:a@bc.com</csta:transferredTo> </csta:SingleStepTransferCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
TransferCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:TransferCall> <csta:heldCall>4711</csta:heldCall> <csta:activeCall>4712</csta:activeCall> </csta:TransferCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
AnswerCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:AnswerCall> <csta:callToBeAnswered>4711</csta:callToBeAnswered> </csta:AnswerCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
ClearCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:ClearCall> <csta:callToBeCleared>4711</csta:callToBeCleared> </csta:ClearCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
MakeCall
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:MakeCall> <csta:callingDevice>22343</csta:callingDevice> <csta:calledDirectoryNumber>18005551212</csta:calledDirectoryNumber> </csta:MakeCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
callingDevice is the user name of a configured identity. When this field has an empty value, then the active identity is used to make the call. Otherwise the value is used to choose the identity by comparing the value with the configured user name of every identity.
Resposes from the phone
The following snippet show the code we use to deliver the response. You can see from it what XML message we send back. We send a 200 OK when everything was ok, otherwise we send 500 Internal Server Error with the error code.
if (returnCode == CSTA_RET_COMMAND_SUCCESSFUL) {
out = str("HTTP/1.1 200 Ok\r\n");
content = str::sprintf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""
"xmlns:csta=\"http://www.ecma-international.org/standards/ecma-323/csta/ed4\">\r\n"
" <SOAP-ENV:Body>\r\n"
" <csta:%sResponse>\r\n"
" </csta:%sResponse>\r\n"
" </SOAP-ENV:Body>\r\n"
"</SOAP-ENV:Envelope>\r\n", str::arg_str(requestType), str::arg_str(requestType));
} else {
out = str("HTTP/1.1 500 Internal Server Error\r\n");
content = str::sprintf(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""
"xmlns:csta=\"http://www.ecma-international.org/standards/ecma-323/csta/ed4\">\r\n"
" <SOAP-ENV:Body>\r\n"
" <SOAP-ENV:Fault>\r\n"
" <SOAP-ENV:faultcode>Client</SOAP-ENV:faultcode>\r\n"
" <SOAP-ENV:faultstring>CSTA Error</SOAP-ENV:faultstring>\r\n"
" <SOAP-ENV:detail>\r\n"
" <csta:CSTAErrorCode xmlns:csta=\"http://www.ecma-international.org/standards/ecma-323/csta/ed4\">\r\n"
" <csta:operation>%s</csta:operation>\r\n"
" </csta:CSTAErrorCode>\r\n"
" </SOAP-ENV:detail>\r\n"
" </SOAP-ENV:Fault>\r\n"
" </SOAP-ENV:Body>\r\n"
"</SOAP-ENV:Envelope>\r\n", str::arg_str(returnCode));
}
How to post it to the phone
HTTP-POST to
http://<ip-of-phone>/csta.
The content-type should be text/xml.
Example:
POST /csta HTTP/1.1 User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1 Host: 192.168.11.253 Accept: */* Content-Length: 343 Content-Type: text/xml ... <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed4"> <SOAP-ENV:Body> <csta:AnswerCall> <csta:callToBeAnswered>-2</csta:callToBeAnswered> </csta:AnswerCall> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
