-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Convert LIDs to PN by sending a call rejection message #2085
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
Conversation
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
📋 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: