twilio / twilio-salesforce

A Salesforce/Force.com library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at help@twilio.com
http://www.twilio.com/salesforce
MIT License
189 stars 136 forks source link

Call redirect is throwing exception 404 even though uri is valid #53

Closed kishorejena closed 8 years ago

kishorejena commented 8 years ago

I have the following code running from developer console to redirect in progress calls to a conference room. Thought the URi of the call is valid the redirect is throwing 494 exception. Not sure why. Any help will be appreciated.

Here is my script.

TwilioRestClient client = TwilioAPI.getDefaultClient(); Map<String,String> filters = new Map<String,String>{'Status'=>'in-progress'}; Iterator calls = client.getAccount().getCalls(filters).iterator(); while (calls.hasNext()) { TwilioCall call = calls.next(); System.Debug('Call Sid = ' + call.getSid()); System.Debug('Call Parent Sid = ' + call.getParentCallSid()); System.Debug('Call Uri = ' + call.getUri());

if(call.getParentCallSid() != null)    
call.redirect('http://test-businessfunding.cs10.force.com/conference',
        'POST'); 

}

Here is the error.

04:05:32:665 USER_DEBUG [8]|DEBUG|Call Uri = /2010-04-01/Accounts/AC5c27dcb4dd999d2aafc04c5d809d1483/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json

