简体   繁体   English

Sip Manager失败,出现错误注册超时(错误代码为5)

[英]Sip Manager failed with error Registration Time Out (Error Code is 5)

Good Day. 美好的一天。 I'm following a simple guide from the android developers' webpage on creating the simplest sip profile and opening it. 我正在遵循android开发人员网页上的简单指南,以创建最简单的sip配置文件并打开它。 Though even not passing 1 second, or even 0.5 second, the sip manager returns me this error of time out...here is my full code... Please help guys: (I'm really new to sip and what's wrong with it? 尽管甚至没有经过1秒甚至0.5秒,但sip管理员仍会向我返回超时错误...这是我的完整代码...请帮助大家:(我真的很新来sip,这是怎么回事?

public class CallingActivity extends AppCompatActivity {
    Button registeraccount;
    Bundle extras;
    String opponentid;
    public static final String sipdomen= "sip2sip.info";
    String myid;
    Button call;
    SipManager  mSipManager;
    SipProfile myprofile;
    SipProfile opponentprofile;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calling);
        call = (Button)findViewById(R.id.button5);
        registeraccount = (Button)findViewById(R.id.button4);
        extras = getIntent().getExtras();
        if(extras!=null){
            opponentid = extras.getString("opponentid");
            myid = extras.getString("myid");
        }
        registeraccount.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSipManager = SipManager.newInstance(CallingActivity.this);
                SipProfile.Builder builder = null;
                try {
                    builder = new SipProfile.Builder(myid, sipdomen);
                    builder.setPassword("000000");
                    myprofile = builder.build();
                    Intent intent = new Intent();
                    intent.setAction("android.SipDemo.INCOMING_CALL");
                    PendingIntent pendingIntent = PendingIntent.getBroadcast(CallingActivity.this, 0, intent, Intent.FILL_IN_DATA);
                    mSipManager.open(myprofile, pendingIntent, null);
                    try {
                        mSipManager.setRegistrationListener(myprofile.getUriString(), new SipRegistrationListener() {
                            @Override
                            public void onRegistering(String localProfileUri) {
                                Log.d("safhaskjfa","registering");
                            }

                            @Override
                            public void onRegistrationDone(String localProfileUri, long expiryTime) {
                                Log.d("safhaskjfa","Registration succesfull"+localProfileUri+"");
                            }

                            @Override
                            public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
                                Log.d("safhaskjfa","failed to register"+localProfileUri+"the error code is"+errorCode+"the error message is"+errorMessage);
                            }
                        });
                    } catch (SipException e) {
                        e.printStackTrace();
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                } catch (SipException e) {
                    e.printStackTrace();
                }

            }
        });
        call.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    mSipManager.makeAudioCall(myprofile,opponentprofile, new SipAudioCall.Listener(),100000);
                } catch (SipException e) {
                    e.printStackTrace();
                }
            }
        });
    }
}

To make sure your request is transmitted or not to registration sever, please run Wireshark and filter it for sip and see if the request is passing through. 为确保您的请求已传输或未传输到注册服务器,请运行Wireshark并将其过滤为Sip,然后查看请求是否通过。

If the request is going and no-reply is coming then it's the server problem otherwise it's your code problem. 如果请求继续进行且没有答复,则是服务器问题,否则是您的代码问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM