[asterisk-dev] chan_dahdi - dnid handling

Wolfgang Pichler wpichler at yosd.at
Wed Jun 30 02:10:03 CDT 2010


Hi all,

i have a question / bug report about the chan_dahdi dnid handling...

I am setting up a gateway system - for use in austria. In Austria we can get
the dnid complete on a new call (we call it Blockwahl) - or we do get it as
dtmf sequence (we call it Einzelwahl).

Setting up chan_dahdi with immediate=no does work for this - but if the call
is comming - and does not have the complete set - then asterisk will wait 8
seconds to send the call to the s extension - which is definitly to long.

So i tried to use immediate=yes - and do provide my own logic - so far so
good - but i have encountered a problem with the calls which are coming in
using Blockwahl.

On a blockwahl call i will get the dialed extension in the dnid variable -
thats ok.
But if you get a new call - without dnid after a call with dnid - then the
dnid field won't get reset. So you have the dnid of the last call available.
So jumping based on dnid is not possible - would cause unexpected behaviour.

I have taken a look at the source - and found in chan_dahdi around line
12980 the following

---------------------------------------------------------------------------------------------------------------------------------------------
/* Set DNID on all incoming calls -- even immediate */
if (!ast_strlen_zero(e->ring.callednum))
 ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum,
sizeof(pri->pvts[chanpos]->dnid));
---------------------------------------------------------------------------------------------------------------------------------------------

As far as i can interpret this right - on immediate it does check if it got
a callednum - if so - then copy it - if not - then.... nothing....
the pri->pvts[chanpos] seems not to be a structure which does get allocated
on new calls - so the value of the old call will be in there.

I would suggest to change it to

---------------------------------------------------------------------------------------------------------------------------------------------
/* Set DNID on all incoming calls -- even immediate */
if (!ast_strlen_zero(e->ring.callednum))
ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum,
sizeof(pri->pvts[chanpos]->dnid));
else
pri->pvts[chanpos]->dnid[0] = '\0';
---------------------------------------------------------------------------------------------------------------------------------------------

so it should always contain the valid dnid...

To get it better working with immediate=no - i would suggest the following

Lets add some new config options - which are channel specific - to control
the generic digit timeout and the match digit timeout. So it would be
possible to set the generic and match digit timeout on bri_net channels to a
higher value then on bri_cpe channels.

I think the change wouldn't be that hard - or i am wrong with this ?

What do you think about this ?

best regards,
Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20100630/ab27b150/attachment.htm 


More information about the asterisk-dev mailing list