[Asterisk-Dev] Identifying associated channel in rtp.c

Alf Thomas Nilsen a-t-n at online.no
Wed Apr 20 01:30:41 MST 2005


If I was running a business I would consider hiring someone for this job.
However, this is in fact a final project of a bachelor degree so it's not
possible to do that :) I do get help from other professionals as well, so
luckily I'm not all alone with this.

It might be a good thing if I explain something about why I want to minimize
overhead. I have previously stated that this modification hopefully would be
useful for places where bandwidth is very expensive. This is relevant for
satellite transmissions. Some audible problems or delays may be an
acceptable trade-off for lower bandwidth usage in this case.

I'm mainly hoping to be able to control voice payload through
extensions.conf for SIP, but I'm also interested in doing the same thing for
IAX2 (Only for Asterisk <-> Asterisk conversations, since clients work on a
peer2peer basis). I wish to do this for several codecs, primarily G.726 and
G.729A. In other words, I believe bandwidth usage can be decreased by
putting more voice data in each packet and thus reducing the overhead. The
important thing here is not which payload sizes are good and which are bad.
The point is to be able to control it easily through for example
extensions.conf. The testing so far has been done on G.729A. It looks to me
that when I get one codec working as desired it shouldn't be too much of a
problem to do the same thing with another codec.

There is a relevant part of the code in rtp.c, line 1225:

case AST_FORMAT_G729A:
		if (!rtp->smoother) {
			rtp->smoother = ast_smoother_new(20);
			if (rtp->smoother)
				ast_smoother_set_flags(rtp->smoother,
AST_SMOOTHER_FLAG_G729);

I was under the impression that the third line in that code snippet directly
or indirectly controls the amount of voice data in each packet. When I
change that value to, for example, 40, Asterisk will collect packets it
receives from clients (Naturally, Asterisk can not control the voice payload
of these packets) until the desired value is reached, and then transmit that
packet to the other client.

You say that I cannot control the voice payload in rtp.c. Do I understand it
correctly if that means that the above mentioned modification will yield no
decreased bandwidth usage since the frames are already created and I'm only
packing frames with their headers into a larger frame? In other words, it
would in fact increase bandwidth usage, since the large frame with all the
small frames also will need to have its own header. And do, please
forgive/correct me if I'm mixing terms like frames / packets. 

Currently, I have made a quick modification where one is able to set the
voice payload in rtp.conf. Asterisk is modified to parse that value in
ast_rtp_reload(). The problem with this, however, is that it affects all
calls. In reality, different clients may have different optimal voice
payload sizes and that's why it was thought that it would be a good idea to
do this through SetVar() in extensions.conf. Now, if there is other
preferred ways to do this, I'm all ears.

Another thing that might help understanding this code is if I could have a
look at some kind of functional diagram of Asterisk. I have been looking at
www.asteriskdocs.org, but that seems to be a work in progress. I would be
very happy if someone had a functional diagram of Asterisk.

You help is greatly appreciated!

Best regards,
Alf Thomas Nilsen

-----Original Message-----
From: asterisk-dev-bounces at lists.digium.com
[mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Kevin P. Fleming
Sent: 20. april 2005 03:15
To: Asterisk Developers Mailing List
Subject: Re: [Asterisk-Dev] Identifying associated channel in rtp.c

Alf Thomas Nilsen wrote:

> I am hoping to be able to define the amount of voice data in each packet
> through extensions.conf. That way several conversations at the same time
> will be able to operate at different voice payloads.

You cannot do this in rtp.c. By the time the RTP layer gets the 
information, the audio has already been packed into a frame with an 
appropriate number of samples.

If you want the audio frames to contain a different number of samples, 
you have to handle that during the call setup (negotiation). However, 
given your stated lack of experience in dealing with this kind of code, 
I'd honestly say that you'd be better off hiring someone to do this for 
you... Trying to figure out how to do this by asking one question at a 
time via this list is going to take forever :-)

Why don't you start by explaining _exactly_ what you want Asterisk to 
do, including giving details of the SIP (or other) clients involved, 
codecs in use, etc.
_______________________________________________
Asterisk-Dev mailing list
Asterisk-Dev at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev





More information about the asterisk-dev mailing list