2017-09-14 224 views
0

如何在本地服务器上执行Pjsip Android中的呼叫?禁止呼叫连接Android Pjsip SIP库

我用 的User-Agent:Pjsua2的Android 2.6 - svn的

我做成功registraion之后,席力图召,但它抛出禁止(503) 我Registraion代码:

 AccountConfig accCfg = new AccountConfig(); 
     accCfg.setIdUri("sip:localhost"); 
     accCfg.getNatConfig().setIceEnabled(true); 
     accCfg.getVideoConfig().setAutoTransmitOutgoing(true); 
     accCfg.getVideoConfig().setAutoShowIncoming(true); 
    //Like 123.12.12.23 
     accCfg.getRegConfig().setRegistrarUri("sip:172.16.4.124"); 

     AuthCredInfoVector creds = accCfg.getAuthCreds(); 
     creds.clear(); 
     if (username.length() != 0) { 
      creds.add(new AuthCredInfo("Digest", "*", "[email protected]", 0, 
      "123")); 
        } 
     StringVector proxies = accCfg.getSipConfig().getProxies(); 
        proxies.clear(); 
        if (proxy.length() != 0) { 
         proxies.add("sip:172.16.4.124"); 
        }         
      accCfg.getSipConfig().setProxies(proxies); 

     /* Enable ICE */ 
        accCfg.getNatConfig().setIceEnabled(true); 
        try { 
         account.add(accCfg); 
        } catch (Exception e) { 
         e.printStackTrace(); 
         Log.i(TAG, "Exception in Dialog"); 
        } 
       } 

用于打电话我用

public void makeCall(View view) { 
    if (buddyListSelectedIdx == -1) 
     return; 

/* Only one call at anytime */ 
    if (currentCall != null) { 
     return; 
    } 

    HashMap<String, String> item = (HashMap<String, String>) buddyListView. 
      getItemAtPosition(buddyListSelectedIdx); 
    String buddy_uri = item.get("uri"); 

    MyCall call = new MyCall(account, -1); 
    SendInstantMessageParam param = new SendInstantMessageParam(); 
    param.setContent("Hello Pjsip"); 
    param.setContentType("text"); 


    CallOpParam prm = new CallOpParam(true); 

    try { 
     call.makeCall(buddy_uri, prm); 
//   call.delete(); 
//   call.sendInstantMessage(param); 
    } catch (Exception e) { 
     e.printStackTrace(); 
     call.delete(); 
     return; 
    } 
    currentCall = call; 
    showCallActivity(); 

} 

我能够连接呼叫与sip默认客户端,如si p:本地主机和其他sip提供者,如linphone,但被我们的服务器禁止。 请专家帮忙。

+0

请张贴您的日志的禁止响应消息。 – NandhaKumar

+0

我能够连接它与本地也但语音不是来自任何一方,然后我在亚马逊设置相同,呼吁不与我们的客户端连接获取请求超时错误,同时工作其他客户端,请咨询。 –

+0

如果要在**本地服务器**上建立呼叫,则必须在同一LAN上连接设备和本地服务器。 – NandhaKumar

回答

0

非常感谢我自己,我终于拿到3天后锻炼的解决方案, 有缺失端口号对我的亚马逊的服务器,让我可以连接之间的SIP结束作出吮吸电话。