Make call with parameter and header in SIP URI

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

 



 The Problem is that I don't knwo in advance the header name, so I cannot
do it like that.
But thanks for your answer!

2014-12-15 17:40 GMT+01:00 Bill Gardner <billg at wavearts.com>:
>
>  Hi Alicia,
>
> Using pjsua, it is pretty easy to add header items to an INVITE and then
> read them when the call is answered. See the example code below.
>
> Regards,
>
> Bill
>
> // code on calling endpoint
> void add_sip_header(pj_pool_t *pool, pjsua_msg_data *msg_data, char
> *hname, char *hvalue)
> {
>     pj_str_t my_hname = pj_str(hname);
>     pj_str_t my_hvalue = pj_str(hvalue);
>     pjsip_hdr *h;
>
>     h = (pjsip_hdr*) pjsip_generic_string_hdr_create(pool, &my_hname,
> &my_hvalue);
>     pj_list_push_back(&(msg_data->hdr_list), h);
> }
>
> void make_call()
> {
>     pjsua_acc_id acc_id;
>     pj_str_t uri_to_call;
>     pjsua_msg_data msg_data;
>     pjsua_call_id call_id;
>
>     // add header
>     pjsua_msg_data_init(&msg_data);
>     add_sip_header(pjsua_var.pool, &msg_data, "X-MyHeader", "value");
>
>     // other call setup goes here...
>     acc_id = pjsua_acc_get_default();
>     status = pjsua_call_make_call(acc_id, &uri_to_call, 0, NULL,
> &msg_data, &callID);
>     // ...etc
> }
>
> // code on answering endpoint to get header item
> void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
>     pjsip_rx_data *rdata)
> {
>     pjsip_generic_string_hdr *hdr = NULL;
>     pj_str_t name;
>     name = pj_str("X-MyHeader");
>     if (hdr = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &name,
> NULL)) {
>         PJ_LOG(3, (THIS_FILE, "found header name '%.*s' value '%.*s'",
>             hdr->name.slen, hdr->name.ptr, hdr->hvalue.slen,
> hdr->hvalue.ptr));
>     }
>     // other stuff...
>
> }
>
>
>
> On 12/15/2014 10:21 AM, Alicia Romero wrote:
>
>   Hi!!
>
>  I want to make a call with a parameter and a header in the SIP-URI
> target, something like this:
>
>  sip:call_test at 192.168.13.190;parameter1=pvalue1?header1=hvalue1
>
>  The problem is that pjsua send the header not in the SIP-URI, but as a
> Message Header of the INVITE.
>
> This is a problem for me because then I have to implement a parser for
> this Header, but if it were sent in the SIP-URI I nee only to take the
> header parameters from the pjsip_sip_uri structure.
>
> Is it possible to change this behaviour and make pjsua send the header as
> a part of the SIP-URI Adress? If not, is there a way to get the Message
> Header without implementing a specific parser for that Header?
>
>  Thanks!!
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>
> _______________________________________________
> 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/20141215/3c794182/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