next up previous contents
Next: PP Implementation using D4x Up: Voice Response Virtualization Layer Previous: Implementation - D4X, SCO   Contents

Subsections

PP Implementation using D4x on UNIX

Following are the PP Layer Interface based on Unix Dialogic Implementation. PP Layer Interface is listed below:

Initialization

PP layer needs to be initialized before providing any services. During the initialization the module obtains its required resources.

void PP_init()
Initialize the PP_ module. Initialize the Trace Module for PP_.

SAP management

A hierarchical SAP addressing scheme is used

PP_SapDesc       PP_sapBind( sapDesc )
PP_SapDesc sapDesc;
Bind an Address to a Service User.

SuccFail         PP_sapUnBind( sapDesc )
PP_SapDesc sapDesc;
Unbind an Address from a Service User.

SuccFail PP_sapEventGet( sapDesc, event )
PP_SapDesc      sapDesc;
PP_Event        *event;
Get Any events associated with the Port.

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

typedef struct PP_Event {
struct PP_Event *next;
   struct PP_Event *prev;
   PP_PortDesc portDesc;
   PP_EventId evtId;
   union EventData {
      PP_PlayCnf playCnf;
      PP_GetDtmfCnf getDtmfCnf;
      PP_RecordCnf recordCnf;
      PP_DialCnf dialCnf;
   } evtData;
} PP_Event;

PP_PortDesc PP_attach( sapDesc, portId )
PP_SapDesc      sapDesc;
PP_PortId       portId;
Request that the named Phone-Port be associated with this SAP. Get a PP_portDesc. Open at the board level first to set the DTMF duration and inter-digit delay. We get the channel number referenced to this board as a by-product to use later to open channel on board. Associate the PP_portId with PP_SapDesc. Create trace information on board device name.

typedef struct PP_SapInfo {
   struct PP_SapInfo *next;
   struct PP_SapInfo *prev;
   struct PP_PortInfoSeq portInfoSeq;
   PP_EventSeq eventSeq;
} PP_SapInfo;
typedef PP_SapInfo *PP_SapDesc;

typedef struct PP_EventSeq {
   struct PP_Event *first;
   struct PP_Event *last;
} PP_EventSeq;

typedef Int PP_PortId; /* Name By which the Phone Port is identified */


SuccFail PP_detach( portDesc )
PP_PortDesc     portDesc;
Request that the named Phone-Port be deassociated with this SAP

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

Event Handeling

SuccFail PP_eventTriggerMaskSet(PP_PortDesc portDesc, PP_EventTriggerMask mask)
Not implemented

SuccFail PP_eventTriggerWait(PP_PortDesc portDesc)
Not implemented

SuccFail PP_portEventGet( portDesc, event )/* Get Any events associated with the Port */
PP_PortDesc                     portDesc;
PP_Event        *event;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;

typedef struct PP_Event {
struct PP_Event *next;
   struct PP_Event *prev;
   PP_PortDesc portDesc;
   PP_EventId evtId;
   union EventData {
      PP_PlayCnf playCnf;
      PP_GetDtmfCnf getDtmfCnf;
      PP_RecordCnf recordCnf;
      PP_DialCnf dialCnf;
   } evtData;
} PP_Event;

SuccFail PP_waitRing( portDesc, nuOfRings )
PP_PortDesc portDesc;
int nuOfRings;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

SuccFail PP_getDtmfs(portDesc, nuDtmfs, termDtmf, wait)
PP_PortDesc portDesc;
int     nuDtmfs;
char    termDtmf;
int     wait;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

Action Primitives

SuccFail PP_onHook( portDesc )
PP_PortDesc portDesc;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;

SuccFail PP_offHook( portInfo )
PP_PortInfo *portInfo;
                        
typedef struct PP_PportInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;

PP_playN( portDesc, vMsgDesc, nuDtmfs, typeahead ) /* Play a message */
PP_PortDesc     portDesc;
VM_MsgDesc                      vMsgDesc;
int             nuDtmfs;
BOOLEAN         typeahead;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

SuccFail PP_plaympN( portDesc, msgp, nuDtmfs, typeahead ) /* Play a message or series */
PP_PortDesc     portDesc;                        /* of messages.             */
char            *msgp;                     /* pointer to message or filename */
int             nuDtmfs;
BOOLEAN         typeahead;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

SuccFail PP_recordN( ppNu, vMsgDesc, maxDuration, maxSilence, nuDtmfs )
int     ppNu;
VM_MsgDesc vMsgDesc;
int     maxDuration;    /* Seconds */
int     maxSilence;     /* Seconds */
int     nuDtmfs;

SuccFail PP_dial( portDesc, phoneNu )
PP_PortDesc     portDesc;
String          phoneNu;

typedef struct PP_PortInfo {
   struct PP_PortInfo *next;
   struct PP_PortInfo *prev;
   PP_PortId portId;
   Int dev;
   struct PP_SapInfo *sapInfo;
   Char dtmfBuf[PP_K_DtmfNuMax];
} PP_PortInfo;
typedef PP_PortInfo *PP_PortDesc;

SuccFail         PP_setDtmfDurations( boardDev )
int boardDev;
Set new DTMF duration and inter-digit delay.

SuccFail PP_genDtmf( portDesc, phoneNu )
PP_PortDesc     portDesc;
char            *phoneNu;