dlg-api
*******

$Revision: 6$ $Date: 16.06.2008 17:11:43$

Note: This are the build in definitions. Some useful functions can also 
be found in lib.h in the driver data directory. Use dlg.vdl to get a
living example of the functions.

Konstanten:

  FOLDER_RECEIVE 0
  FOLDER_POOL    1
  FOLDER_SEND    2
  FOLDER_PUBLIC  3

  MSG_ALL		0
  MSG_FAX		1
  MSG_VOICE	2
  MSG_MAIL	3
  MSG_VIDEO       4

  EVENT_TIMEOUT	'T'	// timeout 
  EVENT_HANGUP	'H'	// hangup 
  EVENT_FAX	'F'	// fax detected 
  EVENT_SPEAKER	'S'	// speaker detected 
  EVENT_VIDEO	'V'	// video detected
  EVENT_NOMORE	'N'	// no more events will come before AcceptCall() 
  EVENT_UNKNOWN	'U' 	// unknown (possibly a new driver release)
  NOERR		0x00000000
  ERR_FAILED	0x10000001
  ERR_TIMEOUT	0x10000004
  ERR_NOTFOUND	0x10000006

Typen:
  u_long DRVERR;

  void    *PIPE

  typedef struct NEWMESSAGESTAT {
	  int nFax;
	  int nVoice;
	  int nMail;
  } NEWMESSAGESTAT;

  typedef struct DOCUMENT {
	  long DocID;
	  int  Folder;		
	  int  Type;	
	  char szSenderName[128];		
	  char szComment[256];
	  long CreationTime;
	  int  Pages;
  } DOCUMENT;

  typedef struct USER {
	  char szID[11];		
	  char szHost[36];	
	  char szExtension[11];
	  char szName[256];
  } USER;

  typedef struct GROUP {
	  char szID[11];		
	  char szName[256];
  } GROUP;

  typedef struct EXTENSIONDATA {
	  char  szExtension[11];
	  int   bIsUser;
	  USER  User;
	  int   bHasGreeting;
	  int   bHasGoodBye;
	  int   bHasVideoGreeting;
	  int   bHasVideoGoodBye;
	  int   bIsGroup;
	  GROUP Group;
	  int   bIsPolling;
	  char  szPollingHost[36];
	  long  lPollingFaxID;
	  int   bIMAP;
	  int   bIMAPError;
	  char  szIMAPUser[128];
	  char  szIMAPHost[128];
  } EXTENSIONDATA;

  typedef struct CONNECTIONDATA {
	  char szDialedNumber[32];
	  char szDialedExtension[32];
	  char szCallingNumber[32];
	  char szCallingSubAdr[32];
	  char szRedirectingNumber[32];
  } CONNECTIONDATA;

  typedef struct NEWMESSAGESTAT {
	  int nFax;
	  int nVoice;
	  int nMail;
  } NEWMESSAGESTAT;

Globale Variablen:

  CONNECTIONDATA ConnectionData;	// the dialed number / extebsion
  EXTENSIONDATA  ExtensionData;	// the information of extension
  BOOL           bVideo;		// video connection ?

  char szMsg[1024];	// general purpose string


