[asterisk-dev] [Code Review] dial by name in chan_dahdi

Tzafrir Cohen tzafrir.cohen at xorcom.com
Thu Mar 25 16:06:41 CDT 2010



> On 2010-03-24 18:21:20, rmudgett wrote:
> > /trunk/channels/chan_dahdi.c, line 12172
> > <https://reviewboard.asterisk.org/r/535/diff/3/?file=8850#file8850line12172>
> >
> >     The built path is missing a leading '/' like the built path in device2chan().
> >     "/dev/dahdi/%s%d"
> 
> Tzafrir Cohen wrote:
>     The loop will always add one.
>     
>     (The rest of the issues you pointed out were fixed in r4. Thanks for the review)
> 
> rmudgett wrote:
>     If you are referring to the loop that builds subdir, then that is not what I am pointing out.
>     
>     snprintf will set path to: dev/...
>     Note that the first character in path is a 'd' not a '/'.  The next line then uses path:
>     
>     if (stat(path, &stbuf) < 0)
>     
>     in device2chan() the similar code has a leading / in the path: /dev/...

Right. This is intended to force sysadmins to use Asterisk with '/' as its CWD, which is how it should be (and how is done on my testing :-)


- Tzafrir


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/535/#review1747
-----------------------------------------------------------


On 2010-03-25 14:31:11, Tzafrir Cohen wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/535/
> -----------------------------------------------------------
> 
> (Updated 2010-03-25 14:31:11)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Currently a name of a channel in chan_dahdi must (with some exception of trunk-groups syntax) rely on DAHDI channel numbers. Sadly channel numbers depend on the specific order of registration. Changing that seems to be quite difficult.
> 
> Thus we try to use the original ope-by-device-file (rather than indert open through /dev/dahdi/channel), and allow files to reside in subdirectories of /dev/dahdi .
> 
> Specifically, the file name must still be a number (to allow using the same ranges syntax). However it should be preceded with the string '<dirname>!' .
> 
> For instance we have: /dev/dahdi/work/1 and /dev/dahdi/work/2 that are symlinks to /dev/dahdi/9 and /dev/dahdi/10 (DAHDI channels 9 and 10), I can refer to them in chan_dahdi.conf as:
> 
>   channel => work!1
>   channel => work!2
> 
> And likewise can dial through them using:
> 
>   Dial(DAHDI/work!1/123456)
> 
> See also the http://svn.asterisk.org/dahdi/linux/team/tzafrir/sysfs .
> 
> 
> Current status: 
> 
> * Tested to basically work. 
> 
> TODO:
> * Adapt better to Asterisk coding style.
> * Use '!' in subdir (in chan_dahdi.conf) as well?
> * Can the original path be exposed to the dialplan?
>   The equivalent of:
>   Set(DAHDI_CHAN=${CUT(-,${CHANNEL}))}
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_dahdi.c 254639 
>   /trunk/configs/chan_dahdi.conf.sample 254639 
> 
> Diff: https://reviewboard.asterisk.org/r/535/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Tzafrir
> 
>




More information about the asterisk-dev mailing list