Re: SIP header allocation for pjsua_call_make_call()

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

 



I do not think you have to be concerned about memory pool allocation for headers in an outgoing call. Pjsip will duplicate what you pass in msg_data.

So, something like below will be ok (disclaimer for typos):

pj_str_t hdr_text = pj_str(“my header value”);

pjsua_msg_data msg_data;

pjsip_generic_string_hdr hdr;


pjsip_generic_string_hdr_init2(hdr, &MY_GENERIC_HDR_NAME, &hdr_text);

pj_list_push_back(&msg_data->hdr_list, hdr);


pjsua_call_make_call(account, &to, NULL, NULL, &msg_data, &call_id);



Johan


From: pjsip on behalf of David Talmage
Reply-To: pjsip list
Date: Wednesday 7 September 2016 at 21:36
To: "pjsip@xxxxxxxxxxxxxxx"
Subject: [pjsip] SIP header allocation for pjsua_call_make_call()

[A better subject line might be "memory pool best practices".]

What is the best way to allocate SIP headers to pass to pjsua_call_make_call()?  I have a map of SIP header-value pairs. I don't know whether to allocate pjsip_generic_string_hdr from a pool or to use new().  Please advise me.

If I use a pool, is it one pool per call or one pool for all calls?  If it's a shared pool, can I reuse the pjsip_generic_string_hdr in it?  Does the pool take care of that for me?

If I allocate pjsip_generic_string_hdr myself, when can I free() them?  When pjsua_call_make_call() returns?  In my on_stream_destroyed callback?

Dave




Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario, puede contener información privilegiada o confidencial y es para uso exclusivo de la persona o entidad de destino. Si no es usted. el destinatario indicado, queda notificado de que la lectura, utilización, divulgación y/o copia sin autorización puede estar prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

The information contained in this transmission is privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, do not read it. Please immediately reply to the sender that you have received this communication in error and then delete it.

Esta mensagem e seus anexos se dirigem exclusivamente ao seu destinatário, pode conter informação privilegiada ou confidencial e é para uso exclusivo da pessoa ou entidade de destino. Se não é vossa senhoria o destinatário indicado, fica notificado de que a leitura, utilização, divulgação e/ou cópia sem autorização pode estar proibida em virtude da legislação vigente. Se recebeu esta mensagem por erro, rogamos-lhe que nos o comunique imediatamente por esta mesma via e proceda a sua destruição
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[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