SIP calls POSTing StatusCallback when call ends even though no StatusCallback URL is configured - sip

When SIP calls end, the last request that was POSTed to my app gets POSTed again, slightly modified, but with the params that the Twilio docs indicate will be included in a call StatusCallback POST. This is doubly weird because I don't have a StatusCallback URL configured!
So ...an example. The environment (all URLs are https):
Twilio SIP endpoint: test-myaccount.sip.twilio.com
Voice URL (POST): myapp.myserver.com/twilioapp
Fallback URL (GET): s3.amazonaws.com/somebucket/twilioerror.xml (can't imagine that's relevant, but I mention it in case it tips anyone off to weird side effects)
StatusCallback URL (POST): blank
The call flow:
1a. Call made to SIP endpoint - Twilio sends request to TwiML app server:
POST myapp.myserver.com/twilioapp
1b. TwiML app responds:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="en-US" voice="alice">May the fourth be with you!</Say>
<Redirect>myapp.myserver.com/twilioapp/secondstep?actualdate=20140503</Redirect>
</Response>
2a. Twilio plays the TTS speech, then POSTs back to the app server (per the Redirect verb):
POST myapp.myserver.com/twilioapp/secondstep?actualdate=20140503
2b. The app server responds:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say language="en-US" voice="alice">Whoops, wrong date. Goodbye!</Say>
<Hangup />
</Response>
3a. Here's the funkiness I'm seeing - Twilio is then POSTing another request:
POST myapp.myserver.com/twilioapp/secondstep/?actualdate=20140503
Note (a) that the POST is to the last URL that Twilio posted to and (b) a trailing slash has been added to the URL, before the querystring params.
Params that are sent with that final POST:
AccountSid: <MyAccountSid>
Caller: sip:55512345678#169.0.0.0
CallStatus: completed
Duration: 1
Called: sip:test-myaccount.sip.twilio.com
To: sip:test-myaccount.sip.twilio.com
CallDuration: 22
CallSid: <TheCallSid>
From: sip:55512345678#169.0.0.0
Direction: inbound
ApiVersion: 2010-04-01
More weird: both Duration and CallDuration are included in the POST params - Duration in (rounded up) minutes, CallDuration in seconds.
So - I have no idea what's up. I've got a support ticket in, but haven't heard back in several days; figured while I was waiting on the Twilio code spelunkers to work their magic I'd ping the community and see if anyone else has noticed this behavior too.

Twilo Evangelist here.
I just spoke with one of our customer support team members and it looks like we have an issue reported for this behavior. She should be reaching out to you shortly to give you a more detailed update.
If we identify a work-around, we'll make sure to update this SO post with those details.
Hope that helps.

Related

Correct envelope to use for a SOAP request?

I'm trying to integrate with the SOAP API specified here:
https://api.okpay.com/OkPayAPI?singleWsdl
https://api.okpay.com/OkPayAPI?wsdl
At the moment the code autogenerated from the wsdl files appears to be acting up, so I'm wondering what should be the correct envelope to send and where should I be sending it?
I used this service for testing: http://www.soapclient.com/soapmsg.html . For server address I put in:
https://api.okpay.com/
And for SOAP Message I put in what my code is currently generating:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Get_Date_Time xmlns="https://api.okpay.com"></Get_Date_Time></Body></Envelope>
And the response appears to be a HTML code of a page, rather than an envelope response.
What would be the correct SOAP Action / Message to what Server Address to send in order to invoke the Get_Date_Time method as specified in the WSDL?
A couple of things:
The "Server Address" needs to point at the actual service, so in this case
https://api.okpay.com/OkPayAPI
The action can be seen in the WSDL, in this case
https://api.okpay.com/I_OkPayAPI/Get_Date_Time
Have a look at the WSDL and search for the action I gave above, that should give you an idea for how to find it for other actions.
With those two updates you should get back the response you expect:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Get_Date_TimeResponse xmlns="https://api.okpay.com">
<Get_Date_TimeResult>2015-01-31 17:52:37</Get_Date_TimeResult>
</Get_Date_TimeResponse>
</s:Body>
</s:Envelope>

Setting up Twilio CallBack

