If I understand correctly that each input character is in the range of zero to 9, then just add 48 to the outgoing character, this gives the correct ascii character to display on your terminal. so try:
You get 7 = Bell, add 48 = 55 = 7 see link below
http://www.asciitable.com/
HSERIN char
HSEROUT char+32
Bookmarks