asterisk-java-users Mailing List for Asterisk-Java Library (Page 108)
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: Vincent L. <vin...@he...> - 2008-07-20 19:35:08
|
Hello, this post is related to the one posted by Svante Paldan and replied by Martin Smith I have just subscribed to the mailing list so I cannot reply to previous message. sorry about that. I would be very interested if by somehow Svante has found a solution to the problem. I am exactly at the same point and I have tried all the different packaging I could think of. I am using eclipse to package things as EAR or EJB3-JAR as needed. My first attempt was to package everything in a ear project (one jar for asterisk-java, one ejb3-jar for the server, one ejb3-jar for the script, the fastagi-mapping.properties everywhere in the ear...to be sure) : asterisk-java-1.0.0-m1.jar theServer.jar (AgiMgtMBean.class, AgiMgt.class, AgiMgt$AgiServerThread.class) theScript.jar (HelloAgiScript.class) The second attempt was to package the server classes and the script class in the same java package in the same ejb3-jar. And put the asterisk-java-1.0.0-m1.jar in the lib directory of the server. Again I also put fastagi-mapping.properties everywhere (everywhere in the ejb3-jar and also in the conf directory). In both cases result is the same : at deployment I get an encouraging : 20:37:44,105 INFO [DefaultAgiServer] Listening on *:4573. but when I actually make the call on asterisk I get : 20:37:57,057 INFO [DefaultAgiServer] Received connection from /127.0.0.1 20:37:57,084 ERROR [ClassNameMappingStrategy] Unable to create AgiScript instance of type hello.agi: Class not found, make sure the class exists and is available on the CLASSPATH 20:37:57,084 ERROR [AgiConnectionHandler] No script configured for URL 'agi://localhost/hello.agi' (script 'hello.agi') I have the feeling that fastagi-mapping.properties is not really taken into account because the script class is in the same package as the 3 server classes and this should prevent any classpath problem. I have made a brillant copy-paste from http://asterisk-java.org/development/faq.html : THE SERVER CLASS : package fr.helmet.asterisk.test; import java.io.IOException; import org.apache.log4j.Logger; import org.asteriskjava.fastagi.AgiServer; import org.asteriskjava.fastagi.ClassNameMappingStrategy; import org.asteriskjava.fastagi.DefaultAgiServer; import org.jboss.annotation.ejb.Depends; import org.jboss.annotation.ejb.Management; import org.jboss.annotation.ejb.Service; //@Depends({"JNDI name of anything your Agi scripts depend on"}) @Management(AgiMgtMBean.class) @Service public class AgiMgt implements AgiMgtMBean { private static final Logger log = Logger.getLogger(AgiMgt.class); private AgiServerThread agiServerThread = null; class AgiServerThread extends Thread implements Runnable { private AgiServer agiServer; public AgiServerThread(AgiServer agiServer) { this.agiServer = agiServer; } public void run() { try { agiServer.startup(); log.info("Asterisk Gatway Interface server MBean has been started"); } catch (IOException e) // NOPMD { // nothing we can do about that and exceptions have already been // logged by startup(). log.trace("Exception from startUp(), probably already logged", e); } } public AgiServer getAgiServer() { return agiServer; } } public void start() throws Exception { try { // get agi server & start it DefaultAgiServer agiServer = new DefaultAgiServer(); agiServer.setMappingStrategy(new ClassNameMappingStrategy(false)); agiServerThread = new AgiServerThread(agiServer); agiServerThread.start(); } catch (Exception ex) { log.error("Startup failed in MBean AgiMBean -- attempting to continue", ex); } } /** * Note that on JBoss 4.0.5, this method is accidentally called twice by JBoss. It is a known bug; reports can be found at: * <p> * http://jira.jboss.org/jira/browse/EJBTHREE-711<br/> * http://jira.jboss.org/jira/browse/EJBTHREE-766<br/> * http://jira.jboss.org/jira/browse/EJBTHREE-781<br/> */ public void stop() throws Exception { if (agiServerThread != null && agiServerThread.getAgiServer() != null) { agiServerThread.getAgiServer().shutdown(); } } } THE SERVER INTERFACE package fr.helmet.asterisk.test; public interface AgiMgtMBean { public void start() throws Exception; public void stop() throws Exception; } THE AGI SCRIPT : package fr.helmet.asterisk.test; //import java.util.logging.Logger; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiException; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.BaseAgiScript; import org.asteriskjava.util.internal.Log4JLogger; public class HelloAgiScript extends BaseAgiScript { private static final Logger logger = Logger.getLogger(HelloAgiScript.class); public void service(AgiRequest request, AgiChannel channel) throws AgiException { // Answer the channel... answer(); logger.info("pause"); waitForDigit(20000); logger.info("resume"); // ...say hello... streamFile("welcome"); // ...and hangup. hangup(); } } Thank you for your help regards vincent |
From: Gaëtan M. <gm...@ea...> - 2008-07-18 15:56:22
|
Hi Jeff It depends on how you started the music on hold. I think the simpler solution is to start it asynchronously and have the thread sleep/wait. If you're using AGI, maybe you're looking for something like the StartMusicOnHold([class]) and StopMusicOnHold() dialplan applications ? With astaerisk-java, you can exec them through AgiChannel or use the builtin agi command in AgiChannel: public void playMusicOnHold(String musicOnHoldClass) throws AgiException { sendCommand(new SetMusicOnCommand(musicOnHoldClass)); } public void stopMusicOnHold() throws AgiException { sendCommand(new SetMusicOffCommand()); } In your case: 1. StartMusicOnHold() 2. while ( ! isDone() && ! timeout ) { sleep 1 second } 3. StopMusicOnHold() or better use wait() and signal the agi thread when done. Kind regards Gaetan On 18/07/2008, at 12:21, Jeff Li wrote: > Hi *, > > I need to stop the being played wait-by music as soon as an external > task is finished. I was wondering that if there is some apps like > Monitor() ,which I can signal it on before checking the status of > the task and then signal it off when the status is available. > > Or anyone has some sophisticated solution to help? > > Thanks, > -- > Jeff > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Jeff L. <ll...@gm...> - 2008-07-18 10:21:14
|
Hi *, I need to stop the being played wait-by music as soon as an external task is finished. I was wondering that if there is some apps like Monitor() ,which I can signal it on before checking the status of the task and then signal it off when the status is available. Or anyone has some sophisticated solution to help? Thanks, -- Jeff |
From: Carlos G M. <tr...@hu...> - 2008-07-17 17:23:23
|
FTR, I changed my logic to follow calls. I generate calls using originate, where the channel is Local and the extension points to "handler" of call, as has been discussed elsewhere. What I do now, to track call progress, is to keep a reference (UniqueId) to the Local channel involved, and another reference (Channel name) of the actual channel doing the dialing. The first reference tracks Local 2 (the one on the dialing side) and I get the reference from the Dial event, source UniqueID. The same event provides the outgoing channel name (destination). The way I use to get the right Dial event is by using a unique callerId pattern in the originate request and then look for it. Newstate events on the dialing channel track the call progress. Hangup events on the local uniqueId track end of call attempt. When the call is connected, a Rename from Local 1 to dialing channel takes place. I use that event to update the unique id reference to the Local 1 side, now with the name of the dialing channel. Seems to be working... -Carlos Carlos G Mendioroz @ 15/7/2008 11:12 -0300 dixit: > Yep, Stefan's link is good material. > I read it throughly a while back. > But it seems some assumptions I made where not all that happy. > > I do track all events, renames included. But I thought that only > one channel was important. This is actually false. > I need to look at real channels for progressing information, > but I have to keep a reference to the local channel up to the > time they vanish (i.e. call connected). > > My bad. I will try to see what is the way it's implemented in live. > > Thanks, > -Carlos > > Martin Smith @ 15/7/2008 10:26 -0300 dixit: >> Hi Carlos, >> >> There *should* be enough Manager events for you to follow the progress >> through local channels and subsequent dials. Are you only looking at >> Hangup events? >> >> I would think you'd be able to follow channel renames through as one >> endpoint of the local channel becomes each new Dial() channel (each >> endpoint is a proxy for another channel). >> >> I presume you could also: set a channel variable when you're done with >> whatever retry logic (this could also be a loop counter), examine the >> last extension and priority of a call to determine which dial succeeded >> and if it was the last one. >> >> Stefan's blog article at >> http://blogs.reucon.com/asterisk-java/2007/04/18/originate_using_asteris >> k_local_channels.html demonstrates a single iteration of the logic you'd >> probably need to use. >> >> Cheers, >> >> Martin Smith, Systems Developer >> ma...@be... >> Bureau of Economic and Business Research >> University of Florida >> (352) 392-0171 Ext. 221 >> >> >> >>> -----Original Message----- >>> From: ast...@li... >>> [mailto:ast...@li...] On >>> Behalf Of Carlos G Mendioroz >>> Sent: Monday, July 14, 2008 6:24 PM >>> To: ast...@li... >>> Subject: Re: [Asterisk-java-users] How to tell... >>> >>> Hi Martin, thanks for answering! >>> >>> I'm not using Live API, I'm using manager directly... >>> >>> -Carlos >>> >>> Martin Smith @ 14/07/2008 18:17 -0300 dixit: >>>> Hi Carlos, >>>> >>>> As you're actually making more than one call, I think the >>> best way for >>>> now to tell what is happening is not using the Live API. It >>> has no way >>>> of knowing that two distinct Dial() events are the same >>> call. It only >>>> made one of them :) >>>> >>>> Perhaps someone can correct me if I'm wrong... :) >>>> >>>> Martin Smith, Systems Developer >>>> ma...@be... >>>> Bureau of Economic and Business Research >>>> University of Florida >>>> (352) 392-0171 Ext. 221 >>>> >>>> >>>> >>>>> -----Original Message----- >>>>> From: ast...@li... >>>>> [mailto:ast...@li...] On >>>>> Behalf Of Carlos G Mendioroz >>>>> Sent: Sunday, July 13, 2008 6:45 PM >>>>> To: ast...@li... >>>>> Subject: [Asterisk-java-users] How to tell... >>>>> >>>>> if originated call has failed "for good" ? >>>>> >>>>> Ok, it's hard to put it in a simple sentence :) >>>>> I'm originating a call using manager's originateAction, and then >>>>> monitoring its progress via events. Now, I assume that if I receive >>>>> a HangupEvent, that is indicative that there was something >>> wrong with >>>>> the call (after a successfull originate, but w/o a >>>>> intervening connect). >>>>> >>>>> I thought this was ok, but now I have a "smart" extensions >>>>> programming >>>>> that actually retries the call when some errors are >>> signalled by the >>>>> carrier (using another carrier). >>>>> Net result, I believe that the call did not get through, but the >>>>> retry did work and the call was delivered. >>>>> >>>>> Is there any way to tell if a call is being "controlled" >>> by extension >>>>> programming ? >>>>> >>>>> -- >>>>> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >>>>> >>>>> -------------------------------------------------------------- >>>>> ----------- >>>>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>>>> Studies have shown that voting for your favorite open >>> source project, >>>>> along with a healthy diet, reduces your potential for >>> chronic lameness >>>>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>>>> _______________________________________________ >>>>> Asterisk-java-users mailing list >>>>> Ast...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>>> >>> -------------------------------------------------------------- >>> ----------- >>>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>>> Studies have shown that voting for your favorite open >>> source project, >>>> along with a healthy diet, reduces your potential for >>> chronic lameness >>>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>>> _______________________________________________ >>>> Asterisk-java-users mailing list >>>> Ast...@li... >>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>> -- >>> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >>> >>> -------------------------------------------------------------- >>> ----------- >>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>> Studies have shown that voting for your favorite open source project, >>> along with a healthy diet, reduces your potential for chronic lameness >>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Carlos G M. <tr...@hu...> - 2008-07-15 14:12:00
|
Yep, Stefan's link is good material. I read it throughly a while back. But it seems some assumptions I made where not all that happy. I do track all events, renames included. But I thought that only one channel was important. This is actually false. I need to look at real channels for progressing information, but I have to keep a reference to the local channel up to the time they vanish (i.e. call connected). My bad. I will try to see what is the way it's implemented in live. Thanks, -Carlos Martin Smith @ 15/7/2008 10:26 -0300 dixit: > Hi Carlos, > > There *should* be enough Manager events for you to follow the progress > through local channels and subsequent dials. Are you only looking at > Hangup events? > > I would think you'd be able to follow channel renames through as one > endpoint of the local channel becomes each new Dial() channel (each > endpoint is a proxy for another channel). > > I presume you could also: set a channel variable when you're done with > whatever retry logic (this could also be a loop counter), examine the > last extension and priority of a call to determine which dial succeeded > and if it was the last one. > > Stefan's blog article at > http://blogs.reucon.com/asterisk-java/2007/04/18/originate_using_asteris > k_local_channels.html demonstrates a single iteration of the logic you'd > probably need to use. > > Cheers, > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > >> -----Original Message----- >> From: ast...@li... >> [mailto:ast...@li...] On >> Behalf Of Carlos G Mendioroz >> Sent: Monday, July 14, 2008 6:24 PM >> To: ast...@li... >> Subject: Re: [Asterisk-java-users] How to tell... >> >> Hi Martin, thanks for answering! >> >> I'm not using Live API, I'm using manager directly... >> >> -Carlos >> >> Martin Smith @ 14/07/2008 18:17 -0300 dixit: >>> Hi Carlos, >>> >>> As you're actually making more than one call, I think the >> best way for >>> now to tell what is happening is not using the Live API. It >> has no way >>> of knowing that two distinct Dial() events are the same >> call. It only >>> made one of them :) >>> >>> Perhaps someone can correct me if I'm wrong... :) >>> >>> Martin Smith, Systems Developer >>> ma...@be... >>> Bureau of Economic and Business Research >>> University of Florida >>> (352) 392-0171 Ext. 221 >>> >>> >>> >>>> -----Original Message----- >>>> From: ast...@li... >>>> [mailto:ast...@li...] On >>>> Behalf Of Carlos G Mendioroz >>>> Sent: Sunday, July 13, 2008 6:45 PM >>>> To: ast...@li... >>>> Subject: [Asterisk-java-users] How to tell... >>>> >>>> if originated call has failed "for good" ? >>>> >>>> Ok, it's hard to put it in a simple sentence :) >>>> I'm originating a call using manager's originateAction, and then >>>> monitoring its progress via events. Now, I assume that if I receive >>>> a HangupEvent, that is indicative that there was something >> wrong with >>>> the call (after a successfull originate, but w/o a >>>> intervening connect). >>>> >>>> I thought this was ok, but now I have a "smart" extensions >>>> programming >>>> that actually retries the call when some errors are >> signalled by the >>>> carrier (using another carrier). >>>> Net result, I believe that the call did not get through, but the >>>> retry did work and the call was delivered. >>>> >>>> Is there any way to tell if a call is being "controlled" >> by extension >>>> programming ? >>>> >>>> -- >>>> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >>>> >>>> -------------------------------------------------------------- >>>> ----------- >>>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>>> Studies have shown that voting for your favorite open >> source project, >>>> along with a healthy diet, reduces your potential for >> chronic lameness >>>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>>> _______________________________________________ >>>> Asterisk-java-users mailing list >>>> Ast...@li... >>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>> >> -------------------------------------------------------------- >> ----------- >>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>> Studies have shown that voting for your favorite open >> source project, >>> along with a healthy diet, reduces your potential for >> chronic lameness >>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >> -- >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >> >> -------------------------------------------------------------- >> ----------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Johan S. <js...@sv...> - 2008-07-15 14:00:46
|
Hi Martin, Logging is good now, no multiple entries anymore. I will look into these alternative suggestions instead of using AsteriskServer. But for now, I'd like to keep a connection to _one_ DefaultAsteriskServer instead (shared by all threads), since my project is running late here :-) One thing happened though with the new shared solution, and I have no idea how to deal with it, maybe you do? I create only one connection now, and all threads are sharing this DefaultAsteriskServer-object. Correct? Anyway, if no thread uses the connection for a while, I get this in the log, "[internal.ManagerConnectionImpl] INFO - Closing socket." Every call using this object of DefaultAsteriskServer hereafter fails, of course. How can I make it reconnect automatically, or keep the socket up, or find out IF it still is connected, so I can reconnect it on demand? Or am I working things the wrong unintended way? Greetings, Johan -----Ursprungligt meddelande----- Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 15 juli 2008 15:11 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] [SPAM] - Re: ConfusingAsterisk-JavaDaemonPoolbehavior - Email found in subject -Email found in subject - Email found in subject Hi Johan, You said you need AsteriskServer to redirect the channel somewhere else. Can you use AgiChannel's setContext, setExtension, and setPriority methods to move the channel to a different part of the dialplan? You could also you use exec() to call the Dial application here. I only use setPriority heavily for my use case, but I am assuming those other methods will bring your call anywhere else it needs to go. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Tuesday, July 15, 2008 3:14 AM > To: ast...@li... > Subject: Re: [Asterisk-java-users] [SPAM] - Re: Confusing > Asterisk-JavaDaemonPoolbehavior - Email found in subject - > Email found in subject > > Hi Martin, > > > I think you are great at seeing things! What a pleasure to > get answer from you! :-) > > I will definitely move the code opening a connection to an > AsteriskServer out of my threadcode, true, it's clearly > enough with one shared connection, now when I see things with > your eyes :) > > > > You asked me about this line: > AsteriskChannel incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > Is talking to asteriskServer to "convert" the incoming > AgiChannel to an AsteriskChannel instead because an > "asteriskChannel"-reference to the same channel gives me more > functions to call, like 'redirect call 'which I use. > > If there is another way of doing this, or to be able to > redirect calls with a reference to an AgiChanne, I would be > glad to know. Or I can keep the way I do it, but with the > important change you taught me. > > The function I did not include was this one: > > protected static AsteriskChannel > getChannelFromAsteriskServer ( > String channelName, AsteriskServer > asteriskServer) throws ManagerCommunicationException > { > AsteriskChannel channel = null; > for (AsteriskChannel asteriskChannel > : asteriskServer.getChannels()) > { > // Checks if the name matches > the incoming string: > if > ((asteriskChannel.getName().compareTo(channelName) == 0)) > { > channel = asteriskChannel; > } > } > return channel; > } > > > > Sincerely, > Johan > > > -----Ursprungligt meddelande----- > Från: ast...@li... > [mailto:ast...@li...] > För Martin Smith > Skickat: den 14 juli 2008 23:29 > Till: ast...@li... > Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing > Asterisk-JavaDaemonPoolbehavior - Email found in subject - > Email found in subject > > Hi Johan, > > It looks like you really create a new DefaultAsteriskServer > for every single Agi request. You can configure them to all > start from the same manager connection, but you haven't done > so. But either way, *every* event in Asterisk will be sent to > *every* Manager connection you have open. In your case, a > pool of 10 AgiScript instances waiting to handle requests > would all have 10 manager connections open. If you had 10 > calls made using a context with 10 priorities, you'd already > be at 1,000 events sent from Asterisk to your Java program. > > This won't scale, and it repeats the same information through > mutliple connections. You really want to keep a single > ManagerConnection open for the duration of your program's > execution. What you're seeing in the console is System.out > calls from different threads. Because of the nature of > System.out, they will be intermingled and you will also not > see everything until the buffer is flushed for System.out. > This probably matches up exactly with what you're experiencing. > > Further, I've noticed you have some lines like: > AsteriskChannel incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > Since I don't really know what you're doing here, I can't > really give you suggestions for a way around your problem, > other than to say that I think you can probably find a > solution that does *not* require passing around the > asteriskServer in this fashion. > > > At the *very* least, use a shared lock to a single instance > of the AsteriskServer since it has *nothing* to do with a > particular Agi script and can exist without them. I urge you > to take these AsteriskServer instances out of your threads > (the Agi scripts will almost always be in a threadpool > dispatcher) -- the sheer overhead of connecting and > reconnecting will significantly lower the capacity of > Asterisk and your application. > > Cheers, > > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > > > ________________________________ > > From: > ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Saturday, July 12, 2008 11:29 AM > To: ast...@li... > Subject: Re: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPoolbehavior - Email found in subject > > > > Hi Martin, > > > > Ok, now I've tried to give you a view on my used > files (running debian) from how I make asterisk connect to my > java program upon an incoming call, > > and the code my javaprogram uses to connect/close to > an asteriskServer. > > Yes, it's true I need a connection to an > asteriskServer, since I need some features it provides J > There is more code, but I guessed it won't be relevant, since > it's at startup I get these triple connections. It's not > always they occur, note this. > > > > > I've tried to arrange the info neatly below, hope > it's easy to read J > > > > Thanks for wanting to help! > > /Johan > > > > > > > > File: /etc/asterisk/extensions.conf > > > > (...) > > [Incoming] > > exten => s,1,Set(DYNAMIC_FEATURES=hangup) > > exten => s,2,Agi(agi://localhost/answer.agi) > > ;exten => s,3,Hangup > > > > > > File: /home/user/fastagi-mapping.properties > > hangup.agi = com.test.Hangup > > answer.agi = com.test.Answer > > errorcheckingcall.agi = com.ErrorCheckingCall > > > > File: Answer.java > > > > package com.test.Answer; > > import java.io.IOException; > > import java.util.InvalidPropertiesFormatException; > > import org.asteriskjava.fastagi.AgiChannel; > > import org.asteriskjava.fastagi.AgiRequest; > > import org.asteriskjava.fastagi.BaseAgiScript; > > import org.apache.log4j.Logger; > > > > public class Answer extends BaseAgiScript { > > private static final > Logger logger = Logger.getLogger(Answer.class); > > public Answer() > > { > > > logger.debug("Answer.java-Answer() constructor called"); > > } > > > > public void > service(AgiRequest request, AgiChannel agiChannel) > > { > > try > > { > > > CallHandler = new CallHandler(); > > > handler.service(request, agiChannel); > > > handler = null; > > > } catch (InvalidPropertiesFormatException ivfe ) { > > > // TODO: handle exception > > > }catch (IOException ie) > > { > > > // TODO: handle exception > > } > > } > > } > > > > > > File: Answer.java > > > > package com.callManager; > > imports (..) > > > > public class CallManager{ > > // Variables > > AsteriskChannel > incomingChannel = null; > > private AgiRequest > currentAgiRequest; > > private AgiChannel > currentAgiChannel; > > private > DefaultAsteriskServer asteriskServer; > > > > public CallManager() > throws IOException > > { > > > asteriskServer = new DefaultAsteriskServer("localhost", > "user", "pwd"); > > } > > > > public void > service(AgiRequest agiRequest, AgiChannel agiChannel) > > { > > if(dbApi.getSystemPaused()) > > { > > logger.debug("System > in pause, call will be hungup"); > > agiRequest = null; > > try { > > > agiChannel.answer(); > > > agiChannel.hangup(); > > } > catch(AgiException ae) {} > > agiChannel = null; > > shutdown(); > > return; > > } > > } > > > > private void shutdown() > > { > > incomingChannel = null; > > > > dbApi.shutdown(); > > dbApi = null; > > > > if(asteriskServer!=null) > > asteriskServer.shutdown(); > > } > > > > } > > > > > > File: Hangup.java > > package com.callmanager; > > > > import (...) > > > > public class Hangup extends BaseAgiScript { > > > > private > DefaultAsteriskServer asteriskServer; > > > > public Hangup() throws > IOException { > > > asteriskServer = new DefaultAsteriskServer("localhost", > "user", "pwd"); > > } > > > > public void > service(AgiRequest request, AgiChannel agiChannel) { > > > > > String incomingChannelName = agiChannel.getName(); > > > > > // Todo: titta på om vi inte kan slippa skapa en > asteriskServer-connection... spara resources > > > // agiChannel.sendCommand(arg0) > > > > > try { > > > AsteriskChannel > incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > > if (incomingChannel != null) > > { > > > > (some code using this incomingChannel...) > > > > > } > > > Thread.sleep(300); > > > agiChannel.hangup(); > > > agiChannel = null; > > > if(dbApi!=null) > > > { > > > > dbApi.shutdown(); > > > > dbApi = null; > > > } > > } > > > } catch (ManagerCommunicationException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (SQLException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (AgiException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (InterruptedException e) { > > > // TODO Auto-generated catch block > > > e.printStackTrace(); > > } > > > > } > > > > > > > > /Johan > > > > > > Från: > ast...@li... > [mailto:ast...@li...] > För Martin Smith > Skickat: den 11 juli 2008 15:22 > Till: ast...@li... > Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPoolbehavior - Email found in subject > > > > Hi Johan, > > > > Thanks for reposting :) > > > > The channel manager messages you are seeing are from > the Live component keeping track of channels through the > manager interface. > > > > Yet, your code sample is an Agi script. Your Zap > messages are before your Agi request is dispatched to a > script. The Live and the Agi components of our library do not > interact -- so I can only assume you have some code that is > connecting them up. I wouldn't be surprised if you are > creating 3 AsteriskServer objects, all separately keeping > track of state in the server, giving you your extra messages. > > > > If you're only running Agi scripts, you shouldn't > need to instantiate an AsteriskServer at all. If you do need > to use both Live and AGI functionality, can we see the > methods/lines that first create/connect your Asterisk-Java > objects like AgiServer and AsteriskServer, so we can see what > you get 3 messages? > > > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > > > > ________________________________ > > From: > ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Friday, July 11, 2008 7:10 AM > To: ast...@li... > Subject: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPool behavior > > Hi again, sorry for making the erranous post > earlier, new try! :-) > > You got an idea of what is going wrong here? > I get a call to Zap/3 and my javaprogram is called. > Look at my log output below, I get multiple > Adding channel Zap/3 and multiple Removing... > > Is asterisk multiplying itself? > I don't really know what this DaemonPool is > really, anyone can explain? > > public class Answer extends BaseAgiScript { > > public void service(AgiRequest > agiRequest, AgiChannel agiChannel) > { > if(dbApi.getSystemPaused()) > { > logger.debug("System > paused, call will be hungup"); > agiRequest = null; > try { > agiChannel.answer(); > agiChannel.hangup(); > } > catch(AgiException ae) {} > agiChannel = null; > shutdown(); > // freeing db-resources, etc > return; > } > } > > LOG > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-4-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-2-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-3-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [WrapperSimpleAppMain] > [fastagi.DefaultAgiServer] INFO - Received connection from > /127.0.0.1 > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO > - Begin AgiScript com.test.Answer on Asterisk-Java > DaemonPool-1-thread-9 > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System > in pause, call will be hungup > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-4-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-3-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-2-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO > - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 > > > /Johan > > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users _______ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Martin S. <ma...@be...> - 2008-07-15 13:26:27
|
Hi Carlos, There *should* be enough Manager events for you to follow the progress through local channels and subsequent dials. Are you only looking at Hangup events? I would think you'd be able to follow channel renames through as one endpoint of the local channel becomes each new Dial() channel (each endpoint is a proxy for another channel). I presume you could also: set a channel variable when you're done with whatever retry logic (this could also be a loop counter), examine the last extension and priority of a call to determine which dial succeeded and if it was the last one. Stefan's blog article at http://blogs.reucon.com/asterisk-java/2007/04/18/originate_using_asteris k_local_channels.html demonstrates a single iteration of the logic you'd probably need to use. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Carlos G Mendioroz > Sent: Monday, July 14, 2008 6:24 PM > To: ast...@li... > Subject: Re: [Asterisk-java-users] How to tell... > > Hi Martin, thanks for answering! > > I'm not using Live API, I'm using manager directly... > > -Carlos > > Martin Smith @ 14/07/2008 18:17 -0300 dixit: > > Hi Carlos, > > > > As you're actually making more than one call, I think the > best way for > > now to tell what is happening is not using the Live API. It > has no way > > of knowing that two distinct Dial() events are the same > call. It only > > made one of them :) > > > > Perhaps someone can correct me if I'm wrong... :) > > > > Martin Smith, Systems Developer > > ma...@be... > > Bureau of Economic and Business Research > > University of Florida > > (352) 392-0171 Ext. 221 > > > > > > > >> -----Original Message----- > >> From: ast...@li... > >> [mailto:ast...@li...] On > >> Behalf Of Carlos G Mendioroz > >> Sent: Sunday, July 13, 2008 6:45 PM > >> To: ast...@li... > >> Subject: [Asterisk-java-users] How to tell... > >> > >> if originated call has failed "for good" ? > >> > >> Ok, it's hard to put it in a simple sentence :) > >> I'm originating a call using manager's originateAction, and then > >> monitoring its progress via events. Now, I assume that if I receive > >> a HangupEvent, that is indicative that there was something > wrong with > >> the call (after a successfull originate, but w/o a > >> intervening connect). > >> > >> I thought this was ok, but now I have a "smart" extensions > >> programming > >> that actually retries the call when some errors are > signalled by the > >> carrier (using another carrier). > >> Net result, I believe that the call did not get through, but the > >> retry did work and the call was delivered. > >> > >> Is there any way to tell if a call is being "controlled" > by extension > >> programming ? > >> > >> -- > >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > >> > >> -------------------------------------------------------------- > >> ----------- > >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > >> Studies have shown that voting for your favorite open > source project, > >> along with a healthy diet, reduces your potential for > chronic lameness > >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > >> _______________________________________________ > >> Asterisk-java-users mailing list > >> Ast...@li... > >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > >> > > > > > -------------------------------------------------------------- > ----------- > > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > Studies have shown that voting for your favorite open > source project, > > along with a healthy diet, reduces your potential for > chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > -- > Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |
From: Martin S. <ma...@be...> - 2008-07-15 13:11:03
|
Hi Johan, You said you need AsteriskServer to redirect the channel somewhere else. Can you use AgiChannel's setContext, setExtension, and setPriority methods to move the channel to a different part of the dialplan? You could also you use exec() to call the Dial application here. I only use setPriority heavily for my use case, but I am assuming those other methods will bring your call anywhere else it needs to go. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Tuesday, July 15, 2008 3:14 AM > To: ast...@li... > Subject: Re: [Asterisk-java-users] [SPAM] - Re: Confusing > Asterisk-JavaDaemonPoolbehavior - Email found in subject - > Email found in subject > > Hi Martin, > > > I think you are great at seeing things! What a pleasure to > get answer from you! :-) > > I will definitely move the code opening a connection to an > AsteriskServer out of my threadcode, true, it's clearly > enough with one shared connection, now when I see things with > your eyes :) > > > > You asked me about this line: > AsteriskChannel incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > Is talking to asteriskServer to "convert" the incoming > AgiChannel to an AsteriskChannel instead because an > "asteriskChannel"-reference to the same channel gives me more > functions to call, like 'redirect call 'which I use. > > If there is another way of doing this, or to be able to > redirect calls with a reference to an AgiChanne, I would be > glad to know. Or I can keep the way I do it, but with the > important change you taught me. > > The function I did not include was this one: > > protected static AsteriskChannel > getChannelFromAsteriskServer ( > String channelName, AsteriskServer > asteriskServer) throws ManagerCommunicationException > { > AsteriskChannel channel = null; > for (AsteriskChannel asteriskChannel > : asteriskServer.getChannels()) > { > // Checks if the name matches > the incoming string: > if > ((asteriskChannel.getName().compareTo(channelName) == 0)) > { > channel = asteriskChannel; > } > } > return channel; > } > > > > Sincerely, > Johan > > > -----Ursprungligt meddelande----- > Från: ast...@li... > [mailto:ast...@li...] > För Martin Smith > Skickat: den 14 juli 2008 23:29 > Till: ast...@li... > Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing > Asterisk-JavaDaemonPoolbehavior - Email found in subject - > Email found in subject > > Hi Johan, > > It looks like you really create a new DefaultAsteriskServer > for every single Agi request. You can configure them to all > start from the same manager connection, but you haven't done > so. But either way, *every* event in Asterisk will be sent to > *every* Manager connection you have open. In your case, a > pool of 10 AgiScript instances waiting to handle requests > would all have 10 manager connections open. If you had 10 > calls made using a context with 10 priorities, you'd already > be at 1,000 events sent from Asterisk to your Java program. > > This won't scale, and it repeats the same information through > mutliple connections. You really want to keep a single > ManagerConnection open for the duration of your program's > execution. What you're seeing in the console is System.out > calls from different threads. Because of the nature of > System.out, they will be intermingled and you will also not > see everything until the buffer is flushed for System.out. > This probably matches up exactly with what you're experiencing. > > Further, I've noticed you have some lines like: > AsteriskChannel incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > Since I don't really know what you're doing here, I can't > really give you suggestions for a way around your problem, > other than to say that I think you can probably find a > solution that does *not* require passing around the > asteriskServer in this fashion. > > > At the *very* least, use a shared lock to a single instance > of the AsteriskServer since it has *nothing* to do with a > particular Agi script and can exist without them. I urge you > to take these AsteriskServer instances out of your threads > (the Agi scripts will almost always be in a threadpool > dispatcher) -- the sheer overhead of connecting and > reconnecting will significantly lower the capacity of > Asterisk and your application. > > Cheers, > > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > > > ________________________________ > > From: > ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Saturday, July 12, 2008 11:29 AM > To: ast...@li... > Subject: Re: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPoolbehavior - Email found in subject > > > > Hi Martin, > > > > Ok, now I've tried to give you a view on my used > files (running debian) from how I make asterisk connect to my > java program upon an incoming call, > > and the code my javaprogram uses to connect/close to > an asteriskServer. > > Yes, it's true I need a connection to an > asteriskServer, since I need some features it provides J > There is more code, but I guessed it won't be relevant, since > it's at startup I get these triple connections. It's not > always they occur, note this. > > > > > I've tried to arrange the info neatly below, hope > it's easy to read J > > > > Thanks for wanting to help! > > /Johan > > > > > > > > File: /etc/asterisk/extensions.conf > > > > (...) > > [Incoming] > > exten => s,1,Set(DYNAMIC_FEATURES=hangup) > > exten => s,2,Agi(agi://localhost/answer.agi) > > ;exten => s,3,Hangup > > > > > > File: /home/user/fastagi-mapping.properties > > hangup.agi = com.test.Hangup > > answer.agi = com.test.Answer > > errorcheckingcall.agi = com.ErrorCheckingCall > > > > File: Answer.java > > > > package com.test.Answer; > > import java.io.IOException; > > import java.util.InvalidPropertiesFormatException; > > import org.asteriskjava.fastagi.AgiChannel; > > import org.asteriskjava.fastagi.AgiRequest; > > import org.asteriskjava.fastagi.BaseAgiScript; > > import org.apache.log4j.Logger; > > > > public class Answer extends BaseAgiScript { > > private static final > Logger logger = Logger.getLogger(Answer.class); > > public Answer() > > { > > > logger.debug("Answer.java-Answer() constructor called"); > > } > > > > public void > service(AgiRequest request, AgiChannel agiChannel) > > { > > try > > { > > > CallHandler = new CallHandler(); > > > handler.service(request, agiChannel); > > > handler = null; > > > } catch (InvalidPropertiesFormatException ivfe ) { > > > // TODO: handle exception > > > }catch (IOException ie) > > { > > > // TODO: handle exception > > } > > } > > } > > > > > > File: Answer.java > > > > package com.callManager; > > imports (..) > > > > public class CallManager{ > > // Variables > > AsteriskChannel > incomingChannel = null; > > private AgiRequest > currentAgiRequest; > > private AgiChannel > currentAgiChannel; > > private > DefaultAsteriskServer asteriskServer; > > > > public CallManager() > throws IOException > > { > > > asteriskServer = new DefaultAsteriskServer("localhost", > "user", "pwd"); > > } > > > > public void > service(AgiRequest agiRequest, AgiChannel agiChannel) > > { > > if(dbApi.getSystemPaused()) > > { > > logger.debug("System > in pause, call will be hungup"); > > agiRequest = null; > > try { > > > agiChannel.answer(); > > > agiChannel.hangup(); > > } > catch(AgiException ae) {} > > agiChannel = null; > > shutdown(); > > return; > > } > > } > > > > private void shutdown() > > { > > incomingChannel = null; > > > > dbApi.shutdown(); > > dbApi = null; > > > > if(asteriskServer!=null) > > asteriskServer.shutdown(); > > } > > > > } > > > > > > File: Hangup.java > > package com.callmanager; > > > > import (...) > > > > public class Hangup extends BaseAgiScript { > > > > private > DefaultAsteriskServer asteriskServer; > > > > public Hangup() throws > IOException { > > > asteriskServer = new DefaultAsteriskServer("localhost", > "user", "pwd"); > > } > > > > public void > service(AgiRequest request, AgiChannel agiChannel) { > > > > > String incomingChannelName = agiChannel.getName(); > > > > > // Todo: titta på om vi inte kan slippa skapa en > asteriskServer-connection... spara resources > > > // agiChannel.sendCommand(arg0) > > > > > try { > > > AsteriskChannel > incomingChannel = > some_function_ive_not_included(incomingChannelName, asteriskServer); > > > if (incomingChannel != null) > > { > > > > (some code using this incomingChannel...) > > > > > } > > > Thread.sleep(300); > > > agiChannel.hangup(); > > > agiChannel = null; > > > if(dbApi!=null) > > > { > > > > dbApi.shutdown(); > > > > dbApi = null; > > > } > > } > > > } catch (ManagerCommunicationException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (SQLException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (AgiException e) { > > > // logger.fatal(e.getMessage()); > > > } catch (InterruptedException e) { > > > // TODO Auto-generated catch block > > > e.printStackTrace(); > > } > > > > } > > > > > > > > /Johan > > > > > > Från: > ast...@li... > [mailto:ast...@li...] > För Martin Smith > Skickat: den 11 juli 2008 15:22 > Till: ast...@li... > Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPoolbehavior - Email found in subject > > > > Hi Johan, > > > > Thanks for reposting :) > > > > The channel manager messages you are seeing are from > the Live component keeping track of channels through the > manager interface. > > > > Yet, your code sample is an Agi script. Your Zap > messages are before your Agi request is dispatched to a > script. The Live and the Agi components of our library do not > interact -- so I can only assume you have some code that is > connecting them up. I wouldn't be surprised if you are > creating 3 AsteriskServer objects, all separately keeping > track of state in the server, giving you your extra messages. > > > > If you're only running Agi scripts, you shouldn't > need to instantiate an AsteriskServer at all. If you do need > to use both Live and AGI functionality, can we see the > methods/lines that first create/connect your Asterisk-Java > objects like AgiServer and AsteriskServer, so we can see what > you get 3 messages? > > > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > > > > ________________________________ > > From: > ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Friday, July 11, 2008 7:10 AM > To: ast...@li... > Subject: [Asterisk-java-users] Confusing > Asterisk-Java DaemonPool behavior > > Hi again, sorry for making the erranous post > earlier, new try! :-) > > You got an idea of what is going wrong here? > I get a call to Zap/3 and my javaprogram is called. > Look at my log output below, I get multiple > Adding channel Zap/3 and multiple Removing... > > Is asterisk multiplying itself? > I don't really know what this DaemonPool is > really, anyone can explain? > > public class Answer extends BaseAgiScript { > > public void service(AgiRequest > agiRequest, AgiChannel agiChannel) > { > if(dbApi.getSystemPaused()) > { > logger.debug("System > paused, call will be hungup"); > agiRequest = null; > try { > agiChannel.answer(); > agiChannel.hangup(); > } > catch(AgiException ae) {} > agiChannel = null; > shutdown(); > // freeing db-resources, etc > return; > } > } > > LOG > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-4-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-2-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-3-thread-1] [internal.ChannelManager] INFO - > Adding channel Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [WrapperSimpleAppMain] > [fastagi.DefaultAgiServer] INFO - Received connection from > /127.0.0.1 > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO > - Begin AgiScript com.test.Answer on Asterisk-Java > DaemonPool-1-thread-9 > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System > in pause, call will be hungup > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-4-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-3-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-2-thread-1] [internal.ChannelManager] INFO - > Removing channel Zap/3-1 due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java > DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO > - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 > > > /Johan > > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |
From: Johan S. <js...@sv...> - 2008-07-15 07:11:37
|
Hi Martin, I think you are great at seeing things! What a pleasure to get answer from you! :-) I will definitely move the code opening a connection to an AsteriskServer out of my threadcode, true, it's clearly enough with one shared connection, now when I see things with your eyes :) You asked me about this line: AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); Is talking to asteriskServer to "convert" the incoming AgiChannel to an AsteriskChannel instead because an "asteriskChannel"-reference to the same channel gives me more functions to call, like 'redirect call 'which I use. If there is another way of doing this, or to be able to redirect calls with a reference to an AgiChanne, I would be glad to know. Or I can keep the way I do it, but with the important change you taught me. The function I did not include was this one: protected static AsteriskChannel getChannelFromAsteriskServer ( String channelName, AsteriskServer asteriskServer) throws ManagerCommunicationException { AsteriskChannel channel = null; for (AsteriskChannel asteriskChannel : asteriskServer.getChannels()) { // Checks if the name matches the incoming string: if ((asteriskChannel.getName().compareTo(channelName) == 0)) { channel = asteriskChannel; } } return channel; } Sincerely, Johan -----Ursprungligt meddelande----- Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 14 juli 2008 23:29 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing Asterisk-JavaDaemonPoolbehavior - Email found in subject - Email found in subject Hi Johan, It looks like you really create a new DefaultAsteriskServer for every single Agi request. You can configure them to all start from the same manager connection, but you haven't done so. But either way, *every* event in Asterisk will be sent to *every* Manager connection you have open. In your case, a pool of 10 AgiScript instances waiting to handle requests would all have 10 manager connections open. If you had 10 calls made using a context with 10 priorities, you'd already be at 1,000 events sent from Asterisk to your Java program. This won't scale, and it repeats the same information through mutliple connections. You really want to keep a single ManagerConnection open for the duration of your program's execution. What you're seeing in the console is System.out calls from different threads. Because of the nature of System.out, they will be intermingled and you will also not see everything until the buffer is flushed for System.out. This probably matches up exactly with what you're experiencing. Further, I've noticed you have some lines like: AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); Since I don't really know what you're doing here, I can't really give you suggestions for a way around your problem, other than to say that I think you can probably find a solution that does *not* require passing around the asteriskServer in this fashion. At the *very* least, use a shared lock to a single instance of the AsteriskServer since it has *nothing* to do with a particular Agi script and can exist without them. I urge you to take these AsteriskServer instances out of your threads (the Agi scripts will almost always be in a threadpool dispatcher) -- the sheer overhead of connecting and reconnecting will significantly lower the capacity of Asterisk and your application. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Saturday, July 12, 2008 11:29 AM To: ast...@li... Subject: Re: [Asterisk-java-users] Confusing Asterisk-Java DaemonPoolbehavior - Email found in subject Hi Martin, Ok, now I've tried to give you a view on my used files (running debian) from how I make asterisk connect to my java program upon an incoming call, and the code my javaprogram uses to connect/close to an asteriskServer. Yes, it's true I need a connection to an asteriskServer, since I need some features it provides J There is more code, but I guessed it won't be relevant, since it's at startup I get these triple connections. It's not always they occur, note this. I've tried to arrange the info neatly below, hope it's easy to read J Thanks for wanting to help! /Johan File: /etc/asterisk/extensions.conf (...) [Incoming] exten => s,1,Set(DYNAMIC_FEATURES=hangup) exten => s,2,Agi(agi://localhost/answer.agi) ;exten => s,3,Hangup File: /home/user/fastagi-mapping.properties hangup.agi = com.test.Hangup answer.agi = com.test.Answer errorcheckingcall.agi = com.ErrorCheckingCall File: Answer.java package com.test.Answer; import java.io.IOException; import java.util.InvalidPropertiesFormatException; import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.BaseAgiScript; import org.apache.log4j.Logger; public class Answer extends BaseAgiScript { private static final Logger logger = Logger.getLogger(Answer.class); public Answer() { logger.debug("Answer.java-Answer() constructor called"); } public void service(AgiRequest request, AgiChannel agiChannel) { try { CallHandler = new CallHandler(); handler.service(request, agiChannel); handler = null; } catch (InvalidPropertiesFormatException ivfe ) { // TODO: handle exception }catch (IOException ie) { // TODO: handle exception } } } File: Answer.java package com.callManager; imports (..) public class CallManager{ // Variables AsteriskChannel incomingChannel = null; private AgiRequest currentAgiRequest; private AgiChannel currentAgiChannel; private DefaultAsteriskServer asteriskServer; public CallManager() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System in pause, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); return; } } private void shutdown() { incomingChannel = null; dbApi.shutdown(); dbApi = null; if(asteriskServer!=null) asteriskServer.shutdown(); } } File: Hangup.java package com.callmanager; import (...) public class Hangup extends BaseAgiScript { private DefaultAsteriskServer asteriskServer; public Hangup() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest request, AgiChannel agiChannel) { String incomingChannelName = agiChannel.getName(); // Todo: titta på om vi inte kan slippa skapa en asteriskServer-connection... spara resources // agiChannel.sendCommand(arg0) try { AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); if (incomingChannel != null) { (some code using this incomingChannel...) } Thread.sleep(300); agiChannel.hangup(); agiChannel = null; if(dbApi!=null) { dbApi.shutdown(); dbApi = null; } } } catch (ManagerCommunicationException e) { // logger.fatal(e.getMessage()); } catch (SQLException e) { // logger.fatal(e.getMessage()); } catch (AgiException e) { // logger.fatal(e.getMessage()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /Johan Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 11 juli 2008 15:22 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing Asterisk-Java DaemonPoolbehavior - Email found in subject Hi Johan, Thanks for reposting :) The channel manager messages you are seeing are from the Live component keeping track of channels through the manager interface. Yet, your code sample is an Agi script. Your Zap messages are before your Agi request is dispatched to a script. The Live and the Agi components of our library do not interact -- so I can only assume you have some code that is connecting them up. I wouldn't be surprised if you are creating 3 AsteriskServer objects, all separately keeping track of state in the server, giving you your extra messages. If you're only running Agi scripts, you shouldn't need to instantiate an AsteriskServer at all. If you do need to use both Live and AGI functionality, can we see the methods/lines that first create/connect your Asterisk-Java objects like AgiServer and AsteriskServer, so we can see what you get 3 messages? Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Friday, July 11, 2008 7:10 AM To: ast...@li... Subject: [Asterisk-java-users] Confusing Asterisk-Java DaemonPool behavior Hi again, sorry for making the erranous post earlier, new try! :-) You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Carlos G M. <tr...@hu...> - 2008-07-15 00:17:03
|
As I said in my first message, problem arises because I have a "smart" extensions that retries a call that fails at first. I've been doing this for months and it was just last Friday that I discovered the thing :( (I called someone some 50 times bacause the system did not know that the call was getting through, so he was VERY helpfull in pointing that there was some problem) Thameem Ansari @ 14/07/2008 20:54 -0300 dixit: > I do the exact same in my application and didn't find any issues. I am > using the Local channels to initiate the call and track them using events. > > -Thameem > > --- On *Mon, 7/14/08, Carlos G Mendioroz /<tr...@hu...>/* wrote: > > From: Carlos G Mendioroz <tr...@hu...> > Subject: Re: [Asterisk-java-users] How to tell... > To: tha...@ya..., ast...@li... > Date: Monday, July 14, 2008, 4:10 PM > > Thameem, > asterisk does not terminate calls, and calls need two ends, so originate > actually fires two half calls, so to say (two channels): > one is specified as extension/prio and the other is specifies as > channel/destination. Asterisk tries to setup the later, and > when > successfull, it bridges that to the specified extension/priority. > > In order to do outbound calls, I'm using the local channel to bounce the > first call into extensions logic. And I do follow events that are > generated to track what's going on. > > I hope this clears my problem... > > -Carlos > > Thameem Ansari @ 14/07/2008 20:01 -0300 dixit: > > You have mentioned that you are using asterisk dialplan to control the > > call or make it success if there is a busy or congestion from the > > carrier. I believe when you originate a call from manager api, it will > > be placed to an extension with priority. You will never receive a hangup > > event if the dialplan extension still trying to send the call before > > hangup. If the call is hungup then asterisk immediately closes the > channel. > > > > If you want to track whats going on with the channel you just > > originated, why don't you > use actionid and query the asterisk via > apis? > > > > -Thameem > > > > --- On *Mon, 7/14/08, Carlos G Mendioroz /<tr...@hu...>/* > wrote: > > > > From: Carlos G Mendioroz <tr...@hu...> > > Subject: Re: [Asterisk-java-users] How to tell... > > To: ast...@li... > > Date: Monday, July 14, 2008, 3:24 PM > > > > Hi Martin, thanks for answering! > > > > I'm not using Live API, I'm using manager directly... > > > > -Carlos > > > > Martin Smith @ 14/07/2008 18:17 -0300 dixit: > > > Hi Carlos, > > > > > > As you're actually making more than one call, I think the > best way for > > > now to tell what is happening is not using the Live API. It has > no way > > > of knowing that two distinct Dial() events are the same call. It > only > > > > made one of them :) > > > > > > Perhaps someone can correct me if I'm wrong... :) > > > > > > Martin Smith, Systems Developer > > > ma...@be... > > > Bureau of Economic and Business Research > > > University of Florida > > > (352) 392-0171 Ext. 221 > > > > > > > > > > > >> -----Original Message----- > > >> From: ast...@li... > > >> > > [mailto:ast...@li...] On > > >> Behalf Of Carlos G Mendioroz > > >> Sent: Sunday, July 13, 2008 6:45 PM > > >> To: ast...@li... > > >> Subject: [Asterisk-java-users] How to tell... > > >> > > >> if originated call has failed "for good" ? > > > >> > > >> Ok, it's hard to put it in a simple sentence :) > > >> I'm originating a call using manager's > originateAction, and > > then > > >> monitoring its progress via events. Now, I assume that if I > receive > > >> a HangupEvent, that is indicative that there was something > wrong with > > >> the call (after a successfull originate, but w/o a > > >> intervening connect). > > >> > > >> I thought this was ok, but now I have a "smart" > extensions > > >> programming > > >> that actually retries the call when some errors are signalled > by the > > >> carrier (using > > another carrier). > > >> Net result, I believe that the call did not get through, but > the > > >> retry did work and the call was delivered. > > >> > > > >> Is there any way to tell if a call is being > "controlled" by > > extension > > >> programming ? > > >> > > >> -- > > >> Carlos G Mendioroz <tr...@hu...> LW7 EQI > Argentina > > >> > > >> > -------------------------------------------------------------- > > >> ----------- > > >> Sponsored by: SourceForge.net Community Choice Awards: VOTE > NOW! > > >> Studies have shown that voting for your favorite open source > project, > > >> along with a healthy diet, reduces your potential for chronic > lameness > > >> and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > > >> _______________________________________________ > > >> Asterisk-java-users mailing list > > >> > > > Ast...@li... > > >> > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > >> > > > > > > > ------------------------------------------------------------------------- > > > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > > Studies have shown that voting for your favorite open source > project, > > > along with a healthy diet, reduces your potential for chronic > lameness > > > and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > > > _______________________________________________ > > > Asterisk-java-users mailing list > > > Ast...@li... > > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > > > -- > > Carlos G Mendioroz > <tr...@hu...> LW7 EQI Argentina > > > > > ------------------------------------------------------------------------- > > Sponsored by: SourceForge.net Community Choice > > Awards: VOTE NOW! > > Studies have shown that voting for your favorite open source project, > > along with a healthy diet, reduces your potential for chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move > Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -- > Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Thameem A. <tha...@ya...> - 2008-07-14 23:54:01
|
I do the exact same in my application and didn't find any issues. I am using the Local channels to initiate the call and track them using events. -Thameem --- On Mon, 7/14/08, Carlos G Mendioroz <tr...@hu...> wrote: From: Carlos G Mendioroz <tr...@hu...> Subject: Re: [Asterisk-java-users] How to tell... To: tha...@ya..., ast...@li... Date: Monday, July 14, 2008, 4:10 PM Thameem, asterisk does not terminate calls, and calls need two ends, so originate actually fires two half calls, so to say (two channels): one is specified as extension/prio and the other is specifies as channel/destination. Asterisk tries to setup the later, and when successfull, it bridges that to the specified extension/priority. In order to do outbound calls, I'm using the local channel to bounce the first call into extensions logic. And I do follow events that are generated to track what's going on. I hope this clears my problem... -Carlos Thameem Ansari @ 14/07/2008 20:01 -0300 dixit: > You have mentioned that you are using asterisk dialplan to control the > call or make it success if there is a busy or congestion from the > carrier. I believe when you originate a call from manager api, it will > be placed to an extension with priority. You will never receive a hangup > event if the dialplan extension still trying to send the call before > hangup. If the call is hungup then asterisk immediately closes the channel. > > If you want to track whats going on with the channel you just > originated, why don't you use actionid and query the asterisk via apis? > > -Thameem > > --- On *Mon, 7/14/08, Carlos G Mendioroz /<tr...@hu...>/* wrote: > > From: Carlos G Mendioroz <tr...@hu...> > Subject: Re: [Asterisk-java-users] How to tell... > To: ast...@li... > Date: Monday, July 14, 2008, 3:24 PM > > Hi Martin, thanks for answering! > > I'm not using Live API, I'm using manager directly... > > -Carlos > > Martin Smith @ 14/07/2008 18:17 -0300 dixit: > > Hi Carlos, > > > > As you're actually making more than one call, I think the best way for > > now to tell what is happening is not using the Live API. It has no way > > of knowing that two distinct Dial() events are the same call. It only > > made one of them :) > > > > Perhaps someone can correct me if I'm wrong... :) > > > > Martin Smith, Systems Developer > > ma...@be... > > Bureau of Economic and Business Research > > University of Florida > > (352) 392-0171 Ext. 221 > > > > > > > >> -----Original Message----- > >> From: ast...@li... > >> > [mailto:ast...@li...] On > >> Behalf Of Carlos G Mendioroz > >> Sent: Sunday, July 13, 2008 6:45 PM > >> To: ast...@li... > >> Subject: [Asterisk-java-users] How to tell... > >> > >> if originated call has failed "for good" ? > >> > >> Ok, it's hard to put it in a simple sentence :) > >> I'm originating a call using manager's originateAction, and > then > >> monitoring its progress via events. Now, I assume that if I receive > >> a HangupEvent, that is indicative that there was something wrong with > >> the call (after a successfull originate, but w/o a > >> intervening connect). > >> > >> I thought this was ok, but now I have a "smart" extensions > >> programming > >> that actually retries the call when some errors are signalled by the > >> carrier (using > another carrier). > >> Net result, I believe that the call did not get through, but the > >> retry did work and the call was delivered. > >> > >> Is there any way to tell if a call is being "controlled" by > extension > >> programming ? > >> > >> -- > >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > >> > >> -------------------------------------------------------------- > >> ----------- > >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > >> Studies have shown that voting for your favorite open source project, > >> along with a healthy diet, reduces your potential for chronic lameness > >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > >> _______________________________________________ > >> Asterisk-java-users mailing list > >> > Ast...@li... > >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > >> > > > > ------------------------------------------------------------------------- > > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > Studies have shown that voting for your favorite open source project, > > along with a healthy diet, reduces your potential for chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > -- > Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice > Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Carlos G M. <tr...@hu...> - 2008-07-14 23:10:47
|
Thameem, asterisk does not terminate calls, and calls need two ends, so originate actually fires two half calls, so to say (two channels): one is specified as extension/prio and the other is specifies as channel/destination. Asterisk tries to setup the later, and when successfull, it bridges that to the specified extension/priority. In order to do outbound calls, I'm using the local channel to bounce the first call into extensions logic. And I do follow events that are generated to track what's going on. I hope this clears my problem... -Carlos Thameem Ansari @ 14/07/2008 20:01 -0300 dixit: > You have mentioned that you are using asterisk dialplan to control the > call or make it success if there is a busy or congestion from the > carrier. I believe when you originate a call from manager api, it will > be placed to an extension with priority. You will never receive a hangup > event if the dialplan extension still trying to send the call before > hangup. If the call is hungup then asterisk immediately closes the channel. > > If you want to track whats going on with the channel you just > originated, why don't you use actionid and query the asterisk via apis? > > -Thameem > > --- On *Mon, 7/14/08, Carlos G Mendioroz /<tr...@hu...>/* wrote: > > From: Carlos G Mendioroz <tr...@hu...> > Subject: Re: [Asterisk-java-users] How to tell... > To: ast...@li... > Date: Monday, July 14, 2008, 3:24 PM > > Hi Martin, thanks for answering! > > I'm not using Live API, I'm using manager directly... > > -Carlos > > Martin Smith @ 14/07/2008 18:17 -0300 dixit: > > Hi Carlos, > > > > As you're actually making more than one call, I think the best way for > > now to tell what is happening is not using the Live API. It has no way > > of knowing that two distinct Dial() events are the same call. It only > > made one of them :) > > > > Perhaps someone can correct me if I'm wrong... :) > > > > Martin Smith, Systems Developer > > ma...@be... > > Bureau of Economic and Business Research > > University of Florida > > (352) 392-0171 Ext. 221 > > > > > > > >> -----Original Message----- > >> From: ast...@li... > >> > [mailto:ast...@li...] On > >> Behalf Of Carlos G Mendioroz > >> Sent: Sunday, July 13, 2008 6:45 PM > >> To: ast...@li... > >> Subject: [Asterisk-java-users] How to tell... > >> > >> if originated call has failed "for good" ? > >> > >> Ok, it's hard to put it in a simple sentence :) > >> I'm originating a call using manager's originateAction, and > then > >> monitoring its progress via events. Now, I assume that if I receive > >> a HangupEvent, that is indicative that there was something wrong with > >> the call (after a successfull originate, but w/o a > >> intervening connect). > >> > >> I thought this was ok, but now I have a "smart" extensions > >> programming > >> that actually retries the call when some errors are signalled by the > >> carrier (using > another carrier). > >> Net result, I believe that the call did not get through, but the > >> retry did work and the call was delivered. > >> > >> Is there any way to tell if a call is being "controlled" by > extension > >> programming ? > >> > >> -- > >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > >> > >> -------------------------------------------------------------- > >> ----------- > >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > >> Studies have shown that voting for your favorite open source project, > >> along with a healthy diet, reduces your potential for chronic lameness > >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > >> _______________________________________________ > >> Asterisk-java-users mailing list > >> > Ast...@li... > >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > >> > > > > ------------------------------------------------------------------------- > > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > Studies have shown that voting for your favorite open source project, > > along with a healthy diet, reduces your potential for chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > -- > Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice > Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Thameem A. <tha...@ya...> - 2008-07-14 23:01:03
|
You have mentioned that you are using asterisk dialplan to control the call or make it success if there is a busy or congestion from the carrier. I believe when you originate a call from manager api, it will be placed to an extension with priority. You will never receive a hangup event if the dialplan extension still trying to send the call before hangup. If the call is hungup then asterisk immediately closes the channel. If you want to track whats going on with the channel you just originated, why don't you use actionid and query the asterisk via apis? -Thameem --- On Mon, 7/14/08, Carlos G Mendioroz <tr...@hu...> wrote: From: Carlos G Mendioroz <tr...@hu...> Subject: Re: [Asterisk-java-users] How to tell... To: ast...@li... Date: Monday, July 14, 2008, 3:24 PM Hi Martin, thanks for answering! I'm not using Live API, I'm using manager directly... -Carlos Martin Smith @ 14/07/2008 18:17 -0300 dixit: > Hi Carlos, > > As you're actually making more than one call, I think the best way for > now to tell what is happening is not using the Live API. It has no way > of knowing that two distinct Dial() events are the same call. It only > made one of them :) > > Perhaps someone can correct me if I'm wrong... :) > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > >> -----Original Message----- >> From: ast...@li... >> [mailto:ast...@li...] On >> Behalf Of Carlos G Mendioroz >> Sent: Sunday, July 13, 2008 6:45 PM >> To: ast...@li... >> Subject: [Asterisk-java-users] How to tell... >> >> if originated call has failed "for good" ? >> >> Ok, it's hard to put it in a simple sentence :) >> I'm originating a call using manager's originateAction, and then >> monitoring its progress via events. Now, I assume that if I receive >> a HangupEvent, that is indicative that there was something wrong with >> the call (after a successfull originate, but w/o a >> intervening connect). >> >> I thought this was ok, but now I have a "smart" extensions >> programming >> that actually retries the call when some errors are signalled by the >> carrier (using another carrier). >> Net result, I believe that the call did not get through, but the >> retry did work and the call was delivered. >> >> Is there any way to tell if a call is being "controlled" by extension >> programming ? >> >> -- >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >> >> -------------------------------------------------------------- >> ----------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Carlos G M. <tr...@hu...> - 2008-07-14 22:24:27
|
Hi Martin, thanks for answering! I'm not using Live API, I'm using manager directly... -Carlos Martin Smith @ 14/07/2008 18:17 -0300 dixit: > Hi Carlos, > > As you're actually making more than one call, I think the best way for > now to tell what is happening is not using the Live API. It has no way > of knowing that two distinct Dial() events are the same call. It only > made one of them :) > > Perhaps someone can correct me if I'm wrong... :) > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > >> -----Original Message----- >> From: ast...@li... >> [mailto:ast...@li...] On >> Behalf Of Carlos G Mendioroz >> Sent: Sunday, July 13, 2008 6:45 PM >> To: ast...@li... >> Subject: [Asterisk-java-users] How to tell... >> >> if originated call has failed "for good" ? >> >> Ok, it's hard to put it in a simple sentence :) >> I'm originating a call using manager's originateAction, and then >> monitoring its progress via events. Now, I assume that if I receive >> a HangupEvent, that is indicative that there was something wrong with >> the call (after a successfull originate, but w/o a >> intervening connect). >> >> I thought this was ok, but now I have a "smart" extensions >> programming >> that actually retries the call when some errors are signalled by the >> carrier (using another carrier). >> Net result, I believe that the call did not get through, but the >> retry did work and the call was delivered. >> >> Is there any way to tell if a call is being "controlled" by extension >> programming ? >> >> -- >> Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina >> >> -------------------------------------------------------------- >> ----------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Martin S. <ma...@be...> - 2008-07-14 21:28:49
|
Hi Johan, It looks like you really create a new DefaultAsteriskServer for every single Agi request. You can configure them to all start from the same manager connection, but you haven't done so. But either way, *every* event in Asterisk will be sent to *every* Manager connection you have open. In your case, a pool of 10 AgiScript instances waiting to handle requests would all have 10 manager connections open. If you had 10 calls made using a context with 10 priorities, you'd already be at 1,000 events sent from Asterisk to your Java program. This won't scale, and it repeats the same information through mutliple connections. You really want to keep a single ManagerConnection open for the duration of your program's execution. What you're seeing in the console is System.out calls from different threads. Because of the nature of System.out, they will be intermingled and you will also not see everything until the buffer is flushed for System.out. This probably matches up exactly with what you're experiencing. Further, I've noticed you have some lines like: AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); Since I don't really know what you're doing here, I can't really give you suggestions for a way around your problem, other than to say that I think you can probably find a solution that does *not* require passing around the asteriskServer in this fashion. At the *very* least, use a shared lock to a single instance of the AsteriskServer since it has *nothing* to do with a particular Agi script and can exist without them. I urge you to take these AsteriskServer instances out of your threads (the Agi scripts will almost always be in a threadpool dispatcher) -- the sheer overhead of connecting and reconnecting will significantly lower the capacity of Asterisk and your application. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Saturday, July 12, 2008 11:29 AM To: ast...@li... Subject: Re: [Asterisk-java-users] Confusing Asterisk-Java DaemonPoolbehavior - Email found in subject Hi Martin, Ok, now I've tried to give you a view on my used files (running debian) from how I make asterisk connect to my java program upon an incoming call, and the code my javaprogram uses to connect/close to an asteriskServer. Yes, it's true I need a connection to an asteriskServer, since I need some features it provides J There is more code, but I guessed it won't be relevant, since it's at startup I get these triple connections. It's not always they occur, note this. I've tried to arrange the info neatly below, hope it's easy to read J Thanks for wanting to help! /Johan File: /etc/asterisk/extensions.conf (...) [Incoming] exten => s,1,Set(DYNAMIC_FEATURES=hangup) exten => s,2,Agi(agi://localhost/answer.agi) ;exten => s,3,Hangup File: /home/user/fastagi-mapping.properties hangup.agi = com.test.Hangup answer.agi = com.test.Answer errorcheckingcall.agi = com.ErrorCheckingCall File: Answer.java package com.test.Answer; import java.io.IOException; import java.util.InvalidPropertiesFormatException; import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.BaseAgiScript; import org.apache.log4j.Logger; public class Answer extends BaseAgiScript { private static final Logger logger = Logger.getLogger(Answer.class); public Answer() { logger.debug("Answer.java-Answer() constructor called"); } public void service(AgiRequest request, AgiChannel agiChannel) { try { CallHandler = new CallHandler(); handler.service(request, agiChannel); handler = null; } catch (InvalidPropertiesFormatException ivfe ) { // TODO: handle exception }catch (IOException ie) { // TODO: handle exception } } } File: Answer.java package com.callManager; imports (..) public class CallManager{ // Variables AsteriskChannel incomingChannel = null; private AgiRequest currentAgiRequest; private AgiChannel currentAgiChannel; private DefaultAsteriskServer asteriskServer; public CallManager() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System in pause, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); return; } } private void shutdown() { incomingChannel = null; dbApi.shutdown(); dbApi = null; if(asteriskServer!=null) asteriskServer.shutdown(); } } File: Hangup.java package com.callmanager; import (...) public class Hangup extends BaseAgiScript { private DefaultAsteriskServer asteriskServer; public Hangup() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest request, AgiChannel agiChannel) { String incomingChannelName = agiChannel.getName(); // Todo: titta på om vi inte kan slippa skapa en asteriskServer-connection... spara resources // agiChannel.sendCommand(arg0) try { AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); if (incomingChannel != null) { (some code using this incomingChannel...) } Thread.sleep(300); agiChannel.hangup(); agiChannel = null; if(dbApi!=null) { dbApi.shutdown(); dbApi = null; } } } catch (ManagerCommunicationException e) { // logger.fatal(e.getMessage()); } catch (SQLException e) { // logger.fatal(e.getMessage()); } catch (AgiException e) { // logger.fatal(e.getMessage()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /Johan Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 11 juli 2008 15:22 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing Asterisk-Java DaemonPoolbehavior - Email found in subject Hi Johan, Thanks for reposting :) The channel manager messages you are seeing are from the Live component keeping track of channels through the manager interface. Yet, your code sample is an Agi script. Your Zap messages are before your Agi request is dispatched to a script. The Live and the Agi components of our library do not interact -- so I can only assume you have some code that is connecting them up. I wouldn't be surprised if you are creating 3 AsteriskServer objects, all separately keeping track of state in the server, giving you your extra messages. If you're only running Agi scripts, you shouldn't need to instantiate an AsteriskServer at all. If you do need to use both Live and AGI functionality, can we see the methods/lines that first create/connect your Asterisk-Java objects like AgiServer and AsteriskServer, so we can see what you get 3 messages? Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Friday, July 11, 2008 7:10 AM To: ast...@li... Subject: [Asterisk-java-users] Confusing Asterisk-Java DaemonPool behavior Hi again, sorry for making the erranous post earlier, new try! :-) You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan |
From: Martin S. <ma...@be...> - 2008-07-14 21:17:15
|
Hi Carlos, As you're actually making more than one call, I think the best way for now to tell what is happening is not using the Live API. It has no way of knowing that two distinct Dial() events are the same call. It only made one of them :) Perhaps someone can correct me if I'm wrong... :) Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Carlos G Mendioroz > Sent: Sunday, July 13, 2008 6:45 PM > To: ast...@li... > Subject: [Asterisk-java-users] How to tell... > > if originated call has failed "for good" ? > > Ok, it's hard to put it in a simple sentence :) > I'm originating a call using manager's originateAction, and then > monitoring its progress via events. Now, I assume that if I receive > a HangupEvent, that is indicative that there was something wrong with > the call (after a successfull originate, but w/o a > intervening connect). > > I thought this was ok, but now I have a "smart" extensions > programming > that actually retries the call when some errors are signalled by the > carrier (using another carrier). > Net result, I believe that the call did not get through, but the > retry did work and the call was delivered. > > Is there any way to tell if a call is being "controlled" by extension > programming ? > > -- > Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |
From: Carlos G M. <tr...@hu...> - 2008-07-14 21:10:35
|
Take a look at Local channel... just bounce the call into the extensions logic! Thameem Ansari @ 14/7/2008 17:32 -0300 dixit: > Even if you call from one asterisk to another you need to use some > protocol..without that its not possible. Because the first asterisk is > not just a router rather its a pbx itself. So, you better use IAX trunk > between two asterisk servers and route your call from Asterisk1 to 2 > thru IAX2 protocol. > > -Thameem > > --- On *Mon, 7/14/08, Leonardo Lira > /<leo...@gr...>/* wrote: > > From: Leonardo Lira <leo...@gr...> > Subject: [Asterisk-java-users] Originate call without inform > protocol or trunk > To: ast...@li... > Date: Monday, July 14, 2008, 1:03 PM > > Dear all, > > > > I have a doubt about Asterisk and hope you can help me solving it. > > > > When I use the Manager API to make an extern call, the following > command is realized: > > > > /Action: Originate > Channel: Protocol/Protocol Provider (Trunk)/Número a ser discador > “Ex. SIP/Voip/558133333333” > Context: default > Exten: 6011 > Priority: 1 > Callerid: XXXXXX/ > > > > However, I don’t want to inform the protocol or the trunk in the > channel because the asterisk that i will use to conect to the > Manager will only be used to route the calls to other asterisks that > will define the outbound trunks (E1, Voip Etc). For example: > > > > > > > > > > > > > > > > > > > > > > > > > /Channel: 558133333333/ > > /Without “SIP/Voip”/ > > > > > > > > Caixa de texto: Choose the route according to the numer dialed > > > > > > > > > > > > > > > > > > > > > What means that i would like to realize an extern call using the > following command: > > > > /Action: Originate > Channel: 558133333333 > Context: default > Exten: 6011 > Priority: 1 > Callerid: XXXXXX/ > > > > Best regards, > > > > Leonardo Lira > > > > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Thameem A. <tha...@ya...> - 2008-07-14 20:32:21
|
Even if you call from one asterisk to another you need to use some protocol..without that its not possible. Because the first asterisk is not just a router rather its a pbx itself. So, you better use IAX trunk between two asterisk servers and route your call from Asterisk1 to 2 thru IAX2 protocol. -Thameem --- On Mon, 7/14/08, Leonardo Lira <leo...@gr...> wrote: From: Leonardo Lira <leo...@gr...> Subject: [Asterisk-java-users] Originate call without inform protocol or trunk To: ast...@li... Date: Monday, July 14, 2008, 1:03 PM Dear all, I have a doubt about Asterisk and hope you can help me solving it. When I use the Manager API to make an extern call, the following command is realized: Action: Originate Channel: Protocol/Protocol Provider (Trunk)/Número a ser discador “Ex. SIP/Voip/558133333333” Context: default Exten: 6011 Priority: 1 Callerid: XXXXXX However, I don’t want to inform the protocol or the trunk in the channel because the asterisk that i will use to conect to the Manager will only be used to route the calls to other asterisks that will define the outbound trunks (E1, Voip Etc). For example: Channel: 558133333333 Without “SIP/Voip” What means that i would like to realize an extern call using the following command: Action: Originate Channel: 558133333333 Context: default Exten: 6011 Priority: 1 Callerid: XXXXXX Best regards, Leonardo Lira ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08_______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Carlos G M. <tr...@hu...> - 2008-07-13 22:44:58
|
if originated call has failed "for good" ? Ok, it's hard to put it in a simple sentence :) I'm originating a call using manager's originateAction, and then monitoring its progress via events. Now, I assume that if I receive a HangupEvent, that is indicative that there was something wrong with the call (after a successfull originate, but w/o a intervening connect). I thought this was ok, but now I have a "smart" extensions programming that actually retries the call when some errors are signalled by the carrier (using another carrier). Net result, I believe that the call did not get through, but the retry did work and the call was delivered. Is there any way to tell if a call is being "controlled" by extension programming ? -- Carlos G Mendioroz <tr...@hu...> LW7 EQI Argentina |
From: Johan S. <js...@sv...> - 2008-07-12 15:27:11
|
Hi Martin, Ok, now I've tried to give you a view on my used files (running debian) from how I make asterisk connect to my java program upon an incoming call, and the code my javaprogram uses to connect/close to an asteriskServer. Yes, it's true I need a connection to an asteriskServer, since I need some features it provides :) There is more code, but I guessed it won't be relevant, since it's at startup I get these triple connections. It's not always they occur, note this. I've tried to arrange the info neatly below, hope it's easy to read :) Thanks for wanting to help! /Johan File: /etc/asterisk/extensions.conf (...) [Incoming] exten => s,1,Set(DYNAMIC_FEATURES=hangup) exten => s,2,Agi(agi://localhost/answer.agi) ;exten => s,3,Hangup File: /home/user/fastagi-mapping.properties hangup.agi = com.test.Hangup answer.agi = com.test.Answer errorcheckingcall.agi = com.ErrorCheckingCall File: Answer.java package com.test.Answer; import java.io.IOException; import java.util.InvalidPropertiesFormatException; import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.BaseAgiScript; import org.apache.log4j.Logger; public class Answer extends BaseAgiScript { private static final Logger logger = Logger.getLogger(Answer.class); public Answer() { logger.debug("Answer.java-Answer() constructor called"); } public void service(AgiRequest request, AgiChannel agiChannel) { try { CallHandler = new CallHandler(); handler.service(request, agiChannel); handler = null; } catch (InvalidPropertiesFormatException ivfe ) { // TODO: handle exception }catch (IOException ie) { // TODO: handle exception } } } File: Answer.java package com.callManager; imports (..) public class CallManager{ // Variables AsteriskChannel incomingChannel = null; private AgiRequest currentAgiRequest; private AgiChannel currentAgiChannel; private DefaultAsteriskServer asteriskServer; public CallManager() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System in pause, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); return; } } private void shutdown() { incomingChannel = null; dbApi.shutdown(); dbApi = null; if(asteriskServer!=null) asteriskServer.shutdown(); } } File: Hangup.java package com.callmanager; import (...) public class Hangup extends BaseAgiScript { private DefaultAsteriskServer asteriskServer; public Hangup() throws IOException { asteriskServer = new DefaultAsteriskServer("localhost", "user", "pwd"); } public void service(AgiRequest request, AgiChannel agiChannel) { String incomingChannelName = agiChannel.getName(); // Todo: titta på om vi inte kan slippa skapa en asteriskServer-connection... spara resources // agiChannel.sendCommand(arg0) try { AsteriskChannel incomingChannel = some_function_ive_not_included(incomingChannelName, asteriskServer); if (incomingChannel != null) { (some code using this incomingChannel...) } Thread.sleep(300); agiChannel.hangup(); agiChannel = null; if(dbApi!=null) { dbApi.shutdown(); dbApi = null; } } } catch (ManagerCommunicationException e) { // logger.fatal(e.getMessage()); } catch (SQLException e) { // logger.fatal(e.getMessage()); } catch (AgiException e) { // logger.fatal(e.getMessage()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /Johan Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 11 juli 2008 15:22 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] Confusing Asterisk-Java DaemonPoolbehavior - Email found in subject Hi Johan, Thanks for reposting :) The channel manager messages you are seeing are from the Live component keeping track of channels through the manager interface. Yet, your code sample is an Agi script. Your Zap messages are before your Agi request is dispatched to a script. The Live and the Agi components of our library do not interact -- so I can only assume you have some code that is connecting them up. I wouldn't be surprised if you are creating 3 AsteriskServer objects, all separately keeping track of state in the server, giving you your extra messages. If you're only running Agi scripts, you shouldn't need to instantiate an AsteriskServer at all. If you do need to use both Live and AGI functionality, can we see the methods/lines that first create/connect your Asterisk-Java objects like AgiServer and AsteriskServer, so we can see what you get 3 messages? Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Friday, July 11, 2008 7:10 AM To: ast...@li... Subject: [Asterisk-java-users] Confusing Asterisk-Java DaemonPool behavior Hi again, sorry for making the erranous post earlier, new try! :-) You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan |
From: Aaron E. <aar...@gm...> - 2008-07-11 13:44:10
|
Thank you so much Martin for this detailed answer! So yeah, I figure I'll just catch everything and throw an AgiException. In addition, it means I can throw AgiExceptions at will if there are missing request parameters, etc and I don't have to worry about setting this channel variable myself. thanks again, aaron On Thu, Jul 10, 2008 at 11:59 AM, Martin Smith <ma...@be...> wrote: > Hi Aaron, > > Good question. It appears that Asterisk Java's AgiConnectionHandler will > set the AGISTATUS channel variable under the following conditions: > > 1. If the mapping strategy can't find the specified script to execute, > AGISTATUS=NOT_FOUND > 2. If the script throws an AgiException or class/subclass of Exception, > AGISTATUS=FAILED > 3. If the script completes without throwing any exception, > AGISTATUS=SUCCESS > > Keep in mind that if the channel, say, disconnects entirely (you pull an > ethernet plug), Asterisk-Java won't be able to set anything. > > Most of my scripts are data-driven, in that they look things up or > compute information that Asterisk can't, usually related to permissions. > Most of my error cases simply have Asterisk play the same sound file as > if the user failed the check. > > If I were doing something more elaborate, I'd almost certainly catch > more than just checked exceptions, log them, and wrap them in an > AgiException, since I would want a null pointer error to be handled > gracefully too. > > Cheers, > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > >> -----Original Message----- >> From: ast...@li... >> [mailto:ast...@li...] On >> Behalf Of Aaron Evans >> Sent: Thursday, July 10, 2008 10:49 AM >> To: ast...@li... >> Subject: [Asterisk-java-users] Error Handling with FastAGI >> >> With asterisk 1.4 and above, there is a channel variable AGISTATUS >> that can be set to SUCCESS or FAILURE to indicate whether the AGI >> execution was successful. >> >> In asterisk-java, there is an AgiException class that can be thrown >> from the service method of an AgiScript implementation. >> >> Question: If I throw an AgiException, does the server handle setting >> the AGISTATUS variable? >> >> Or should I gracefully handle all exceptions and execution errors and >> set the channel variable myself? >> >> What do most people do? >> >> Thanks in advance for your suggestions... >> >> -------------------------------------------------------------- >> ----------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source project, >> along with a healthy diet, reduces your potential for chronic lameness >> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |
From: Martin S. <ma...@be...> - 2008-07-11 13:22:25
|
Hi Johan, Thanks for reposting :) The channel manager messages you are seeing are from the Live component keeping track of channels through the manager interface. Yet, your code sample is an Agi script. Your Zap messages are before your Agi request is dispatched to a script. The Live and the Agi components of our library do not interact -- so I can only assume you have some code that is connecting them up. I wouldn't be surprised if you are creating 3 AsteriskServer objects, all separately keeping track of state in the server, giving you your extra messages. If you're only running Agi scripts, you shouldn't need to instantiate an AsteriskServer at all. If you do need to use both Live and AGI functionality, can we see the methods/lines that first create/connect your Asterisk-Java objects like AgiServer and AsteriskServer, so we can see what you get 3 messages? Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Johan Sandgren Sent: Friday, July 11, 2008 7:10 AM To: ast...@li... Subject: [Asterisk-java-users] Confusing Asterisk-Java DaemonPool behavior Hi again, sorry for making the erranous post earlier, new try! :-) You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan |
From: Johan S. <js...@sv...> - 2008-07-11 11:07:36
|
Hi again, sorry for making the erranous post earlier, new try! :-) You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan |
From: Martin S. <ma...@be...> - 2008-07-10 16:49:37
|
Please don't hijack an unrelated thread by reply. Start a new one so threading works properly! Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Johan Sandgren > Sent: Thursday, July 10, 2008 12:29 PM > To: ast...@li... > Subject: [Asterisk-java-users] Confusing Asterisk-Java > DaemonPool behavior > > Hi, > > You got an idea of what is going wrong here? > I get a call to Zap/3 and my javaprogram is called. > Look at my log output below, I get multiple Adding channel > Zap/3 and multiple Removing... > > Is asterisk multiplying itself? > I don't really know what this DaemonPool is really, anyone > can explain? > > public class Answer extends BaseAgiScript { > > public void service(AgiRequest agiRequest, AgiChannel > agiChannel) > { > if(dbApi.getSystemPaused()) > { > logger.debug("System paused, call > will be hungup"); > agiRequest = null; > try { > agiChannel.answer(); > agiChannel.hangup(); > } catch(AgiException ae) {} > agiChannel = null; > shutdown(); // freeing > db-resources, etc > return; > } > } > > LOG > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] > [internal.ChannelManager] INFO - Adding channel > Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] > [internal.ChannelManager] INFO - Adding channel > Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] > [internal.ChannelManager] INFO - Adding channel > Zap/3-1(1215706626.16490) > 10 jul 2008 18:17:06 [WrapperSimpleAppMain] > [fastagi.DefaultAgiServer] INFO - Received connection from > /127.0.0.1 > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] > [internal.AgiConnectionHandler] INFO - Begin AgiScript > com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] > [callManager.Answer] DEBUG - System in pause, call will be hungup > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] > [internal.ChannelManager] INFO - Removing channel Zap/3-1 > due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] > [internal.ChannelManager] INFO - Removing channel Zap/3-1 > due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] > [internal.ChannelManager] INFO - Removing channel Zap/3-1 > due to hangup (NOTDEFINED) > 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] > [internal.AgiConnectionHandler] INFO - End AgiScript > com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 > > > /Johan > > > > -----Ursprungligt meddelande----- > Från: ast...@li... > [mailto:ast...@li...] > För Martin Smith > Skickat: den 10 juli 2008 18:00 > Till: ast...@li... > Ämne: [SPAM] - Re: [Asterisk-java-users] Error Handling with > FastAGI - Email found in subject > > Hi Aaron, > > Good question. It appears that Asterisk Java's > AgiConnectionHandler will > set the AGISTATUS channel variable under the following conditions: > > 1. If the mapping strategy can't find the specified script > to execute, > AGISTATUS=NOT_FOUND > 2. If the script throws an AgiException or class/subclass of > Exception, > AGISTATUS=FAILED > 3. If the script completes without throwing any exception, > AGISTATUS=SUCCESS > > Keep in mind that if the channel, say, disconnects entirely > (you pull an > ethernet plug), Asterisk-Java won't be able to set anything. > > Most of my scripts are data-driven, in that they look things up or > compute information that Asterisk can't, usually related to > permissions. > Most of my error cases simply have Asterisk play the same > sound file as > if the user failed the check. > > If I were doing something more elaborate, I'd almost certainly catch > more than just checked exceptions, log them, and wrap them in an > AgiException, since I would want a null pointer error to be handled > gracefully too. > > Cheers, > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > > > -----Original Message----- > > From: ast...@li... > > [mailto:ast...@li...] On > > Behalf Of Aaron Evans > > Sent: Thursday, July 10, 2008 10:49 AM > > To: ast...@li... > > Subject: [Asterisk-java-users] Error Handling with FastAGI > > > > With asterisk 1.4 and above, there is a channel variable AGISTATUS > > that can be set to SUCCESS or FAILURE to indicate whether the AGI > > execution was successful. > > > > In asterisk-java, there is an AgiException class that can be thrown > > from the service method of an AgiScript implementation. > > > > Question: If I throw an AgiException, does the server handle setting > > the AGISTATUS variable? > > > > Or should I gracefully handle all exceptions and execution > errors and > > set the channel variable myself? > > > > What do most people do? > > > > Thanks in advance for your suggestions... > > > > -------------------------------------------------------------- > > ----------- > > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > Studies have shown that voting for your favorite open > source project, > > along with a healthy diet, reduces your potential for > chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |
From: Johan S. <js...@sv...> - 2008-07-10 16:26:46
|
Hi, You got an idea of what is going wrong here? I get a call to Zap/3 and my javaprogram is called. Look at my log output below, I get multiple Adding channel Zap/3 and multiple Removing... Is asterisk multiplying itself? I don't really know what this DaemonPool is really, anyone can explain? public class Answer extends BaseAgiScript { public void service(AgiRequest agiRequest, AgiChannel agiChannel) { if(dbApi.getSystemPaused()) { logger.debug("System paused, call will be hungup"); agiRequest = null; try { agiChannel.answer(); agiChannel.hangup(); } catch(AgiException ae) {} agiChannel = null; shutdown(); // freeing db-resources, etc return; } } LOG 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Adding channel Zap/3-1(1215706626.16490) 10 jul 2008 18:17:06 [WrapperSimpleAppMain] [fastagi.DefaultAgiServer] INFO - Received connection from /127.0.0.1 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - Begin AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [callManager.Answer] DEBUG - System in pause, call will be hungup 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-4-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-3-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-2-thread-1] [internal.ChannelManager] INFO - Removing channel Zap/3-1 due to hangup (NOTDEFINED) 10 jul 2008 18:17:06 [Asterisk-Java DaemonPool-1-thread-9] [internal.AgiConnectionHandler] INFO - End AgiScript com.test.Answer on Asterisk-Java DaemonPool-1-thread-9 /Johan -----Ursprungligt meddelande----- Från: ast...@li... [mailto:ast...@li...] För Martin Smith Skickat: den 10 juli 2008 18:00 Till: ast...@li... Ämne: [SPAM] - Re: [Asterisk-java-users] Error Handling with FastAGI - Email found in subject Hi Aaron, Good question. It appears that Asterisk Java's AgiConnectionHandler will set the AGISTATUS channel variable under the following conditions: 1. If the mapping strategy can't find the specified script to execute, AGISTATUS=NOT_FOUND 2. If the script throws an AgiException or class/subclass of Exception, AGISTATUS=FAILED 3. If the script completes without throwing any exception, AGISTATUS=SUCCESS Keep in mind that if the channel, say, disconnects entirely (you pull an ethernet plug), Asterisk-Java won't be able to set anything. Most of my scripts are data-driven, in that they look things up or compute information that Asterisk can't, usually related to permissions. Most of my error cases simply have Asterisk play the same sound file as if the user failed the check. If I were doing something more elaborate, I'd almost certainly catch more than just checked exceptions, log them, and wrap them in an AgiException, since I would want a null pointer error to be handled gracefully too. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Aaron Evans > Sent: Thursday, July 10, 2008 10:49 AM > To: ast...@li... > Subject: [Asterisk-java-users] Error Handling with FastAGI > > With asterisk 1.4 and above, there is a channel variable AGISTATUS > that can be set to SUCCESS or FAILURE to indicate whether the AGI > execution was successful. > > In asterisk-java, there is an AgiException class that can be thrown > from the service method of an AgiScript implementation. > > Question: If I throw an AgiException, does the server handle setting > the AGISTATUS variable? > > Or should I gracefully handle all exceptions and execution errors and > set the channel variable myself? > > What do most people do? > > Thanks in advance for your suggestions... > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |