cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6121
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

actually, there's something rather important: port numbers. The older generation phones support a wider range than the new phones. Could it be that you're using a port number that is not supported on the new phones? I think (it's been a while since I've been doing this and I just got back from a two week holiday so memory is a bit shady) the 7970 will only accept port numbers above 20k, whereas the 7940/60 would also accept lower port numbers.

Here's a commandline I've used for a bunch of demos, streaming audio to a 7905 (requires the very latest firmware as older ones don't have any multicast functionality), a 7960, a 7970 and an IP communicator:

java JMFTest.JMFTester file:///c:/reggae.wav 239.1.1.1 23456 1

I am developing a Cisco IP Phone Service for announcement.

According to the example Intercomm of Cisco Ip Service Development SDK 3.3 I have tested the following lines of code:

---------------------------

<%@ Language=VBScript %>

<%

Response.ContentType = "text/xml"

Response.write ""

Response.write "Intercom"

Response.write "Press and Hold to Talk"

Response.write "Intercom to 192.168.5.103"

Response.write ""

Response.write "Talk"

Response.write "RTPTx:Stop"

Response.write "RTPTx:192.168.5.103:16384"

Response.write "1"

Response.write ""

Response.write ""

Response.write "Exit"

Response.write "SoftKey:Exit"

Response.write "4"

Response.write ""

Response.write ""

%>

-----------------------------------------------------

I want to start RX and TX with out displaying pressing a soft key. Because the objectiv is to develop a service for announcement where the recevier need not to press any button. I tried to place the TX and RX code with out a soft key. It is not working.

Your help is solicited. My email address is ramprasadp@gtllimited.com.

In order not to require any interaction on the receiver end, you have to push a command to the receiver phone via . You'll find a push example in the IP Phone SDK (download here: http://www.cisco.com/cgi-bin/dev_support/access_level/product_support) - requires a (free) CCO login.

Here's an example you could push to the receiver phone:

where 192.168.5.100 is the IP address of the phone where you make the announcement.

"actually, there's something rather important: port numbers. The older generation phones support a wider range than the new phones. "

Stephan, that's GOOD information to know! Where did you find that?

It didn't solve my problem (I was using RTPMRx:239.0.0.1:42050 which should've worked, I think I also tried 23456 as you requested), but I'd still like to know where you pulled that technical information about the phones from...

I'd like to think my problem is with the 3.x load, as I see the 4.x load fixes some other issues with the 7970 (7970s telling me it's almost time to go home, woohoo!)...and again, I haven't had a chance to experiment with that either...I'll repost when I find something relevant...

DB

I'm not very sure where I got the info, and I have tons of Call Manager documentation on my computer. But I started out using the reference for CM3.3, later found the developer reference for CM4.01 and I think that's where I noticed the port discrepancy. I started out using port numbers that were compatible with the older documentation, then got new phones that weren't even known when the CM3.3 development reference was written, and noted that the same applications wouldn't work for the newer phones. Having some applications using other ports that worked gave me an idea what could be wrong.

It is a bit unfortunate that there's no document that's really comprehensive and outlines all the issues.. I only found the maximum allowable length of an input field in the hardcover book.. imho that's something that should be in the SDK. Same goes for error codes that should not arrive but still do (error 6 for instance, there's a bunch of messages about that in this very forum).

In the 4.01 SDK documentation it says ports 20480 to 32768 are allowed for the RTP(M)R/Tx commands, so your example would definitely not work (or not work with all the phones).

Have you tried using a 7960 phone? I'm afraid the new generation of phones isn't quite as mature as the 7960/40 yet (not only in the XML area).

Does anyone know if the phones have preset TTL/Hop Count at 1 when doing RTPMTx??? I've been trying to transmit by hooking audio feed into IPC or a 7970, but though I hear the stream locally, it doesn't get past any routers. After extensive testing, it looks like hop count can be the only reason it isn't working.

Also, tried downloading the streamer example, and found that with at least the latest version of the JMF, there is an applet included which allows you to listen to audio streams and also to transmit them. However, though I can hear my MOH streams, when I transmit, I hear nothing on the receiving end. The applet tends to crash, too, if you transmit and stop then try to change the transmit settings and start again.

This shouldn't be so hard!

well, finding the TTL isn't hard.. just connect your phone to a hub, and attach a PC with Ethereal running to the same hub and have a look at the RTP packets.

Hi.

I'm trying to develop an application that records a call into a file.

I started to build a CTI Port and add that port to a conference call to catch the audio, but I'm having problems accepting the call in the cti port.

I also read something about XML commands to the IP phones...like RTPMx and RTPTx.

Do you know if the stream from the Phone catches the call(when a phone is in a call) or just catches the audio coming from that phone's microphone?

Thank you!

avang2004
Level 1
Level 1

Can you repost the file again. I missed it or you can e-mail me @ avang@hexagram.com

Here you go. Unfortunately, I have recently tried to increasing the TTL, but all my efforts have failed so far. I have tried this: http://forum.java.sun.com/thread.jspa?threadID=650687

If anybody has any ideas to increase the TTL please let me know.

After I complie AVTransmit2.java and run Java AVTransmit2 it comes up with this error

-I've installed JMF 2.1e

-JDK

Exception in thread "main" java.lang.NoClassDefFoundError: AVTransmit2 (wrong na

me: JMFTest/AVTransmit2)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:502)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12

3)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)

at java.net.URLClassLoader.access$100(URLClassLoader.java:54)

at java.net.URLClassLoader$1.run(URLClassLoader.java:193)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:186)

at java.lang.ClassLoader.loadClass(ClassLoader.java:299)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:272)

at java.lang.ClassLoader.loadClass(ClassLoader.java:255)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)

webmailmaster
Level 1
Level 1

Hello,

Just wanted to ask if it's possible to stream media to all the phones connected to CM, as, if there are, for example, 50 phones it's going to be difficult to enter all their IP addresses and so on.

Cheers,

Victor

It is. Just use a multicast IP address instead of a unicast one. There's one catch that I have mentioned in the post with the attachment: TTL is set to 1 and I haven't been able to chnage that.. this means it works in the subnet where the sender is located but routers will drop the packet, even if they are programmed to forward mulicast. I've already given some pointers for further investigation so if you have any luck, please share your results.

Could you give me any links where I can read about multicast? The thing is that I have no idea how to set up a multicast IP...

Anyway, if I manage to change the TTL, I'll let the community know for sure.

Cheers,

Victor

Cisco has a good page on multicast: http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ipmulti.htm

As far as this streamer is concerned, all you have to do is give a multicast IP address as destination address instead of a unicast (regular) one. To get you started, try 239.1.1.1. Then have your phones listen to this stream via "RTPMRx:239.1.1.1:y" where y is the port number you're using for streaming (you also have to indicate this when you launch the streamer... any unused port above 1024 will be fine, just make sure that the one you pick and the one above it is available.. this streamer will require two ports, port n to send out packets, port n+1 to receive RTCP packets (there are none in our scenario but the port will still be used).