isdn_divert.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* $Id: isdn_divert.h,v 1.5.6.1 2001/09/23 22:24:36 kai Exp $
  2. *
  3. * Header for the diversion supplementary ioctl interface.
  4. *
  5. * Copyright 1998 by Werner Cornelius (werner@ikt.de)
  6. *
  7. * This software may be used and distributed according to the terms
  8. * of the GNU General Public License, incorporated herein by reference.
  9. *
  10. */
  11. #include <linux/ioctl.h>
  12. #include <linux/types.h>
  13. /******************************************/
  14. /* IOCTL codes for interface to user prog */
  15. /******************************************/
  16. #define DIVERT_IIOC_VERSION 0x01 /* actual version */
  17. #define IIOCGETVER _IO('I', 1) /* get version of interface */
  18. #define IIOCGETDRV _IO('I', 2) /* get driver number */
  19. #define IIOCGETNAM _IO('I', 3) /* get driver name */
  20. #define IIOCGETRULE _IO('I', 4) /* read one rule */
  21. #define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */
  22. #define IIOCINSRULE _IO('I', 6) /* insert/append one rule */
  23. #define IIOCDELRULE _IO('I', 7) /* delete a rule */
  24. #define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */
  25. #define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */
  26. #define IIOCDOCFDIS _IO('I',10) /* deactivate control forwarding in PBX */
  27. #define IIOCDOCFINT _IO('I',11) /* interrogate control forwarding in PBX */
  28. /*************************************/
  29. /* states reported through interface */
  30. /*************************************/
  31. #define DEFLECT_IGNORE 0 /* ignore incoming call */
  32. #define DEFLECT_REPORT 1 /* only report */
  33. #define DEFLECT_PROCEED 2 /* deflect when externally triggered */
  34. #define DEFLECT_ALERT 3 /* alert and deflect after delay */
  35. #define DEFLECT_REJECT 4 /* reject immediately */
  36. #define DIVERT_ACTIVATE 5 /* diversion activate */
  37. #define DIVERT_DEACTIVATE 6 /* diversion deactivate */
  38. #define DIVERT_REPORT 7 /* interrogation result */
  39. #define DEFLECT_AUTODEL 255 /* only for internal use */
  40. #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
  41. typedef struct
  42. { ulong drvid; /* driver ids, bit mapped */
  43. char my_msn[35]; /* desired msn, subaddr allowed */
  44. char caller[35]; /* caller id, partial string with * + subaddr allowed */
  45. char to_nr[35]; /* deflected to number incl. subaddress */
  46. u_char si1,si2; /* service indicators, si1=bitmask, si1+2 0 = all */
  47. u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */
  48. u_char callopt; /* option for call handling:
  49. 0 = all calls
  50. 1 = only non waiting calls
  51. 2 = only waiting calls */
  52. u_char action; /* desired action:
  53. 0 = don't report call -> ignore
  54. 1 = report call, do not allow/proceed for deflection
  55. 2 = report call, send proceed, wait max waittime secs
  56. 3 = report call, alert and deflect after waittime
  57. 4 = report call, reject immediately
  58. actions 1-2 only take place if interface is opened
  59. */
  60. u_char waittime; /* maximum wait time for proceeding */
  61. } divert_rule;
  62. typedef union
  63. { int drv_version; /* return of driver version */
  64. struct
  65. { int drvid; /* id of driver */
  66. char drvnam[30]; /* name of driver */
  67. } getid;
  68. struct
  69. { int ruleidx; /* index of rule */
  70. divert_rule rule; /* rule parms */
  71. } getsetrule;
  72. struct
  73. { u_char subcmd; /* 0 = hangup/reject,
  74. 1 = alert,
  75. 2 = deflect */
  76. ulong callid; /* id of call delivered by ascii output */
  77. char to_nr[35]; /* destination when deflect,
  78. else uus1 string (maxlen 31),
  79. data from rule used if empty */
  80. } fwd_ctrl;
  81. struct
  82. { int drvid; /* id of driver */
  83. u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */
  84. ulong procid; /* process id returned when no error */
  85. u_char service; /* basically coded service, 0 = all */
  86. char msn[25]; /* desired msn, empty = all */
  87. char fwd_nr[35];/* forwarded to number + subaddress */
  88. } cf_ctrl;
  89. } divert_ioctl;
  90. #ifdef __KERNEL__
  91. #include <linux/isdnif.h>
  92. #include <linux/isdn_divertif.h>
  93. #define AUTODEL_TIME 30 /* timeout in s to delete internal entries */
  94. /**************************************************/
  95. /* structure keeping ascii info for device output */
  96. /**************************************************/
  97. struct divert_info
  98. { struct divert_info *next;
  99. ulong usage_cnt; /* number of files still to work */
  100. char info_start[2]; /* info string start */
  101. };
  102. /**************/
  103. /* Prototypes */
  104. /**************/
  105. extern spinlock_t divert_lock;
  106. extern ulong if_used; /* number of interface users */
  107. extern int divert_dev_deinit(void);
  108. extern int divert_dev_init(void);
  109. extern void put_info_buffer(char *);
  110. extern int ll_callback(isdn_ctrl *);
  111. extern isdn_divert_if divert_if;
  112. extern divert_rule *getruleptr(int);
  113. extern int insertrule(int, divert_rule *);
  114. extern int deleterule(int);
  115. extern void deleteprocs(void);
  116. extern int deflect_extern_action(u_char, ulong, char *);
  117. extern int cf_command(int, int, u_char, char *, u_char, char *, ulong *);
  118. #endif /* __KERNEL__ */