[asterisk-dev] How to pass a parameter to the DAHDI kernel driver ?

Pavel Troller patrol at sinus.cz
Wed Sep 14 13:06:24 CDT 2011


> On 09/14/2011 02:02 AM, Pavel Troller wrote:
>> Hi!
>>    I'm writing a customization for the DAHDI driver - a possibility to transmit
>> periodical charging pulses to the line for incoming calls.
>>    I've done most of changes on the driver level (dahdi-base.c and corresponding
>> include files) and the pulses are now happily being transmitted in the answered
>> state of the channel, but with a hardcoded pace (3 secs for now).
>>    I've also done a high-level (dialplan) part - according to the called number
>> analysis, a variable is available in the time of the answer signal coming to the
>> caller, containing the required charging pulses timing.
>>    What I need to do to finish my work, is to pass the contents of the variable
>> to the driver during signalling the answer. Any suggestions, how to pass a
>> numeric parameter to the driver during the signalling process ?
>
> You will have to implement an ioctl() operation that chan_dahdi can use to 
> read/write the value on the channel in DAHDI.
>
Hi Kevin,
  thank you for your reply. I'm already on this way. However, I have a small
supplementary question.
  In include/dahdi/user.h, there are definitions like this:
#define DAHDI_SETCADENCE    _IOW(DAHDI_CODE, 42, struct dahdi_ring_cadence)
  I'm about to implement my DAHDI_SETCHAPULSE, but I don't know policy of
assigning the function numbers. These are just raw constants, which seem to be
incrementing, but there are some duplicates (for example, DAHDI_LOOPBACK and
DAHDI_RADIO_[SG]ETPARAM are both using number 58). So, which number can I
assign for my function without danger of collision with current or future
status of DAHDI development ? In my proof-of-concept code I'm using 111, which
doesnt' seem to be used yet.
  With regards, Pavel



More information about the asterisk-dev mailing list