04:05:32:720 USER_DEBUG [93]|DEBUG|RETURN: {code=20404, message=The requested resource /2010-04-01/Accounts/null/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json was not found, more_info=https://www.twilio.com/docs/errors/20404, status=404}

One thing I noticed is that the resource has a null after account instead of the account SID. The uri for the call has real account SID. Not sure why.

Thanks

kishorejena commented 8 years ago

Sorry Typo there - it throws a 404 exception - resource not found

hhai commented 8 years ago

Make sure you have this code in the TwilioCallList.cls

That's where the accountSID will be set for each instance of the callList.

/* implements method from TwilioResource.ListResource */ public override Object makeNew(TwilioClient client, Map<String, Object> params) { TwilioCall call = new TwilioCall((TwilioRestClient)client, params); call.setRequestAccountSid(this.getRequestAccountSid()); return call; }

If you have an older version of the library it had a defect.

Henry Hai twilio cloud communications Solutions Architect e: hhai@twilio.com m: (646) 679-2731

https://join.me/henry_hai

On Sat, Oct 17, 2015 at 4:19 AM, kishorejena notifications@github.com wrote:

I have the following code running from developer console to redirect in progress calls to a conference room. Thought the URi of the call is valid the redirect is throwing 494 exception. Not sure why. Any help will be appreciated.

Here is my script.

TwilioRestClient client = TwilioAPI.getDefaultClient(); Map filters = new Map{'Status'=>'in-progress'}; Iterator calls = client.getAccount().getCalls(filters).iterator(); while (calls.hasNext()) { TwilioCall call = calls.next(); System.Debug('Call Sid = ' + call.getSid()); System.Debug('Call Parent Sid = ' + call.getParentCallSid()); System.Debug('Call Uri = ' + call.getUri());

if(call.getParentCallSid() != null) call.redirect('http://test-businessfunding.cs10.force.com/conference', 'POST');

}

Here is the error.

04:05:32:665 USER_DEBUG [8]|DEBUG|Call Uri = /2010-04-01/Accounts/AC5c27dcb4dd999d2aafc04c5d809d1483/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json

04:05:32:720 USER_DEBUG [93]|DEBUG|RETURN: {code=20404, message=The requested resource /2010-04-01/Accounts/null/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json was not found, more_info=https://www.twilio.com/docs/errors/20404, status=404}

One thing I noticed is that the resource has a null after account instead of the account SID. The uri for the call has real account SID. Not sure why.

Thanks

— Reply to this email directly or view it on GitHub https://github.com/twilio/twilio-salesforce/issues/53.

kishorejena commented 8 years ago

?Thanks a lot Henry! Appreciate that.

I will try this and let you know if it solves.


From: Henry Hai notifications@github.com Sent: Saturday, October 17, 2015 9:03 AM To: twilio/twilio-salesforce Cc: Kishore Jena Subject: Re: [twilio-salesforce] Call redirect is throwing exception 404 even though uri is valid (#53)

Make sure you have this code in the TwilioCallList.cls

That's where the accountSID will be set for each instance of the callList.

/* implements method from TwilioResource.ListResource */ public override Object makeNew(TwilioClient client, Map<String, Object> params) { TwilioCall call = new TwilioCall((TwilioRestClient)client, params); call.setRequestAccountSid(this.getRequestAccountSid()); return call; }

If you have an older version of the library it had a defect.

Henry Hai twilio cloud communications Solutions Architect e: hhai@twilio.com m: (646) 679-2731

https://join.me/henry_hai

On Sat, Oct 17, 2015 at 4:19 AM, kishorejena notifications@github.com wrote:

I have the following code running from developer console to redirect in progress calls to a conference room. Thought the URi of the call is valid the redirect is throwing 494 exception. Not sure why. Any help will be appreciated.

Here is my script.

TwilioRestClient client = TwilioAPI.getDefaultClient(); Map filters = new Map{'Status'=>'in-progress'}; Iterator calls = client.getAccount().getCalls(filters).iterator(); while (calls.hasNext()) { TwilioCall call = calls.next(); System.Debug('Call Sid = ' + call.getSid()); System.Debug('Call Parent Sid = ' + call.getParentCallSid()); System.Debug('Call Uri = ' + call.getUri());

if(call.getParentCallSid() != null) call.redirect('http://test-businessfunding.cs10.force.com/conference', 'POST');

}

Here is the error.

04:05:32:665 USER_DEBUG [8]|DEBUG|Call Uri = /2010-04-01/Accounts/AC5c27dcb4dd999d2aafc04c5d809d1483/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json

04:05:32:720 USER_DEBUG [93]|DEBUG|RETURN: {code=20404, message=The requested resource /2010-04-01/Accounts/null/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json was not found, more_info=https://www.twilio.com/docs/errors/20404, status=404}

One thing I noticed is that the resource has a null after account instead of the account SID. The uri for the call has real account SID. Not sure why.

Thanks

Reply to this email directly or view it on GitHub https://github.com/twilio/twilio-salesforce/issues/53.

Reply to this email directly or view it on GitHubhttps://github.com/twilio/twilio-salesforce/issues/53#issuecomment-148915078.

kishorejena commented 8 years ago

Hi Henry/Dan,

The issue is resolved now. Hopefully we can make some progress on the hot call transfer from the soft phone. Appreciate that.

Thanks,

Kishore


From: Henry Hai notifications@github.com Sent: Saturday, October 17, 2015 9:03 AM To: twilio/twilio-salesforce Cc: Kishore Jena Subject: Re: [twilio-salesforce] Call redirect is throwing exception 404 even though uri is valid (#53)

Make sure you have this code in the TwilioCallList.cls

That's where the accountSID will be set for each instance of the callList.

/* implements method from TwilioResource.ListResource */ public override Object makeNew(TwilioClient client, Map<String, Object> params) { TwilioCall call = new TwilioCall((TwilioRestClient)client, params); call.setRequestAccountSid(this.getRequestAccountSid()); return call; }

If you have an older version of the library it had a defect.

Henry Hai twilio cloud communications Solutions Architect e: hhai@twilio.com m: (646) 679-2731

https://join.me/henry_hai

On Sat, Oct 17, 2015 at 4:19 AM, kishorejena notifications@github.com wrote:

I have the following code running from developer console to redirect in progress calls to a conference room. Thought the URi of the call is valid the redirect is throwing 494 exception. Not sure why. Any help will be appreciated.

Here is my script.

TwilioRestClient client = TwilioAPI.getDefaultClient(); Map filters = new Map{'Status'=>'in-progress'}; Iterator calls = client.getAccount().getCalls(filters).iterator(); while (calls.hasNext()) { TwilioCall call = calls.next(); System.Debug('Call Sid = ' + call.getSid()); System.Debug('Call Parent Sid = ' + call.getParentCallSid()); System.Debug('Call Uri = ' + call.getUri());

if(call.getParentCallSid() != null) call.redirect('http://test-businessfunding.cs10.force.com/conference', 'POST');

}

Here is the error.

04:05:32:665 USER_DEBUG [8]|DEBUG|Call Uri = /2010-04-01/Accounts/AC5c27dcb4dd999d2aafc04c5d809d1483/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json

04:05:32:720 USER_DEBUG [93]|DEBUG|RETURN: {code=20404, message=The requested resource /2010-04-01/Accounts/null/Calls/CAde72b0c3dedadb4b9bc2f92405dbc1b6.json was not found, more_info=https://www.twilio.com/docs/errors/20404, status=404}

One thing I noticed is that the resource has a null after account instead of the account SID. The uri for the call has real account SID. Not sure why.

Thanks

Reply to this email directly or view it on GitHub https://github.com/twilio/twilio-salesforce/issues/53.

Reply to this email directly or view it on GitHubhttps://github.com/twilio/twilio-salesforce/issues/53#issuecomment-148915078.