I want to subscribe presence and dialog of all sip user and get notify when user on call , available, on ringing and unregister.
I am using sip.js with reactjs.
SIPJS : "sip.js": "^0.20.0",
Code :
UserAgent :
`const userOptions: UserAgentOptions = {
uri: UAURI,
authorizationPassword: password,
authorizationUsername: username,
contactName: username,
viaHost: domain,
transportOptions: {
server: server,
traceSip: true,
},
delegate: { onInvite, onNotify },
register: true,
noAnswerTimeout: 60,
userAgentString: "A | B ",
dtmfType: "info",
displayName: "WEBRTC",
activeAfterTransfer: false, // Die when the transfer is completed
logBuiltinEnabled: true, // Boolean - true or false - If true throws console logs
};
console.log( userOptions );
userAgent = new UserAgent( userOptions );
console.log( "USSSSSEEERRR AGENT" );
console.log( userAgent );`
After Register Subscribe another users :
`const Subscribe = () => {
console.log("useragentstate");
console.log(userAgent);
const dialogOptions = {
extraHeaders: [
"Accept: application/pidf+xml"
],
};
const targetURI = new URI("sip", "10019", "example.com");
const eventType = "presence";
const subscriber = new Subscriber(userAgent, targetURI, eventType, dialogOptions);
subscriber.delegate = {
onNotify: (notification: Notification) =>
{
// here you can get the NOTIFY body and parse it to get the users inside the conference...
console.log("COMING FOR NOTIFY");
notification.accept();
}
};
console.log(subscriber);
subscriber.subscribe();
};`
After subscribe that notify not getting for user 10019. User = 10020 -> subscribe -> 10019 Server = Accepted -> User
But after that Notify not getting like below : From 10019 -> 10020 (Register / Unregister)
Please any one help that what i have missing on subscribe or useragent register option that help me solve the problem.