Funktionen:

  /*
   * prepare to chain other script at exit. 
   * the filename must be relative to
   * $FAXROOT/driver/gendrv/data.
   *
   */
  void  PrepareChain(char *script);

  /*
   * same as system() 
   * executes the commandline cmd
   *
   */
  int   System(char *cmd);

  /*
   * pipe functions.
   * executes the commandline cmd and gives access via PIPE
   *
   */
  PIPE  OpenPipe(char *cmd, char *mode);
  int   ClosePipe(PIPE p);

  int   PipeGetc(PIPE p);
  int   PipePutc(int c, PIPE p);

  char *PipeGets(char *buf, int len, PIPE p);
  int   PipePuts(char *buf, PIPE p);

  int   PipeRead (char *buf, int size, int nitems, PIPE p);
  int   PipeWrite(char *buf, int size, int nitems, PIPE p);

  /*
   * debug functions
   *
   */

  void TraceOn();
  void TraceOff();
  void SayError(long dwErr);
  void TraceFunction(char *name, DRVERR res);

   /*
    * time conversion function
    * formats time to string buf with rule fmt like
    * the strftime() c-function
    *
    */

  void FormatTime(char *buf, int len, char *fmt, long time);
                                             // einen Zeit-String formatieren

  /*
   * document management
   *
   */

  DRVERR GetNewMessageStat(NEWMESSAGESTAT *pStat); 
      // holt den Nachrichtenstatus des aktuellen Benutzers 
      // (Anzahl der Nachrichten + Typ)

  DRVERR SetFolderSelection(int Folder, int Type, int bMarked);	
      // whlt einen Nachrichtenordner mit scope Type und bMarked

  DRVERR GetFirstMsg(DOCUMENT *pDoc);				
      // erste Nachricht des aktuellen Nachrichtenordners mit scope

  DRVERR GetLastMsg(DOCUMENT *pDoc);  // letzte Nachricht ...

  DRVERR GetNextMsg(DOCUMENT *pDoc);  // nchste Nachricht ...

  DRVERR GetPreviousMsg(DOCUMENT *pDoc);  // vorhergehende Nachricht

  DRVERR SeekMsg(long DocID, DOCUMENT *pDoc);  
      // zu einer bestimmten Nachricht gehen

  DRVERR MarkMsg(DOCUMENT *pDoc, int bMark);	// Nachricht markieren

  DRVERR DeleteMsg(DOCUMENT *pDoc);		// Nachricht lschen

  DRVERR ForwardMsg(DOCUMENT *pDoc, USER *pDstUser, 
      int DstFolder, int bAnnotation); 
      // Nachricht an einen anderen Benutzer weiterleiten (mit/ohne Anmerkung)


  /* fax message functions */

  DRVERR TransmitFax(DOCUMENT *pDoc, int bPollingMode);	
      // bermittelt Fax-Dokument

  DRVERR ReceiveFax();		              // nimmt Fax-Dokument entgegen

  DRVERR SendFax(DOCUMENT *pDoc, char *pszNumber); 
      // sendet Faxdokument pDoc an Nummer pszNumber


  /* voice message functions */

  DRVERR PlayVoiceMsg(DOCUMENT *pDoc);	// gibt Voice-Nachricht pDoc wieder

  DRVERR ReceiveVoice();		// zeichnet Voice-Nachricht auf

  /* video message functions */

  DRVERR PlayVideoMsg(DOCUMENT *pDoc);	// gibt Video-Nachricht pDoc wieder

  DRVERR ReceiveVideo();		// Zeichnet Video-Nachricht auf


  /* mail message function */

  DRVERR PlayMailMsg(DOCUMENT *pDoc);	// spricht ASCII-email Dokument per TTS


  /*
   * identification functions
   *
   */

  DRVERR GetConnectionData(CONNECTIONDATA *pConnectionData);	
                                           // aktuelle Verbindungsdaten holen

  DRVERR GetExtensionData(char *pszNumber, EXTENSIONDATA *pData);
                                           // Durchwahlinformationen holen

  DRVERR ApplyExtensionData(EXTENSIONDATA *pData);
                                           // Durchwahlinformationen setzen

  DRVERR CheckPincode(char *pszPincode);   // Pincode berprfen

  DRVERR GetUserProperty(char *pszPropName, char *pszPropValue);	
                                         // PAPAGENO-Benutzervariable holen

  DRVERR SetUserProperty(char *pszPropName, char *pszPropValue); 
                                         // PAPAGENO-Benutzervariable setzen

  DRVERR GetSystemProperty(char *pszPropName, char *pszPropValue); 
                                         // PAPAGENO-Systemvariable holen

  DRVERR SetSystemProperty(char *pszPropName, char *pszPropValue);
                                         // PAPAGENO-Systemvariable setzen


  /*
   * voice message functions
   *
   */

  DRVERR RecordVoice();			// Eine Sprachnachricht aufzeichnen

  DRVERR PlayRecordedVoice();	// aufgezeichnete Sprachnachricht abspielen

  DRVERR DeleteRecordedVoice();		// lschen

  DRVERR StoreRecordedVoiceAsGreeting(); // aufgezeichnete Sprachnachricht als 
                                         // Begrung speichern

  DRVERR StoreRecordedVoiceAsGoodBye();	// als Verabscheidung


  /*
   * video message functions
   */

  DRVERR RecordVideo();		// Eine Video-Nachricht aufzeichnen

  DRVERR PlayRecordedVideo();	// aufgezeichnete Video-Nachricht wiedergeben

  DRVERR DeleteRecordedVideo();	// lschen

  DRVERR StoreRecordedVideoAsGreeting(); // aufgezeichnete Video-Nachricht als 
                                         // Begrung speichern

  DRVERR StoreRecordedVideoAsGoodBye();	// aufgezeichnete Video-Nachricht als 
                                        // Verabschiedung speichern


  /*
   * announcements functions
   *
   */

  BOOL HasGreeting();		// Test ob Begrung vorhanden ist. 
                                // Abhngig von bVideo: Voice-/Video-Begrung

  BOOL HasGoodBye();	// Test ob Verabschiedung vorhanden ist. 
                        // Abhngig von bVideo: Voice-/Video-Verabschiedung

  DRVERR PlayGreeting();   // Vorhandene Voice- oder Video-Begrung abspielen

  DRVERR PlayVoiceGreeting();	// Vorhandene Voice-Begrung abspielen

  DRVERR PlayVideoGreeting();	// Vorhandene Video-Begrung abspielen

  DRVERR DeleteVoiceGreeting();	

  DRVERR DeleteVideoGreeting();

  DRVERR PlayGoodBye();	// Vorhandene Voice- oder Video-Begrung abspielen

  DRVERR PlayVoiceGoodBye();	

  DRVERR PlayVideoGoodBye();

  DRVERR DeleteVoiceGoodBye();

  DRVERR DeleteVideoGoodBye();


  /*
   * users's substitue functions
   *
   */

  DRVERR GetSubstitute(USER *pSubstUser, int *bKeepCopy);	
                                // aktuelle Stellvertretereinstellung holen

  DRVERR SetSubstitute(USER *pSubstUser, int bKeepCopy);  
                                                   // Stellvertreter setzen

  DRVERR DeleteSubstitute();		// Stellvertretereinstellung lschen

  /***********
   * pincode *
   ***********/

  DRVERR ChangePincode(char *oldpin, char *newpin);	// what do you think?

  /*
   * standard telephony functions
   *
   */

  DRVERR Dial();		// dials the number of a send job

  DRVERR AcceptCall();	// Anruf annehmen

  DRVERR RejectCall();	// Anruf abweisen

  DRVERR Hangup();	// Auflegen

  DRVERR GetEvent(long MilliSec, char *pcEvent); // wartet MilliSec auf Taste

  DRVERR SetDeleteAfterSend(int on);	// delete document after send


  /*
   * speech functions
   *
   */

  DRVERR SetSpeaker(char *pszSpeaker); // whlt den zu benutzenden Sprecher (SAPI-Name)

  DRVERR PlayFile(char *pszFile);	// spricht ein VIPcom *.voc-file

  DRVERR SayDigit(char cDigit);		// spricht eine Nummer

  DRVERR SayTTS(char *pszText);		// spricht Text ungecached

  DRVERR SayTTSC(char *pszText);	// spricht Text gecached

  DRVERR SayFileTTS(char *pszFileName);	// spricht den inhalt eines ASCII-Textfiles

  /*
   * misc functions
   *
   */
  void   Exit(DRVERR err);		// exit + set sendjob status to err

  DRVERR GetDataFile(char *pszFileName); // gets the name of the sendjob data file

  DRVERR GetErrorString(long dwErr, char *pBuf, int len); 
                                         // liefert Fehler-Beschreibungstext
  short  GetNr();			 // Liefert die aktuelle Kanalnummer

 /*
  * LDAP functions
  *
  */

  typedef void *HQUERY;

  DRVERR LDAPOpenServer(char  *pszHost = "localhost", 
			char  *pszUser = "", 
			char  *pszPwd  = "", 
			short  wPort = 389);

  DRVERR LDAPSetTimeout(int seconds);

  DRVERR LDAPCreateQuery(HQUERY *phq);

  DRVERR LDAPDeleteQuery(HQUERY hq);

  DRVERR LDAPSetFilter(HQUERY hq, char *pszFilter);

  DRVERR LDAPSetSearchRoot(HQUERY hq, char *pszRoot);

  DRVERR LDAPSetSearchMode(HQUERY hq, int mode);

  DRVERR LDAPAddField(HQUERY hq, char *pszFieldName);

  DRVERR LDAPExecute(HQUERY hq);

  DRVERR LDAPGetResultCount(HQUERY  hq, 
			    int    *pnEntries);

  DRVERR LDAPGetResultField(HQUERY  hq,
			    char   *pszFieldName, 
			    char   *pszResult, 
			    int     cbResult, 
			    int     nValue = 1);

  DRVERR LDAPNextResult(HQUERY hq);
	