feat: Add BroadSoft Access-Side Extensions Support (Auto-Answer and Remote Control) - #1118
Open
rasonyang wants to merge 8 commits into
Open
feat: Add BroadSoft Access-Side Extensions Support (Auto-Answer and Remote Control)#1118rasonyang wants to merge 8 commits into
rasonyang wants to merge 8 commits into
Conversation
- BroadSoftEvent.Hold, HoldAction, HoldNotifyBody types - applyHoldAction: re-INVITE with a=sendonly when Established only - hold dispatch in handleRemoteControlNotify/Notification with onHoldEvent callback - case-insensitive answer-after parameter matching per SIP rules - prepare script so git dependencies build lib/ on install
…gn API contracts Core regression fixes: - Invitation.progress() now installs a NOTIFY-only delegate on early dialogs so core defaults keep answering early-dialog BYE/INFO/MESSAGE/re-INVITE (200/469/200/488) instead of dropping them without a response - Session.onNotifyRequest restores the Established-only rule with a narrow carve-out for BroadSoft Event: talk/hold during Initial/Establishing - handleRemoteControlNotify() now applies SIP signaling (accept/resume/hold) as documented, matching handleRemoteControlNotification() Auto-answer hardening: - answer-after is strictly parsed (non-negative integers only); malformed values (1abc, -5, 1.9) no longer schedule an answer - delays are capped at 2^31-1 ms so huge values cannot overflow the timer and answer immediately - handleAutoAnswer returns a cancellation handle and auto-cancels when the invitation leaves Initial (manual answer, CANCEL, termination) - optional logger surfaces previously-swallowed failures API/robustness: - unify the duplicated request/Notification parsing paths on a shared core - holdModifier inserts a=sendonly when SDP has no direction attribute; resumeModifier exported and its sendonly caveat documented - remove console.* debug output from library code - remove unused BroadSoftOptions and undocumented answerafter alias Docs and housekeeping: - README: document Event: hold, mute semantics, NOTIFY response ownership; remove non-existent autoApply option; fix non-compiling examples - drop "prepare" script; untrack compiled test .js and gitignore them Tests: +36 (regression pins for the Session/Invitation changes, malformed delays, cancel/races, applyTalkAction, handleRemoteControlNotify contract, SDP round-trips). Full suite: 5540 passed, 0 failed.
…alog roles on hold re-INVITE Once the client sends the in-dialog re-INVITE that Event: hold asks for on a server-originated call, FreeSWITCH (sofia-sip) takes the remote party from the request's To header - its own identity - and every subsequent server-generated in-dialog request carries To == From. The resume (Event: talk) NOTIFY then matches no dialog and was rejected with 481, leaving the call stuck on hold. When the full dialog id lookup fails, fall back to matching NOTIFY with Event: talk/hold by Call-ID plus remote (From) tag, accepting only an unambiguous single match. RFC 3261 section 12.2.2 explicitly permits accepting requests whose To tag does not match. All other requests and events keep the strict matching and the 481.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for BroadSoft Access-Side Extensions, implementing two key features:
Call-Infoheader withanswer-afterparameterEvent: talkChanges
Core API (
src/api/broadsoft/)auto-answer.ts- Auto-answer logic for Call-Info header parsing and delayed answeringcall-info-parser.ts- Parser for Call-Info header with answer-after parameterremote-control.ts- Handler for remote control NOTIFY events (talk/mute)types.ts- TypeScript types and enums for BroadSoft extensionsindex.ts- Public API exports with helper functionsDemo Application
demo/demo-broadsoft.html- Interactive demo UI for testing BroadSoft extensionsdemo/demo-broadsoft.ts- Full-featured demo implementation with FreeSWITCH integrationdemo/demo-broadsoft.css- Styled UI for demo applicationTests
test/spec/api/broadsoft/auto-answer.spec.ts- Unit tests for auto-answer functionalitytest/spec/api/broadsoft/call-info-parser.spec.ts- Unit tests for Call-Info header parsingtest/spec/api/broadsoft/remote-control.spec.ts- Unit tests for remote control eventsDocumentation
src/api/broadsoft/README.md- Comprehensive API documentation with usage examplesexamples/broadsoft-extensions.ts- Code examples demonstrating integrationintegration-tests/FREESWITCH.md- FreeSWITCH integration testing guideintegration-tests/README.md- General integration testing documentationFeatures
Auto-Answer
Call-Info: <sip:domain>; answer-after=Nheader from incoming INVITEshouldAutoAnswer(),getAutoAnswerDelay(),handleAutoAnswer()Remote Control
Event: talkisBroadSoftNotification(),handleRemoteControlNotification()Testing
Run the test suite: