401 error while making a call using jain sip library android -
i have made sip client using jain sip library. able register client , here respose sip server
31-may-2015 19:00:14.257 [cm504001]: endpoint extn:401: new contact registered. contact(s): [sip:401@192.168.1.3:5080 / 401]
now when click on call button following response server.
31-may-2015 19:05:18.118 [cm504002]: endpoint extn:401: contact unregistered. contact(s): [] 31-may-2015 19:01:04.867 leg l:1.1[unknown:] terminated: cause: bye pbx 31-may-2015 19:01:04.812 [cm502001]: source info: from: <sip:401@192.168.1.3:5080>;tag=tzt0zep92; to: <sip:400> 31-may-2015 19:01:04.812 [cm503013]: call(c:1): incoming call rejected, caller unknown; msg=ivite-in recv req invite 192.168.1.3:5080 tid=-343937-0429701b5f2f8b0122a365a56ac5d974 call-id=c0335e9c736e5785826955de9f0b6ae7@192.168.1.3: invite sip:400 sip/2.0 via: sip/2.0/udp 192.168.1.3:5080;rport=5080;branch=z9hg4bk-343937-0429701b5f2f8b0122a365a56ac5d974 max-forwards: 70 route: <sip:192.168.1.7:5060;transport=udp;lr> contact: <sip:401@192.168.1.3:5080> to: <sip:400> from: <sip:401@192.168.1.3:5080>;tag=tzt0zep92 call-id: c0335e9c736e5785826955de9f0b6ae7@192.168.1.3 cseq: 2 invite call-info: <http://www.antd.nist.gov> content-type: application/sdp proxy-authorization: digest username="401",realm="3cxphonesystem",nonce="414d535c0b7b9a9497:e49c5068970045631f39bac52ed74673",uri="sip:400",response="6e376a0d4dc10ffdc584d3b697aadb0c",algorithm=md5 supported: replaces, outbound content-length: 246 31-may-2015 19:01:04.343 [cm500002]: unidentified incoming call. review invite , adjust source identification: invite-unk recv req invite 192.168.1.3:5080 tid=-343937-fc99c27fff992fb02c73b014c7b6a23d call-id=c0335e9c736e5785826955de9f0b6ae7@192.168.1.3: invite sip:400 sip/2.0 via: sip/2.0/udp 192.168.1.3:5080;rport=5080;branch=z9hg4bk-343937-fc99c27fff992fb02c73b014c7b6a23d max-forwards: 70 route: <sip:192.168.1.7:5060;transport=udp;lr> contact: <sip:401@192.168.1.3:5080> to: <sip:400> from: <sip:401@192.168.1.3:5080>;tag=tzt0zep92 call-id: c0335e9c736e5785826955de9f0b6ae7@192.168.1.3 cseq: 1 invite call-info: <http://www.antd.nist.gov> content-type: application/sdp supported: replaces, outbound content-length: 246
part of code responsible processing response follows
public void processresponse(responseevent arg0) { response response = (response) arg0.getresponse(); system.out.println(response.getstatuscode()); dialog responsedialog = null; clienttransaction tid = arg0.getclienttransaction(); if (tid != null) { responsedialog = tid.getdialog(); } else { responsedialog = arg0.getdialog(); } cseqheader cseq = (cseqheader) response.getheader(cseqheader.name); if (response.getstatuscode() == response.proxy_authentication_required || response.getstatuscode() == response.unauthorized) { authenticationhelper authenticationhelper = ((sipstackext) sipstack) .getauthenticationhelper( new accountmanagerimpl(sipprofile.getsipusername(), sipprofile.getremoteip(), sipprofile .getsippassword()), headerfactory); try { clienttransaction invitetid = authenticationhelper .handlechallenge(response, tid, sipprovider, 5, true); invitetid.sendrequest(); } catch (nullpointerexception e) { system.out.println("a: null error"); e.printstacktrace(); } catch (sipexception e) { system.out.println("b: null error"); e.printstacktrace(); } } else if (response.getstatuscode() == response.ok) { if (cseq.getmethod().equals(request.invite)) { system.out.println("dialog after 200 ok " + dialog); system.out.println("c: invite " + dialog); try { request ackrequest = responsedialog.createack(cseq .getseqnumber()); system.out.println("sending ack"); responsedialog.sendack(ackrequest); byte[] rawcontent = response.getrawcontent(); string sdpcontent = new string(rawcontent, "utf-8"); sdpannounceparser parser = new sdpannounceparser(sdpcontent); sessiondescriptionimpl sessiondescription = parser.parse(); mediadescription incomingmediadescriptor = (mediadescription) sessiondescription .getmediadescriptions(false).get(0); int rtpport = incomingmediadescriptor.getmedia() .getmediaport(); dispatchsipevent(new sipevent(this, sipeventtype.call_connected, "", "", rtpport)); } catch (invalidargumentexception e) { e.printstacktrace(); } catch (sipexception e) { e.printstacktrace(); } catch (unsupportedencodingexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (parseexception e) { e.printstacktrace(); } catch (sdpexception e) { e.printstacktrace(); } } else if (cseq.getmethod().equals(request.cancel)) { if (dialog.getstate() == dialogstate.confirmed) { // oops cancel went in late. need hang // dialog. system.out .println("sending bye -- cancel went in late !!"); request byerequest = null; try { byerequest = dialog.createrequest(request.bye); } catch (sipexception e) { // todo auto-generated catch block e.printstacktrace(); } clienttransaction ct = null; try { ct = sipprovider.getnewclienttransaction(byerequest); } catch (transactionunavailableexception e) { // todo auto-generated catch block e.printstacktrace(); } try { dialog.sendrequest(ct); } catch (transactiondoesnotexistexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (sipexception e) { // todo auto-generated catch block e.printstacktrace(); } } } } else if (response.getstatuscode() == response.decline) { system.out.println("call declined"); dispatchsipevent(new sipevent(this, sipeventtype.declined, "", "")); } else if (response.getstatuscode() == response.not_found) { system.out.println("not found"); } else if (response.getstatuscode() == response.accepted) { system.out.println("accepted"); } else if (response.getstatuscode() == response.busy_here) { system.out.println("busy"); dispatchsipevent(new sipevent(this, sipeventtype.busy_here, "", "")); } else if (response.getstatuscode() == response.service_unavailable) { system.out.println("busy"); dispatchsipevent(new sipevent(this, sipeventtype.service_unavailable, "", "")); } }
i have been struggling make thing work still no luck. please help.
Comments
Post a Comment