[Home]

Summary:ASTERISK-04951: [patch] Simple G.722 pass-through addition
Reporter:Andrew Lindh (andrew)Labels:
Date Opened:2005-08-31 17:51:04Date Closed:2006-10-24 19:32:41
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/CodecInterface
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 5084.codec.g722.patch
( 1) 5084.codec.g722.patch.2
Description:This is my simple addition to support G.722. It does NOT include a working (or any at this time) real translation codec. This set of patches just allows G.722 transport and raw file storage. I have tested it with some Grandstream BT-100 phones and "SIP asterisk to asterisk" (with BT-100's on each end) and it works. I have not tried IAX between servers, but it should work.

As the code is based on existing files or small additions I don't see any crash or major bug issues with it. So I'll call it "safe" to try on a current CVS HEAD system.

A good G.722 codec translator would be great and I'm working on one when I have time, but it's not going well now so it's not included. Without a codec translator nothing execpt phone to phone will work...no MOH, no VM, no MeetMe. If you want to it use on a phone make sure you allow other codecs too in case the have to talk to non G.722 devices.

Note this is based on the old free G.722, not G.722.1 or G.722.2. It is also only tested for 64K streams. If you want to save bandwidth then use a different codec! Later patches may (and should) support different data rates, but for now this is some place to start.






****** ADDITIONAL INFORMATION ******

BEFORE applying this g722 patch please copy formats/format_pcm.c to formats/format_g722.c and then apply the g722 patch since the new program is based on the existing pcm one.

You may ask, how does 16Khz audio work with asterisk....the answer is it does not and it does not matter, at this time. The G.722 stream is a 64K data stream like ULAW/ALAW but it is encoded from a higher source audio. So I just deal with the strem as a normal 64K ULAW type stream. Later the codec would transcode and resample if asterisk is still 8Khz only.

channel.c: add AST_FORMAT_G722
frame.c: add info for AST_FORMAT_G722 and support for the additional codec
rtp.c: add the g722 audio codec info
translate.c: make room in show command for additional codec
chan_h323.c: add G722 format
chan_iax2.c: add G722 format
frame.h: add G.722 as (1<<11)...the next free one
formats/Makefile: include compile for format_g722
format_g722.c: based on the format_pcm.c file, changed to be raw G722

In sip.conf you can use "allow=g722" or "disallow=g722" for peers.


Comments:By: Andrew Lindh (andrew) 2005-08-31 17:53:30

I disclaim this patch.....

Disclaimer on file is old and I'll fax a new one when I get into the office.

By: Brian West (bkw918) 2005-08-31 21:25:14

diff -Nur would pickup the new format_g722.c I don't think having the person patching it cp the file would be the right way to do that part.

/b

By: Andrew Lindh (andrew) 2005-09-01 12:26:13

Please delete the file (it won't let me). And I'll upload a good patch file.

By: Michael Jerris (mikej) 2005-09-01 14:08:20

File deleted.  You can upload new files with different file names.

By: Andrew Lindh (andrew) 2005-09-01 14:26:20

The new patch file (on-line now) dows not require any copy of the format_pcm.c file.

Just patch -p0 <g722.patch in the main asterisk directory.

By: Andrew Lindh (andrew) 2005-11-20 09:52:01.000-0600

Now that 1.2 is release I'll update the code shortly....

By: Clod Patry (junky) 2006-01-03 20:13:55.000-0600

andrew: could you upload an updated patch to process?

By: Andrew Lindh (andrew) 2006-01-04 10:16:45.000-0600

yes I will. (sorry, got married so I had some other things to do!)

By: Olle Johansson (oej) 2006-01-04 12:44:18.000-0600

No patent problems with this codec? (just checking)

By: Matthew Fredrickson (mattf) 2006-01-24 14:26:23.000-0600

I just talked to kevin, and he didn't have any problem with adding this for now, though it's likely to change as we figure out how we want to do codec resampling.



By: Matthew Fredrickson (mattf) 2006-01-24 14:32:03.000-0600

Can you put an updated version up?

By: Matthew Fredrickson (mattf) 2006-01-27 15:01:17.000-0600

Lack of response

By: Olle Johansson (oej) 2006-03-17 04:23:00.000-0600

Re-opened on request.

By: Denis Smirnov (mithraen) 2006-03-17 04:48:13.000-0600

5084.codec.G722.patch -- updated, but not tested patch

By: Olle Johansson (oej) 2006-03-18 03:50:31.000-0600

Added to test-this-branch. Thanks.

By: Denis Smirnov (mithraen) 2006-03-19 04:22:40.000-0600

Without last patch G.722 can't be compiled :)

By: Olle Johansson (oej) 2006-03-19 06:32:27.000-0600

On what platform?

By: Denis Smirnov (mithraen) 2006-03-19 06:46:15.000-0600

I test x86 only.

This patch change io from open/read/write/close to stdio fopen/fread/fwrite/fclose, like in other codecs.

I test building only with -Werror

By: Olle Johansson (oej) 2006-04-04 09:21:50

With the latest changes of the format driver structure, I am afraid I have to ask you for an update to this driver that works with the latest svn trunk.

Thanks.

By: Denis Smirnov (mithraen) 2006-04-04 09:36:20

I can update it after you resync test-this-branch with head (now I checkout test-this-branch, and it hasn't last format_* changes)

By: Denis Smirnov (mithraen) 2006-04-04 10:05:09

update.format_g722.patch -- updated, but can't tested before branch update

By: Denis Smirnov (mithraen) 2006-04-06 05:26:38

format_g722.c doesn't need anymore, it integrated to format_pcm.c with this patch.

By: Andrew Lindh (andrew) 2006-04-12 10:27:07

What phones are you using for testing?

As for the patent question...none for the old G.722 that I can find. When you move up to the newer versions (G.722.1 and G.722.2) then there are issues.

I see G.722, no matter how old, as a gateway to future 16Khz asterisk work.

Thanks for updating the work (I've been kind of busy...)

By: Denis Smirnov (mithraen) 2006-04-15 05:14:38

At now I hasn't access to IP-phones, that support G.722.
Patent issues doesn't matter, because tihs code not add transcoding.This support done like G.729 support.

By: Jeffrey C. Ollie (jcollie) 2006-04-17 09:05:43

Small patch to get test-this-branch compiling again...

Index: formats/format_pcm.c
===================================================================
--- formats/format_pcm.c (revision 20901)
+++ formats/format_pcm.c (working copy)
@@ -455,7 +455,7 @@
.tell = pcm_tell,
.read = pcm_read,
.buf_size = (BUF_SIZE * 2) + AST_FRIENDLY_OFFSET,
- .lockp = &me,
+ .module = &mod_data, /* XXX */
};

static const struct ast_format au_f = {

By: Serge Vecher (serge-v) 2006-05-04 11:14:32

any test results here? Test-this-branch was updated by Olle recently ...

By: Serge Vecher (serge-v) 2006-06-05 10:43:04

Mithraen: can you please update the patch to the latest trunk, so this can be put in to 1.4 beta? Thanks.

By: Denis Smirnov (mithraen) 2006-06-11 13:29:58

This patch supported in test-this-branch by Olle, and easily can be exported from test-this-branch.

2f it really needs for adding to 1.4, I can update this patch for trunk.

By: Serge Vecher (serge-v) 2006-06-12 09:08:06

well, the question is: do you want to see this patch as part of 1.4? If, yes, then you know what to do. Thanks, Mithraen.

By: Denis Smirnov (mithraen) 2006-06-12 09:26:35

Yes, I want it in 1.4.
Patch updated.

By: Serge Vecher (serge-v) 2006-06-12 16:12:11

1. typo prevents loading:
 || ast_foramt_register(&g722_f)
2. why the XXX comment here?
+ .module = &mod_data, /* XXX */
3. might as well fix whitespace, if you are changing this line anyway ;)
- for (i=0;i<11;i++) {
+ for (i=0;i<12;i++) {

Thanks!

By: Denis Smirnov (mithraen) 2006-06-13 08:27:20

1. fixed
2. It was in same place in originam format_pcm.c
3. fixed

By: Serge Vecher (serge-v) 2006-06-15 14:06:54

well, it doesn't break anything in my testing. Although I can't test intended functionality, since I don't posess g.722-capable equipment.

By: Denis Smirnov (mithraen) 2006-08-21 04:26:46

Updated to last trunk

By: Andrew Lindh (andrew) 2006-09-21 16:46:31

The new Polycom SoundPoint IP 650 lists G.722, does anyone have one to test? I don't know if they support the "old" G.722 or are using their own new version.

By: Denis Smirnov (mithraen) 2006-09-21 16:50:12

Snom 360 also supports G.722

By: Kevin P. Fleming (kpfleming) 2006-10-24 19:32:39

Committed to branch 1.4 in rev 46154, and trunk in rev 46155.