Re: [Asterisk-java-users] Issue regarding streamfile on asterisk-java
Brought to you by:
srt
From: Stefan R. <ste...@re...> - 2007-11-22 22:15:00
|
Hi Noel, thanks for your feedback - and your english is not worse than mine *g* You can find our mailing lists at http://asterisk-java.org/development/mail-lists.html I cc'ed this reply to the -users list. I can understand that you want to handle the situation where the file is not available on the PBX but I have reservations regarding the solution you've proposed. The streamFile methods return a char and a char is defined as: "The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive)." so negative values are not allowed by the specification. What I could think of would be to throw an exception (but that would change the contract significantly). Any ideas? =3DStefan Noel R. Morais wrote: > Stefan, >=20 > I'm from Brazil and I use your library for integration with Asterisk AG= I. >=20 > Your library works gracefully and it attend all my requirements. > Thanks for the great job on it. >=20 > Well, there is a issue regarding the "streamFile(file, digits)" > command. I solved it and I want to share. >=20 > The AGI command "STREAM FILE <filename> <escape digits> [sample > offset]" returns: > failure: 200 result=3D-1 endpos=3D<sample offset> > failure on open: 200 result=3D0 endpos=3D0 > success: 200 result=3D0 endpos=3D<offset> > digit pressed: 200 result=3D<digit> endpos=3D<offset> >=20 > The library just return the result code, but in case of a stream file > of a file that doesn't exists it is going to return the wrong result > success. It should return a "failure on open" result. >=20 > So, I have changed the code of AgiChannelImp from: >=20 > public char streamFile(String file, String escapeDigits) > throws AgiException > { > AgiReply reply; >=20 > reply =3D sendCommand(new StreamFileCommand(file, escapeDigits)= ); > return reply.getResultCodeAsChar(); > } >=20 > To: >=20 > public char streamFile(String file, String escapeDigits) > throws AgiException > { > AgiReply reply; > int result; > reply =3D sendCommand(new StreamFileCommand(file, escapeDigits)= ); > result =3D (reply.getResultCode() =3D=3D 0 && reply.getAttribute("endp= os") > =3D=3D "0")? -2 : reply.getResultCodeAsChar() ; > return (char)result ; > } >=20 >=20 > Sorry about the really poor English and sorry about sending it to your > email but I didn't find any email-list or forum :( >=20 >=20 > Thanks in advance, >=20 > Noel --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: ste...@re... Jabber: ste...@re... Steuernummern 215/5140/1791 USt-IdNr. DE220701760 |