Respond
The Respondfunction generates a SIP response to the current request message with the supplied status code and reason phrase.
Syntax
Copy code | |
---|---|
bool Respond( string statusCode, string reasonPhrase, string appendHeader1, string appendHeader2, ..., string appendHeaderN ); |
Parameters
Return values
Returns false if the current message is not a request (see the description of the sipRequest built-in variable in MSPL built-in variables ), or if a non-1xx response has already been sent. Otherwise, it returns true .
Remarks
New headers are appended to the response by passing them in complete form as additional parameters to this function. For example, to add a "Contact" header to a response, the following call is correct.
Copy code | |
---|---|
Respond("200", "OK", "Contact=<someone@example.com>;param1=value1"); |
If the "=" (equals) is not present in the appended header or headers, a critical MSPL error is raised for each occurrence where it must be present.