res_pjsip_caller_id: Use static pj_str_t for fromto header names.

PJSIP assumes that these header names are not allocated, does not clone
the name strings when reusing headers.

Block unload of res_pjsip_caller_id until shutdown to ensure static
memory stays valid.  It was previously unsafe to unload while any
sessions are active.

Change-Id: I190854dea943d6e441cf03733f8a0da661aea27f
13.24
Corey Farrell 7 years ago
parent a40b6ad471
commit 580bc5e2c6
No known key found for this signature in database
GPG Key ID: D1B6E98EB07F7F6C

@ -431,8 +431,7 @@ static pjsip_fromto_hdr *create_new_id_hdr(const pj_str_t *hdr_name, pjsip_fromt
id_hdr = pjsip_from_hdr_create(tdata->pool);
id_hdr->type = PJSIP_H_OTHER;
pj_strdup(tdata->pool, &id_hdr->name, hdr_name);
id_hdr->sname = id_hdr->name;
id_hdr->sname = id_hdr->name = *hdr_name;
id_name_addr = pjsip_uri_clone(tdata->pool, base->uri);
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
@ -782,6 +781,7 @@ static int load_module(void)
{
CHECK_PJSIP_SESSION_MODULE_LOADED();
ast_module_shutdown_ref(ast_module_info->self);
ast_sip_session_register_supplement(&caller_id_supplement);
return AST_MODULE_LOAD_SUCCESS;
}

Loading…
Cancel
Save