2017-03-14 12 views
1

iOSで録音アプリケーションを作成しています。そのアプリケーションでは、通話を録音する機能を提供したいと考えています。アプリケーションから電話に電話する場合は、twilio iOS SDKを使用しています。iOSアプリケーションでtwilioを使用した通話録音

twilio iOS SDKを使用して通話を録音する方法。

ユーザーがアプリに録音を有効にすると、録音が​​録音され、録音がオフの場合は録音されないことが望まれます。

twimlを管理するために私たちが使用するバックエンド技術はPHPです。

コードのため、我々は以下のコード書かれているコールを行うための: を - (ボイド)callsetup:(NSStringの*)dialnumber { NSStringの*発信者番号= [[NSUserDefaults standardUserDefaults] objectForKey:PRPhoneNumber]。 self.callViewController.mainText = dialnumber; [PKTPhone sharedPhone] .callerId = CallerID; [[PKTPhone sharedPhone]コール:ダイヤル番号];ここ

$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>'; 

答えて

0

Twilioの開発者エバンジェリスト: }

///*** 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で、サーバー側で私たちが書いたコードです。

connectParamspass parameters to the TwiML applicationを使用できます。渡すパラメータは、PHPアプリケーションに渡されます。したがって、あなたが録音しているかどうかを示すためのパラメータを追加して、録音する予定のTwiMLを作成します。あなたのPHPで次に

NSMutableDictionary *connectParams = [NSMutableDictionary dictionaryWithDictionary:params]; 
    if (callee.length) 
     connectParams[@"callee"] = callee; 
    if (self.callerId.length) 
     connectParams[@"callerId"] = self.callerId; 
    if (self.recording) 
     connectParams[@"recording"] = @true; 

:たとえば

もちろん

<?php 

$recording = isset($_REQUEST["recording"]); 

$response = "<Response>" 
$response .= "<Dial"; 
if ($recording) { 
    $response .= " record='record-from-answer'"; 
} 
$response .= "><Number>+15551234567</Number></Dial></Response>"; 

header("Content-Type: text/xml"); 
echo $response; 

は、おそらくあまりにも他の値を設定している、それが記録パラメータとusing it with TwiML to record the callを取得する例を示します。

+0

私たちは、PHPで当社のサーバー側で同じコードを書かれているが、我々は我々のPHPコードで記録のparamを取得されていません。 iOSの終了時に、同じコードを書いて呼び出しを開始しました。あなたが提供する解決策に記載されているその他の設定は他にありますか? –

+0

calleeとcallerIdを受信して​​いますが、記録パラメータはphpで受信されていません。 –

+0

質問を編集し、それらのパラメータを使用して電話をかける機能を共有できますか?私はもう少し手伝ってみる必要があります。 – philnash

0

Twilioカスタマーサポートはここにあります。

ウェブアプリケーションへのHTTPリクエストに「記録中」というパラメータが表示されません。つまり、iOSアプリから送信されていないことを意味します。

- ロブ

関連する問題