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:
Arsen Chaloyan 2007-08-20 18:10:00 +00:00
parent f094dc4e71
commit a56dba7f8a
1 changed files with 13 additions and 7 deletions

View File

@ -487,6 +487,7 @@ static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **
</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 *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
if (!position) {
@ -497,6 +498,11 @@ static switch_status_t openmrcp_asr_get_results(switch_asr_handle_t *ah, char **
position += strlen(marker);
*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
// should return False