建立PJSIP的apjsua示例应用程序为Android [英] Building apjsua sample application of pjsip for android

查看:2978
本文介绍了建立PJSIP的apjsua示例应用程序为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟 PJSIP 教程中,我已经成功打造<强> apjsua 的示例应用程序。

I have followed PJSIP tutorial and I have successfully build apjsua sample application.

当我试图通过+ A来添加帐户就问我对于SIP地址,注册官网址,验证领域,用户名,密码

When I try to add account by +a it ask me for Sip Url, Url of the Registrar, Auth Realm, username, Password

我输入

  • SIP URL:SIP:140@122.252.232.5
  • 注册地:SIP:122.252.232.5
  • 验证领域:*
  • 用户名:1​​40
  • 密码:例如

在它下面的错误给了我

    10-17 19:57:27.165: I/apjsua(920): 19:57:27.165  sip_resolve.c  ...Failed to resolve '122.252.232.532.5'. Err=70018 (gethostbyname() has returned error (PJ_ERESOLVE))
10-17 19:57:27.174: I/apjsua(920): 19:57:27.174    tsx0x223a5c  ...Failed to send Request msg REGISTER/cseq=54907 (tdta0x1eb9a0)! err=70018 (gethostbyname() has returned error (PJ_ERESOLVE))
10-17 19:57:27.185: I/apjsua(920): 19:57:27.185    pjsua_acc.c  .....SIP registration failed, status=502 (gethostbyname() has returned error (PJ_ERESOLVE))
10-17 19:57:27.199: I/apjsua(920): 19:57:27.199    pjsua_acc.c  .....Scheduling re-registration retry for acc 2 in 6 seconds..
10-17 19:57:27.212: I/apjsua(920): 19:57:27.212      sip_reg.c  ..Error sending request, status=70018
10-17 19:57:27.226: I/apjsua(920): 19:57:27.226    pjsua_acc.c  ..Unable to create/send REGISTER: gethostbyname() has returned error (PJ_ERESOLVE) [status=70018]

是否有任何身体知道我收到错误的???

Does any body know where I am getting wrong???

或者有谁知道使用Android的PJSIP库的任何其他方式???

Or does anybody know any other way to use pjsip library for android???

推荐答案

您很幸运。我前几天就坐在这个问题,它只是看起来像一个简单的初始化错误。你真的应该去对付调试C code否则你就要有一个很难理解的PJSIP协议栈。反正这里就是你要做的:

You're in luck. I was sitting with this problem a few days ago and it just looked like a simple initialization error. You should really get to grips with debugging c code else you're gonna have a hard time understanding the pjsip stack. Anyway here's what you do:

请下/pjsip-apps/src/pjsua/main_android.c看起来像这样的setInput设置的方法:

Make the "setInput" method under /pjsip-apps/src/pjsua/main_android.c look like this:

void setInput(char *s)
{
  int i = 0;

  for (i = 0; i < sizeof(app_var.line); i++)
  {
      app_var.line[i]=NULL;
  }

  /* app_var.line[0] = 0; */

  if (strlen(s) < sizeof(app_var.line))
      strncpy(app_var.line, s, strlen(s));
  pj_sem_post(app_var.input_sem);
}

纵观code的变化,你应该能够看到app_var.line char变量没有被清除正确。现在去/ PJSIP-应用程序/编译/文件夹并执行作。然后去/ PJSIP-应用程序/ src目录/ apjsua /文件夹并执行作。此后刷新Eclipse项目并运行。这应该做的伎俩。

Looking at the code changes, you should be able to see that the app_var.line char variable was not being cleared properly. Now go to the /pjsip-apps/build/ folder and execute "make". Then go to the /pjsip-apps/src/apjsua/ folder and execute "make". Thereafter refresh your eclipse project and run. That should do the trick.

这篇关于建立PJSIP的apjsua示例应用程序为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