[Asterisk-Dev] Early media in H.323 driver
Soren Rathje
asterisk at lolle.org
Thu Mar 31 10:58:36 MST 2005
Cool,
Works perfectly with my old Siemens Optipoint 300a's, however I'm using
"slowstart" so I still need a 2 sec wait to allow the RTP to settle down..
/Soren
Chih-Wei Huang wrote:
> Hi all,
> I finally solved the early media problem than I different way
> I originally thinked. Originally I hope to connect the two channels
> on the first early media packet arrives. But I can't find enough
> information to call ast_channel_make_compatible.
>
> Instead, I found a given media format is passed to ast_request.
> I believe the format is the nativeformat of the calling party
> (unverified). However, ast_request does not use the format to call the
> channel driver for dialing. It uses the capabilities that the
> driver supports:
>
> c = chan->tech->requester(type, capabilities, data, cause);
> ^^^^^^^^^^^^
> It seems strange, because
>
> * The best codec format is calculated by ast_translator_best_choice
> and stored in variable fmt, but it is never be used later.
> * If we do want the driver to dial by the capabilities set it
> supports, we do not need to pass that as a parameter to the driver.
> Surely the driver knows what capabilities it supports.
>
> So I believe it is a bug. It should be
>
> c = chan->tech->requester(type, fmt, data, cause);
> ^^^
> In this way, we ask the drive to make the outgoing call by the best
> codec format we chose (typically the format the calling party uses)
> However, the H.323 driver doesn't really use the format to make
> outgoing call. Fortunately, it's also a one-line fix.
>
> In summary, here is the two-line fix for this problem.
> (though it spent me at least 5 days to debug)
>
>
> Index: channel.c
> ===================================================================
> RCS file: /usr/cvsroot/asterisk/channel.c,v
> retrieving revision 1.180
> diff -u -r1.180 channel.c
> --- channel.c 28 Mar 2005 20:48:24 -0000 1.180
> +++ channel.c 30 Mar 2005 06:09:26 -0000
> @@ -2013,7 +2013,7 @@
> }
> ast_mutex_unlock(&chlock);
> if (chan->tech->requester)
> - c = chan->tech->requester(type,
> capabilities, data, cause);
> + c = chan->tech->requester(type, fmt,
> data, cause);
> if (c) {
> if (c->_state == AST_STATE_DOWN) {
> manager_event(EVENT_FLAG_CALL,
> "Newchannel",
>
> Index: channels/chan_h323.c
> ===================================================================
> RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
> retrieving revision 1.106
> diff -u -r1.106 chan_h323.c
> --- channels/chan_h323.c 17 Mar 2005 21:30:19 -0000 1.106
> +++ channels/chan_h323.c 30 Mar 2005 06:09:27 -0000
> @@ -1066,6 +1066,6 @@
> }
> /* Assign default capabilities */
> - pvt->capability = capability;
> + pvt->capability = format;
> pvt->dtmfmode = H323_DTMF_RFC2833;
>
> strncpy(tmp, dest, sizeof(tmp) - 1);
More information about the asterisk-dev
mailing list