asterisk-java-users Mailing List for Asterisk-Java Library (Page 148)
Brought to you by:
srt
You can subscribe to this list here.
2005 |
Jan
|
Feb
(8) |
Mar
(33) |
Apr
(36) |
May
(19) |
Jun
(21) |
Jul
(53) |
Aug
(30) |
Sep
(36) |
Oct
(34) |
Nov
(43) |
Dec
(72) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(123) |
Feb
(75) |
Mar
(86) |
Apr
(46) |
May
(41) |
Jun
(29) |
Jul
(76) |
Aug
(38) |
Sep
(39) |
Oct
(68) |
Nov
(16) |
Dec
(17) |
2007 |
Jan
(34) |
Feb
(18) |
Mar
(39) |
Apr
(30) |
May
(20) |
Jun
(10) |
Jul
(59) |
Aug
(54) |
Sep
(60) |
Oct
(22) |
Nov
(14) |
Dec
(10) |
2008 |
Jan
(34) |
Feb
(67) |
Mar
(65) |
Apr
(67) |
May
(60) |
Jun
(51) |
Jul
(88) |
Aug
(75) |
Sep
(47) |
Oct
(143) |
Nov
(54) |
Dec
(42) |
2009 |
Jan
(46) |
Feb
(80) |
Mar
(162) |
Apr
(159) |
May
(200) |
Jun
(34) |
Jul
(46) |
Aug
(59) |
Sep
(5) |
Oct
(35) |
Nov
(73) |
Dec
(30) |
2010 |
Jan
(23) |
Feb
(50) |
Mar
(8) |
Apr
(24) |
May
(19) |
Jun
(49) |
Jul
(56) |
Aug
(35) |
Sep
(26) |
Oct
(79) |
Nov
(39) |
Dec
(34) |
2011 |
Jan
(27) |
Feb
(22) |
Mar
(28) |
Apr
(12) |
May
(16) |
Jun
(19) |
Jul
(1) |
Aug
(64) |
Sep
(19) |
Oct
(11) |
Nov
(17) |
Dec
(12) |
2012 |
Jan
(6) |
Feb
(8) |
Mar
(15) |
Apr
(43) |
May
(41) |
Jun
(14) |
Jul
(32) |
Aug
(3) |
Sep
(4) |
Oct
(7) |
Nov
(11) |
Dec
(11) |
2013 |
Jan
(35) |
Feb
(11) |
Mar
(23) |
Apr
(25) |
May
(37) |
Jun
(47) |
Jul
(25) |
Aug
(21) |
Sep
|
Oct
(1) |
Nov
(9) |
Dec
|
2014 |
Jan
(26) |
Feb
(2) |
Mar
(18) |
Apr
(41) |
May
(7) |
Jun
(7) |
Jul
(24) |
Aug
(5) |
Sep
(6) |
Oct
(8) |
Nov
(9) |
Dec
(7) |
2015 |
Jan
(7) |
Feb
(15) |
Mar
(8) |
Apr
(12) |
May
(7) |
Jun
|
Jul
|
Aug
(5) |
Sep
(1) |
Oct
(3) |
Nov
(30) |
Dec
(3) |
2016 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
(4) |
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Stefan R. <sr...@re...> - 2006-07-06 08:49:24
|
Eduard Martinez wrote: > Another possible cause: > I'm doing Originate to a local channel, like Local@/XXXXX@outcoming > Originate extension then is s, context [connected] you can try setting the variables with two leading underscores (e.g. __callerId) this causes them to be interhited. I am unsure whether this works with Local/ channels though. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: unplug <mai...@gm...> - 2006-07-06 08:45:32
|
Hi, I follow the website tutorial to run HelloAGIScript. http://www.asteriskjava.org/latest/tutorial.html In my directory, I have the following files. fastagi-mapping.properties HelloAGIScript.java HelloAGIScript.class I have already located asterisk-java.jar in a classpath and I run the AGIServer as following. java -cp . net.sf.asterisk.fastagi.DefaultAGIServer server started Then I make a call to 1300 (which I have followed the example to configure the exten). But there is an error in the console. Jul 6, 2006 4:41:49 PM net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Received connection. Jul 6, 2006 4:41:49 PM net.sf.asterisk.util.impl.JavaLoggingLog error SEVERE: Resource bundle 'fastagi-mapping' is missing. Jul 6, 2006 4:41:49 PM net.sf.asterisk.util.impl.JavaLoggingLog error SEVERE: No script configured for URL 'agi://localhost/HelloAGIScript' (script 'HelloAGIScript') Anyone can tell me why AGIServer can't find fastagi-mapping.properties as it is located in the current directory which is also a classpath? What's wrong in the above setting? |
From: Eduard M. <ed...@ba...> - 2006-07-06 08:27:23
|
Maybe, tomorrow I will try upgrading to last bussines edition (I think is=20 equivalent to 1.2) El Jueves, 6 de Julio de 2006 10:25, Stefan Reuter escribi=F3: > Edu wrote: > > According to the logs, the version is Asterisk 1.0: > > > > 06-jul-2006 7:58:34 net.sf.asterisk.util.impl.JavaLoggingLog info > > INFO: Determined Asterisk version: Asterisk 1.0 > > > > Well, the production machine is not exactly Asterisk 1.0 but Asterisk > > Bussines Edition ABE-A.1-6 > > > > I will do more tests > > Is it possible that your version of Asterisk is considered to be > Asterisk 1.0 though it behaves as 1.2 regarding the handling of > variables in originate? > > =3DStefan |
From: Edu <jav...@ba...> - 2006-07-06 08:26:14
|
Another possible cause: I'm doing Originate to a local channel, like Local@/XXXXX@outcoming Originate extension then is s, context [connected] In extensions I have=20 [outcoming] exten =3D> _XXXX,1,UserEvent(LocalChannel) exten =3D> _XXXX,2,Dial(Zap/g2/${EXTEN}) exten =3D> _XXXX,3,Hangup [connected] exten =3D> s, 3,UserEvent(Foo| callId: ${callId}) I'm doing this things because with the LocalChannel userEvent I have the re= al=20 name of the local channel in my java application and I can cancel the=20 originate (hanging up this channel) and when is connected, Foo tells me the= =20 real zap channel answered. OriginateSuccesfulEvent doesn't tell me the real channel, and with originat= e=20 action with a Zap group channel I don't have the channel until is answered= =20 (so I can't cancel the originate while is ringing) El Jueves, 6 de Julio de 2006 10:05, Stefan Reuter escribi=F3: > Edu wrote: > > As commented in Asterisk wiki, Originate syntax and variables differ in > > 1.0 and 1.2, so I think that there is the problem so only want to confi= rm > > this behaviour :) > > Asterisk-Java takes this into account, so it usually works with 1.0 and > 1.2. Does Asterisk-Java recognize your production server as 1.0? > (according to the logs) > > =3DStefan |
From: Eduard M. <ed...@ba...> - 2006-07-06 08:25:51
|
Another possible cause: I'm doing Originate to a local channel, like Local@/XXXXX@outcoming Originate extension then is s, context [connected] In extensions I have=20 [outcoming] exten =3D> _XXXX,1,UserEvent(LocalChannel) exten =3D> _XXXX,2,Dial(Zap/g2/${EXTEN}) exten =3D> _XXXX,3,Hangup [connected] exten =3D> s, 3,UserEvent(Foo| callId: ${callId}) I'm doing this things because with the LocalChannel userEvent I have the re= al=20 name of the local channel in my java application and I can cancel the=20 originate (hanging up this channel) and when is connected, Foo tells me the= =20 real zap channel answered. OriginateSuccesfulEvent doesn't tell me the real channel, and with originat= e=20 action with a Zap group channel I don't have the channel until is answered= =20 (so I can't cancel the originate while is ringing) El Jueves, 6 de Julio de 2006 10:05, Stefan Reuter escribi=F3: > Edu wrote: > > As commented in Asterisk wiki, Originate syntax and variables differ in > > 1.0 and 1.2, so I think that there is the problem so only want to confi= rm > > this behaviour :) > > Asterisk-Java takes this into account, so it usually works with 1.0 and > 1.2. Does Asterisk-Java recognize your production server as 1.0? > (according to the logs) > > =3DStefan |
From: Stefan R. <sr...@re...> - 2006-07-06 08:25:30
|
Edu wrote: > According to the logs, the version is Asterisk 1.0: >=20 > 06-jul-2006 7:58:34 net.sf.asterisk.util.impl.JavaLoggingLog info > INFO: Determined Asterisk version: Asterisk 1.0 >=20 > Well, the production machine is not exactly Asterisk 1.0 but Asterisk B= ussines=20 > Edition ABE-A.1-6 >=20 > I will do more tests Is it possible that your version of Asterisk is considered to be Asterisk 1.0 though it behaves as 1.2 regarding the handling of variables in originate? =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: Edu <jav...@ba...> - 2006-07-06 08:12:31
|
According to the logs, the version is Asterisk 1.0: 06-jul-2006 7:58:34 net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Determined Asterisk version: Asterisk 1.0 Well, the production machine is not exactly Asterisk 1.0 but Asterisk Bussi= nes=20 Edition ABE-A.1-6 I will do more tests Edu El Jueves, 6 de Julio de 2006 10:05, Stefan Reuter escribi=F3: > Edu wrote: > > As commented in Asterisk wiki, Originate syntax and variables differ in > > 1.0 and 1.2, so I think that there is the problem so only want to confi= rm > > this behaviour :) > > Asterisk-Java takes this into account, so it usually works with 1.0 and > 1.2. Does Asterisk-Java recognize your production server as 1.0? > (according to the logs) > > =3DStefan |
From: Eduard M. <ed...@ba...> - 2006-07-06 08:11:58
|
According to the logs, the version is Asterisk 1.0: 06-jul-2006 7:58:34 net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Determined Asterisk version: Asterisk 1.0 Well, the production machine is not exactly Asterisk 1.0 but Asterisk Bussi= nes=20 Edition ABE-A.1-6 I will do more tests Edu El Jueves, 6 de Julio de 2006 10:05, Stefan Reuter escribi=F3: > Edu wrote: > > As commented in Asterisk wiki, Originate syntax and variables differ in > > 1.0 and 1.2, so I think that there is the problem so only want to confi= rm > > this behaviour :) > > Asterisk-Java takes this into account, so it usually works with 1.0 and > 1.2. Does Asterisk-Java recognize your production server as 1.0? > (according to the logs) > > =3DStefan |
From: Stefan R. <sr...@re...> - 2006-07-06 08:05:32
|
Edu wrote: > As commented in Asterisk wiki, Originate syntax and variables differ in= 1.0=20 > and 1.2, so I think that there is the problem so only want to confirm t= his=20 > behaviour :) Asterisk-Java takes this into account, so it usually works with 1.0 and 1.2. Does Asterisk-Java recognize your production server as 1.0? (according to the logs) =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: Edu <jav...@ba...> - 2006-07-06 07:33:10
|
I'm using Asterisk-java 0.2 and I want to put 3 variables in a originate action. In my devel machine with asterisk 1.2 works Ok, but in the production machine with asterisk 1.0 doesn't work. Example code: (...) Map<String,String> variables=new LinkedHashMap<String,String>(2); variables.put("callId",call.getIdCall()); while(i.hasNext())//Locuciones variables.put(LOCUTIONSNAME+(++n),i.next()); originate.setVariables(variables); And later, in extensions.conf I have an UserEvent like this: exten => s, 3,UserEvent(Foo| callId: ${callId}) As commented in Asterisk wiki, Originate syntax and variables differ in 1.0 and 1.2, so I think that there is the problem so only want to confirm this behaviour :) Regards, Edu |
From: Stefan R. <sr...@re...> - 2006-07-05 19:47:11
|
Haiyin Qiu wrote: > the user running the java program to connect asterisk server and then m= odify=20 > the sip.conf file No. You can use Realtime and modify the sip user database table programmatically though. > is there any difference between using AGI to connect the server and usi= ng=20 > manager API?=20 FastAGI is usually used to implement IVR like applications, the Manager API is used to get Asterisk's state, originate new calls, etc. > I check a little the asterisk-java package, some class are=20 > some implementation of fastAGI. Is it mean that if I program a java usi= ng=20 > the manager API to connect the server, then I can't use those classes? that's correct. > Does asterisk-java package only support the command of AGI and manager = AGI? Yes, what else could do you think it could/should support? =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Haiyin Q. <yan...@ho...> - 2006-07-05 19:38:07
|
In the asterisk-java package. it there any class or method that supports the function like below: the user running the java program to connect asterisk server and then modify the sip.conf file is there any difference between using AGI to connect the server and using manager API? I check a little the asterisk-java package, some class are some implementation of fastAGI. Is it mean that if I program a java using the manager API to connect the server, then I can't use those classes? Does asterisk-java package only support the command of AGI and manager AGI? Thanks _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
From: Stefan R. <sr...@re...> - 2006-06-28 10:42:52
|
Hi Oliver, Olivier wrote: > From reading Asterisk, the Future of Telephony, I understood that an > Asterisk server simply uses stdin, stdout and stderr files when calling= > an AGI script : > - Asterisk sends line of text like : > agi_request: test.py > agi_channel: Zap/1-1 >=20 > - Asterisk receives: > SET EXTENTION 122 > SET VARIABLE var1 150 It's not that easy. what goes on is more like: AGI Tx >> agi_network_script: test.agi AGI Tx >> agi_request: agi://endorsed/test.agi AGI Tx >> agi_channel: SIP/1310-f620 AGI Tx >> AGI Rx << ANSWER AGI Tx >> 200 result=3D0 AGI Rx << STREAM FILE "vm-instructions" "1" AGI Tx >> 200 result=3D49 endpos=3D45760 AGI Rx << HANGUP AGI Tx >> 200 result=3D1 So whenever you send a command asterisk sends a reply, this must be handled by your test driver. Therefore the far easier option is to use mock objects for testing and not dealing with I/O at all. I'll show you what this might look like for a simple example: You want to test this script: import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiException; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.AgiScript; public class MyAgiScript implements AgiScript { public void service(AgiRequest request, AgiChannel channel) throws AgiException { char choice; choice =3D channel.getOption("welcome-please-press-1", "1"); if (choice =3D=3D '1') { channel.streamFile("thank-you"); } else { channel.streamFile("you-didnt-do-what-i-said"); channel.hangup(); } } } so this is the JUnit test case: import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiRequest; import junit.framework.TestCase; import static org.easymock.EasyMock.*; public class MyAgiScriptTest extends TestCase { AgiRequest request; AgiChannel channel; MyAgiScript myAgiScript =3D new MyAgiScript(); public void setUp() { request =3D createMock(AgiRequest.class); channel =3D createMock(AgiChannel.class); } public void testServiceUserPresses1() throws Exception { // we expect the script to play 'welcome-please-press-1' and the // user presses 1 expect(channel.getOption("welcome-please-press-1", "1")).andReturn('1'); // next the script should say 'thank-you' channel.streamFile("thank-you"); // replay the mock object replay(channel); myAgiScript.service(request, channel); // and verify all expected methods have been called verify(channel); } public void testServiceUserPresses2() throws Exception { // we expect the script to play 'welcome-please-press-1' and the // user presses 2 expect(channel.getOption("welcome-please-press-1", "1")).andReturn('2'); // next the script should say 'you-didnt-do-what-i-said'... channel.streamFile("you-didnt-do-what-i-said"); // and hangup channel.hangup(); // replay the mock object replay(channel); myAgiScript.service(request, channel); // and verify all expected methods have been called verify(channel); } } You'll find more information about using mock objects in general and easymock in particular on easymocks homepage at http://www.easymock.org/.= =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: Olivier <oza...@my...> - 2006-06-28 09:55:40
|
Hi, (I'm new to the list and I couldn't find in the archive, anything answering my question. Please, forgive me if this question has already been answered) My question is "How can I test a FastAGI script without any Asterisk server ?". I would like to develop a CTI application. Ultimately, this CTI application will run on a dedicated server and exhange data with an Asterisk server and a database server on the same LAN. For the sake of simplicity, I would like to develop this CTI application independently from any Asterisk server : - I will develop a dummy call server - as long as the target CTI application receives from the dummy call server, the same input, it should reply to the dummy server, the same output, - I will just have to substitute the dummy server with a running Asterisk one to complete the setup. >From reading Asterisk, the Future of Telephony, I understood that an Asterisk server simply uses stdin, stdout and stderr files when calling an AGI script : - Asterisk sends line of text like : agi_request: test.py agi_channel: Zap/1-1 - Asterisk receives: SET EXTENTION 122 SET VARIABLE var1 150 So, from an AGI script perspective, a simple set of echo or cat commands behaves the same as a fully fledged Asterisk : echo "agi_request: test.py\nagi_channel: Zap/1-1\n\n" | myagiscript will print "SET EXTENTION 122\nSET VARIABLE var1 150\n\n" on stdout I'm searching the FastAGI equivalent. >From Asterisk the Future of Telephony, I know FastAGI uses TCP instead of stdin, stdout. Which program shall I use to simply output AGI data from a server through TCP ? Something like : mycmd "agi_request: test.py\nagi_channel: Zap/1-1\n\n" | myagiscript which would print "SET EXTENTION 122\nSET VARIABLE var1 150\n\n" somewhere. Regards |
From: Stefan R. <sr...@re...> - 2006-06-27 20:29:51
|
You can probably originate to the Dial application and use its D option: D([called][:calling]) - Send the specified DTMF strings *after* the called party has answered, but before the call gets bridged. The 'called' DTMF string is sent to the called party, and the 'calling' DTM= F string is sent to the calling party. Both parameters can be us= ed alone. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Forte, G. \(GFORTE\) <gf...@ar...> - 2006-06-26 17:29:26
|
Hello all, I was wondering if there was a way to do the following: =20 =20 I currently use the following method to join a conference =20 [code] { userID =3D "8505551212"; OriginateAction oAction; ManagerResponse mResponse; oAction =3D new OriginateAction(); oAction.setApplication("MeetMe"); oAction.setData(confID); oAction.setChannel(userID); oAction.setCallerId(callerID); oAction.setTimeout(new Long(30000)); oAction.setAsync(Boolean.TRUE); if(! managerConnection.isConnected()) { managerConnection.login(); } mResponse =3D managerConnection.sendAction(oAction,30000); managerConnection.logoff(); =20 } [/code] =20 This works fine. Now I have a device that interfaces with radios, it has a 9 digit number = 8505551211. Dial this number and you get the option to dial an extension = 100,101,102,103,etc.. for each radio. So if you dial the extension you = are connected to a radio. =20 I wanted to be able to use the method above but also dial the extension = so I need to dial 8505551212 wait N seconds and then dial the extension = 101. =20 My question is: is the setExten() method designed for this? If so how is this accomplished? If not is there a way to do this in *-J? If not I guess I can do this in the asterisk conf files with a extension = or something. =20 Thanks! |
From: Stefan R. <sr...@re...> - 2006-06-23 19:57:55
|
Hi Andrew, yes there is an issue with the reconnect logic that sometimes triggers the behavior you described. It is fixed in trunk and will be fixed in 0.3. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Andrew W. <an...@ji...> - 2006-06-23 16:58:01
|
Stefan, It looks like we be having problems disconnecting from asterisk in Asterisk-IM. The other day our wildfire instance crashed do to the following: "ManagerReader" prio=1 tid=0x085f2ae0 nid=0x1888 waiting for monitor entry [0x43deb000..0x43deb7f0] at net.sf.asterisk.manager.DefaultManagerConnection.disconnect (DefaultManagerConnection.java:582) - waiting to lock <0x72549e00> (a net.sf.asterisk.manager.DefaultManagerConnection) at net.sf.asterisk.manager.DefaultManagerConnection.reconnect (DefaultManagerConnection.java:1044) at net.sf.asterisk.manager.DefaultManagerConnection.dispatchEvent (DefaultManagerConnection.java:1001) at net.sf.asterisk.manager.impl.ManagerReaderImpl.run (ManagerReaderImpl.java:282) at java.lang.Thread.run(Thread.java:595) Asterisk-IM had more than 1K of threads at this spot, probably do to the plugin being reloaded. Do you have any idea why the connection isn't closing and the lock being released? thanks, Andrew |
From: <mar...@my...> - 2006-06-14 13:38:22
|
Hi there! When I sent more than one CommandAction, every List I recently got from getResult() will "point" to a last Result. That's a problem since it is not documented and can cause strange behaviour of some applications. I send a simple patch I did. Whoops. I forgot to send it last time ;) Here it is: Index: DefaultManagerConnection.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultManagerConnection.java,v retrieving revision 1.36 diff -u -r1.36 DefaultManagerConnection.java --- DefaultManagerConnection.java 10 Jan 2006 23:09:11 -0000 1.36 +++ DefaultManagerConnection.java 14 Jun 2006 13:09:13 -0000 @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.LinkedList; import java.util.Map; import net.sf.asterisk.AsteriskVersion; @@ -635,7 +636,10 @@ + action.getAction()); } } - + if (result.getResponse() instanceof CommandResponse) { + CommandResponse res = (CommandResponse) result.getResponse(); + res.setResult(new LinkedList(res.getResult())); + } return result.getResponse(); } |
From: <mar...@my...> - 2006-06-14 13:34:30
|
Hi there! When I sent more than one CommandAction, every List I recently got from getResult() will "point" to a last Result. That's a problem since it is not documented and can cause strange behaviour of some applications. I send a simple patch I did. |
From: idir a. <idi...@ho...> - 2006-06-12 08:52:09
|
Thank you for your reply Stefan. I understand now why i can't get anything from the SIP_CODEC variable.... So please just tell me if you know how to get information about the nature of a channel (video/audio). In brief, when a channel is set, i just want to know if there is video on this one. For the moment i'm interested in both ways: with or without the Manager API... Thank you very much dear Stefan Reuter |
From: Tony M. <to...@am...> - 2006-06-09 16:15:13
|
This is perhaps an asterisk question instead of an asterisk-java, but maybe someone here will know the answer. If I make two calls in a row to the same ZAP extension the second call fails with a "Channel Unavailable Exception". If I add in a delay of half a second between calls then the call will succeed. If the extension is a SIP extension then there is no problem. Below is my test code (ext 100 is my ZAP phone and 101 my SIP phone): package com.pbxworkbench; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import junit.framework.TestCase; import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.ChannelState; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.LiveException; import org.asteriskjava.live.OriginateCallback; import org.asteriskjava.manager.ManagerConnection; import org.asteriskjava.manager.ManagerConnectionFactory; public class AsteriskServerTest extends TestCase { private DefaultAsteriskServer server; protected void setUp() throws Exception { super.setUp(); ManagerConnectionFactory factory = new ManagerConnectionFactory( "192.168.2.150", "username", "password"); ManagerConnection connection = factory.createManagerConnection(); server = new DefaultAsteriskServer(connection); server.initialize(); } protected void tearDown() throws Exception { super.tearDown(); } /* * Test method for * */ public void testOriginate () throws Exception { MyOriginateCallback callback = new MyOriginateCallback(); server.originateToExtensionAsync( "local/100@default", "default", "101", 1, 30000, callback); callback.waitForCallEnd(); Thread.sleep(200); server.originateToExtensionAsync( "local/100@default", "default", "101", 1, 30000, callback); callback.waitForCallEnd(); } private class MyOriginateCallback implements OriginateCallback, PropertyChangeListener { Semaphore semaphore = new Semaphore(1); public MyOriginateCallback() { semaphore.drainPermits(); } public void waitForCallEnd() throws Exception { semaphore.tryAcquire(30, TimeUnit.SECONDS); semaphore.drainPermits(); } public void onSuccess(AsteriskChannel channel) { channel.addPropertyChangeListener(this); } public void onCallEnd() { System.out.println("call ended"); semaphore.release(); } public void onNoAnswer(AsteriskChannel channel) { System.out.println("no answer"); onCallEnd(); } public void onBusy(AsteriskChannel channel) { System.out.println("busy"); onCallEnd(); } public void onFailure(LiveException cause) { System.out.println("failure " + cause); onCallEnd(); } public void propertyChange(PropertyChangeEvent evt) { System.out.println(evt.getPropertyName() + "=" + evt.getNewValue()); if (ChannelState.HUNGUP.equals(evt.getNewValue())) { onCallEnd(); } } } } |
From: Stefan R. <sr...@re...> - 2006-06-09 11:17:37
|
Tony Mowers wrote: > I'm not sure if it is working as it should yet. If I call someone, who= is > using a SJPhone for example, and they hit their "ignore call" button th= en I > get an "onFailure" callback. I'd expect an "onBusy".=20 I have to check this with a softphone, and probably with a sip client that is not registered at all. It seems like this is treated the same way as a failure to a completely invalid channel. Hopefully we can see a difference for the two cases. > An "onFailure" makes > me think there is something wrong with the phone number, the trunk, or = some > such thing. Yes the only reason for onFailure i am aware of is an invalid channel. > I'd also kind of expect the onFailure to have a cause if > possible. Yes, I added a cause parameter (up to now this is always a NoSuchChannelException). > The property change listener also works for me. It seemed a little stra= nge > at first because I was expecting the natural listener with an onHangup = and > such. After I saw that there were several properties that could be obse= rved > I understood the reason for your choosing the property change listener.= I > think most other people will understand too. ok. plus its always the same for observing channels, meetme users and so on. will need a good example ;) =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: Tony M. <to...@am...> - 2006-06-09 11:01:30
|
This change makes sense to me. -----Original Message----- From: ast...@li... [mailto:ast...@li...] On Behalf Of Stefan Reuter Sent: Friday, June 09, 2006 4:12 AM To: ast...@li... Subject: Re: [Asterisk-java-users] Asterisk Live Stefan Reuter wrote: > Tony Mowers wrote: >> I am guessing that in theory it would now be possible for you to throw an >> Exception with the origination failure cause contained in the exception. In >> that case you'd never have to return AsteriskChannel = null. >> >> Is that the plan? > > Yes that might be done. - Probably a good idea! I changed it to throw a NoSuchChannelException instead of returning null. A ManagerCommunictionException indicates a lower level problem, i.e. something is wrong with the connection to the Manager API like not being connected. =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Tony M. <to...@am...> - 2006-06-09 11:00:59
|
The new async OriginateCallback method will work for me. I'm not sure if it is working as it should yet. If I call someone, who is using a SJPhone for example, and they hit their "ignore call" button then I get an "onFailure" callback. I'd expect an "onBusy". An "onFailure" makes me think there is something wrong with the phone number, the trunk, or some such thing. I'd also kind of expect the onFailure to have a cause if possible. The property change listener also works for me. It seemed a little strange at first because I was expecting the natural listener with an onHangup and such. After I saw that there were several properties that could be observed I understood the reason for your choosing the property change listener. I think most other people will understand too. -----Original Message----- From: ast...@li... [mailto:ast...@li...] On Behalf Of Stefan Reuter Sent: Friday, June 09, 2006 4:28 AM To: ast...@li... Subject: Re: [Asterisk-java-users] originateCall in AsteriskManager > The types of things I'd like to watch for are: > - Originating channel was created (I didn't screw up with channel data) > - Origination information was incorrect and call ended > - Originating channel was congested and so call aborted > - Alerting is happening on originating channel > - Origination alerting timed out > - Originator has answered > - Another channel has been linked to call > - A channel in the call is being alerted > - A channel in the call has answered > - One of the channels has hung-up or failed > - Call has ended With the new async originate methods, do you think things are better now? Do you like the OriginateCallback and the PropertyChangeListener or does it feel strange to register a PropertyChangeListener and you would expect to have a more "natural" listener for channel changes with methods like onNewState or even onHangup and so on? =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |