US President Barack Obama says his Iranian counterpart Hassan Rouhani appears to want to open a dialogue with Washington and that he is willing to test whether this is the case.