Describe the bug
When using the SendApi method in the EventSocket class, an exception is thrown if the response string only contains "ERR" with no further characters following it.
To Reproduce
Steps to reproduce the behaviour:
To reproduce the error, call EventSocket's SendApi method with something which would cause FreeSWITCH to send only "ERR" back in response. In our case we called uuid_transfer with the same channel identifier more than 66 times, which FreeSWITCH does not allow by default and returns just "ERR" as its response. Anything which returns this as a response should reproduce the problem which should also exist with the SendCommand method in the same class although we did not verify this case specifically.
Expected behavior
The ErrorMessage property in ApiResponse should just return an empty string.
Screenshots
Here is an excerpt of a stack trace describing the exception:
startIndex cannot be larger than length of string. (Parameter 'startIndex')
error.ParamName startIndex
error.Source System.Private.CoreLib
error.StackTrace
at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex, Int32 length)
at NEventSocket.FreeSwitch.ApiResponse.get_ErrorMessage()
Describe the bug
When using the
SendApimethod in theEventSocketclass, an exception is thrown if the response string only contains "ERR" with no further characters following it.To Reproduce
Steps to reproduce the behaviour:
To reproduce the error, call
EventSocket'sSendApimethod with something which would cause FreeSWITCH to send only "ERR" back in response. In our case we calleduuid_transferwith the same channel identifier more than 66 times, which FreeSWITCH does not allow by default and returns just "ERR" as its response. Anything which returns this as a response should reproduce the problem which should also exist with theSendCommandmethod in the same class although we did not verify this case specifically.Expected behavior
The
ErrorMessageproperty inApiResponseshould just return an empty string.Screenshots
Here is an excerpt of a stack trace describing the exception: