Re: [Asterisk-java-users] Termination Status
Brought to you by:
srt
From: CHUCK S. <CSY...@DU...> - 2007-08-15 19:02:42
|
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@gafa= chi' is not available Here is part of the code, its a bite ugly: public void run() { fireEvent( D88CCEvent.CCTHREAD_BORN ); try { =09 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.getAsteriskServic= eProvider(); =09 channel =3D server.originateToExtension(tas= k.getAsteriskTrunk() + "/" + task.getPhone() + sp, task.getAsteriskContext(= ), task.getExtension()+"", 1, task.getTimeOut() * 1000 ); if ( channel !=3D null ) { =09 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.RING ) { sleep( 100 ); = =09 } =09 if ( oldState !=3D = channel.getState() ) { handleStateChange( = channel );=09 oldState =3D = channel.getState(); } } else { fireEvent( D88CCEvent.CCTHR= EAD_GENERAL_ERROR ); lg( channel.toString() ); System.exit( 1 ); } =09 handleStateChange( channel );=09 finalizeCall( channel ); } managerConnection.logoff(); }=09 =09 } catch( Exception e ) {=09 blComplete =3D true; if ( e instanceof NoSuchChannelException ) { fireEvent( D88CCEvent.CCTHREAD_INVALIDNUMBE= R ); System.err.println( e.toString() ); e.printStackTrace(); =09 if ( channel !=3D null && channel.wasBusy()= ) { System.out.println( "Was Busy" ); } else { System.out.println( "Was NOT Busy" = ); =09 } =09 =09 System.out.println( e.getCause() ); System.out.println( e.getMessage() ); =09 System.exit( 1 ); } else { intCompletionCode =3D D88CCEvent.CCTHREAD_D= IED; System.err.println( e.getMessage() ); e.printStackTrace(); //fireEvent( intCompletionCode );=09 System.exit( 1 );=09 } } =09 } >>> 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...=20 Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221=20 =20 > -----Original Message----- > From: ast...@li...=20 > [mailto:ast...@li...] On=20 > Behalf Of CHUCK SYPERSKI > Sent: Wednesday, August 15, 2007 12:02 PM > To: ast...@li...=20 > Subject: [Asterisk-java-users] Termination Status >=20 > I am in the process of testing a autodialer I wrote for a=20 > school district. Basically what I do is make an outgoing=20 > call via a gafachi sip trunk and connect the user to an=20 > internal extension that plays a message and hangs up. =20 > Everything works great, but I wanted to know if there is=20 > anyway that I can tell if I have called a fax machine, or=20 > voicemail. Right now I am using the live package and I am=20 > using the AsteriskChannel.getState() and using the=20 > HangupCause enumeration. Thanks so much for any help that=20 > can be provided and thanks for writting a great api. >=20 > Thanks, > Chuck Syperski > DuPage High School District 88 >=20 >=20 > -------------------------------------------------------------- > ----------- > 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=20 > a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li...=20 > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users=20 >=20 ------------------------------------------------------------------------- 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/=20 _______________________________________________ Asterisk-java-users mailing list Ast...@li...=20 https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |