0

我正在使用 Java 开发一个 sip 电话,我使用 Asterisk 1.8 之类的服务器。我在连接服务器时遇到问题(compte sip 1700 - address Ip Server : 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)
`
4

1 回答 1

-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

于 2015-02-09T08:00:04.923 回答