我正在尝试使用 Twilio sdk 进行调用 但我的电话在 2 或 3 秒后就断开了。我的 Twilio 帐户已升级。我正在使用下面的代码
-(IBAction)mainButtonPressed:(id)sender
{
BasicPhoneAppDelegate* delegate = (BasicPhoneAppDelegate*)[UIApplication sharedApplication].delegate;
BasicPhone* basicPhone = delegate.phone;
if (!basicPhone.connection || basicPhone.connection.state == TCConnectionStateDisconnected)
{
NSString* strToNumber = self.textOutgoingDest.text;
if (strToNumber && ![strToNumber isEqualToString:@""]) {
switch (_eOutgoingType) {
case BPOutgoingNumber:
break;
case BPOutgoingClient:
strToNumber = [NSString stringWithFormat:@"client:%@", strToNumber];
break;
default:
break;
}
NSDictionary* dictParams = [NSDictionary dictionaryWithObjectsAndKeys:strToNumber, @"To", nil];
[self.phone connectWithParams:dictParams];
}
else {
[self.phone connectWithParams:nil];
}
}
else
{
[basicPhone disconnect];
}
[self syncMainButton];
}
最佳答案
我的问题已经解决了
-(IBAction)mainButtonPressed:(id)sender
{
BasicPhoneAppDelegate* delegate = (BasicPhoneAppDelegate*)[UIApplication sharedApplication].delegate;
BasicPhone* basicPhone = delegate.phone;
if (!basicPhone.connection || basicPhone.connection.state == TCConnectionStateDisconnected)
{
NSString* strToNumber = self.textOutgoingDest.text;
if (strToNumber && ![strToNumber isEqualToString:@""])
{
strToNumber = [NSString stringWithFormat:@"%@", strToNumber];
NSDictionary* dictParams = [NSDictionary dictionaryWithObjectsAndKeys:strToNumber, @"number", nil];
[self.phone connectWithParams:dictParams];
}
else
{
[self.phone connectWithParams:nil];
}
}
else
{
[basicPhone disconnect];
}
[self syncMainButton];
}
关于ios - 我正在尝试使用 Twilio sdk 进行调用,但我的调用在 2 或 3 秒后断开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37139899/