def _convert_to_int(items):
    """
    Extracts the offset-value from Asterisk's response, `items`, or returns -1 if the value
    can't be parsed.
    """
    offset = items.get('endpos')
    if offset and offset.data.isdigit():
        return int(offset.data)
    else:
        return -1
