我正在使用Java开发一个SIP手机,我使用像服务器一样的Asterisk 1.8。 我有连接到服务器的问题(compte sip 1700 - 地址IP服务器:192.168.1.10
我有这样的信息:
>>> REGISTER sip:192.168.1.10:5060 SIP/2.0
Call-ID: 9156414a4935f5b6a698218aec5ea69d@192.168.1.4
CSeq: 1 REGISTER
From: "Jaafar" <sip:1700>;tag=647554
To: "Jaafar" <sip:1700>
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK19dfa39eec2c6ea76aff876d7facf2b2
Max-Forwards: 70
Contact: <sip:192.168.1.4:5060>
Expires: 60000
Content-Length: 0
<<< SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.4:5060;rport=5060;branch=z9hG4bK19dfa39eec2c6ea76aff876d7facf2b2;received=192.168.1.4
From: "Jaafar" <sip:1700>;tag=647554
To: "Jaafar" <sip:1700>;tag=as7841605b
Call-ID: 9156414a4935f5b6a698218aec5ea69d@192.168.1.4
CSeq: 1 REGISTER
Server: Asterisk PBX 1.8.22.0
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest nonce="6993072a",realm="asterisk",algorithm=MD5
Content-Length: 0
请帮帮我 PS:这是客户端sip的源URL http://speedy.sh/H8YeK/SipClient.zip
我用Asterisk解决了这个问题。现在我可以连接两个软电话,但我有另一个问题。语音和视频不起作用。 当我从Eclipse
执行软电话时出现这种异常`
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Unknown Source)
at com.pfe.config.VoiceTool.startMedia(VoiceTool.java:32)
at com.pfe.phone.Softphone3Listener.processResponse(Softphone3Listener.java:426)
at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:290)
at gov.nist.javax.sip.EventScanner.run(EventScanner.java:492)
at java.lang.Thread.run(Unknown Source)
EL LLAMANTE ESCUCHA EN40000"`
当我点击没有按钮
时出现此异常`
java.lang.NullPointerException
at com.pfe.config.VoiceTool.stopMedia(VoiceTool.java:88)
at com.pfe.phone.Softphone3Listener.userInput(Softphone3Listener.java:613)
at com.pfe.phone.Softphone3GUI.jButton4_actionPerformed(Softphone3GUI.java:288)
at com.pfe.phone.zphone2GUI_jButton4_actionAdapter.actionPerformed(Softphone3GUI.java:360)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
`
答案 0 :(得分:-1)
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
因为潜水员没有找到。你可以改变:
// AudioFormat df=new AudioFormat(AudioFormat.LINEAR,44100,16,1);
// Vector devices=CaptureDeviceManager.getDeviceList(df);
// CaptureDeviceInfo di=(CaptureDeviceInfo) devices.elementAt(0);
// DataSource daso=Manager.createDataSource(di.getLocator());
MediaLocator ml = new MediaLocator("javasound://44100");
DataSource daso = Manager.createDataSource(ml);
和
AudioFormat(AudioFormat.GSM_RTP, 8000, 4, 1);
如果您使用jainsip进行编码。 :d