source: verona/phapi/phapi.h @ 161:44e78cf7fed0

Last change on this file since 161:44e78cf7fed0 was 161:44e78cf7fed0, checked in by Vadim Lebedev <vadim@…>, 2 years ago

implement header monitoring

File size: 44.5 KB
Line 
1#ifndef __PHAPI_H__
2#define __PHAPI_H__ 1
3/*
4  The phapi module implements simple interface for eXosip stack
5  Copyright (C) 2004  Vadim Lebedev  <vadim@mbdsys.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20*/
21
22/**
23 * @file phapi.h
24 * @brief softphone  API
25 *
26 * phoneapi is a library providing simplified api to create VOIP sessions
27 * using eXosip library oSIP stack and oRTP stack
28 * <P>
29 */
30
31/**
32 * @defgroup phAPI  Phone API
33 * @{
34 * 
35 *  From the perspecitve of the phApi client the call can be in the following states:
36 *   
37 *   [INCOMING], [ACCEPTING], [OUTGOING], [ESTABLISHED], [ONHOLD], [CLOSED]
38 *
39 *               
40 *                                              V
41 *                           +--(INCALL)--------+----(phPlaceCall)-------------------+
42 *                           |                                                       |
43 *                           |                                                       |
44 *                           v                                                       v           
45 *  +--(phRejectCall)--<-[INCOMING]<----<------- +                               [OUTGOING]--(DIALING/RINGING)-->-+
46 *  |                        v                   ^                                v   v  ^                        |
47 *  |                        |                   |                                |   |  |                        |
48 *  |                        +--(phRingingCall)--+                                |   |  |                        |
49 *  |                        |                                                    |   |  |                        |
50 *  |                        v                                                    |   |  |                        |
51 *  |                   (phAcceptCall)            +--------+                      |   |  +------------------------+
52 *  |                        |                 (DTMF)      |                      |   |
53 *  |                        |                    ^        |                  (CALLOK)|
54 *  |                        v                    |        v                      v   |
55 *  |                  [ACCEPTING]->--(ret==0)-->[ESTABLISHED]<--+---------+------+   +-------->+
56 *  |                        |                    v        v               ^                    v
57 *  |                        |                    |        |               |                    |
58 *  |                (CALLCLOSED/CALLERROR)       +   (CALLHELD/HOLDOK)    |    (CALLCLOSED/CALLERROR/CALLBUSY/NOANSWER/REDIRECTED)
59 *  |                        |                    |        |               |                    |
60 *  |                        |             (CALLCLOSED)    |               ^                    |
61 *  |                        v                    |        +->[ONHOLD]->(CALLRESUMED/RESUMEOK)  |
62 *  |                        |                    |             v                               |
63 *  |                        |                    |             |                               |
64 *  |                        |                    +<-----(CALLCLOSED)                           |
65 *  |                        |                    |                                             |
66 *  v                        |                    v                                             v
67 *  +------------------------+------->[CLOSED]<---+---------------------------------------------+
68 *
69 *
70 *   Blind transfer operation
71 *
72 *   Suppose we have 2 parties A and B  and a call 'cid'  established between them.
73 *   On the A's side the call is identified bu cidA  and on the B's side the call is identfied by cidB.
74 *   Suppose the user A  want to transfer the call to a 3rd party  P.
75 *   So A does :
76 *     phBlindTransferCall(cidA, "P");
77 *   this will cause following sequence of events:
78 *     1. B  will receive a CALLHELD event
79 *     2. B  will receive a XFERREQ  event for cidB containingg "P" as remoteUri and newcid field will
80 *           contain a callid for an automatically generated call to the new destination
81 *   A will receive a XFERPROGRESS event
82 *   P will receive a INCALL event
83 *   P will do:
84 *     phAcceptCall
85 *   B will receive CALLOK
86 *   A will receive XFEROK
87 *   A will get CALLCLOSED for cidA
88 *   B will get CALLCLOSED  for cidB
89 *
90 *  In case of failure transfer for whatever reason A will receive an
91 *   XFERFAIL event with status field containing SIP status code
92 *
93 *   the file ../miniua/minua.c contains the code demonstrating the usage of blind transfer
94 *
95 *
96 *  Assisted Transfer operation:
97 *
98 *   Suppose we have 2 parties A and B  and a call 'cid'  established between them.
99 *   On the A's side the call is identified bu cidA  and on the B's side the call is identfied by cidB.
100 *   Suppose the user A  want to transfer the call to a 3rd party  P.
101 *   So A does :
102 *     phHoldCall(cidA);
103 *   B will receive  CALLHELD event
104 *   A does:
105 *       newcid = phPlaceCall2("A", "P");
106 *   P Gets INCALL event with cidP0 and accepts it
107 *   A talks to B and then does
108 *     phHoldCall(newcid)
109 *   P gets CALLHELD event
110 *   A does
111 *     phTransferCall(cidA, newcid)
112 *   B  will receive a XFERREQ  event for cidB containing "P" as remoteUri and newcid field will
113 *      contain a callid for an automatically generated call to the new destination
114 *   A gets XFERPROGRESS events
115 *   P will get CALLREPLACED for cidP0 with newcid cidP1
116 *   A gets XFEROK event
117 *   A will get CALLCLOSED for cidA
118 *   B will get CALLCLOSED for cidB
119 *   P will get CALLCLOSED for cidP0 
120 *       
121 */
122
123#ifdef WIN32
124#if defined(BUILD_PHAPI_DLL)
125#define PHAPI_EXPORT __declspec(dllexport)
126#elif defined(PHAPI_DLL)
127#define PHAPI_EXPORT __declspec(dllimport)
128#endif
129#endif
130
131#ifndef PHAPI_EXPORT
132#define PHAPI_EXPORT
133#endif
134
135#ifndef PHAPI_VERSION_STRING
136#define PHAPI_VERSION_STRING "1.0.0"
137#endif
138
139#ifdef __cplusplus
140extern "C" {
141#endif
142
143enum phErrors {
144  PH_ERROR=1,    /* generic error */
145  PH_HOLDERR,     /* HOLD/RESUME error */
146  PH_BADID,      /* bad identity -  usually ther is no virtual line which correpond to 'from' or userid parameter */
147  PH_BADVLID,   /*  Bad virual line ID  */
148  PH_BADCID,     /* Bad callid */
149  PH_NOMEDIA,     /* No media stream avalable */
150  PH_NOTUNNEL,    /* Unable to create tunnel */
151  PH_NORESOURCES, /* No resources for operation */
152  PH_RPCERR,     /* RPC error */
153  PH_BADARG,      /* BAD argument */
154  PH_VLBUSY,       /* There is oparation pending on this VLINE */
155  PH_BADCFID,       /* bad conf call id */
156  PH_REDIRLOOP,    /* setFollomMe or blindTransfer creates a loop */
157  PH_NOTINIT       /* phapi isn't init */
158};
159
160#define PH_REFRESH_INTERVAL             30  /* 30 seconds */
161
162#define PH_SOCK_MODE_UDP 0
163#define PH_SOCK_MODE_HTTP_TUNNEL 1
164#define PH_STREAM_AUDIO (1 << 0)
165#define PH_STREAM_VIDEO_RX (1 << 1)
166#define PH_STREAM_VIDEO_TX (1 << 2)
167#define PH_STREAM_VIDEO (PH_STREAM_VIDEO_RX|PH_STREAM_VIDEO_TX)
168#define PH_OVERRIDE_AUDIO_ADDR (1 << 3)
169#define PH_OVERRIDE_VIDEO_ADDR (1 << 4)
170#define PH_NOMEDIA_STREAMS (1 << 5)
171#define PH_STREAM_DATA (1 << 6)
172#define PH_STREAM_MCSEND (1 << 7)
173#define PH_STREAM_MCRECV (1 << 8)
174
175enum ph_subs_type
176{
177  PH_SUBS_PRESENCE,    /*  regular presence events */
178  PH_SUBS_WINFO,        /* presence+watcher info */
179  PH_SUBS_PRESENCE_LIST, /* batched presence notifications */
180  PH_SUBS_CONFLIST,    /*  server based conference list */
181  PH_SUBS_SIPPROFILE,   /* server based contact list */
182  PH_SUBS_ADDRBOOK_QRY   /* query the addressbook for a contact list */
183};
184
185enum ph_line_mobility
186{
187
188  PH_LINE_MOBILITY_DEFAULT,
189  PH_LINE_MOBILITY_FIXED,
190  PH_LINE_MOBILITY_MOBILE
191};
192
193
194#ifndef SWIG
195/********************TELEPHONY*********************/
196
197/**
198 * Add virtual line
199 * The virtual line corresponds to identity/server/proxy triplet
200 *
201 * @param  displayname display name component of the SIP identity "displayname" <sip:username@host>
202 * @param  username    username   
203 * @param  host        the host component of SIP identity username@host corresponding to this virtual line
204 *                     if regTimeout != 0 'host' will designate the REGISTRAR server, in this case it may have form of host:port
205 *                     otherwise it should be set to IP address or hostname of the local machine
206 * @param  proxy       outgoing proxy URI  (all calls using this virtual line will be routed
207 *                     through this proxy)
208 * @param  regTimeout  registration timeout  (when 0 will NOT use registrations)
209 *                     to unergister one should do phDelVline (or phUnregister -- depreciated)
210 * @param  mobility    mobility value from enum ph_line_mobility
211 * @return             -1 in case of error vlid  in case of success
212 */
213PHAPI_EXPORT int phAddVline(const char* username, const char *host, const char*  proxy,  int regTimeout);
214PHAPI_EXPORT int phAddVline2(const char* displayname, const char* username, const char *host, const char*  proxy, int regTimeout);
215PHAPI_EXPORT int phAddVline3(const char* displayname, const char* username, const char *host, const char*  proxy, int regTimeout, int mobility);
216 
217/**
218 * Register virtual line
219 *  This will cause REGISTER request to be sent to server
220 *
221 * @param  vlid        Virual line id to register
222 * @return             0 in case of success
223 */
224PHAPI_EXPORT int phvlRegister(int vlid);
225
226/**
227* Set virtual line register timeout (must be call before phvlRegister)
228*
229* @param  vlid        Virual line id to register
230* @param  regTimeout  register timeout
231* @return             0 in case of success
232*/
233PHAPI_EXPORT int phvlSetRegisterTimeOut(int vlid, int regTimeout);
234       
235/**
236 * Delete virtual line
237 *  This will cause REGISTER request with timeout=0 to be sent to server if needed
238 *
239 * @param  vlid        Virual line id to remove
240 * @return             0 in case of success
241 */
242PHAPI_EXPORT int phDelVline(int vlid);
243
244
245/**
246 * @brief initialize the payload/codecs that are allowed to be handled by the SIP stack
247 */
248PHAPI_EXPORT void ph_payloads_init();
249       
250#define PH_STREAM_MAX_ATTRS 32
251
252struct ph_stream_params
253{
254  const char  *streamtype;    /*!<  "audio", "video", ... */
255  const char  *payloads;      /*!<  space separated list of accepted payloads, if NULL use default list */ 
256  const char  *streamaddr;    /*!<  ip address of the stream, if NULL use default address */
257  int   streamport;           /*!<  if != -1 stream port number else use default port */
258  const char  *attrs[PH_STREAM_MAX_ATTRS]; /*!<  NULL terminated list of RTP stream attributes    */
259};
260
261/**
262 * information about negotiated media streams
263 */ 
264struct ph_confirmed_media_info
265{
266  struct
267 {
268    int localport, remoteport;
269    char remoteip[32];
270  } audio;
271  struct
272  {
273    int localport, remoteport;
274    char remoteip[32];
275  } video;
276};
277
278/**
279 * Place an outgoing call using given virtual line
280 *
281 * @param vlid         virtual line id to use for the call
282 * @param uri          call destination address
283 * @param userData     application specific data
284 * @param rcid         call id of the original call (MUST BE ZERO)
285 * @param streams      which stream to activate
286 * @param adev         audio device for call
287 * @param audio_addr   audio stream address (NULL == default local address)
288 * @param video_addr   video stream address (NULL == default local address)
289 * @return             if positive the call id else error indication
290 */
291PHAPI_EXPORT int phLinePlaceCall(int vlid, const char *uri, void *userData, int rcid);
292PHAPI_EXPORT int phLinePlaceCall2(int vlid, const char *uri, void *userData, int rcid, int streams);
293PHAPI_EXPORT int phLinePlaceCall4(int vlid, const char *uri, void *userdata, int rcid, int streams, const char *adev, const char *audio_addr, const char *video_addr);
294PHAPI_EXPORT int phLinePlaceCall5(int vlid, const char *uri, void *userdata, int rcid, int streams, const char *adev, ...);
295
296/**
297 * Accept an incoming a call.
298 *
299 * @param cid          call id of call.
300 * @return             0 in case of success
301 */
302PHAPI_EXPORT int phAcceptCall2(int cid, void *userData);
303PHAPI_EXPORT int phAcceptCall3(int cid, void *userData, int streams);
304PHAPI_EXPORT int phAcceptCall4(int cid, void *userData, int streams, const char *audio_addr, const char *video_addr);
305
306/*
307 * Accept incoming call in multicast mode
308 * 
309 * @param cid  call id (it will be considered as master call)
310 * @param adev audio device (could be NULL to use defualt audio device)
311 * @param audioaddr  multicast ip addres for the audio stream
312 * @param port       port number for the audio stream
313 */
314PHAPI_EXPORT int phAcceptMcCall(int cid, const char *adev, const char *audioaddr, int port);
315
316
317/*
318 * Accept incoming call in multicast mode
319 * 
320 * @param cid  call id (it will be considered as slave id)
321 * @param mcid call id of the master call
322 * @param port       port number for the audio stream
323 */
324PHAPI_EXPORT int phAcceptMcCall2(int cid, int mcid);
325
326
327
328
329/*
330 * Place a call to a peer which will respiond with multicasted stream
331 * @param vlid         virtual line id to use for the call
332 * @param uri          call destination address
333 * @param userData     application specific data
334 * @param streams      which stream to activate
335 * @param adev         audio device for call
336 */
337PHAPI_EXPORT int phLinePlaceMcCall(int vlid, const char *uri, void *userdata, int streams, const char *adev);
338
339
340
341#define phAcceptCall(cid) phAcceptCall2(cid, 0)
342
343/**
344 * Reject the incoming call.
345 *
346 * @param cid          call id of call.
347 * @param reason       SIP reason code for the rejection
348 *                     suggested values: 486 - Busy Here, 488 - Not acceptable here
349 * @param uri          uri to stuff into Contact field in case of reason = 302
350 * @return             0 in case of success
351 */
352PHAPI_EXPORT int phRejectCall(int cid, int reason);
353PHAPI_EXPORT int phRejectCall2(int cid, const char *uri,int reason);
354
355
356/**
357 * Signal reining event to the remote side.
358 *
359 * @param cid          call id of call.
360 * @return             0 in case of success
361 */
362PHAPI_EXPORT int phRingingCall(int cid);
363
364/**
365 * Terminate a call.
366 *
367 * @param cid          call id of call.
368 * @return             0 in case of success
369 */
370PHAPI_EXPORT int phCloseCall(int cid);
371
372/**
373 * Perform an assisted  call transfer
374 *
375 * @param cid          call id of call.
376 * @param targetCid    call id of the destination call
377 * @return             txid  used in the subsequent transferProgress callback
378 */
379PHAPI_EXPORT int phTransferCall(int cid, int targetCid);
380
381PHAPI_EXPORT int phCallStartMedia(int cid, int streamFlags);
382PHAPI_EXPORT int phCallGetMediaInfo(int cid, struct ph_confirmed_media_info *mi);
383
384/**
385 * Get the SIP CallID for the given call
386 *
387 * @param cid  call id
388 * @param idbuf where to store the SIP  CallID string
389 * @param  bufsize size of te idbuf
390 */
391PHAPI_EXPORT int phCallGetSipCallID(int cid, char *idbuf,  int bufsize);
392
393
394
395/**
396 * Configure follow me address  for a virtual line.
397 * All incoming calls on this line  will be redirected to this address
398 *
399 * @param uri          destination of the forwarding
400 * @return             0 in case of success
401 */
402PHAPI_EXPORT int phLineSetFollowMe(int vlid, const char *uri);
403
404/**
405 * Set busy mode for a virtual line
406 * When activated all incoming calls will be answerd by busy signal
407 *
408 * @param busyFlag          when 0 busy mode is deactivated else activated
409 * @return             0 in case of success
410 */
411PHAPI_EXPORT int phLineSetBusy(int vlid, int busyFlag);
412
413
414
415/********************CHAT & PRESENCE*********************/
416
417/**
418 * Send a MESSAGE request
419 *
420 * @param vlid    virtual line id
421 * @param to      uri to put in the To: header
422 * @param target  request target-uri
423 * @param message  message to send
424 * @param mime  message mime type
425 * @param sipcid optional value for SIP CallID header
426 * @param cid  callid (used to send a message inside a dialog as per RFC 3428)
427 * @return  if positive msgid
428*/
429PHAPI_EXPORT int phLineSendMessage(int vlid, const char *uri,
430                                   const char *buff, const char *mime);
431PHAPI_EXPORT int phLineSendMessage2(int vlid, const char *target, const char *uri,
432                                   const char *buff, const char *mime, 
433                                    const char *sipcid);
434PHAPI_EXPORT int phCallSendMessage(int cid, const char *buff, const char *mime);
435
436
437
438
439/**
440 * Subscribe to presence
441 *
442 * @param vlid virtual line id
443 * @param to subscribe to
444 * @param winfo value from enum ph_subs_type specifying subscription kind
445 * @param data value setted in X-Addressbook header option
446 * @param use_proxy if 0, don't use vline proxy for request uri
447 * @param expire expire time of the subscribe
448 * @return 0 if success else -1
449*/
450PHAPI_EXPORT int phLineSubscribe2(int vlid, const char *to, const int winfo, char *data, int use_proxy, int expire);
451
452/**
453 * Subscribe to presence
454 *
455 * @param vlid virtual line id
456 * @param to subscribe to
457 * @param winfo value from enum ph_subs_type specifying subscription kind
458 * @return 0 if success else -1
459*/
460PHAPI_EXPORT int phLineSubscribe(int vlid, const char *to, const int winfo);
461
462/**
463 * Unsubscribe to presence
464 *
465 * @param vlid virtual line id
466 * @param to subscribe to
467 * @param winfo value from enum ph_subs_type specifying subscription kind
468 * @return 0 if success else -1
469*/
470PHAPI_EXPORT int phLineUnsubscribe(int sid, int winfo);
471
472/**
473 * Publish my presence
474 *
475 * @param vlid virtual line id
476 * @param to subscribe to
477 * @param winfo message type to send
478 * @param evt value for Event  SIP header
479 * @param content_type content type ("application/pidf+xml", for example)
480 * @param content content
481 * @param expires  expiration timeout
482 * @return 0 if success else -1
483*/
484PHAPI_EXPORT int phLinePublish(int vlid, const char *to, int winfo, const char * content_type, const char * content);
485PHAPI_EXPORT int phLinePublish2(int vlid, const char *to, const char *evt, const char * content_type, const char * content,
486                                int expires);
487
488
489
490/********************AUDIO*********************/
491
492/**
493 * Send a DTMF to remote party
494 *
495 * @param cid          call id of call.
496 * @param dtmfChar     DTMF event to send
497 *                     ('0','1','2','3','4','5','6','7','8','9','0','#','A','B','C','D','!')
498 * @mode               bitmask specifying DTMF geneartion mode
499 *                     INBAND - the DTMF signal is mixed in the outgoing
500 *                     RTPPAYLOAD - the DTMF signal will be sent using telephone_event RTP payload
501 *                     SIP -  use application/dtmf content type for INFO method
502 *                     SIPRELAY - use application/dtmf-relay content type method
503 * @return             0 in case of success
504 */
505#define PH_DTMF_MODE_INBAND 1
506#define PH_DTMF_MODE_RTPPAYLOAD 2
507#define PH_DTMF_MODE_ALLRTP 3
508#define PH_DTMF_MODE_SIP 4       
509#define PH_DTMF_MODE_SIPRELAY 8 
510PHAPI_EXPORT int phSendDtmf(int cid, int dtmfChar, int mode);
511
512/**
513 * Play a sound file
514 *
515 * @param fileName     file to play (the file externsion will determine the codec to use
516 *                     .sw - 16bit signed PCM, .ul - uLaw, .al - aLaw, .gsm - GSM, (.wav on Windows)
517 * @param loop         when TRUE play the file in loop
518 * @return             0 in case of success
519 */
520PHAPI_EXPORT int phPlaySoundFile(const char *fileName , int loop);
521
522/**
523 * Stop playing a sound file
524 *
525 * @return             0 in case of success
526 */
527PHAPI_EXPORT int phStopSoundFile( void );
528
529/**
530 * Mix a sound file into the outgoing network audio stream
531 *
532 * @param cid          call id
533 * @param fileName     file to play - for the moment only
534 *                      RAW audio files containing 16Bit signed PCM sampled at 16KHZ are supported
535 * @return             0 in case of success
536 */
537PHAPI_EXPORT int phSendSoundFile(int cid, const char *fileName);
538
539/**
540 * Set speaker volume 
541 *
542 * @param      cid       call id (-1 for general volume, -2 for playing sounds)
543 * @param      volume    0 - 100
544 * @return             0 in case of success
545 */
546PHAPI_EXPORT int phSetSpeakerVolume(int cid,  int volume);
547
548/**
549 * Set recording level 
550 *
551 * @param      cid - call id (-1 for general recording level)
552 * @param      level    0 - 100
553 * @return             0 in case of success
554 */
555PHAPI_EXPORT int phSetRecLevel(int cid,  int level);
556
557/**
558 * Change Audio devices
559 * change the audio devices used by phApi. The change will take effect for
560 * the new calls only.
561 *
562 * @param  devstr    the same value as in phcfg.audio_dev
563 * @return           0 on success, or error code
564 *
565 */
566PHAPI_EXPORT int phChangeAudioDevices(const char *devstr);
567
568
569/**
570 * Change Video devices
571 * change the video devices used by phApi. The change will take effect for
572 * the new calls only.
573 *
574 * @param  devstr    the same value as in phcfg.audio_dev
575 * @return           0 on success, or error code
576 *
577 */
578PHAPI_EXPORT int phChangeVideoDevices(const char *devstr);
579
580/**
581 * Set the value for UserAgent header
582 *
583 * @param uastring              value ut use in UserAgent header
584 * @return      0 if succeeds, an error value otherwise
585 */
586PHAPI_EXPORT int  phSetUaString(const char *uastr);
587
588
589/**
590  * Add customization rule for given header, for given request types
591  * the customization can be later disabled and re-enabled by using phEnableCustomization...
592  *
593  * @param reqnames  comma separated list of SIP REQUEST NAMES in capital letters  to which this rule apply ("*" means all requests)
594  * @param hdrname   the header name to add
595  * @param hdrval       header value to add
596  * @return     -1 in case of failure (no memory) or positive index to use in phEanbleCustomization...
597  */
598PHAPI_EXPORT int phAddCustomHeader(const char *reqnames, const char *hdrname,  const char *hdrval);
599
600/*
601 * Enable or Disable a given customization
602 *
603 * @param custID   the customization id (value returned by phAddCustomHeader)
604 * @param enable   if zero the customization is disabled else enable
605 * @return 0 in case of success, -1 if custID specifies non-existent
606 */
607PHAPI_EXPORT int phEnableCustomization(int custID, int enable);
608
609
610/**
611  * Add monitoring rule for given header, for given request/response types
612  * the rule can be later disabled and re-enabled by using phEnableCustomization...
613  *
614  * @param reqnames  comma separated list of SIP REQUEST NAMES in capital letters  to which this rule apply ("*" means all requests)
615  * @param hdrname   the header name to add
616  * @param hdrval       header value to add
617  * @return     -1 in case of failure (no memory) or positive index to use in phEnableMonitor...
618  */
619
620PHAPI_EXPORT int phMonitorHeader(const char *reqnames, const char *hdrname);
621
622/*
623 * Enable or Disable a given montor rule
624 *
625 * @param ruleID   the rule id (value returned by phMonitorHeader)
626 * @param enable   if zero the rule is disabled else enable
627 * @return 0 in case of success, -1 if custID specifies non-existent
628 */
629
630PHAPI_EXPORT int phEnableMonitor(int ruleID, int enable);
631
632PHAPI_EXPORT void phResetMonitoring();
633
634/********************CONFERENCING*********************/
635
636/*
637 *  conferencing APIs (not yet finished)
638 *
639 *  These Fuctions and callback events are avaialable to the confernce intiator application
640 *  The conference members are for the moment completely unaware of the fact that they are participating
641 *  in a conf call
642 *
643 */
644
645/**
646 * Create a conference
647 * Given a call id transform this call into a conference
648 * In case of success this API will provoke a deliverey of phCONFCREATED event, following
649 * by the phCONFJOINED event with memberCid = cid
650 *
651 * @param   cid  call id to tranform into the conference
652 * @return        if positive conference id  else error code
653 *
654 */
655PHAPI_EXPORT int phConfCreate(int cid);
656
657/**
658 * Invite a party to a conference
659 * This call is more or less equivalent to phLinePlaceCall followed by phConfAddMember
660 *
661 * @param   cid  call id to tranform into the conference
662 * @return        callid of the created call or error code
663 *
664 */
665PHAPI_EXPORT int phLineConfInvite(int vlid, int cfid, const char *uri);
666
667/**
668 * Add a given call to the given conference
669 * This will provoke phCONFJOINED event or phCONFJOINERROR event
670 *
671 * @param    cfid conference id
672 * @param    cid  call id to add ito the conference
673 * @return   0 or error code
674 *
675 */
676PHAPI_EXPORT int phConfAddMember(int cfid, int callid);
677
678/**
679 * Remove a call from the conference
680 * This will provoke phCONFLEFT event
681 * The removed call will be moved to LOCALHOLD state, if the application wish to terminate it
682 * it should call phCloseCall explicitly
683 *
684 * @param    cfid conference id
685 * @param    cid  call id to remove from the conference
686 * @return   0 or error code
687 *
688 */
689PHAPI_EXPORT int phConfRemoveMember(int cfid, int cid);
690
691/**
692 * Close the conference
693 * This will provoke phCONFCLOSED event
694 * all member calls will be moved to LOCALHOLD state
695 *
696 * @param    cfid conference id
697 * @return   0 or error code
698 *
699 */
700PHAPI_EXPORT int phConfClose(int cfid);
701
702
703/* Conference Test: simple implementation */
704
705/**
706 * Start conferencing btewwen to calls
707 * This will start mixing of audio streams coming from two correspodents
708 * @param    cid1 first call id to mix
709 * @param    cid2 second call id to mix
710 * @return   0 or error code
711 *
712 */ 
713PHAPI_EXPORT int phConf(int cid1, int cid2);
714
715/**
716 * Stop  conferencing between to calls
717 * This will stop mixing of audio streams coming from two correspodents
718 * @param    cid1 first call id to mix
719 * @param    cid2 second call id to mix
720 * @return   0 or error code
721 *
722 */ 
723PHAPI_EXPORT int phStopConf(int cid1, int cid2);
724
725
726
727
728
729/********************UTILS*********************/
730
731/**
732 * Set value of SIP "Contact:"  associated with given virtual line
733 * @param    vlid virtual line id
734 * @param    uri value of the "Contact:" header
735 * @param    translate if non-zero the uri will be translated by phApi to use local ip address, else the uri will be used as is.
736 * @return   0 or error code
737 *
738 */ 
739PHAPI_EXPORT  int phSetContact(int vlid, const char *uri);
740PHAPI_EXPORT  int phSetContact2(int vlid, const char *uri, int translate);
741
742
743/**
744 * Return the SIP address associated to the given virtual ine id
745 *
746 * @param vlid   --   virtual line id
747 * @param buf     --  the buffer that receive the SIP address
748 * @param bufsize -- the size of the buffer
749 * @return --  0 in case of success
750*/
751PHAPI_EXPORT int phLineGetSipAddress(int vlid, char buf[], int bufsize);
752
753/**
754 * Send an OPTIONS packet send OPTIONS packet using given destination over given
755 * virtual line
756 * 
757 * @param vlid  --  vlid
758 * @param to    --  uri to put in the To: header
759*/
760PHAPI_EXPORT int phLineSendOptions(int vlid, const char *to);
761
762/**
763 * Return the NAT router type and it's ip address
764 *
765 * @param   natType  string buffer to receive nat type string (possible "fcone,rcone,prcone,sym,open")
766 * @param   ntlen  sizeof natType buffer
767 * @param   fwip   firewall ip address buffer
768 * @param   sizeof of fwip buffer
769 * @return  error or success code
770 *
771 */
772PHAPI_EXPORT int phGetNatInfo(char *natType, int ntlen, char *fwip, int fwiplen);
773
774
775/**
776 * Set mobility flag on the vilrual line
777 *
778 * @param vlid virtual line id
779 * @param mobility value from enum ph_line_mobility
780 * @return mobility value or negative error code
781 *
782 */
783PHAPI_EXPORT int phLineGetMobility(int vlid);
784
785
786/**
787 * Return the codecs used for the given call
788 *
789 * @param   cid  call id in question
790 * @param   audioCodecBuf  buffer to return audio codec used (or NULL)
791 * @param   aBufLen  size of audioCodecBuf
792 * @param   videoCodecBuf  buffer to return video codec used (or NULL)
793 * @param   vBufLen  size of videoCodecBuf
794 * @return  0 or error code
795 *
796 */
797
798PHAPI_EXPORT int phCallGetCodecs(int cid, char *audioCodecBuf, int aBufLen, char *videoCodecBuf, int vBufLen);
799
800
801/**
802 * @brief Try to crash the application
803*/
804PHAPI_EXPORT int phCrash();
805
806#endif
807
808/********************STRUCTS*********************/
809
810struct ph_hdr_val {
811        const char *hdr;
812        const char *val;
813};
814typedef struct ph_hdr_val ph_hdr_val_t;
815
816struct ph_hdr_list {
817        int count;
818        struct ph_hdr_val *elems;
819};
820
821typedef struct ph_hdr_list ph_hdr_list_t;
822
823/**
824 * @enum phCallStateEvent
825 * @brief call progress events.
826 *
827 */ 
828enum  phCallStateEvent {
829        phDIALING, phRINGING, phNOANSWER, phCALLBUSY,
830        phCALLREDIRECTED, phCALLOK,     phCALLHELD, phINCALLREADY,
831        phCALLRESUMED, phHOLDOK, phRESUMEOK, phINCALL,
832        phCALLCLOSED, phCALLERROR, phDTMF, phXFERPROGRESS,
833        phXFEROK, phXFERFAIL, phXFERREQ, phCALLREPLACED,
834        phRINGandSTART, phRINGandSTOP, phCALLCLOSEDandSTOPRING
835};
836/**
837 * @struct phCallStateInfo
838 */
839struct phCallStateInfo {
840  enum phCallStateEvent event;
841  void *userData;              /*!< used to match placeCall with callbacks */ 
842  const char *localUri;        /*!< valid for all events execpt CALLCLOSED and DTMF */
843  int   newcid;                /*!< valid for CALLREPLACED and XFERREQ */
844  int   oldcid;                /*!< in case of CALL OK specifies the old CALL which was target of XFRERREQ */
845  int   vlid;                  /*!< virtual line id */
846  int   streams;               /*!< proposed (for phINCALL) and active (for other events) streams for the call */
847  char  *callinfo;             /*! pointer to Call-Info header value if available */ 
848  const char  *remoteUri;    /*!< valid for all events execpt CALLCLOSED, DTMF and CALLERROR */
849  int   errorCode;           /*!< valid for CALLERROR */
850  int   dtmfDigit;           /*!< valid for DTMF */
851  const char *remoteSdp;
852  struct ph_hdr_list hlist;
853};
854typedef struct phCallStateInfo phCallStateInfo_t;
855
856
857/**
858 * @enum phMsgEvent
859 */
860enum phMsgEvent {
861    phMsgNew, phMsgOk, phMsgError
862};
863/**
864 * @struct phMsgStateInfo
865 */
866struct phMsgStateInfo {
867  enum phMsgEvent event;
868  int   status;
869  const char *from;
870  const char *to;
871  const char *ctype;
872  const char *subtype;
873  const char *content;
874  const char *rawctt;
875  int   cid;     /*!<  when non-zero this is message inside a dialog corresponding to call 'cid' */
876  struct ph_hdr_list hlist;
877};
878typedef struct phMsgStateInfo  phMsgStateInfo_t;
879
880
881/**
882 * @enum phSubscriptionEvent
883 */
884enum phSubscriptionEvent {
885        phSubscriptionOk, phSubscriptionErrNotFound, phSubscriptionError
886};
887/**
888 * @struct phSubscriptionStateInfo
889 */
890struct phSubscriptionStateInfo  {
891        enum phSubscriptionEvent event;
892        int status;
893        char *from;
894        char *to;
895        struct ph_hdr_list hlist;
896};
897typedef struct phSubscriptionStateInfo  phSubscriptionStateInfo_t;
898
899
900struct phPicture
901{
902        int width,height;
903        void *planes[4];
904        int strides[4];
905};
906typedef struct phPicture  phPicture_t;
907       
908/**
909 * @struct phVideoFrameReceivedEvent
910 */
911struct phVideoFrameReceivedEvent {
912        phPicture_t *frame_remote;
913        phPicture_t *frame_local;
914};
915typedef struct phVideoFrameReceivedEvent  phVideoFrameReceivedEvent_t;
916
917
918/**
919 * @enum phConfEvent
920 */
921enum phConfEvent {
922  phCONFCREATED,   /* conference is created */
923  phCONFJOINED,    /* memeber joined a the conferences */
924  phCONFLEFT,      /* member left a conference */
925  phCONFCLOSED,     /* coneference closed       */ 
926  phCONFJOINERROR,   /* error joining a member to a conference */
927  phCONFERROR       /* generic error */
928};
929/**
930 * @enum phConfStateInfo
931 */
932struct phConfStateInfo {
933  int  confEvent;
934  int  memberCid;  /* call id's for the calls participating in the conference */
935                   /* valid for CONFJOINED,CONFLEFT,CONFJOINERROR events      */
936  int  errorCode;
937};
938typedef struct phConfStateInfo phConfStateInfo_t;
939
940/**
941 * @struct phVideoConfig
942 */
943struct ph_videoconfig_s {
944#define PHAPI_VIDEO_LINE_50KBPS         0
945#define PHAPI_VIDEO_LINE_64KBPS         1
946#define PHAPI_VIDEO_LINE_128KBPS        2
947#define PHAPI_VIDEO_LINE_256KBPS        3
948#define PHAPI_VIDEO_LINE_512KBPS        4
949#define PHAPI_VIDEO_LINE_1024KBPS       5
950#define PHAPI_VIDEO_LINE_2048KBPS       6
951#define PHAPI_VIDEO_LINE_AUTOMATIC      5
952        int video_fps;
953        int video_camera_flip_frame;
954        int video_max_frame_size;
955        int video_webcam_capture_width; /** width x height for capture must be given. 320x240 is a good guess */
956        int video_webcam_capture_height;
957        int video_line_configuration;
958        int video_codec_max_bitrate;
959        int video_codec_min_bitrate;
960        char video_device[256];
961};
962
963/**
964 * @struct ph_videocodecconfig_s
965 * @brief temporary structure that holds codec config, to be set from GUI
966 */
967struct ph_videocodecconfig_s {
968        int minrate;
969        int maxrate;
970        int gopsize;
971        int qmin;
972        int qmax;
973        float b_offset;
974        float b_factor;
975        float i_offset;
976        float i_factor;
977        int compress;
978        int max_b_frame;
979        int f_quality;
980};
981
982typedef struct phTransferStateInfo phTransferStateInfo_t;
983typedef struct phRegStateInfo phRegStateInfo_t;
984typedef void (*phFrameDisplayCbk)(int cid, phVideoFrameReceivedEvent_t *ev);
985
986
987#ifndef SWIG
988/********************MAIN*********************/
989
990/**
991 * @struct phCallbacks
992 * @brief  callbacks to the MMI
993 */
994struct phCallbacks {
995  void  (*callProgress)(int cid, const phCallStateInfo_t *info);       /*!< call progress callback routine */
996  void  (*transferProgress)(int cid, const phTransferStateInfo_t *info); /*!< transfer progress callback routine */
997  void  (*confProgress)(int cfid, const phConfStateInfo_t *info);        /*!< conference progress callback routine */
998  void  (*regProgress)(int regid, int regStatus);                       /*!< registration status (0 - OK, else SIP error code */
999  void  (*msgProgress)(int mid,  const phMsgStateInfo_t *info);
1000  void  (*connectionLost)(const char* host, int port);                  /*!< TCP connection lost */
1001  void  (*onNotify) (const char* event, const char* from, const char *ctt, const char* content);
1002  void  (*subscriptionProgress)(int sid,  const phSubscriptionStateInfo_t *info);
1003  phFrameDisplayCbk onFrameReady;
1004  void  (*errorNotify) (enum phErrors error);
1005};
1006typedef struct phCallbacks phCallbacks_t;
1007
1008/**
1009 * @var phcb
1010 * @brief pointer to callback structure
1011 *
1012 */
1013PHAPI_EXPORT extern phCallbacks_t *phcb;
1014
1015/**
1016 * Initilize phApi
1017 *
1018 * @param cbk          pointer to callback descriptor
1019 * @param server       string containing an ip address of the phApi server
1020 *                     (ignored when in direct link mode)
1021 * @param asyncmode    when != 0 a thread will be created to deliver
1022 *                     callbacks asyncronously, othewise the client
1023 *                     is supposed to call phPoll periodically to get
1024 *                     phApi events delivered
1025 *                     In DIRECT link mode this parameter is copied to the phcfg.asyncmode structure
1026 *                     in client/server mode this parameter has client local meaning.
1027 */
1028PHAPI_EXPORT int phInit(phCallbacks_t *cbk, char *server, int asyncmode);
1029
1030/**
1031 *  Terminate phApi
1032 */
1033PHAPI_EXPORT void phTerminate( void );
1034
1035/**
1036 * Add authentication info
1037 * the given info will be to send as authentication information
1038 * when server request it.
1039 *
1040 * @param  username    username which will figure in the From: headers
1041 *                     (usually the same as userid)
1042 * @param  userid      userid field value
1043 * @param  realm       authentication realm
1044 * @param  passwd      password correspoinding to the userid
1045 * @return             0 in case of success
1046 */
1047PHAPI_EXPORT int phAddAuthInfo(const char *username, const char *userid,
1048              const char *passwd, const char *ha1,
1049              const char *realm);
1050
1051/**
1052 * Configure tunnel parameters:         This funtion should be call just before phInit, when the global variable phcfg
1053 *                                                                      is properly set up.
1054 *
1055 * @param http_proxy                        IP address of http proxy in local network, set to 0 if there is no local proxy
1056 * @param http_proxy_port                               Port of local http proxy
1057 * @param httpt_server                          IP address of the HTTP TUNNEL SERVER that do the http to udp conversion
1058 * @param httpt_server_port                     Port of the HTTP TUNNEL SERVER that do the http to udp conversion
1059 * @param proxy_user                            User name used for authentication purpose
1060 * @param proxy_passwd                          Password for proxy
1061 * @param use_ssl                           if true request usage of SSL protocol
1062 * @param autoconf                      If this is set to 1, this funtion will try to detect network configuration when it can't
1063 *                                                                      setup a tunnel with given parameters.
1064*/
1065PHAPI_EXPORT int phTunnelConfig(const char* http_proxy, const int http_proxy_port,
1066                                                                const char* httpt_server, const int httpt_server_port, 
1067                                                                const char *proxy_user, const char* proxy_passwd,
1068                                                                int use_ssl, int autotoconf);
1069
1070/**
1071  @var phIsInitialize
1072  @brief 1 : if phInit has been called and phTerminate has not been called
1073                 0 : Otherwise
1074*/
1075PHAPI_EXPORT extern int phIsInitialized;
1076
1077/**
1078 * Get the version of the phAPI module
1079 *
1080 * @return  encoded value corresponding to Version.Subversion.Release
1081 *
1082 */
1083PHAPI_EXPORT int phGetVersion(void);
1084
1085/**
1086 * Get the mecurial reivision of the phAPI module
1087 *
1088 * @return  the value of PHAPI_REVISION (hg tip --template="{rev}")or NULL if not set
1089 *
1090 */
1091PHAPI_EXPORT const char * phGetRevision(void);
1092
1093/**
1094 * poll for phApi events
1095 */
1096PHAPI_EXPORT int phPoll( void );
1097
1098
1099/**
1100 * Set debugging level (between 0 and 9)
1101 */
1102PHAPI_EXPORT void phSetDebugLevel(int);
1103PHAPI_EXPORT int  phGetDebugLevel();
1104
1105
1106/**
1107 * Define log file name
1108 */
1109PHAPI_EXPORT void phSetLogFileName(const char *name);
1110
1111
1112/**
1113 * Internal function. Do a register for all virtual lines
1114 */
1115PHAPI_EXPORT void phRefresh(void);
1116
1117/**
1118 * In the case of rpc mode, the phapi server port
1119 */
1120PHAPI_EXPORT extern unsigned short phServerPort;
1121
1122
1123#define phRegister(u, s) phRegister2(u, s, 3600)
1124#define phUnregister(u, s) phRegister2(u, s, 0)
1125#define PH_UNREG_MASK               0x8000            /* this mask is ored with regStatus to distingush REGISTER from UNREGISTER */
1126
1127#define phRelease(v) ((v) & 0xff)
1128#define phSubversion(v) ((v >> 8) & 0xff)
1129#define phVersion(v) ((v >> 16) & 0xff)
1130
1131
1132/********************VIDEO*********************/
1133
1134PHAPI_EXPORT int  phVideoControlChangeFps(int callid, int fps);
1135PHAPI_EXPORT int  phVideoControlChangeQuality(int callid, int quality);
1136PHAPI_EXPORT int  phVideoControlSetCameraFlip(int flip);
1137PHAPI_EXPORT int  phVideoControlSetWebcamCaptureResolution(int width, int height);
1138PHAPI_EXPORT int  phVideoControlSetBitrate(int callid, int maxrate, int minrate);
1139PHAPI_EXPORT void phVideoControlCodecSet(int, struct ph_videocodecconfig_s *);
1140PHAPI_EXPORT void phVideoControlCodecGet(int, struct ph_videocodecconfig_s *);
1141
1142
1143#endif
1144
1145/********************CONFIG*********************/
1146
1147/**
1148 * @struct phConfig
1149 * @brief ph API configuration info
1150 */
1151#define VAD_VALID_MASK 0x80000000
1152#define VAD_THRESHOLD_MASK 0x7fffffff
1153
1154// SPIKE_HDX:different configuration modes are available
1155enum PH_HDX_MODES {
1156  PH_HDX_MODE_MIC = 1,   /*!< Half Duplex mode where microphone signal has priority over speaker signal */
1157  PH_HDX_MODE_SPK = 2    /*!< Half Duplex mode where speaker signal has priority over microphone signal */
1158};
1159
1160
1161struct ph_config_s {
1162  char local_ip_addr[16];  /*!< ip address to use in case of muti-homed setup */
1163  char local_audio_rtp_port[16]; /*!< port number used for RTP data */
1164  char local_audio_rtcp_port[16]; /*!< port number used for RTCP data */
1165  char local_audio_rtp_port_max[16]; /*!< maximal port number used for RTP data */
1166  char local_audio_rtcp_port_max[16]; /*!< maximal port number used for RTCP data */
1167  char local_video_rtp_port[16]; /*!< port number used for video RTP data */ 
1168  char local_video_rtcp_port[16]; /*!< port number used for video RTCP data */ 
1169
1170  char sipport[16];              /*!< sip port number */
1171  int transport;                        /*!< sip transport */
1172  char nattype[16];         /*!< nat type (auto,none,fcone,rcone,prcone,sym)  */
1173  char audio_codecs[128];         /*!< comma separate list of codecs in order of priority */
1174  char video_codecs[128];         /*!< comma separate list of codecs in order of priority */
1175                            /* example: PCMU,PCMA,GSM,ILBC,SPEEX   */
1176
1177  int  asyncmode;           /*!< when true phApi creates a separate eXosip polling thread... in client/server mode MUST be TRUE */
1178  char audio_dev[64];       /*!< audio device identifier */
1179                            /* example: IN=2 OUT=1 ; 2 is input device and 1 is ouput device */
1180  int softboost;            /* to be removed */
1181  int nomedia;
1182  int noaec;                /* when non-zero - disable aec */
1183  unsigned int vad;         /* if bit31=1  DTX/VAD features activated and bits0-30 contains the power threshold */
1184  int cng;                  /* if 1,  CNG feature will be negotiated */
1185 
1186  // SPIKE_HDX: setting of hdxmode in phconfig
1187  int hdxmode;              /* if 0, half duplex mode is desactivated. otherwise check enum PH_HDX_MODES */ 
1188 
1189  int nat_refresh_udp_time;       /* timeout for udp sip address/port refresh (when 0 no-refresh) */
1190  int nat_refresh_tcp_time;       /* timeout for tcp sip address/port refresh (when 0 no-refresh) */
1191  int nat_refresh_time_adjust;/*  timeout adjustment (must be at most nat_refresh_time/2) nat_refresh_time */
1192  int ptime;                              /* default global ptime */
1193  int jitterdepth;           /* jitter buffer depth in miliseconds (if 0 default of 60 msecs is used) */
1194  int stream_timeout;            /* max allowed latency before timeout in second, 0 or -1 to disable */
1195  int nodefaultline;         /* temporary hack for implementing backward compatibility... Don't touch it */
1196  int autoredir;            /*!< when NONZERO the redirect requests will be automatically executed by phApi
1197                              the new CID will be deliverd in newcid field  in the CALLREDIRECTED event */
1198  char stunserver[128]; /*!< stun server address:port or name:port */
1199
1200#define PH_TUNNEL_SSL 4
1201#define PH_TUNNEL_AUTOCONF 2
1202#define PH_TUNNEL_USE  1
1203  int  use_tunnel; 
1204
1205  char httpt_server[128];
1206  int  httpt_server_port;
1207  char http_proxy[128];
1208  int  http_proxy_port;
1209  char http_proxy_user[128];
1210  char http_proxy_passwd[128];
1211#ifdef WIN32
1212  void* videoHandle;
1213#endif
1214
1215  struct ph_videoconfig_s video_config;
1216  char  plugin_path[256];  /*!< where to look for plugin modules */
1217  int qos;                  /* QoS bits to add to TOS to : 0x2 min cost, 0x4 max reliability, 0x8 max throughput, 0x10 min delay */
1218  unsigned int hdxlevel;    /* if bit31=1  HDX level is valid and bits0-30 contains the power threshold */
1219
1220};
1221
1222
1223typedef struct ph_config_s ph_config_t;
1224
1225#ifndef SWIG
1226/**
1227 * @brief retrieve pointer to phapi config structure
1228 */
1229
1230PHAPI_EXPORT ph_config_t *ph_get_config();
1231
1232
1233/* JT */
1234#ifdef QOS_DEBUG_ENABLE
1235PHAPI_EXPORT void phrtcp_QoS_enable_rtcp_report(int ToF);
1236PHAPI_EXPORT void phrtcp_report_set_cb(jt_rtcpCallbacks_t *cbk);
1237PHAPI_EXPORT int phrtcp_report_begin();
1238PHAPI_EXPORT int phrtcp_report_end();
1239#endif /* QOS_DEBUG_ENABLE */
1240
1241#endif
1242
1243
1244/** Sound API **/
1245
1246struct ph_audio_card_desc_s
1247{
1248  char *id;
1249  char *name;
1250  unsigned int capabilities;
1251};
1252
1253typedef struct ph_audio_card_desc_s ph_audio_card_desc_t;
1254
1255struct ph_video_web_cam_desc_s
1256{
1257        char *id;
1258        char *name;
1259};
1260       
1261typedef struct ph_video_web_cam_desc_s ph_video_web_cam_desc_t;
1262       
1263#ifndef SWIG
1264/**
1265 * Return a list of available sound cards for capture
1266 * @param   device_tab  an array containing available ph_audio_card_desc_t
1267 * @return  number of device in the array or -1 on error
1268 */
1269
1270PHAPI_EXPORT int phAudioCaptureCardList(ph_audio_card_desc_t** device_tab);
1271
1272/**
1273 * Return a list of available sound cards for playback
1274 * @param   device_tab  an array containing available ph_audio_card_desc_t
1275 * @return  number of device in the array or -1 on error
1276 */
1277
1278PHAPI_EXPORT int phAudioPlaybackCardList(ph_audio_card_desc_t** device_tab);
1279
1280/**
1281 * Return a list of available webcam
1282 * @param   device_tab  an array containing available ph_video_cam_desc_t
1283 * @return  number of device in the array or -1 on error
1284 */
1285PHAPI_EXPORT int phVideoWebcamList(ph_video_web_cam_desc_t ** device_tab);
1286
1287/**
1288 * Apply a gain to the input signal
1289 * @param   cid   call associated with the audiostream
1290 * @param   gain  gain applied to the input signal
1291 * @return  0 if successfull, <0 otherwise.
1292 */
1293PHAPI_EXPORT int phAudioSoftRecvVolumeGain(int cid, float gain);
1294
1295/**
1296 * Apply a gain to the output signal
1297 * @param   cid   call associated with the audiostream
1298 * @param   gain  gain applied to the output signal
1299 * @return  0 if successfull, <0 otherwise.
1300 */
1301PHAPI_EXPORT int phAudioSoftSendVolumeGain(int cid, float gain);
1302
1303/**
1304 * Set playback mixer level value.
1305 * @param  cid    call associated with the audiostream
1306 * @param  percent  A volume level
1307 * @return  0 if successfull, <0 otherwise.
1308 */
1309PHAPI_EXPORT int phAudioRecvVolumeLevel(int cid, int percent);
1310
1311/**
1312 * Set capture mixer level value.
1313 * @param  cid    call associated with the audiostream
1314 * @param  percent  A volume level
1315 * @return  0 if successfull, <0 otherwise.
1316 */
1317PHAPI_EXPORT int phAudioSendVolumeLevel(int cid, int percent);
1318
1319/**
1320 * Mute playback mixer
1321 * @param  cid    call associated with the audiostream
1322 * @param  val    mute status 0: unmute, 1: mute
1323 * @return  0 if successfull, <0 otherwise.
1324 */
1325PHAPI_EXPORT int phAudioMutePlayback(int cid, int val);
1326
1327/**
1328 * Mute capture mixer
1329 * @param  cid    call associated with the audiostream
1330 * @param  val    mute status 0: unmute, 1: mute
1331 * @return  0 if successfull, <0 otherwise.
1332 */
1333PHAPI_EXPORT int phAudioMuteCapture(int cid, int val);
1334
1335#endif
1336
1337#ifdef __cplusplus
1338}
1339#endif
1340
1341/** @} */
1342#endif
Note: See TracBrowser for help on using the repository browser.