Re: [Asterisk-java-users] Termination Status
Brought to you by:
srt
From: <gl...@gm...> - 2007-08-16 18:41:42
|
Look up the DefaultAsteriskServer Class, it has an originateToExtension method, or something like that. Which is a sync method. On 8/16/07, Martin Smith <ma...@be...> wrote: > Hello Chuck, > > I think there's an issue with thread synchronization in Asterisk-Java at > the moment. The Live API keeps track of a channel by unique ID, and AJ > gets the failure event before the live API has recorded the unique of > the channel -- the failure event ends up triggering a lookup by unique > id, and can't find the channel yet. > > Hopefully that's a good explanation of the problem. > > I recall that you can use an OriginateAction with > .setAsync(Boolean.FALSE) if you are using the core part of the library, > but I don't think there is an option for that in the live API yet. > > I hope I've explained that correctly, though I don't have a solution. > Perhaps Stefan can comment more. > > 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 CHUCK SYPERSKI > > Sent: Wednesday, August 15, 2007 3:02 PM > > To: ast...@li... > > Subject: Re: [Asterisk-java-users] Termination Status > > > > Is there a way to detect if the line you just called is busy. > > When I dial a busy number I keep getting: > > > > org.asteriskjava.live.NoSuchChannelException: Channel > > 'SIP/1xxxxxxxxxx@gafachi' is not available > > > > Here is part of the code, its a bite ugly: > > > > public void run() > > { > > fireEvent( D88CCEvent.CCTHREAD_BORN ); > > try > > { > > if ( login() ) > > { > > DefaultAsteriskServer server =3D > > new DefaultAsteriskServer( managerConnection ); > > fireEvent( > > D88CCEvent.CCTHREAD_RINGING ); > > String sp =3D ""; > > if ( > > task.getAsteriskServiceProvider() !=3D null && > > task.getAsteriskServiceProvider().length() > 0 ) > > sp =3D "@" + > > task.getAsteriskServiceProvider(); > > > > channel =3D > > server.originateToExtension(task.getAsteriskTrunk() + "/" + > > task.getPhone() + sp, task.getAsteriskContext(), > > task.getExtension()+"", 1, task.getTimeOut() * 1000 ); > > > > if ( channel !=3D null ) > > { > > handleStateChange( channel ); > > ChannelState oldState =3D null; > > if ( channel.getState() > > =3D=3D ChannelState.UP || channel.getState() =3D=3D > > ChannelState.RINGING || channel.getState() =3D=3D ChannelState.RING ) > > { > > while( > > channel.getState() =3D=3D ChannelState.UP || channel.getState() > > =3D=3D ChannelState.RINGING || channel.getState() =3D=3D ChannelState.R= ING ) > > { > > sleep( > > 100 ); > > } > > > > if ( oldState > > !=3D channel.getState() ) > > { > > > > handleStateChange( channel ); > > > > oldState =3D channel.getState(); > > } > > } > > else > > { > > fireEvent( > > D88CCEvent.CCTHREAD_GENERAL_ERROR ); > > lg( > > channel.toString() ); > > System.exit( 1 ); > > } > > > > handleStateChange( channel ); > > finalizeCall( channel ); > > } > > managerConnection.logoff(); > > } > > > > } > > catch( Exception e ) > > { > > blComplete =3D true; > > > > if ( e instanceof NoSuchChannelException ) > > { > > fireEvent( > > D88CCEvent.CCTHREAD_INVALIDNUMBER ); > > System.err.println( e.toString() ); > > e.printStackTrace(); > > > > if ( channel !=3D null && > > channel.wasBusy() ) > > { > > System.out.println( > > "Was Busy" ); > > } > > else > > { > > System.out.println( > > "Was NOT Busy" ); > > } > > > > System.out.println( e.getCause() ); > > System.out.println( e.getMessage() ); > > > > System.exit( 1 ); > > } > > else > > { > > intCompletionCode =3D > > D88CCEvent.CCTHREAD_DIED; > > System.err.println( e.getMessage() ); > > e.printStackTrace(); > > //fireEvent( intCompletionCode ); > > System.exit( 1 ); > > } > > } > > > > } > > > > >>> ma...@be... 08/15/07 11:52AM >>> > > Hi Chuck, > > > > I wish I had an answer to that question myself. I'm not sure there's a > > way that is completely error-free, especially given an older > > generation > > of answering machine that may do any number of things. > > > > Is your project open source? > > > > 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 CHUCK SYPERSKI > > > Sent: Wednesday, August 15, 2007 12:02 PM > > > To: ast...@li... > > > Subject: [Asterisk-java-users] Termination Status > > > > > > I am in the process of testing a autodialer I wrote for a > > > school district. Basically what I do is make an outgoing > > > call via a gafachi sip trunk and connect the user to an > > > internal extension that plays a message and hangs up. > > > Everything works great, but I wanted to know if there is > > > anyway that I can tell if I have called a fax machine, or > > > voicemail. Right now I am using the live package and I am > > > using the AsteriskChannel.getState() and using the > > > HangupCause enumeration. Thanks so much for any help that > > > can be provided and thanks for writting a great api. > > > > > > Thanks, > > > Chuck Syperski > > > DuPage High School District 88 > > > > > > > > > -------------------------------------------------------------- > > > ----------- > > > This SF.net email is sponsored by: Splunk Inc. > > > Still grepping through log files to find problems? Stop. > > > Now Search log events and configuration files using AJAX and > > > a browser. > > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > > _______________________________________________ > > > Asterisk-java-users mailing list > > > Ast...@li... > > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > > > -------------------------------------------------------------- > > ----------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and > > a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > -------------------------------------------------------------- > > ----------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and > > a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Asterisk-java-users mailing list > > Ast...@li... > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > --=20 Guilherme Loch G=F3es MSN:gl...@gm... (48) 99115299 |