[英]Twilio SDK voip call Invalid Uri
当我尝试通过twilio调用“名称”到“名称”时,出现此错误:
pjsua_call.c。对话框创建失败:无效的URI(PJSIP_EINVALIDURI)
当我遵循twilio教程时,我不知道为什么会发生此错误。 有什么线索吗?
这是我获得令牌的方式(应该可以)
- (void)getTwilioToken{
NSString *urlString = [NSString stringWithFormat:@"http://foo.herokuapp.com/token?client=%@", [[[Utils getUserCredential] componentsSeparatedByString:@"|"] objectAtIndex:1]];
NSURL *url = [NSURL URLWithString:urlString];
NSError *error = nil;
NSString *token = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
if(token == nil){
NSLog(@"Error retrieving token: %@", [error localizedDescription]);
} else {
_phone = [[TCDevice alloc] initWithCapabilityToken:token delegate:self];
}
}
这里是用来进行调用的代码:
-(IBAction)callResponder:(id)sender{
NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
NSString *responderEmail = [[self.responders objectAtIndex:indexPath.row] email];
NSDictionary *params = @{@"To": responderEmail};
//check if we can make an outgoing call and attempt a connection
NSNumber* hasOutgoing = [_phone.capabilities objectForKey:TCDeviceCapabilityOutgoingKey];
if ( [hasOutgoing boolValue] == YES ){
//Disconnect if we've already got a connection in progress
if(_connection){
[_connection disconnect];
}
_connection = [_phone connect:params delegate:self];
[_connection retain];
}
}
我本人也遇到了同样的问题。 问题与我如何设置Twilio令牌的权限(使用其Javascript API)有关:
var capability = new twilio.Capability(twilioAccountSid, twilioAuthToken);
capability.allowClientOutgoing(twilioAppSid);
capability.allowClientIncoming(); // this is the problematic line
在删除(显然不正确的)传入权限设置行之后,我的设备完美地完成了呼叫。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.