To fellow Twilio users,
we have set up a Twilio trial account.
Our question is can we define/set up a CALLBACK URL in Twilio App Dashboard ( or any other settings panel) to satisfy the following use case:
1. From browser/apps / mobile device
, user dials 310-333-1234 6789 (Twilio phone # / accesscode)
2. Twilio receives this call
3. Twilio captures accesscode (6789) trailing the phone number
and passes to CALLBACK URL
I understand Twilio MakeCall API allows you to specify CallBackURL:
where parmeters :
sendDigits=6789
StatusCallBack=My_CallBack_URL
StatusCallBackMethod=Post
But what we want is to set up CALLBACK URL so physical incoming calls (not calls made with API) and their accesscode would always be passed to this CALLBACK URL.
I'm Megan from Twilio. Not sure what language you're working with and I typically write Python, but I'll share an example in PHP below.
It looks like what you're trying to do here involves the Twiml <Gather> verb, where in the following example you would set http://example.com/complex_gather.xml as the URL in your Voice Request URL configuration of your Twilio number per Carter's suggestion in the comments. The <action> verb then allows you to redirect the caller to your custom Voice Request URL after they input the access code.
<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://example.com/complex_gather.xml -->
<Response>
<Gather numDigits="4" action="/customVoiceUrl" method="GET">
<Say>
Please enter your access code.
</Say>
</Gather>
<Say>We didn't receive any input. Goodbye!</Say>
</Response>
And an example page for the customVoiceUrl:
<?php
// page located at http://example.com/customVoiceUrl
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<Response><Say>You entered " . $_REQUEST['Digits'] . "</Say></Response>";
?>
Same issue described above was happening to me. It was happening because the url contained a query parameter that had an apostraphe in the value
e.g. the url had an apostraphe that was encoded with %27
https://www.example.com?name=O%27Malley
The fix for me was to double encode the query parameters before sending the request to twilio.
e.g. https://www.example.com?name=O%2527Malley
And then make sure to do an extra decoding on the callback query params on my backend
If the signature generated by Twilio decodes special charecters including those in the url as query parameter values, the library should do decoding along with parsing on validate
https://github.com/twilio/twilio-ruby/blob/main/lib/twilio-ruby/security/request_validator.rb#L27

Unable to create(POST) objects (Account, customer...) on QB Windows using IDS and Sync Manager

Here I am provideing you the complete scenario where I am getting the error while posting request for creating a new account.
I am using Intuit OAuth Access and OAuth API console for testing (Using all security tokens).(https://appcenter.intuit.com/Playground/OAuth)
And the URL and request:
URL: https://services.intuit.com/sb/account/v2/570357960
Method : Post
Format: XML/JSON
Request:
<?xml version="1.0" encoding="UTF-16"?><Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="4df87bw2-916a-
4r95-h5d6-06dce3667562"
xmlns="http://www.intuit.com/sb/cdm/v2"><ExternalRealmId>570357960</ExternalRealmId><Objectxsi:type="Account"><Name>CurrentAccount</Name><Active>true</Active><Type>Expense<
/Type><Subtype>Expense</Subtype><AcctNum>1111</AcctNum></Object></Add>
And getting the response (error in html):
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
and I have also checked with RESTClient utility, but getting the same above error.
Please note that the same url
(https://services.intuit.com/sb/account/v2/570357960) with same
security tokens is working fine for GET data , I am getting data from
QB desktop into my online Application.
As Keith said, check the Content-Type. You will also need to use a RestClient for testing. The playground will not work for testing API calls. It only works for platform calls.
If I had to guess... I'd guess you're sending the wrong Content-Type header... but it's impossible to tell for sure until you post more code/the rest of your HTTP request.
A few things to try. Be sure the XML is in the same order as this sample and try it.
the other is a common mistake when you use Oauth in a GET you are including just the url in the signature, but in a POST you need to include the Body in the signature too or it will not pass Oauth validation.
Lastly, as Keith mentioned to check the content type. Although you would generally get a content type error.
156234822
CurrentAccount
true
Expense
Expense
1111

I have integrated yahoo into iphone app but i am getting error:400 bad request

I have to access social information for the logged-in user.i have used following link. http://developer.yahoo.com/social/sdk/objectivec
i have used send request method to get user information.
but i am getting following error message
<
?xml version='1.0' encoding='utf-8'?>
<error xmlns='http://yahooapis.com/v1/base.rng'
xml:lang='en'>
<description>400 Bad Request</description>
<detail>400 Error : syntax error, unexpected &apos;(&apos; at "*(*null)"
can any one help me?
thank you in advance.
The Yahoo Web server (running the Web site) thinks that the data stream sent by the client (e.g. your Web browser or our CheckUpDown robot) was 'malformed' i.e. did not respect the HTTP protocol completely. So the Web server was unable to understand the request and process it. so make sure you are sending the well structured request.
Based on your commented:
http://nullinfo.wordpress.com/oauth-yahoo/
http://developer.yahoo.com/oauth/guide/oauth-make-request.html
You should understand how to make request with oauth, first read that and later if you could not succeed, ask again.

Soap xml for Paypal API SetMobileCheckout (rolling my own objective-c request)

I have the generic structure here:
<?xml version=”1.0” encoding=”UTF-8”?>
<SOAP-ENV:Envelope xmlns:xsi= ” http://www.w3.org/2001/XMLSchema-instance”
xmlns:SOAP-ENC=”http://schemas.xmlsoap.org/soap/encoding/”
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”
><SOAP-ENV:Header>
<RequesterCredentials xmlns=”urn:ebay:api:PayPalAPI”>
<Credentials xmlns=”urn:ebay:apis:eBLBaseComponents”>
<Username>api_username</Username>
<Password>api_password</Password>
<Signature/>
<Subject/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<specific_api_name_Req xmlns=”urn:ebay:api:PayPalAPI”>
<specific_api_name_Request>
<Version xmlns=urn:ebay:apis:eBLBaseComponents”>service_version
</Version>
<required_or_optional_fields xsi:type=”some_type_here”> data
</required_or_optional_fields>
</specific_api_name_Request>
</specific_api_name_Req>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The specific calls (SetMobileCheckout and DoMobileCheckoutPayment) I need are here
I'm well on my way. But I am rolling my own xml request in objective-c and I I'm trying to make sure I get this right.
Has anyone got an actual example with a real request?
Bonus if it is wrapped in objective-C, but just naked xml would be great.
Thanks,
Corey
I eventually went around the problem.
You can use NVP in a HTTP POST. This was munch easier on the iPhone. Not sure why my SOAP response kept getting rejected, but it was too time consuming to keep going.
In search for my answer, I did run across gSoap, which may help others. I just needed to make 2 requests, so I didn't want to get wrapped up in leaning that framework.
I also ran across wsdl2objC, unfortunately, it is not working on the iPhone right now (Data Type issues).
Here is a link to the HTTP POST request which uses NVP instead:
Has anyone implemented the PayPal API through a native iPhone app?