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

support X-CID for feature server to detect sip callid #147

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ class CallSession extends Emitter {
'-Allow',
'-Session-Expires'
],
// Add X-CID header to feature server response.
// to allow calling/status hooks contains sbc_callid.
responseHeaders: (uacRes, headers) => {
if (this.req.locals.cdr) {
headers['X-CID'] = this.req.locals.cdr.sip_callid;
davehorton marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this is set

              if (this.req.locals.account?.disable_cdrs) {
                this.logger.debug('cdrs disabled for this account');

Then won't this.req.locals.cdr not exist, and your code above throw an exception and crash the process?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was overthinking, the uacRes object will have call-id for the sbc oubound invite.

}
},
headers: hdrs,
auth: gw ? gw.auth : undefined,
localSdpB: response.sdp,
Expand Down