pjsua_process_msg_data() same header type add

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

 



On Sat, Sep 27, 2008 at 12:27 AM, Tom?? Valenta <vali at kamarad.cz> wrote:

> Hi Benny,
> I found a strange behaviour of function pjsua_process_msg_data(). For
> example if you try to add a custom Expires: 30 header in
>
> pjsua_call_xfer(some_id, some_dest, msg_with_my_expires_header);
>
> the request would look like this:
>
> Expires: 300  /* standard value */
> ...
> Expires: 30   /* my additional header */
>
> The same header should not be added twice imho and also some clients or
> proxies reject it, e.g. X-Lite.
>
>
The msg_data is never intended to give the application total freedom to
modify headers (otherwise it may cause havoc when standard headers such as
From/To are modified). As the doc says, it's only used to "add extra
headers". So I'd say this is by design.

If you want to modify the standard headers, then that must be done
explicitly through API. In this case, probably a new API should be created
which takes the additional expiration parameter, and propagate the changes
to the underlying library.

Or alternatively, in this case, make the expiration time configurable (if
it's not already is).

Cheers
 Benny



> Is this exactly what You want or the additional header should replace the
> original one? Patch goes here:
>
> // Replace loop in pjsua_core.c lines 1892-1900 with:
> hdr = msg_data->hdr_list.next;
> while (hdr && hdr != &msg_data->hdr_list) {
> pjsip_hdr *new_hdr;
>
> new_hdr = pjsip_msg_find_hdr_by_names(tdata->msg, &hdr->name, &hdr->sname,
> NULL);
> if (new_hdr) pj_list_erase(new_hdr);
> new_hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hdr);
> pjsip_msg_add_hdr(tdata->msg, new_hdr);
>
> hdr = hdr->next;
> }
>
>
> I discovered this when trying to cancel call transfer. See mail ``Cancel
> call transfer''.
>
> Cheers
>        Vali
>
>
> _______________________________________________
> 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/20080927/3f635218/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