threads demonstrates handling multiple ports using one thread per port. This demonstration application is a multi-threaded answering machine using ctademo. Each thread opens a port and repeatedly waits for calls on the port. Each time a call is received, it answers, plays the answering message, and hangs up.
Note: adiStartPlaying (and consequently, this demonstration program) is not supported when the application is running in client/server mode.
threads [options]
where options are:
|
Option |
Use this option to specify the... |
|---|---|
|
-b n |
Board number n. Default is 0. |
|
-s n:m |
MVIP stream and timeslot for the first channel. Default is 0:0. |
|
-n nports |
Number of ports (and threads) to use. Default is 1. |
|
-p protocol |
Protocol to run. Default is lps0. |
|
-f filename |
Voice file to use for answering message. Default is answer.vce. Encoding is assumed to be ADI_ENCODE_NMS_24. |
adiStartPlaying (in DemoPlayFile)
Before running threads, verify that your system has the proper configuration. It must have the desired number of lines connected to loop start hybrids having the same MVIP stream and successive MVIP timeslots.
To run threads, type the following command at the prompt:
threads [-b n -s n:m -n nports -p protocol -f filename ]
Specify the MVIP stream, the lowest-numbered MVIP timeslot, and the number of timeslots to use.
The demonstration continues to answer all of the lines until you stop it by pressing Ctrl+C.
Note: Code in threads parses and documents the command line arguments and creates threads under various operating systems. RunDemo performs the call handling.