Open GuillaumeCousin opened 9 years ago
Hi, Here is my JS code for Register and Invite : var configUA = { uri: user+'@'+registrar, // 6001@192.168.1.123 wsServers: ['ws://'+registrar+':8088/ws'], // ws://192.168.1.123:8088/ws displayName: user, // 6001 register: false, autostart: false, registerExpires: 120, traceSip: true, authorizationUser: user, // 6001 // Replace this with the username from your sip.conf file password: pswd, // 6001 // Replace this with the password from your sip.conf file hackIpInContact: true, // HackIpInContact for Asterisk }; if(isIOS()) { configUA['mediaHandlerFactory'] = PhoneRTCMediaHandler; } this.SipPhoneUA = new SIP.UA(configUA);
var options = { media: { constraints: { audio: this.useAudio, video: this.useVideo }, render: { remote: { audio: document.getElementById('id-audio-remote') }, } }, }; this.SipPhone = this.SipPhoneUA.invite(target, options); // target = 6002@192.168.1.123
And finally the sip.js console log :
sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | configuration parameters after validation: sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · viaHost: "192.0.2.122" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · uri: sip:6001@192.168.1.123 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · wsServers: [{"ws_uri":"ws://192.168.1.123:8088/ws","sip_uri":"sip:192.168.1.123:8088;transport=ws;lr","weight":0,"status":0,"scheme":"WS"}] sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · password: NOT SHOWN sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · registerExpires: 120 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · register: false sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · registrarServer: sip:192.168.1.123 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · wsServerMaxReconnection: 3 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · wsServerReconnectionTimeout: 4 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · connectionRecoveryMinInterval: 2 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · connectionRecoveryMaxInterval: 30 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · usePreloadedRoute: false sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · userAgentString: "SIP.js/0.6.2" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · noAnswerTimeout: 60000 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · stunServers: ["stun:null"] sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · turnServers: [] sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · traceSip: true sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · hackViaTcp: false sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · hackIpInContact: true sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · autostart: false sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · rel100: "none" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · mediaHandlerFactory: function () { var instance = Object.create(constructor.prototype); var result = constructor.apply(instance, arguments); return typeof result === 'object' ? result : instance; } sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · authorizationUser: "6001" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · displayName: "6001" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · instanceId: "526dfa13-fbc8-47e6-b59d-4415c8c0532b" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · sipjsId: "dmlmj" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · hostportParams: "192.168.1.123" sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | · media: undefined sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event connecting sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event connected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event disconnected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event newTransaction sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event transactionDestroyed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event unregistered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event registrationFailed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event invite sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event newSession sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event message sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event ack sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event cancel sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event bye sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event options sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event info sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | adding event notify sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event progress sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event accepted sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event rejected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event failed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event cancel sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | adding event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | adding event unregistered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | new listener added to event failed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | new listener added to event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | new listener added to event unregistered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event connected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event disconnected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event unregistered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event registrationFailed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event message sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | new listener added to event invite sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | user requested startup... sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | connecting to WebSocket ws://192.168.1.123:8088/ws sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event connecting sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | WebSocket ws://192.168.1.123:8088/ws connected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | connection state set to 0 sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event connected sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event newTransaction sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | adding event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | sending WebSocket message:
REGISTER sip:192.168.1.123 SIP/2.0 Via: SIP/2.0/WS 192.0.2.122;branch=z9hG4bK962829 Max-Forwards: 70 To: sip:6001@192.168.1.123 From: "6001" sip:6001@192.168.1.123;tag=8e2e2hv5a9 Call-ID: ohq4c8t5t3fr63dk0k975q CSeq: 81 REGISTER Contact: sip:ar95cnh1@192.0.2.122;transport=ws;reg-id=1;+sip.instance="urn:uuid:526dfa13-fbc8-47e6-b59d-4415c8c0532b";expires=120 Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE Supported: path,gruu,outbound User-Agent: SIP.js/0.6.2 Content-Length: 0
sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | received WebSocket text message:
SIP/2.0 401 Unauthorized Via: SIP/2.0/WS 192.0.2.122;branch=z9hG4bK962829;received=192.168.1.12 From: "6001" sip:6001@192.168.1.123;tag=8e2e2hv5a9 To: sip:6001@192.168.1.123;tag=as0b5e0888 Call-ID: ohq4c8t5t3fr63dk0k975q CSeq: 81 REGISTER Server: Asterisk PBX 12.6.1 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="380ae524" Content-Length: 0
sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event newTransaction sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | adding event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | sending WebSocket message:
REGISTER sip:192.168.1.123 SIP/2.0 Via: SIP/2.0/WS 192.0.2.122;branch=z9hG4bK783957 Max-Forwards: 70 To: sip:6001@192.168.1.123 From: "6001" sip:6001@192.168.1.123;tag=8e2e2hv5a9 Call-ID: ohq4c8t5t3fr63dk0k975q CSeq: 82 REGISTER Authorization: Digest algorithm=MD5, username="6001", realm="asterisk", nonce="380ae524", uri="sip:192.168.1.123", response="5156d430ea2db739769eb7ac7110d1ad" Contact: sip:ar95cnh1@192.0.2.122;transport=ws;reg-id=1;+sip.instance="urn:uuid:526dfa13-fbc8-47e6-b59d-4415c8c0532b";expires=120 Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE Supported: path,gruu,outbound User-Agent: SIP.js/0.6.2 Content-Length: 0
sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event transactionDestroyed sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transport | received WebSocket text message:
SIP/2.0 200 OK Via: SIP/2.0/WS 192.0.2.122;branch=z9hG4bK783957;received=192.168.1.12 From: "6001" sip:6001@192.168.1.123;tag=8e2e2hv5a9 To: sip:6001@192.168.1.123;tag=as0b5e0888 Call-ID: ohq4c8t5t3fr63dk0k975q CSeq: 82 REGISTER Server: Asterisk PBX 12.6.1 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Expires: 120 Contact: sip:ar95cnh1@192.0.2.122;transport=ws;expires=120 Date: Tue, 03 Feb 2015 10:40:28 GMT Content-Length: 0
sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | emitting event accepted sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.registercontext | emitting event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event registered sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.transaction.nict | emitting event stateChanged sip.js:2655 Tue Feb 03 2015 11:40:26 GMT+0100 (Paris, Madrid) | sip.ua | emitting event transactionDestroyed sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event progress sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event accepted sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event rejected sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event failed sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event cancel sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event connecting sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event terminated sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event dtmf sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event invite sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | skipping event cancel - Event exists sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event refer sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event bye sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event hold sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event unhold sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event muted sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.clientcontext | adding event unmuted sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.invitecontext.mediahandler | XXX phonertcGetDescriptionCall sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event progress sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event accepted sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event rejected sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event failed sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event connecting sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event cancel sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event bye sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event muted sip.js:2655 Tue Feb 03 2015 11:40:59 GMT+0100 (Paris, Madrid) | sip.inviteclientcontext | new listener added to event unmuted
the same error here, the plugin doesnt send INVITE
There was a bug with the sample code. I have uploaded new sample code to the Readme file. Try and see if that resolves your issue.
Hi, i'm new here. I'm trying to make a web app to make call between ios or Android Device via an Asterisk. For compatibility with iOS i read on sipjs guide that i need to use your plugin. I've installed it on my web project. When i work with my Ipad the REGISTER on my Asterisk is OK, but if i make a call the INVITE is not send to the Asterisk. I think it's not send by the iPad. I work with the latest version of iOS.
Anyone can help me ?