asr result in mrcp message body must be checked to exist before use
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5633 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
f094dc4e71
commit
a56dba7f8a
|
@ -487,6 +487,7 @@ static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **
|
||||||
</result>
|
</result>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
|
||||||
char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
|
char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
|
||||||
char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
|
char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
|
||||||
if (!position) {
|
if (!position) {
|
||||||
|
@ -497,6 +498,11 @@ static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **
|
||||||
position += strlen(marker);
|
position += strlen(marker);
|
||||||
*xmlstr = strdup(position);
|
*xmlstr = strdup(position);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server: %s");
|
||||||
|
ret = SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// since we are returning our result here, future calls to check_results
|
// since we are returning our result here, future calls to check_results
|
||||||
// should return False
|
// should return False
|
||||||
|
|
Loading…
Reference in New Issue