Thread: [Asterisk-java-users] Originating calls
Brought to you by:
srt
|
From: Laurent S. <lau...@pr...> - 2005-10-06 15:37:28
|
Hello,
I would like to make a small program that will be able:
1) to originate a call,
2) then send an audio message,
3) and finally hangup the call after X seconds.
I have search over the web and I found that the only way=20
to make spontaneous calls was to use the Asterisk manager.
Hence I am trying to use Asterisk-Java which offers among
others this fonctionality.
Currently I am encoutering the following problem. I succeed
to login to Asterisk and initiate a call (both with the OriginateAction
and with the originateCall method of AsteriskManager).
String remote =3D "SIP/laurent";
originateAction =3D new OriginateAction();
originateAction.setChannel(remote);
originateAction.setContext("from-sip");
originateAction.setExten("8");
originateAction.setPriority(new Integer(1));
originateAction.setTimeout(new Long(30000));
However in both methods I do not have as return value the identifier of =
the call (or channel).
(e.g.: SIP/laurent-b7485# )
Hence when I am trying to hangup the phone using the channel SIP/laurent =
I am obtaining
an error.=20
Is there any way to obtain easily the identifier of the channel?
Otherwise what do you suggest?
Just for information but I am planning to have simultaneous calls=20
to the same number.
Thanking you in advance for you help,
Laurent
|
|
From: Stefan R. <sr...@re...> - 2005-10-06 19:42:31
|
On Thu, 2005-10-06 at 17:37 +0200, Laurent Salagaras wrote: > Currently I am encoutering the following problem. I succeed > to login to Asterisk and initiate a call (both with the > OriginateAction > and with the originateCall method of AsteriskManager). > =20 [...] > However in both methods I do not have as return value the identifier > of the call (or channel). > (e.g.: SIP/laurent-b7485# ) originateCall() in AsteriskManager returns a Call object. call.getChannel().getName() will return what you are looking for. But another question: Do you really need to hangup the call via the Manager API or wouldn't it be easier to just hang up after playing the sound file (via dialplan or AGI or whatever you use) =3DStefan |
|
From: Laurent S. <lau...@pr...> - 2005-10-07 09:20:37
|
Hello Stefan,
First thank you for your quick answer.
I had already done that:
Call call = astManager.originateCall( origCall );
Channel ch = call.getChannel();
But the problem is that once the call has been established
the the result return by the 'call.getChannel();' sentence
is null.
Using the debuger I saw that most of the fields of the
'Call ' objects are null. None of them allows me to
make an association between the originateCall
and the resultant call.
Furthermore I tried to use the following method:
public void displayChannels( AsteriskManager astManager )
{
Map map = astManager.getChannels();
if( map.isEmpty() == true )
System.out.println( "The MAP is empty." );
System.out.println("Map content: " + map );
}
... but in my big surprise despite the fact that a call was
established no calls were available in the list.
Do you have any suggestions?
Please find hereafter my configuration:
- asterisk v1.0.9
- Asterisk-Java 0.2-rc1
For your question: Indeed I know that I could
hangup the application inside the diaplan. But
I want to keep the control logic at manager
level in order to be able to add other commands
as transfers, queueing ...
Thanking you in advance,
Laurent
----- Original Message -----
From: "Stefan Reuter" <sr...@re...>
To: <ast...@li...>
Sent: Thursday, October 06, 2005 9:42 PM
Subject: Re: [Asterisk-java-users] Originating calls
On Thu, 2005-10-06 at 17:37 +0200, Laurent Salagaras wrote:
> Currently I am encoutering the following problem. I succeed
> to login to Asterisk and initiate a call (both with the
> OriginateAction
> and with the originateCall method of AsteriskManager).
>
[...]
> However in both methods I do not have as return value the identifier
> of the call (or channel).
> (e.g.: SIP/laurent-b7485# )
originateCall() in AsteriskManager returns a Call object.
call.getChannel().getName() will return what you are looking for.
But another question:
Do you really need to hangup the call via the Manager API or wouldn't it
be easier to just hang up after playing the sound file (via dialplan or
AGI or whatever you use)
=Stefan
|
|
From: Stefan R. <sr...@re...> - 2005-10-10 02:59:24
|
On Fri, 2005-10-07 at 11:20 +0200, Laurent Salagaras wrote: > I had already done that: > Call call =3D astManager.originateCall( origCall ); > Channel ch =3D call.getChannel(); >=20 > But the problem is that once the call has been established > the the result return by the 'call.getChannel();' sentence > is null.=20 thats probably a bug. I created http://jira.reucon.org/browse/AJ-17 to keep track of it. =3DStefan |