我们正在iOS中创建一个录音应用程序,在该应用程序中,我们希望提供录制电话的功能。对于从应用程序到手机的呼叫,我们使用twilio iOS SDK。在iOS应用程序中使用twilio拨打电话录音
如何使用twilio iOS SDK记录通话。
我们希望如果用户启用录制到应用程序,然后调用应该得到记录,如果记录关闭,那么它不应该得到记录。
我们用来管理twiml的后端技术是PHP。
代码以便进行呼叫,我们已经写了以下代码: - (无效)呼叫建立:(的NSString *)dialnumber { 的NSString *来电= [[NSUserDefaults的standardUserDefaults] objectForKey:PRPhoneNumber]; self.callViewController.mainText = dialnumber; [PKTPhone sharedPhone] .callerId = CallerID; [[PKTPhone sharedPhone] call:dialnumber]; }
///*** PKTPhone class next working***
-(void)call:(NSString *)callee
{
[self call:callee withParams:nil];
}
- (void)call:(NSString *)callee withParams:(NSDictionary *)params
{
reciverID = callee;
if (!(self.phoneDevice && self.capabilityToken)) {
NSLog(@"Error: You must set PKTPhone's capability token before you make a call");
return;
}
NSMutableDictionary *connectParams = [NSMutableDictionary dictionaryWithDictionary:params];
if (callee.length)
connectParams[@"callee"] = callee;
if (self.callerId.length)
connectParams[@"callerId"] = self.callerId;
connectParams[@"recording"] = @true;
self.activeConnection = [self.phoneDevice connect:connectParams delegate:self];
if ([self.delegate respondsToSelector:@selector(callStartedWithParams:incoming:)]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.delegate callStartedWithParams:connectParams incoming:NO];
});
}
}
这是在PHP服务器在年底由我们写的代码:
$from = $_REQUEST['From'];
$callee = $_REQUEST['callee'];
$callerId = $_REQUEST['callerId'];
$digits = $_REQUEST['Digits'];
$record = (isset($_REQUEST["recording"]) && $_REQUEST["recording"] == true) ? " record='record-from-answer'" : '';
if (isset($digits) && !$callee) {
$callee = $_REQUEST[$digits];
}
$response = '<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial'.$record.' callerId="'.$callerId.'">
<Number url="http://ourserverurl.net/phoneRecorder/twilio/twilio-client-server-master/notification.php">'.$callee.'</Number>
</Dial>
</Response>';
我们已经写了相同的代码在PHP我们的服务器端,但我们没有得到我们的PHP代码记录PARAM。在iOS端,我们编写了相同的代码并发起了呼叫。除了您提供的解决方案中提及的其他设置是否还有其他设置? –
我们正在接收callee和callerId,但是在php中没有收到记录参数。 –
你能编辑你的问题并分享使用这些参数进行呼叫的功能吗?为了帮助,我需要多看点。 – philnash