2013-12-13 1 views
3

twilio를 사용하여 간단한 음성 채팅 android 응용 프로그램을 개발 중입니다. 나는 나가는 전화를 걸 수 있고 또한 클라이언트 이름을 사용하여 들어오는 전화를 받아 들일 수있다. 이것은 내 twilio 음성의 URL PHP 스크립트입니다 : 내가 뭘해야 내가 걸려 오는 전화를받는 사용자에게 호출 클라이언트의 이름을 표시해야하지만, 난을 얻는 방법을 알아낼 수 없습니까들어오는 전화 받기 twilio (전화를 건 고객의 이름을 얻으십시오)

<?php 
header('Content-type: text/xml'); 
$client= $_REQUEST["userName"]; 

?> 
<Response> 
    <Dial callerId="<?php echo $client ?>"> 
     <Client><?php echo $number;?></Client> 
    </Dial> 
</Response> 

호출 클라이언트의 이름. 난,

@Override 
     public void onResume() { 
      super.onResume(); 

      Intent intent = getIntent(); 
      Device device = intent.getParcelableExtra(Device.EXTRA_DEVICE); 
      Connection incoming = intent 
        .getParcelableExtra(Device.EXTRA_CONNECTION); 
      incoming.setConnectionListener(this); 
        String clientName = Connection.getParameters().get(incoming.IncomingParameterFromKey); 

      Log.i(TAG, "Call from : " + clientName); 
     } 

을이 일을 시도하지만 로그 캣 출력 다음 가지고 : 나는 클라이언트 이름 대신 숫자 873797 무엇입니까

12-13 16:17:25.531: E/Voice chat sample app log(16157): Call from : 873797 

.

클라이언트 이름을 얻는 방법이있을 수 있습니다. 나는 또한 twilio 문서를 통과하지 못했습니다. 어떤 도움이라도 대단히 감사하겠습니다.

+0

희망이 도움? – Carlos

+0

아니요. 나는하지 않았다. – Raeesaa

답변

0

그냥이 링크이 당신을 위해 작동

https://www.twilio.com/user/account/phone-numbers/incoming

1. Click on your twilio number. 
    2. Enter into the Configure Tab 
    3. Go into Voice . Check the Url in Configure with: 
    4. Over there you have a drop down of Caller Name Lookup that is set to disabled. Enable it . 

희망을 이동하기 만하면됩니다! :)

0

나는이 함께 문제를 해결 한은

은 당신이 이것에 대한 해결책을 찾았나요

@Override 
public void onResume() { 
    super.onResume(); 

    Intent intent = getIntent(); 

    if (intent != null) { 
     /* 
     * Determine if the receiving Intent has an extra for the incoming connection. If so, 
     * remove it from the Intent to prevent handling it again next time the Activity is resumed 
     */ 
     Device device = intent.getParcelableExtra(Device.EXTRA_DEVICE); 
     Connection incomingConnection = intent.getParcelableExtra(Device.EXTRA_CONNECTION); 
     if (incomingConnection == null && device == null) { 
      return; 
     } 
     intent.removeExtra(Device.EXTRA_DEVICE); 
     intent.removeExtra(Device.EXTRA_CONNECTION); 

     pendingConnection = incomingConnection; 
     pendingConnection.setConnectionListener(this); 

     String incomingRecipientCallNumber = pendingConnection.getParameters().get(incomingConnection.IncomingParameterFromKey); 

     showRecipientNumber.setText(incomingRecipientCallNumber); 

     showIncomingDialog(); 
    } 
} 
관련 문제