We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
`async function subscribeContactExt(contact, account) { try {
// get userAgent from sipAccounts const sessionManager = sipAccounts[account.id].sessionManager; const userAgent = sessionManager.userAgent; // Create a new subscriber. const targetURI = new URI("sip", contact.number, account.domain); const eventType = "presence"; const subscriber = new Subscriber(userAgent, targetURI, eventType); // Add delegate to handle event notifications. subscriber.delegate = { onNotify: (notification) => { // send a response notification.accept(); // handle notification here console.log('Notification received:', notification); updateContactPresence(contact, notification.request.body); }, onSubscribe: (subscription) => { console.log('Subscribed to contact:', contact); updateContactPresence(contact, 'subscribed'); }, onRefresh: (subscription) => { console.log('Refreshed subscription:', contact); } }; // Monitor subscription state changes. subscriber.stateChange.addListener((newState) => { switch (newState) { case SubscriptionState.Terminated: console.log('Subscription terminated'); updateContactPresence(contact, 'terminated'); break; case SubscriptionState.Subscribed: console.log('Subscription subscribed'); updateContactPresence(contact, 'subscribed'); break; case SubscriptionState.NotifyWait: console.log('Subscription notify wait'); updateContactPresence(contact, 'notify wait'); break; default: console.log('Subscription state changed:', newState); break; } }); // Attempt to establish the subscription await subscriber.subscribe(); // add subscriber to subscription sipAccounts[account.id].subscribers[contact.number] = subscriber; console.log('Subscription established:', contact.number);
} catch (error) { console.error('Error subscribing to contact:', error); } }`
after running this code i only get, console.log('Subscription notify wait');
console.log('Subscription established:', contact.number);
and after sometime, console.log('Subscription terminated');
does this work with userAgent of sessionManager?
The text was updated successfully, but these errors were encountered:
Assalamu Alaikum @md-riaz, I am facing the same problem!
Any clues yet?
Sorry, something went wrong.
After some research, you might want to checkout this past issue.
Apparently Freeswitch has a hard time handling presence notifications with TLS/WSS.
signalwire/freeswitch#398
No branches or pull requests
`async function subscribeContactExt(contact, account) {
try {
} catch (error) {
console.error('Error subscribing to contact:', error);
}
}`
after running this code i only get,
console.log('Subscription notify wait');
console.log('Subscription established:', contact.number);
and after sometime,
console.log('Subscription terminated');
does this work with userAgent of sessionManager?
The text was updated successfully, but these errors were encountered: