0
votes

I am developing a sip phone using Java and I using Asterisk 1.8 like server. I have a problem to connect to server(compte sip 1700 - address Ip Server : 192.168.1.10

I have this message :

>>> REGISTER sip:192.168.1.10:5060 SIP/2.0
Call-ID: [email protected]
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: [email protected]
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

Please help me PS: This the URL of the source of the client sip http://speedy.sh/H8YeK/SipClient.zip


I resolved this problem with Asterisk. Now I could connect two soft phone but I have another problem. The voice and video don't work. this exceptions appear when I execute the soft phone from 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"`

And this exception when I click no button

`
    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)
`
1
Exactly what is your problem? You seem to have the connection set up OK. Remember that it is the SIP URI in the To header that is used for registration, and that looks a little suspicios (a host named '1700'?).forty-two
My problem is : When I can't connect to Asterisk (SIP/2.0 401 Unauthorized) I created a sip account in Asterisk (user name 1700, password 1700)JHDev
The SIP URI syntax is sip:userid:password@host:port, where everything is optional except host.forty-two
I try that but does not work, I think I miss something in my code please can you look at it.(Sorry, I don't speak English very well)JHDev
Please Any one could help me?JHDev

1 Answers

-1
votes
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0

because diver don't found. You can change:

//    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);

and

AudioFormat(AudioFormat.GSM_RTP, 8000, 4, 1);

if you using jainsip to code. :D