0

Why is Tropo inserting spaces into number responses?

Using Python/Django app hosted on Heroku.  When asked by my app to pick from a list of numbers, in this case [12,13,14], and I text back 13, the response I see from Tropo shows the following:

u'utterance': u'1 3'   and   u'value': u'1 3'

There is a space between the 1 and the 3.  If I put in a 5 digit number, it inserts a space between each digit.  And entering letters seems to be ignored altogether.  Here are the lines of code capturing the response:

r = Result(request.body)

t = Tropo()

actions = r._actions

if type(actions) is list:

    r_dict = actions[0]

else:

    r_dict = actions

if r_dict['disposition'] != 'SUCCESS': #only process if previous ask was successful

    t.hangup()

else:

    try:

        this_user = User.objects.get(user_profile__mobile_phone = caller_id)

        account_id = r.getValue()

        account = get_object_or_404(Account, pk = account_id)

It fails on the last line because account_id = '1 3' instead of '13'.  Please help.

1 comment

Please sign in to leave a comment.