crashes when registering and unregistering same sip account

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Sir,
              I would like to register and unregister same sip account and
it must not be crash. It is crashes third time.
Sir i don't have idea how to use same account id and only add it with
pjsua_acc_add once.
pjsua_acc_add returns different reg id like 2 ,3, and next time it get
crashes.


Registring process:

Step -1:
regid = general_call_register(ACCOUNT_SIP,

[[dict objectForKey:SIP_DOMAIN_KEY]UTF8String],

[[dict objectForKey:SIP_USERNAME_KEY]UTF8String],

[[dict objectForKey:SIP_PASSWORD_KEY]UTF8String],

"*", [[dict objectForKey:SIP_PROXY_SRV_KEY] UTF8String]);




Step -2: -int general_call_register(enum general_call_protocol calltype,
const char *host, const char* user, const char *pass, const char* realm,
const char* proxyserver )

{

  int regid = -1;




regid = pjsip_regist_account(user, pass, host, realm, proxyserver);



  if(regid != -1)   add_new_register_acc(calltype, regid, user, pass, host,
realm);

  return regid;

}



Step -3:

int pjsip_regist_account(const char* sip_user, const char* sip_passwd, const
char* sip_domain, const char* sip_realm, const char* proxyserver)

{

pjsua_acc_config acc_cfg;

pj_status_t status;

char buf[256];

char buf2[256];

int  accid;

static int count=1;//updated


 pjsua_acc_config_default(&acc_cfg);

sprintf(buf,"sip:%s@%s", sip_user, sip_domain);

acc_cfg.id = pj_str(buf);

sprintf(buf2,"sip:%s", sip_domain);

acc_cfg.reg_uri = pj_str(buf2);

acc_cfg.cred_count = 1;

acc_cfg.cred_info[0].scheme = pj_str("Digest");

acc_cfg.cred_info[0].realm = pj_str(sip_realm);

acc_cfg.cred_info[0].username = pj_str(sip_user);

acc_cfg.cred_info[0].data_type = 0;

acc_cfg.cred_info[0].data = pj_str(sip_passwd);

if(proxyserver!=NULL && proxyserver[0] != '\0')

acc_cfg.proxy[acc_cfg.proxy_cnt++] = pj_str(proxyserver);


 if (count==1) {//updated if condition for first time execution

status = pjsua_acc_add(&acc_cfg,PJ_TRUE, &accid);

count++;

}

 if (status != PJ_SUCCESS) {

pjsua_perror(THIS_FILE, "Error adding new account", status);

return -1;

}

return accid;//Second time returns -1 and not register

}


- If i call pjsua_acc_add only once Then it gets register but second time
it's not registering.


Please help me.



Thanks & Regards

Laxman Pandey



Message: 2
Date: Tue, 17 May 2011 21:05:39 +0200
From: Even Andr? Fiskvik <eaf@xxxxxxxxxx>
To: pjsip list <pjsip at lists.pjsip.org>
Subject: Re: iphone crashes when registering and unregistering
       account
Message-ID: <34D4E059-D11E-4A21-8FB0-0DF4499C93C9 at oyatel.com>
Content-Type: text/plain; charset=windows-1252

If I understand you correctly you are adding the same account multiple
times.
This is the same as adding three different accounts, and I think there is an
adjustable limit
set somewhere on how many accounts you can use.

What you are probably trying to achieve though is to unregister and register
the same account,
and for those cases you should use the same account ID and only add it with
pjsua_acc_add ONCE.

Best regards,
Even Andr?

On 17. mai 2011, at 16.22, Laxman Pandey wrote:

> Dear Sir,
>
> When i try to register correct sip info.
>
>  1-  it get register and return the reg id =2 from
general_call_register();
> then successfully unregister.
>
> 2- it get register and return the reg id =3 from general_call_register();
> then successfully unregister.
>
> In third attempt it gets crash the application at the function-: status =
pjsua_acc_add(&acc_cfg, PJ_TRUE, &accid);
>
> GDB Display:
>
> Current language:  auto; currently c
> Assertion failed: (pjsua_var.acc_cnt <
(sizeof(pjsua_var.acc)/sizeof(pjsua_var.acc[0]))), function pjsua_acc_add,
file ../src/pjsua-lib/pjsua_acc.c, line 290.
> Program received signal:  ?SIGABRT?.
>
> Could you please help me to solve this issue, I will be greatly thankful
for the help.
>
> Regards
> Laxman Pandey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20110518/3d5f1207/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux