Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Headers parameter missing for transfer() #22

Closed
kevinbond opened this Issue May 16, 2011 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

kevinbond commented May 16, 2011

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 May 19, 2011

Contributor

egilchri commented May 19, 2011

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.

Contributor

kevinbond commented May 19, 2011

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.

Contributor

egilchri commented May 19, 2011

Hi Kevin,

Did you try this example?

https://github.com/tropo/tropo-webapi-python/blob/master/samples/gh-22.transfer.py

If it didn't work for you I wonder if you are accessing the tropo.py that
incorporates the fixes.

Ted

On Thu, May 19, 2011 at 2:37 PM, kevinbond <
reply@reply.github.com>wrote:

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.

Reply to this email directly or view it on GitHub:
#22 (comment)

"Speech, not just for humans"

http://www.google.com/profiles/egilchri
about.me/ted.gilchrist

Contributor

kevinbond commented May 20, 2011

Hello Ted,

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

Contributor

egilchri commented May 20, 2011

Hi Kevin,

When I run gh-22.transfer.py, with a phone number subbed for TO_NUMEBER,
the script outputs:

{"tropo": [{"say": {"value": "Hello. , , , Transferring"}}, {"transfer":
{"to": "11234567890", "headers": {"x-callername": "Kevin Bond"}}}]}

Ted

On Fri, May 20, 2011 at 11:48 AM, kevinbond <
reply@reply.github.com>wrote:

Hello Ted,

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

Reply to this email directly or view it on GitHub:
#22 (comment)

"Speech, not just for humans"

http://www.google.com/profiles/egilchri
about.me/ted.gilchrist

buildingspeak pushed a commit to buildingspeak/tropo-webapi-python that referenced this issue Jan 8, 2016

ran 2to3 plus fixed gh-22.transfer.py and GoogleS3.py manually with b…
…readcrumb line ##DRA indicating what was done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment