Home > Lucent Technologies > Communications System > Lucent Technologies DEFINITY Enterprise Communications Server Release 6 CallVisor PC ASAI Instructions Manual

Lucent Technologies DEFINITY Enterprise Communications Server Release 6 CallVisor PC ASAI Instructions Manual

Here you can view all the pages of manual Lucent Technologies DEFINITY Enterprise Communications Server Release 6 CallVisor PC ASAI Instructions Manual. The Lucent Technologies manuals for Communications System are available online for free. You can easily download all the documents as PDF.

Page 131

ASAI Library Functions
Issue  3  May 1998
4-9
asai_get_env( )
The asai_get_env function allows you to check the version of the ASAI library, 
or retrieve your node id and server settings.
The version number of the ASAI library includes three values:  a major value, a 
minor value and a delta value. A change to a major value indicates significant 
functional change to the ASAI library; for example, addition of new capabilities. A 
change to a minor value indicates change within the existing capabilities;...

Page 132

ASAI Library Functions
4-10Issue  3  May 1998 
asai_send( )
asai_send() and asai_rcv() together are the central functions in the library.  
These two functions convey all ASAI capabilities and data across an association.
asai_send() has only three parameters:  file descriptor fd, a pointer to the 
buffer that contains the message to be sent and the length of the buffer. It is your 
responsibility to map the message to the appropriate structure (one of the 
structures contained in the union asai_info_t);...

Page 133

ASAI Library Functions
Issue  3  May 1998
4-11
The maximum useful size of the user buffer is size of (asai_info_t), but you 
can select a size appropriate for your application. The example below uses size of 
(asai_common_t). If you are not sure, use size of (asai_info_t).
Figure 4-6.  asai_send () Function
asai_send() returns the size of the message on success and -1 on failure. 
Technically, a return code of 0 is not an error; however, it does indicate that only 
the control portion of a message has...

Page 134

ASAI Library Functions
4-12Issue  3  May 1998 
asai_rcv( )
This function reads messages from the communication path specified by fd. Like 
asai_send(), it expects a buffer and the length of the buffer to be passed to it.
Figure 4-7.  asai_rcv () Function
asai_rcv() returns the size of the buffer on success and -1 on failure. A return 
code of 0 does not indicate an error; it merely indicates that the received message 
was intended for the library and no program data is available at this time.
In the...

Page 135

ASAI Library Functions
Issue  3  May 1998
4-13
asai_close( )
You may never have to use asai_close(). However, the UNIX system imposes 
a limit on the number of files that can be open at one time. If your application 
opens a large number of files, you may have to call asai_close() to close 
specific communication paths. asai_close() closes the communication path 
identified by fd. It returns 0 on success and -1 on failure.
You may also want to write a function to close your application under certain...

Page 136

ASAI Library Functions
4-14Issue  3  May 1998 
Sample Code
The sample code reproduced here tests the Event Notification capabilities.
First the program determines whether the domain type is an ACD split or a call 
vector. Then it requests appropriate event reports.
The C_EN_REQ capability is sent on lines 65-74 in Figure 4-9. If an abort capability 
is received (lines 75 to 91) the program exits. Similarly, if 
C_EN_CONF is received with a negative acknowledgement (lines 92 to 98), as 
shown in Figure...

Page 137

ASAI Library Functions
Issue  3  May 1998
4-15
Figure 4-9. Sample Code — Testing the Event Notification Capabilities
  1   /*
    2    * :set tabstop=4 shiftwidth=4
    3    *
    4    * usage: entest  acd|vec  []
    5    *     entest signal01 acd 9999
    6    *               # receive reports from acd domain
    7    *     entest signal01 vec 9999 10
    8    *               # receive 10 reports from vector domain
    9    */
   10   
   11   #include 
   12   #include 
   13   #include 
   14...

Page 138

ASAI Library Functions
4-16Issue  3  May 1998 
Figure 4-9.  Sample Code — Testing the Event Notification Capabilities — Continued
  46         en.cv_info.domain_ext = argv[3];
   47      }
   48      else
   49      {
   50         goto usage;
   51      }
   52      if ((fd = asai_open(/dev/asai/asai, 0)) < 0)
   53      {
   54         asai_errval(asai_open(dev/asai/asai) failed:);
   55         exit(-asai_errno);
   56      }
   57      if (asai_set_env(fd, C_NODE_ID, argv[1]) < 0)
   58      {
   59...

Page 139

ASAI Library Functions
Issue  3  May 1998
4-17
Figure 4-9.  Sample Code — Testing the Event Notification Capabilities — Continued
  91      }
   92      else if (rsp.asai_common.capability==C_EN_CONF &&
   93          rsp.asai_common.primitive_type==C_NEG_ACK)
   94      {
   95         printf(	cause:%s
, \
   96            causes[rsp.en_rsp.en_nak.cause_value]);
   97         exit(2);
   98      }
   99      printf(
);
  100   
  101      for (;cnt--;)
  102      {
  103         if (asai_rcv(fd, &rsp,...

Page 140

ASAI Library Functions
4-18Issue  3  May 1998 
Figure 4-9.  Sample Code — Testing the Event Notification Capabilities — Continued
  136            break;
  137         default:
  138            printf(	Unexpected capability \
  139                           causes abort!
);
  140            exit(4);
  141         }
  142      }
  143   
  144      en.en_common.asai_common.capability = C_EN_CAN;
  145   
  146      printf(Sent: C_EN_CAN (C_REQUEST) on clid 0
);
  147      if (asai_send(fd, &en,...
Start reading Lucent Technologies DEFINITY Enterprise Communications Server Release 6 CallVisor PC ASAI Instructions Manual

Related Manuals for Lucent Technologies DEFINITY Enterprise Communications Server Release 6 CallVisor PC ASAI Instructions Manual

All Lucent Technologies manuals