2012-03-13 61 views
2

我們想要在Android 2.3.3上創建SIP應用程序,並且在android.sip堆棧(默認SIP堆棧)中存在一些問題。我們的移動應用發送寄存器sip數據包,但是 1.)默認情況下OpenIMS核心響應400錯誤請求P-Visited-Network-ID頭丟失 2.)在我們設置端口號爲4060的情況下-PCSCF /builder.setPort (4060)/ OpenIMS核心將此請求從4060發送到4060(相同的端口,相同的IP,相同的CSCF,相同的數據包),直到OpenIMS核心發送響應移動應用 - 504服務器超時爲止。 我們也嘗試了SipDemo,CSipSimple,我們也遇到了同樣的問題。 當我們嘗試怪獸通訊器或IMSDroid時,它的工作原理!具有授權的SIP堆棧註冊包

工作和有問題的應用程序之間有一個區別 - 工作應用程序也發送註冊包與授權字段。

部分代碼:

public SipManager mSipManager = null; 
public SipProfile mSipProfile = null; 
SipProfile.Builder builder = new SipProfile.Builder(username, domain); 
builder.setPassword(password); 
builder.setDisplayName(username); 
builder.setProfileName(username + "@" + domain); 
port = Integer.parseInt(4060); 
builder.setProtocol(protocol); 
mSipProfile = builder.build(); 
... 
try { mSipManager.open(mSipProfile);} catch (SipException e) { ...} 
try { 
     mSipManager.register(mSipProfile, 30, new SipRegistrationListener(){ 
     public void onRegistering(String localProfileUri) { 
     } 
     public void onRegistrationDone(String localProfileUri, long expiryTime) { 
     } 
     public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) { 
     } 
     }); 
    } catch (SipException e) { 

.... }

如何給授權場登記在經典的SIP協議棧包?

我們還試圖J-SIP但它顯示錯誤:轉換爲Dalvik的格式錯誤1.

每一個答案,將是非常讚賞失敗。

回答

0

您的問題與缺少授權標題無關。

登記在下列的事項進行:

  1. 客戶端發送的註冊請求沒有「授權」頭。

  2. 服務器響應401響應代碼,其中包括一個名爲「WWW-Authnticate」的頭,該頭將參數保存爲realm,opaque,qop和hashing算法類型。

  3. 將這些參數與用戶名和密碼一起使用授權標頭由SIP堆棧自動生成。併發送包含「授權」頭的第二個註冊請求。

  4. 如果請求是以正確的方式發送服務器返回200 OK響應代碼,這意味着你現在註冊了。

你的問題是別的東西,你甚至不要求您收到400錯誤的請求響應代碼到第3步(授權步驟),你不能在步驟1中,爲初始註冊 - 這幾乎總是意味着您的請求中有語法錯誤。