Setting Custom Registration Header

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

 



Hi spencer and sandeep

am also trying to add custom headers 

i am using this method 

???? pj_str_t hname = pj_str(headerx);
? ?? pj_str_t hvalue = pj_str(header);
??? pjsua_msg_data_init(&msg_data);
??? pjsip_generic_string_hdr_init2(&my_hdr, &hname, &hvalue);
??? pj_list_push_back(&msg_data.hdr_list, &my_hdr);
??? 
??? status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, &msg_data, call_id);

it works but not always !! Its strange !! 
the server is not always catch the custom header 20% of trials not work !!

is there a better way to do add the custom header ?!!



?
-----------------------
Eng. Moath Othman 

+962-796988538
------------------------


________________________________
 From: Spencer MacDonald <spencer.macdonald.other@xxxxxxxxx>
To: pjsip list <pjsip at lists.pjsip.org> 
Sent: Tuesday, December 11, 2012 4:49 PM
Subject: Re: Setting Custom Registration Header
 

Hi Sandeep,

That works great, thanks a lot for your help!!!

Regards

Spencer


On Tue, Dec 11, 2012 at 11:45 AM, Sandeep Karanth <sandeepk.kdp at gmail.com> wrote:

You could try something like this and hopefully should help you.
>pjsip_hdr *hdr;
>pj_str_t hname = pj_str("HEADER_NAME");
>pj_str_t hvalue = pj_str("HEADER_VALUE");
>
>
>hdr = (pjsip_hdr*)pjsip_generic_string_hdr_create(pool,?&hname?,&hvalue);
>?pj_list_push_back(&accountConfig.reg_hdr_list,hdr?);
>pj_status_t status = pjsua_acc_add(&accountConfig, PJ_FALSE,&accountIdentifier);
>
>
>
>
>
>On Tue, Dec 11, 2012 at 4:47 PM, Spencer MacDonald <spencer.macdonald.other at gmail.com> wrote:
>
>I just create an account and add it to pjsua like so:
>>
>>
>>pjsua_acc_config accountConfig;
>>pjsua_acc_config_default(&accountConfig);
>>??
>>//Other Config is here
>>accountConfig.reg_timeout = 600;
>>? 
>>pjsua_acc_id accountIdentifier;
>>pj_status_t status = pjsua_acc_add(&accountConfig, PJ_FALSE,&accountIdentifier);
>>
>>
>>Regards
>>
>>Spencer
>>
>>
>>On Tue, Dec 11, 2012 at 11:08 AM, Sandeep Karanth <sandeepk.kdp at gmail.com> wrote:
>>
>>So are you using the pjsua app? How do you do the registration?If you could mention that it would give a more clear view of your problem to me.
>>>
>>>
>>>
>>>On Tue, Dec 11, 2012 at 4:26 PM, Spencer MacDonald <spencer.macdonald.other at gmail.com> wrote:
>>>
>>>The issue is that PJSIP is handling the registration for me, I just set the?reg_timeout for an account.
>>>>
>>>>
>>>>Regards
>>>>
>>>>Spencer
>>>>
>>>>
>>>>
>>>>On Tue, Dec 11, 2012 at 10:51 AM, Sandeep Karanth <sandeepk.kdp at gmail.com> wrote:
>>>>
>>>>You can use the method?
>>>>>pjsip_msg_add_hdr(pjsip_msg *msg, pjsip_hdr *hdr ) to add your custom header.?
>>>>>
>>>>>
>>>>>Regards,
>>>>>Sandeep
>>>>>
>>>>>
>>>>>
>>>>>On Tue, Dec 11, 2012 at 4:12 PM, Spencer MacDonald <spencer.macdonald.other at gmail.com> wrote:
>>>>>
>>>>>Hi,
>>>>>>
>>>>>>
>>>>>>Im trying to send a custom header in a SIP?Registration, but I can't find a way to do so.
>>>>>>
>>>>>>
>>>>>>It looks like you should be able to call
>>>>>>
>>>>>>
>>>>>>pjsip_regc_get_module()
>>>>>>
>>>>>>
>>>>>>to get the sip?registration?module, but this gives me a linker error. Looking in footprint.c this method appears to be commented out.?
>>>>>>
>>>>>>
>>>>>>Should this be working or is there an alternative solution?
>>>>>>
>>>>>>
>>>>>>Regards
>>>>>>
>>>>>>Spencer
>>>>>>_______________________________________________
>>>>>>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
>>>>>>
>>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>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
>>>>>
>>>>>
>>>>
>>>>_______________________________________________
>>>>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
>>>>
>>>>
>>>
>>>_______________________________________________
>>>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
>>>
>>>
>>
>>_______________________________________________
>>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
>>
>>
>
>_______________________________________________
>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
>
>

_______________________________________________
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/20121212/7174e554/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