Convert LIDs to PN by sending a call rejection message#2085
Merged
DavidsonGomes merged 5 commits intoEvolutionAPI:developfrom Oct 15, 2025
Merged
Convert LIDs to PN by sending a call rejection message#2085DavidsonGomes merged 5 commits intoEvolutionAPI:developfrom
DavidsonGomes merged 5 commits intoEvolutionAPI:developfrom
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR ensures that call rejection messages are sent to the correct phone number by converting LIDs to PNs and refines the Chatwoot integration to accurately parse chat IDs by stripping trailing suffixes. Sequence diagram for call rejection message with LID to PN conversionsequenceDiagram
participant BaileysStartupService
participant SignalRepository
participant WhatsAppClient
participant ChatwootService
BaileysStartupService->>WhatsAppClient: Receive call with 'offer' status
alt call.from ends with '@lid'
BaileysStartupService->>SignalRepository: getPNForLID(call.from)
SignalRepository-->>BaileysStartupService: Return PN
BaileysStartupService->>WhatsAppClient: sendMessage(PN, msgCall)
else call.from is PN
BaileysStartupService->>WhatsAppClient: sendMessage(call.from, msgCall)
end
WhatsAppClient->>ChatwootService: Emit 'messages.upsert' event
Class diagram for BaileysStartupService and SignalRepository changesclassDiagram
class BaileysStartupService {
+client: WhatsAppClient
+rejectCall(call)
}
class WhatsAppClient {
+signalRepository: SignalRepository
+sendMessage(to, message)
+ev: EventEmitter
}
class SignalRepository {
+lidMapping: LIDMapping
}
class LIDMapping {
+getPNForLID(lid: string): string
}
BaileysStartupService --> WhatsAppClient
WhatsAppClient --> SignalRepository
SignalRepository --> LIDMapping
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Consider adding a debug log after converting a LID to a PN in whatsapp.baileys.service.ts so you can trace when and how often that mapping occurs.
- The chatId split(':')[0] change in chatwoot.service.ts might still break on more complex JID formats—consider using a dedicated JID parser or regex to reliably extract the user portion.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a debug log after converting a LID to a PN in whatsapp.baileys.service.ts so you can trace when and how often that mapping occurs.
- The chatId split(':')[0] change in chatwoot.service.ts might still break on more complex JID formats—consider using a dedicated JID parser or regex to reliably extract the user portion.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
📋 Description
🔗 Related Issue
Closes #(issue_number)
🧪 Type of Change
🧪 Testing
📸 Screenshots (if applicable)
✅ Checklist
📝 Additional Notes
Corrige o número utilizando getLIDForPN() para resposta ao rejeitar uma chamada. Principal mudança seria no recebimento no webhook e na conversa correta no Chatwoot.
Summary by Sourcery
Fix Failed Call Handling for LID-Originated WhatsApp Calls and Chat ID Parsing in Chatwoot
Bug Fixes: