Summary:ASTERISK-01690: latest chan_h323 doesnt seem to like my gnugk / openphone
Reporter:zoa (zoa)Labels:
Date Opened:2004-05-25 08:02:38Date Closed:2011-06-07 14:09:59
Versions:Frequency of
Environment:Attachments:( 0) asterisk.h323.diff
( 1) magma.patch
( 2) trace.txt
Description:I wanted to try again for the deadlock i was having with chan_h323, but the current version doesnt seem to work for me.

I get no sound at all.


trace is included
Comments:By: zoa (zoa) 2004-05-25 08:15:17

the version as of some days ago worked sweet.

By: jerjer (jerjer) 2004-05-25 11:55:26

This is not cvs -head

By: zoa (zoa) 2004-05-25 14:58:35

Asterisk CVS-HEAD-05/25/04-12:48:12, Copyright (C) 1999-2004 Digium.
Written by Mark Spencer <markster@digium.com>
Connected to Asterisk CVS-HEAD-05/25/04-12:48:12 currently running on imroVOIP1 (pid = 22931)

Is the version i'm experiencing the problems with.
imroVOIP1:~# date
Tue May 25 21:54:36 EEST 2004

They tested both with h323 -> iax2 and with h323 to conf.

By: jerjer (jerjer) 2004-05-25 23:12:23

only thing i can suggest is your OpenPhone's Open H.323 version is too old.

By: zoa (zoa) 2004-05-26 07:45:40

i'll try using a newer version of openh323 on those clients (when i can, since i'm back in belgium now), but i kinda need the old one as that one had g729 :)

The old openh323 seemed to work fine until the latest changes :(

By: davet (davet) 2004-06-01 09:14:01

FWIW, I have the same problem. CVS circa 20040518 worked fine for me with latest stable release of OpenH323 (v1.12.2) and PWLIB (v1.5.2).

Just checked out Asterisk this morning (20040601) and no longer get any audio on H.323.

Will try CVS versions of OpenH323 and PWLIB.

By: zoa (zoa) 2004-06-01 12:48:04

if you have some time, could you try some cvs versions from the week before i posted this bug report ? in that week something changed.

I can't check it right now, my h323 setup is 3500km's away from where i am now.

By: zoa (zoa) 2004-06-01 12:48:08

if you have some time, could you try some cvs versions from the week before i posted this bug report ? in that week something changed.

I can't check it right now, my h323 setup is 3500km's away from where i am now.

By: davet (davet) 2004-06-04 11:38:25

I've just got the latest CVS openh323 and ptlib_unix from openh323.org and built the libraries - Asterisk won't build chan_h323 against them.

I think the mention of gnugk is a red herring. If I dial the asterisk PBX IP address it connects fine but still no audio.

I'm still convinced something broke in H.323 recently (last two weeks) that stops audio from working with OpenH323 v1.12.2 and PWLIB 1.5.2 tarballs.

What versions are other people using?

By: jerjer (jerjer) 2004-06-04 14:42:22

I run Redhat 7.3, 8.0 and 9 using Open H.323 v1.12.2 and PWLib v1.5.2 and cvs -head of Asterisk work flawlessly for me...including Cisco, Qunitum and a RadVision based H.323 app, as well as all Open H.323 based apps.

I tried installing debian but it hung on the install process, so I gave up.

By: magma (magma) 2004-06-05 09:13:02

I'm using Debian (testing) with openh323-gk version 2.2beta4. Got Asterisk CVS-HEAD-06/04/04-11:08:12 with Channel H323. PWLib version 1.5.2 and OpenH323 1.12.2 according to the README file.

No sound...

By: magma (magma) 2004-06-05 21:28:59

I've isolated the bug. It's in the file ast_h323.cpp between revision 1.48 and 1.49. I'm investigating deeper ! Looking on the diff file

By: magma (magma) 2004-06-05 22:11:13

Here are the patch to apply in order to have sound (again) in H323 channel :

*** ast_h323.h  Tue May 25 04:27:59 2004
--- /root/asterisk/channels/h323/ast_h323.h     Sun Jun  6 05:21:05 2004
*** 248,254 ****
--- 248,256 ----
       PString destE164;

       PIPSocket::Address externalIpAddress;
+       PIPSocket::Address remoteIpAddress;
       WORD externalPort;
+       WORD remotePort;
       WORD sessionId;
       BOOL bridging;
*** 287,293 ****
--- 289,297 ----
       BOOL OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param);

       PIPSocket::Address externalIpAddress;
