[asterisk-dev] Question

Gad Alaloof gadi.alaloof at gmail.com
Wed Jul 15 06:19:20 CDT 2009


Hi
I'm new developer on Asterisk and i have some questions:

I would like to write an application with Java api that does the following :

Lets assume we have 2 extensions SIP .
My application should dial to  1 Sip account and when answer is getting to
astrisk farward the call to another extention.
My astrisk server should be connected to some external operator SIP service
that does the physical call for me.

*My questions is (I would like to get general answers here ):*

1-If i want to simulate this scenario - can i use some simulator that
simulate the operator behavior ? (Or maybe i don't need one)
2-Which soft phone is recommended by you for my scenario ? (I uses x-lite
but i cant add more than 1 SIP account )
3-What (In general ) should be my architecture for this scenario ?
4-What  (In general ) should be my configuration of the asterisk ?

5-I have downloaded asterisk win 32 and run some Java test application that
does the following thing:
Assume we have a phone connected via SIP that is available at SIP/3000 and
we want to initiate a call from that phone to extension 3001 in the default
context.

Here is the example from http://asterisk-java.org/0.2/tutorial.html site:

(I have configured everything to work with Manager.)

*import java.io.IOException;

import net.sf.asterisk.manager.AuthenticationFailedException;
import net.sf.asterisk.manager.ManagerConnection;
import net.sf.asterisk.manager.ManagerConnectionFactory;
import net.sf.asterisk.manager.TimeoutException;
import net.sf.asterisk.manager.action.OriginateAction;
import net.sf.asterisk.manager.response.ManagerResponse;

public class HelloManager
{
    private ManagerConnection managerConnection;

    public HelloManager() throws IOException
    {
        ManagerConnectionFactory factory = new ManagerConnectionFactory();

        this.managerConnection = factory.getManagerConnection("localhost",
                "manager", "pa55w0rd");
    }

    public void run() throws IOException, AuthenticationFailedException,
            TimeoutException
    {
        OriginateAction originateAction;
        ManagerResponse originateResponse;

        originateAction = new OriginateAction();
        originateAction.setChannel("SIP/3000");
        originateAction.setContext("default");
        originateAction.setExten("3001");
        originateAction.setPriority(new Integer(1));
        originateAction.setTimeout(new Integer(30000));

        // connect to Asterisk and log in
        managerConnection.login();

        // send the originate action and wait for a maximum of 30
seconds for Asterisk
        // to send a reply
        originateResponse =
managerConnection.sendAction(originateAction, 30000);

        // print out whether the originate succeeded or not
        System.out.println(originateResponse.getResponse());

        // and finally log off and disconnect
        managerConnection.logoff();
    }

    public static void main(String[] args) throws Exception
    {
        HelloManager helloManager;

        helloManager = new HelloManager();
        helloManager.run();
    }
}*

But  when running it i get an error with no explanation.

(I have configured  one soft phone x-lite with 1 sip account 3000 ) and run
astrisk.
The login to the asterisk manager is successful.)
How can i add more SIP accounts to x-lite ?
How can i get more info about the error ?

Thanks  (and hope its not to much questions.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20090715/4daeddca/attachment.htm 


More information about the asterisk-dev mailing list