I’m using SIP.js to implement WebRTC functionality. I have implemented the SUBSCRIBE method, but FreeSWITCH doesn’t send any NOTIFY packet to the SIP.js client. However, when I test the same functionality using the SIPp tool, FreeSWITCH sends the NOTIFY message as expected.
What could I be missing?
Here is my implementation:
const targetURI = new SIP.URI("sip", "2001", "test.example.com");
const eventType = "presence"; // https://www.iana.org/assignments/sip-events/sip-events.xhtml
const subscriberOptions = {
expires: 60, // Set the expiration time to 1 minute
extraHeaders: [
'Accept: application/simple-message-summary',
'Allow-Events: presence, kpml, talk'
],
};
const subscriber = new SIP.Subscriber(userAgent, targetURI, eventType, subscriberOptions);
// Add delegate to handle event notifications
subscriber.delegate = {
onNotify: (notification) => {
const presenceInfo = notification.request.body;
console.log('Presence Information:', presenceInfo);
console.log("Received NOTIFY:", notification.request);
// send a response
// notification.accept();
// handle notification here
}
};
subscriber.subscribe();
The same SUBSCRIBE logic works fine with SIPp tool, but FreeSWITCH doesn’t seem to send the NOTIFY when using SIP.js.
Is there something I’m missing in my SIP.js code or FreeSWITCH configuration?
Any help would be appreciated. Thanks!