iPhone 4 pjsua app EXC_BAD_ACCESS

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

 



Hi

It's possible is the same issue I described two days ago.
You should compile in debug mode: -O0 -gdwarf-2

Samuel

Le 21/10/10 14:23, floda 0 a ?crit :
> Hi,
>
> I  developing a app for iPhone4 (IOS4.1) and uses pjsua-lib. I want to 
> develope a kind of VOIP-call application for the iPhone.
> Right now I having some problems with registration to the server by 
> creating a account.
> I have used the "Simple PJSUA" example as a starting point.
>
> I do the following in my app:
> First initialize and start pjsua by this code:
>
> *****************************************************************************
> pj_status_t status;
>     pjsua_config cfg;
>     pjsua_logging_config log_cfg;
>     pjsua_transport_config transport_cfg;
>     pjsua_acc_config acc_cfg;
>     pjsua_acc_id acc_id;
>
>     //Create pjsua and check that it worked
>     status = pjsua_create();
>     if(status != PJ_SUCCESS) {
>         NSLog(@"ERROR: Couldn't instantiate pjsua!");
>         return NO;
>     }
>
>     pjsua_config_default(&cfg);
>     cfg.cb.on_incoming_call = &on_incoming_call;
>     cfg.cb.on_call_media_state = &on_call_media_state;
>     cfg.cb.on_call_state = &on_call_state;
>     pjsua_logging_config_default(&log_cfg);
>     log_cfg.console_level = 4;
>
>     status = pjsua_init(&cfg, &log_cfg, NULL);
>     if(status != PJ_SUCCESS) {
>         NSLog(@"ERROR: Couldn't initialize pjsua!");
>         return NO;
>     }
>
>     pjsua_transport_config_default(&transport_cfg);
>     transport_cfg.port = 5060;
>
>     status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, 
> &transport_cfg, NULL);
>     if(status != PJ_SUCCESS) {
>         NSLog(@"ERROR: Couldn't create UDP transport for pjsua!");
>         return NO;
>     }
>
>     //Start pjsua
>     status = pjsua_start();
>     if(status != PJ_SUCCESS) {
>         NSLog(@"ERROR: Couldn't start pjsua!");
>         return NO;
>     }
> *****************************************************************************
>
>
> This is pretty much exactly the same thing that "Simple PJSUA" does.
> Then I tries to register by using this code:
>
> *****************************************************************************
>     pjsua_acc_config_default(&acc_cfg);
>     acc_cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
>     acc_cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
>     acc_cfg.cred_count = 1;
>     acc_cfg.cred_info[0].realm = pj_str(SIP_REALM);
>     acc_cfg.cred_info[0].scheme = pj_str(SIP_SCHEME);
>     acc_cfg.cred_info[0].username = pj_str(SIP_USER);
>     acc_cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
>     acc_cfg.cred_info[0].data = pj_str(SIP_PASSWD);
>
>     status = pjsua_acc_add(&acc_cfg, PJ_TRUE, &acc_id);
>     if(status != PJ_SUCCESS) {
>         NSLog(@"ERROR: Couldn't add account!");
>         return NO;
>     }
> *****************************************************************************
>
>
> But here is the problem occuring. When I have specified the 
> acc_cfg.reg_uri like above, I gets a "EXC_BAD_ACCESS" error when 
> trying to call pjsua_acc_add. I can't figure out why I get this error. 
> Anyone spoting any major faults?
>
> Then I have some code for a user to input what uri to call and then 
> just make a call like this:
>
> *****************************************************************************
> //Check if it is a correct format of the input
>     if([regExpTest evaluateWithObject:string] == YES) {
>
>         //Make the string have the correct format for calling
>         NSString *tmp = [NSString stringWithFormat:@"sip:%@", string];
>
>         //Just for testing, print a calling message
>         output.text = [NSString stringWithFormat:@"Calling %@...", tmp];
>
>         //Convert the input string to pj_str_t format so it can be used
>         const pj_str_t uri = pj_str((char *)[tmp UTF8String]);
>         NSLog(@"CALL: %s", uri);
>
>         //Make a call, (account id to use (NULL = default), dst 
> address, options *must be zero*, pointer to user data, pointer to msg 
> data, pointer to call id)
>         pjsua_call_make_call(0, &uri, 0, NULL, NULL, NULL);
>     }
>     else {
>         output.text = @"Illegal format on URI!";
>         NSLog(@"Unsupported format on input!");
>     }
> *****************************************************************************
>
>
> I really don't understand why this occur and I ain't got a clue how to 
> fix it or debugg it.
> If really appreciate if someone can help me or redirect me to some how 
> can help me.
> Thank you!
>
> // Fredschi
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101021/1978856a/attachment.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