+                       PIPSocket::Address remoteIpAddress;
       WORD externalPort;
+                       WORD remotePort;


*** ast_h323.cpp        Wed May 26 21:14:51 2004
--- /root/asterisk/channels/h323/ast_h323.cpp   Sun Jun  6 05:43:19 2004
*** 23,29 ****
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!  * Version Info: $Id: ast_h323.cpp,v 1.50 2004/05/26 19:14:51 jeremy Exp $
 #include <asterisk/logger.h>
 #include "ast_h323.h"
--- 23,29 ----
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!  * Version Info: $Id: ast_h323.cpp,v 1.49 2004/05/25 02:27:59 jeremy Exp $
 #include <asterisk/logger.h>
 #include "ast_h323.h"
*** 471,476 ****
--- 471,478 ----
                                                       unsigned options)
       : H323Connection(ep, callReference, options)
+       remoteIpAddress = 0;
+       remotePort = 0;
       if (h323debug) {
               cout << "       == New H.323 Connection created." << endl;
*** 722,732 ****
--- 724,738 ----

       /* adjust the count of channels we have open */
+       H323_ExternalRTPChannel & external = (H323_ExternalRTPChannel &)channel;
+       external.GetRemoteAddress(remoteIpAddress, remotePort);

       if (h323debug) {
               cout <<  "              -- channelsOpen = " << channelsOpen << endl;

+       on_start_logical_channel(GetCallReference(), (const char *)remoteIpAddress.AsString(), remotePort);
       return TRUE;

By: hristo (hristo) 2004-06-08 13:29:48

i cannot apply the patch. gives out an error on line 6 (patch: **** malformed patch at line 6: PString destE164;). can you attach the patch file to this bug? my audio on h323 channels also disappeared at some point when i updated from cvs. i am using vocaltec gateway but the symptoms are the same. running * on redhat 9.

By: davet (davet) 2004-06-14 04:21:38

I have found that adding a Wait() before Answer() seems to get the audio working again. For example, I have a macro for playing a SIT message that when called sends no audio unless there is a Wait(1) before the Answer(). Audio on H.323 used to work fine up until mid-May CVS. I've just retested using CVS: Asterisk CVS-NHEAD-06/14/04-09:39:23 and the problem still exists.

This macro sends audio/works OK:

; Macro to play SIT then a message in a loop
; ARG1 - Message to play after SIT
exten => s,1,Wait(1)
exten => s,2,Answer
exten => s,3,Wait(1)
exten => s,4,PlayTones(info)
exten => s,5,Wait(1)
exten => s,6,Playback(${ARG1})
exten => s,7,Wait(2)
exten => s,8,Goto(s,3)

This sends no audio but still seems to loop through the code:

; Macro to play SIT then a message in a loop
; ARG1 - Message to play after SIT
exten => s,1,NoOp
exten => s,2,Answer
exten => s,3,Wait(1)
exten => s,4,PlayTones(info)
exten => s,5,Wait(1)
exten => s,6,Playback(${ARG1})
exten => s,7,Wait(2)
exten => s,8,Goto(s,3)

By: Paul Cadach (pcadach) 2004-06-14 05:52:18

2davet: This happens when OpenH323 doesn't ready to send ANSWER signal to remote party.

Solution is very simple - just do not start PBX (i.e do not call oh323_new()) immediately when SETUP is received (but check for existance of requested number in dial plan), and give OpenH323 to do its background work until it calls back chan_h323 with OnAnswerCall(), where all things are ready to start PBX.

By: jerjer (jerjer) 2004-06-14 11:44:16

PCadach:  please submit a diff

By: zoa (zoa) 2004-06-15 06:40:13

yes please, i have 1 more week to test this. (afterwards i'm going back to belgium and testing is more difficult).

By: Paul Cadach (pcadach) 2004-06-15 10:10:28

Something like attached. A patch is just hand-moved from big changeset for chan_h323 stuff coming with outdated asterisk-0.5.0, so it:
1) doesn't check existance of requested extension (not so important for me);
2) couldn't compile yet (if I missed something), so further changes is your own.

By: jerjer (jerjer) 2004-06-15 11:51:07

instead of teasing us with some allegedged hudge patch you have for chan_h323, why don't you just update the damn thing to TODAYS cvs and post it?

By: Paul Cadach (pcadach) 2004-06-15 13:33:44

Jeremy, attached patch is for current CVS (updated 20 minutes before the patch was published).

As for old stuff, there was many changes (done by principle something here, something there) which is not agreed by chan_h323 maintainer, so I'm unable to track all changes in CVS and to be in-tact with development sources (especially on working systems). No flame, ok?

By: jerjer (jerjer) 2004-06-15 13:46:23

I am the chan_h323 maintainer and I have seen nothing from you.

By: Paul Cadach (pcadach) 2004-06-15 13:59:48

I remember who is chan_h323 maintainer, also I remember about some fixes for chan_h323 published at Mantis and gk cycle patch sent to you by e-mail at February, 11 and 26. Nothing new or any feedback except "keep it simple". But there was about 3 new procedures only and piece of code to call them at right places... Also, I'm not so much familiar with english to heavily discuss why this thing done by this way not another.

Attached patch is very simple too - just new callback from OpenH323's OnAnswerCall() to chan_h323 core, and moved creating Asterisk's channel to new callback.

By: jerjer (jerjer) 2004-06-15 14:12:47

The one patch you did provide I asked you to seperate into discrete feature additions so they could be applied seperately and tested properly.  You never provided the requested patches, thus I was forced to implement the couple features that made any sense to me on my own.

I've never claimed to be a master at any of this.

By: Paul Cadach (pcadach) 2004-06-15 14:28:05

Ok, I'll try to synchronize my chan_h323 to the current CVS and split into set of more-or-less small (problem/feature related) pieces.

What about attached patch? Is it applicable/working? Is it helps to fix problem with wait(1) on incoming calls to bring voice up?

By: jerjer (jerjer) 2004-06-15 15:41:13

applied to cvs.

I would really like to re-design chan_h323 not to need those funky internal callbacks like that.

By: jerjer (jerjer) 2004-06-15 15:52:18

please test and report

By: davet (davet) 2004-06-16 04:29:38

I've tried this version, ast_h323.cpp 1.51, and it still exhibits the same problem - No audio .... unless there is a wait() before the answer.

By: jerjer (jerjer) 2004-06-16 11:27:18

Your show PCadach

By: hristo (hristo) 2004-06-22 11:37:30

I still can't get the sound working. Just tested with the CVS from today (few hours ago). Is there anyone who had more luck applying the patch posted on 06-05-04 22:11 by magma?

By: zoa (zoa) 2004-07-05 14:08:46

i tested it today and the no sound problem is gone for me

By: hristo (hristo) 2004-07-08 10:31:05

Tested with the lastes CVS. Still having the same problem - no sound. The latest version that wokrs for me is from May, 18.

By: aschultz (aschultz) 2004-07-14 05:58:07

I've tested magma's patch with no success, still no audio. From a trace the cruelprint seems to be:
0:19.234                 H245:81378f0       codecs.cxx(1299)  Codec   G711 uLaw encoder created for at 64k, frame of 80 samples
 0:19.235                 H245:81378f0       h323ep.cxx(2140)  Codec   Could not open sound channel "" for recording:
 0:19.235                 H245:81378f0     channels.cxx(1096)  LogChan Transmit thread aborted (open fail) for G.711-uLaw-64k{sw} <1>
 0:19.235                 H245:81378f0         h323.cxx(4046)  H323    OnSelectLogicalChannels, OpenLogicalChannel failed: G.711-uLaw-64k{sw} <1>

By: hristo (hristo) 2004-07-14 09:36:18

I have tested the patch by magma with the CVS from yesteday. I was not able to apply the patch as posted so I did that by hand (added every line that starts with a + to the correct place in the source) and I had the audio working again.

Can somebody re-post the patch? If this doesn't break anything maybe it can be merged?

Did somebody else test it?

By: ag (ag) 2004-07-18 03:05:20

I have opened a ticket  for a similar problem which I see that it was closed in the mean time (SIP <->H323 no sound).

For the clarity,  the problem with no sound occurs beteeen Asterisk and Cisco GW running latest IOS 12.3.9 and not some linux h323 clients as it was suggested.

By: twisted (twisted) 2004-07-23 21:10:42

JerJer - is this a problem that can be resolved?  (only asking because you're the H.323 God around here :P )

By: jerjer (jerjer) 2004-07-24 10:13:49

I cannot dupliate any of these problems.

By: ag (ag) 2004-07-24 10:17:16

I can provide access to an Asterisk box where this problem can be reproduced 100%.  Does this help?


By: jerjer (jerjer) 2004-07-24 10:23:02

read the readme

By: twisted (twisted) 2004-07-24 15:40:35

Just out of curiosity, I saw in the trace that FastStart was enabled, does it make any difference if we disable it?  There have been some issues revolving FS + audio in the past..

By: jerjer (jerjer) 2004-07-24 16:04:41

Using what I was told as the proper method to send the RTP information from Open H.323 to Asterisk breaks FastStart on many endpoints.

So at this point the solution is to disable FastStart or someone has to tell me how to properly get the information we need with FastStart enabled.

The old method I used was returning the signalling ip address and not the media ip address, even though this seemed to accompolish the task in lots of circumstances, it was not correct.  

There are people out there that know Open H.323 (PCadach, Derek, etc) far better than myself, but I haven't heard a damn thing from anyone on how to make chan_h323 better.

By: hristo (hristo) 2004-07-26 12:20:23

The patch by magma solves the problem for my setup. If it is merged to the CVS this will definitely make the channel better for me. I will try to upload the patch against the latest CVS. I am not a programmer and I have no idea what it does but it works for me.

By: jerjer (jerjer) 2004-07-26 12:24:13

This is precisely what I was doing before.  That looks at the remote H.323 signalling IP address, NOT the remote media address.

While this patch might seem to work, it is not correct.

By: hristo (hristo) 2004-07-27 08:11:53

My gateway has 2 boards with different IPs by the way - one for signaling and another for media. Maybe this problem is related only to gateways with different IPs?

But then it's strange that this only works with the magma patch, which as you say looks at the signaling IP instead of the media IP.

By: Olle Johansson (oej) 2004-08-14 15:48:37

Seems like this patch doesn't get into the cvs, right JerJer? Is this report ready for closing or do we have another plan?


By: twisted (twisted) 2004-08-25 18:30:45

Closing after 17 days with no real update and 10 days since last request for update.  Note, closing does not mean gone, if we wish to pick this back up, please notify a bug marshall to re-open.

Thank you!

By: Digium Subversion (svnbot) 2008-01-15 14:58:20.000-0600

Repository: asterisk
Revision: 3220

U   trunk/channels/chan_h323.c
U   trunk/channels/h323/ast_h323.cpp
U   trunk/channels/h323/chan_h323.h

r3220 | jeremy | 2008-01-15 14:58:20 -0600 (Tue, 15 Jan 2008) | 2 lines

check to make sure the extension exists b4 actually accepting the call and lets hope this gives Open H.323 enough time to sync up (bug ASTERISK-1690)