Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Headers parameter missing for transfer() #22

Closed
kevinbond opened this Issue · 5 comments

2 participants

@kevinbond
Owner

Unable to change headers using WebAPI. The parameter does not exist as shown below:

{ "transfer": {
        "to": String or Array,#Required
        "answerOnMedia": Boolean,
        "choices": Object,
        "from": String,
        "name": String,
        "required": Boolean,
        "terminator": String,
        "timeout": Float } }

I will be utilizing this feature as follows:

from itty import *
from tropo import Tropo, Session


@post('/PythonReverseSipT.json')

def index(request):

  s = Session(request.body)
  t = Tropo()

  t.say("Hello. , , , Transferring")
  t.transfer(to="sip:9991489767@sip.tropo.com", headers={"x-callername":"Kevin Bond"})

  return t.RenderJson()

run_itty(server='wsgiref', host='0.0.0.0', port=8888)

Thank you!

@egilchri egilchri closed this in 5b6fbe5
@egilchri

I just pushed out a new tropo.py that I think fixes this issue. However, I welcome your feedback. The sample script is called gh-22.transfer.py.

@kevinbond
Owner

Thank you for the fast update, however, I am still having issues with python rendering the headers into the JSON. I copied the exact code and also messed around with it and the resulting JSON is always as follows:

{"tropo": [{"say": {"value": "Hello. , , , Transferring"}}, {"transfer": {"to": "sip:9991489767@sip.tropo.com"}}]}

When I tested it in another language, this is what I got, which worked:

{"tropo": [{"say": [{"value": "Hello. , , , transferring"}]},{"transfer": {"to":"sip:9991489762@sip.tropo.com","headers": {"x-callername": "Kevin Bond"}}}]}

I pulled the newly changes and had a peek at them and it looks good. I don't why it is failing to set the headers. Thank you for all the help.

@egilchri
@kevinbond
Owner

Hello Ted,

I did use the example and incorporated the fixes. Did you run any successful tests?

@egilchri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.