Ok, so I managed to get it working, but I'm far from being great with this so I'd really appreciate feedback on my approach. Basically I'm running:
pj_caching_pool cp;
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
pj_pool_t *pool = pj_pool_create(&cp.factory, "header", 1000, 1000, NULL);
[self convertAccountConfiguration:configuration config:&config pool:pool]; // this is the method that sets headers by allocating from the provided pool
pjsua_acc_modify((int) _id, &config);
pj_pool_release(pool);
Is that acceptable? Is there a better approach?
On Wed, May 25, 2016 at 9:57 PM Colin Morelli <colin.morelli@xxxxxxxxx> wrote:
If it makes any difference, I'm actually looking to have this header change on every registration request. The use case is to include a JWT in the registration (instead of a standard username and password)Thanks,ColinOn Wed, May 25, 2016 at 9:54 PM Colin Morelli <colin.morelli@xxxxxxxxx> wrote:Hey all,I'm trying to send a custom header in my registration request. However, my app always ends up crashing when trying to set it. I'm calling:pj_list_init(&config->reg_hdr_list);pjsip_generic_string_hdr generic_hdr;pj_str_t name = pj_str("name");pj_str_t value = pj_str("value");pjsip_generic_string_hdr_init2(&generic_hdr, &name, &value);pj_list_push_back(&config->reg_hdr_list, &generic_hdr);The backtrace from the crash is:frame #0: 0x348dcae6 libsystem_platform.dylib`_platform_memmove + 486frame #1: 0x347ebc64 libsystem_c.dylib`__memcpy_chk + 16frame #2: 0x347ebc64 libsystem_c.dylib`__memcpy_chk + 16frame #3: 0x0026f34a MyApp`pj_memcpy + 26frame #4: 0x0026f31c MyApp`pj_strdup + 68frame #5: 0x002c58f2 MyApp`pjsip_generic_string_hdr_init + 38frame #6: 0x002c5948 MyApp`pjsip_generic_string_hdr_create + 36frame #7: 0x002c6d1c MyApp`pjsip_generic_string_hdr_clone + 24frame #8: 0x002c4d62 MyApp`pjsip_hdr_clone + 34frame #9: 0x00301aae MyApp`pjsua_acc_config_dup + 420frame #10: 0x00301e68 MyApp`pjsua_acc_add + 666I'm assuming I need to be allocating the strings on the pool but I'm not sure which pool to use without causing a leak.Best,Colin
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org