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

Is there a way to set headers in the CANCELs emitted by the simringer #7

Open
elbow opened this issue Nov 5, 2019 · 7 comments · May be fixed by #10
Open

Is there a way to set headers in the CANCELs emitted by the simringer #7

elbow opened this issue Nov 5, 2019 · 7 comments · May be fixed by #10
Labels
good first issue Good for newcomers

Comments

@elbow
Copy link

elbow commented Nov 5, 2019

Hi @davehorton ,

We use simringer.

When one of the forks answers, I'd like to be able to add a "Reason" header to all the cancels sent on the other legs, viz 'Reason: SIP;cause=200;text="Call completed elsewhere"'.

This is so the client devices can adjust how they show the "missed" invite. Kamailio includes such a header, at least in our configuration.

My skim through the code here shows calls to req.cancel() and I don't see any place for something to set the headers for the cancel sent.

In related news if I receive a CANCEL from the upstream (caller) side, then I want to proxy the Reason: header from the incoming cancel to my outgoing cancels. Not sure if there's a way to do that - I added 'reason' to my proxyRequestHeaders which I will try now but its just a guess as to what to do.

Thanks,
Steve

@davehorton davehorton added the good first issue Good for newcomers label Nov 5, 2019
@davehorton
Copy link
Collaborator

Well, I'd love a pull request on this. It should be a simple matter of adding the header here:

https://github.com/davehorton/drachtio-fn-b2b-sugar/blob/28e26f210feeb6e78c03994982aabaf462eafd90/lib/call-manager.js#L177

@elbow
Copy link
Author

elbow commented Nov 5, 2019

Hi @davehorton ,

Very happy to give it a go, but there's no way to pass headers into cancel function on a request, and I can't figure out how else to do it?

https://github.com/davehorton/drachtio-srf/blob/44f9848a43dba3faedb043255e2d86d87af6fe32/lib/request.js#L70 is the cancel on Request. It delegates the cancel to _agent though to me its not clear who this agent is and where to look next.

Can you get me on track?

Thanks,
Steve

@davehorton
Copy link
Collaborator

ah, good point!. I will have to push a change to drachtio-srf to allow the standard opts on a cancel.

@danjenkins
Copy link
Contributor

@davehorton is that just a standard someone else can do a PR for? Or will there be underlying changes needed to drachtio-server?

@davehorton
Copy link
Collaborator

This is a change only to drachtio-srf. No changes required to drachtio server. I'm actually testing it now should be in shortly...

@davehorton
Copy link
Collaborator

hmm, scratch that. It looks like changes may be needed to drachtio server as well..

@davehorton
Copy link
Collaborator

ok as of:

[email protected], and
[email protected]

you can now attach headers to a cancel request, e.g.

req.cancel({
   headers: {
      'Reason':  'SIP;cause=200;text="Call completed elsewhere"''
   }
});

So please test, and if it looks good send me a PR for the simring change

@danjenkins danjenkins linked a pull request Nov 13, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants