Sip.js Handling reject/busy on an outgoing call.

1,463 views
Skip to first unread message

jagdeep...@gmail.com

unread,
Oct 15, 2014, 3:07:29 PM10/15/14
to sip...@googlegroups.com
Hello,

I am new to sip.js and was looking on what would be the best way to handle a reject or busy on a outbound call.

So in a scenario when a user makes a call to a client and the client rejects, session.reject(), which event would be triggered on the user side.

Right now in the logs I always accepted event is being emitted even on reject.

Joseph Frazier

unread,
Oct 20, 2014, 1:06:49 PM10/20/14
to sip...@googlegroups.com
Hi Jagdeep,

I haven't been able to reproduce this using SIP.js 0.6.3. Can you provide a test case?

Thanks,
Joseph

jagdeep singh

unread,
Oct 20, 2014, 2:21:56 PM10/20/14
to sip...@googlegroups.com
Thanks for your reply, Below is my code snippet .

Below is how i am making the call and bindiing the accepted , rejected and failed event for that session. And on the receiver side i am rejecting the call in the reject function. However on the caller side i am always getting into the onAccepted event. I am also adding the logs for both side, let me know if you need anything else.

In logs you can see I am rejecting the call on the reciever end, but accepted event is triggered.

function call() {
        // add the check if the agent is busy or not.

        console.log($scope.phoneNumber);
        $scope.sessionSuccessfull = false;
                    var invitenumber = $scope.phoneNumber + '@' + ipAddress;
            alert(invitenumber);
            $scope.session = $scope.userAgent.invite(invitenumber, $scope.options);
            $scope.session.on("accepted", function () {
                  alert("Accepted");
                callAccepted();
            });
            $scope.session.on("rejected", function(){

                alert("rejected was triggered");

            });
            $scope.session.on("cancel", function(){

            alert("cancel was triggered");

        });

        $scope.session.on("failed", function () {
            callFailed();
        });
        $scope.session.on("connecting", function () {
            callConnecting();
        });
        $scope.onCall = true;
    }

function reject() {
            ringer.pause();
            $scope.currentSession.reject();
            $modalInstance.dismiss();
        }


***************************************************caller side logs ************************************************************
on Oct 20 2014 11:12:59 GMT-0700 (PDT) | sip.ua | emitting event newTransaction sip-0.6.3.js:2677
Mon Oct 20 2014 11:12:59 GMT-0700 (PDT) | sip.transaction.ict | adding event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:12:59 GMT-0700 (PDT) | sip.transaction.ict | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:12:59 GMT-0700 (PDT) | sip.transaction.ict | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:00 GMT-0700 (PDT) | sip.dialog | new UAC dialog created with status EARLY sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:00 GMT-0700 (PDT) | sip.inviteclientcontext | emitting event progress sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.transaction.ict | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.dialog | dialog hjj5g336cg0v4d6ueoumf7g0khouh64mQQKe38U1mDp  changed to CONFIRMED state sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.invitecontext.mediahandler | emitting event setDescription sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.invitecontext.mediahandler | stream added: n737ipLuM0YYbdGFDr02X65KCxXMlcey sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.invitecontext.mediahandler | emitting event addStream sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.invitecontext.mediahandler | ICE connection state changed to "checking" sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:06 GMT-0700 (PDT) | sip.inviteclientcontext | emitting event accepted sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:12 GMT-0700 (PDT) | sip.invitecontext.mediahandler | ICE connection state changed to "connected" sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:21 GMT-0700 (PDT) | sip.invitecontext.mediahandler | ICE connection state changed to "completed" sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:38 GMT-0700 (PDT) | sip.transaction.ict | Timer B expired for INVITE client transaction z9hG4bK6985674 sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:44 GMT-0700 (PDT) | sip.transaction.ict | Timer M expired for INVITE client transaction z9hG4bK6985674 sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:44 GMT-0700 (PDT) | sip.transaction.ict | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:13:44 GMT-0700 (PDT) | sip.ua | emitting event transactionDestroyed sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.ua | emitting event newTransaction sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.transaction.ist | adding event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.transaction.ist | new listener added to event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.transaction.ist | new listener added to event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.inviteclientcontext | re-INVITE received sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.transaction.ist | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.transaction.ist | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:02 GMT-0700 (PDT) | sip.ua | emitting event transactionDestroyed sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.ua | emitting event newTransaction sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.transaction.nist | adding event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.servercontext | adding event progress sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.servercontext | adding event accepted sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.servercontext | adding event rejected sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.servercontext | adding event failed sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.transaction.nist | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.inviteclientcontext | emitting event bye sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.inviteclientcontext | closing INVITE session hjj5g336cg0v4d6ueoum3m2r5s9hk6 sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.invitecontext.mediahandler | closing PeerConnection sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.dialog | dialog hjj5g336cg0v4d6ueoumf7g0khouh64mQQKe38U1mDp deleted sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.inviteclientcontext | emitting event terminated sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.transaction.nist | Timer J expired for non-INVITE server transaction z9hG4bKF2g7c9rNFSc1j sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.transaction.nist | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.ua | emitting event transactionDestroyed sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:18 GMT-0700 (PDT) | sip.invitecontext.mediahandler | ICE connection state changed to "closed" sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:34 GMT-0700 (PDT) | sip.transaction.ist | Timer H expired for INVITE server transaction z9hG4bKDgyN9jQeN7ZUB sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:34 GMT-0700 (PDT) | sip.transaction.ist | emitting event stateChanged sip-0.6.3.js:2677
Mon Oct 20 2014 11:14:34 GMT-0700 (PDT) | sip.ua | emitting event transactionDestroyed sip-0.6.3.js:2677

**********************************************************************************************************************************************************************************************************

*************************************************************************************** Reciever side logs *********************************************************************************************
Mon Oct 20 2014 11:12:58 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | new listener added to event invite
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:12:58 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | emitting event progress
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:12:58 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | emitting event invite
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:12:58 GMT-0700 (Pacific Standard Time) | sip.ua | emitting event invite
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | rejecting RTCSession
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.transaction.ist | emitting event stateChanged
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | emitting event rejected
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | emitting event failed
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | closing INVITE session 9094040a-d327-1232-6898-005056a4720c5XggN9KcSaB0H
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.invitecontext.mediahandler | closing PeerConnection
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.invitecontext.mediahandler | ICE connection state changed to "closed"
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.dialog | dialog 9094040a-d327-1232-6898-005056a4720c0lk34hkg1i5XggN9KcSaB0H deleted
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.inviteservercontext | emitting event terminated
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.transaction.ist | emitting event stateChanged
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:04 GMT-0700 (Pacific Standard Time) | sip.ua | emitting event transactionDestroyed
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:36 GMT-0700 (Pacific Standard Time) | sip.transaction.ist | Timer H expired for INVITE server transaction z9hG4bKByB45vN7tNKpm
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:36 GMT-0700 (Pacific Standard Time) | sip.transaction.ist | emitting event stateChanged
sip-0.6.3.js (line 2677)
Mon Oct 20 2014 11:13:36 GMT-0700 (Pacific Standard Time) | sip.ua | emitting event transactionDestroyed

*****************************************************************************************************************************************************************

Joseph Frazier

unread,
Oct 20, 2014, 2:47:57 PM10/20/14
to sip...@googlegroups.com
Thanks for including the logs; I forgot to ask for them before. At a glance, it looks like you are using a SIP server that is answering on behalf of the receiver. Can you add traceSip:true to the configuration parameters for your user agents and re-post the logs to confirm?

Joseph

jagdeep singh

unread,
Oct 20, 2014, 7:21:55 PM10/20/14
to sip...@googlegroups.com
Thanks! Joseph, you are correct the freeswitch was answering  on behalf of the client. 
Reply all
Reply to author
Forward
0 new messages