Accept a call/Miss a call

34 views
Skip to first unread message

Алексей Макуш

unread,
Mar 8, 2022, 7:31:51 AMMar 8
to JsSIP
Hey guys,
Maybe someone can help me. How I can define 2 different situations.
1) User accept a call
2) User miss a call
In this two cases fired the same events ('accepting/confirmed')
Any idea?

Alex Balashov

unread,
Mar 8, 2022, 7:50:08 AMMar 8
to js...@googlegroups.com
Привет Алексей,

Both inbound and outbound calls generate an event, on the JsSIP.UA level, called ‘RTCSession’:

https://jssip.net/documentation/3.9.x/api/ua/#event_newRTCSession

This is the key to activating both inbound and outbound calls.

In the case of the outbound call, JsSIP.UA.call() initiates the call, and the RTCSession event is caught merely to establish the audio path, attach MediaStream tracks to audio/video elements and so forth.

In the case of inbound, however, one must call session.answer() in order to accept the call:

const ua = new jssip.UA({...});

ua.on(‘RTCSession’, s => {
s.session.connection.addEventListener(’track’, t => {
...
});

// Inbound handling specifically.

if(s.session.direction === ‘inbound’) {
// Promise-based modal dialog to accept the call?

modal.confirmDialog.then(() => {
s.session.answer();
},
() => {
// catch / reject.

s.session.terminate();
});
});

// Outbound call would be initiated this way.

ua.call('sip:uri@host’, { config etc });

Hopefully that helps! Удачи!

— Alex
> --
> You received this message because you are subscribed to the Google Groups "JsSIP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jssip+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jssip/3518a8b9-d906-4723-b39e-4aea0fcb1240n%40googlegroups.com.

--
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

Reply all
Reply to author
Forward
0 new messages