Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom headers #1

Open
xaled1 opened this issue Apr 27, 2021 · 4 comments
Open

Add custom headers #1

xaled1 opened this issue Apr 27, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@xaled1
Copy link

xaled1 commented Apr 27, 2021

Hi,

Great application! I was looking for something like this for a long time.

One thing that would actually make it perfect for my use case. I need to add P-Asserted-Identity to the outgoing INVITE to make it work with my service provider. In the simplest case it could be set to the same value as From header.
Could the code be extended to include the P-Asserted-Identity header?

Thank you in advance.

@gmaruzz gmaruzz added the enhancement New feature or request label Apr 28, 2021
@gmaruzz
Copy link
Owner

gmaruzz commented Apr 28, 2021

yes, definitely a good idea!
I looked (superficially) into how to add headers and I was not able to find that in pjsip documentation.
So, probably there is not a "ready made" function for that in sipjs, and instead it needs some lower level programming
I'm not sure when I'll have time to look again into that, but patches are very welcome!

@xaled1
Copy link
Author

xaled1 commented Apr 29, 2021

Hi,

I got it working adding following code in sipnagios.c
It's just a hack and it would be good if you could integrate it using some kind of parameters to the app.

static pj_status_t make_call(const pj_str_t *dst_uri)
{
...
status = pjsip_inv_invite(call->inv, &tdata);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);

pj_str_t hname = pj_str("P-Asserted-Identity");
pj_str_t hvalue = pj_str("sip:+12345678@test.com");
pjsip_generic_string_hdr *gheader;

gheader = pjsip_generic_string_hdr_create(tdata->pool, &hname, &hvalue);
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *) gheader);

@gmaruzz
Copy link
Owner

gmaruzz commented Apr 29, 2021

would you please attach (as an attachment) the git diff ?

thanks a lot!!!

@xaled1
Copy link
Author

xaled1 commented Apr 29, 2021

Here
sipnagios.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants