cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6115
Views
0
Helpful
54
Replies

G.711 streamer example

stephan.steiner
Spotlight
Spotlight

I guess I'm not the only one to ever have tried it (I found a number of messages concerning this on the JMF newsgroups, but never a satisfactory solution spelled out), so my attachment could be useful.

Install JMF, put the JMF jar files into the classpath, and compile the source code. Then you have a commandline based G.711 capable streamer. It is not a very streamlined example as it's based on a streamer for video (in fact it still streams video as well as audio), but it is good enough for basic audio streaming.. just use a wav file as input (make sure it's not already ylaw as this program will transcode the content no matter what), specify destination port and address and you're all set.

There's no repeat, play until the end of file, use other input ports (like line in or microphone) but it's a working piece of code, which is more when I got when I started out doing this.

Enjoy

54 Replies 54

@avang2004: If you look at the source, the code is part of a package called JMFTest. So after compiling, you need to put the AVTransmit2.class into a folder called JMFTest, then lanch the app via "java JMFTest.AVTransmit2 " from the folder below JMFTest.

And I have no clue as to why this thread has a last posting date of September 12th

I got the java file to work it streams in dvi/rtp using any .wav file and also passed the URI

What kind of wave file is it? I found that it only works with CD quality files.. the compression and resampling chain would have to be adapted for other input formats. Also, I know the volume tag is attractive, but all my tests were done without it and it always worked.. so guess where I would look for errors ;)

Hi Stephan,

How can I get an IP address of an IP Phone using its

extension number like 2001.

I am using Cisco JTAPI for CM 4.0.

Please reply as soon as possible.

--- Ashish Nijai

Ashish,

Assuming you're using CCM4.0, and that there is only one phone with extension 2001, the CCMAdmin will tell you the IP address of the phone. If you're trying to get the IP address into another program, I think you have to query against the CCM database, but I'm afraid I don't know how to do that. If this is a one-off application, you could always assign a specific IP to the phone and then hard-code it into your application. Best of luck.

Hi msaulters,

First, Thank you for your reply.

I am using two IP Phones and one soft phone.

and they have various extesions.

I want to obtain IP address by using extension number and JTAPI.

I can get the IP address form CCM Administration pages.

But I want to obtain it Dynamically.

If you hace such sample codes,please send it to me.

Regards,

Ashish

Well, from within JTAPI, you can get phones and extensions. So you go extension ->phone and then you have to like at the devicelistx report which allows you to resolve phonename -> IP address. Have a look at the IP phone SDK, it has examples on how to query the devicelistx report.

Hi Stephan and all,

Thank to all for quick replies!!!

I want to know that is there any table in CM databse where the extension number and IP of phones are stored?

If there are such tables ,please tell me as soon as possible.

Regards,

Ashish

Hi,

It is not stored in the database, it is real-time information.

You can query http://ccm/CCMAdmin/reports/devicelistx.asp which will give devicename and ip-address.

Then use AXL or DB to get extension to devicename mapping.

Or get http://ccm/ccmadmin/numplandump.asp which gives the NumPlan.csv

hi to all,

I am using AVTransmit2 code

when i used it more times

it gives report as Can't open local port :

Can anybody tell me how to avoid this problem?

And can I get the same AVTransmit2 code in C++ for Windows platform?

Please reply ASAP.

Regards,

Ashish

What do you mean when you use it multiple times? Each instance will need a different port.. in fact due to RTPC you need two ports per instance... the one you specify and the one immediately above that. So if you're using port 12345, then the next instance must use port 12347 as 12346 is already used by the first instance.

There are commercial tools to turn java apps into native apps.. but if that works for source code as well? If you want C++ code, search for WinRTP.. it works out of the box but it has some inheritent disadvantages like needing the microphone input (so your streaming server needs a soundcard), and I never could get it to stream a wav file even with a mic present.

kstearns
Level 1
Level 1

Any chance you could re-post your sample code for AVTransmit2.java ?

I've tried to do the same thing with JMF in the past, with little success.

I'm actually looking for a code sample that I can include in the Cisco IP Phone Services SDK, if that would be ok with you.

BTW - has anyone had any luck getting MP3 files to RTP stream as G.711/ulaw to a Cisco IP Phone ?

I'd like to create an MP3 jukebox as a sample app. I've tried doing that with just JMStudio before, but it would only give me the option to RTP stream MPEG audio - didn't give me the option to transcode it into anything else (RAW/RTP ulaw). Ideas ??

I reposted on August 14th 2005.. the attachment should still be valid.

I don't mind if you put it in the SDK.. it might be a good idea to incorporate the TTL fix (I posted a link), I guess it would be appropriate to mention where it comes from though.

As far as MP3 goes, I've tried and failed with AVTransmit.. there is an MP3 plugin for JMF (or does it even support it natively), but I think the trick is finding the proper transcoder combination. Unless our sales crew brings an order my way, I'm afraid that's just one of these things I might look into if I have nothing to do.. but that's not going to happen anytime soon.

I think the transcoder would first have to decode the MP3, then resample and finally packetize.

Further improvement could also include analyzing the source first (possible with JMF or JavaSound), and if the source is already in the proper format, there's no resampling necessary.. I'm afraid my process chain turns G.711 compatible WAV files into something you can no longer hear.. I think that's because I'm applying processing where none would be necessary.

I've tried AVTransmit2 but it still doesn't work. Is this multicasting? The command line I used was:

java AVTransmit2 file://c://stream.wav 224.112.112.112 22222

I got :

Track 0 is set to transmit as:

ULAW/rtp, 8000.0 Hz, 8-bit, Mono

Created RTP session: 224.112.112.112 22222

Start transmission for 60 seconds...

...transmission ended.

But my phone did not pick up the stream for some reason. I used the following XML:

I saw a post about changing the default packet size from 60 to 20, but I could not figure out where to do this in AVTransmit2.

The phone is a Cisco 7961 Series.

Any help would be appreciated.

Stephan,

Would you please repost the attachment or outline what changes you've made. The latest post I can find of the attachment has expired.

Thanks!