📄 scprot.h
字号:
/* voifax scripting protocol interface library * Copyright (C) 2004 Simone Freddio & Andrea Emanuelli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#ifndef SCPROT_H#define SCPROT_H#include "libvoice.h"#include "scriptcntl.h"#define SP_HM_OK 1#define SP_HM_CLOSED 2#define SP_HM_NONE 3#define SP_HM_ERROR 0#define SP_DEVICES 12#define HANDSHAKE_WAITING 0#define HANDSHAKE_CONNECTING 1#define HANDSHAKE_DONE 2#define HANDSHAKE_CLOSED 3/* Outside event handlers */#define SP_EVENT_PLAY "SP_PLAY"#define SP_EVENT_GET_TTY "SP_GET_TTY"#define SP_EVENT_GET_MODEM "SP_GET_MODEM"#define SP_EVENT_AUTOSTOP "SP_AUTOSTOP"#define SP_EVENT_BEEP "SP_BEEP"#define SP_EVENT_DIAL "SP_DIAL"#define SP_EVENT_DEVICE "SP_DEVICE"#define SP_EVENT_RECORD "SP_RECORD"#define SP_EVENT_WAIT "SP_WAIT"#define SP_EVENT_STOP "SP_STOP"#define SP_EVENT_DTMF "SP_DTMF"#define SP_EVENT_QUOTE "SP_QUOTE"#define SP_EVENT_GETFAX "SP_GETFAX"#define SP_EVENT_SENDFAX "SP_SENDFAX"/* Voice protocol descriptor */typedef struct { t_scriptcntl sc; /* script control descriptor */ int handshake; /* script-library connection status */} t_sp;/* Devices types list */typedef struct { int devno; /* Device number */ char devname[50]; /* Device description */} t_sp_devdesc;int sp_handle_messages(void);/* Gestisce i messaggi in entrata dallo script esterno. La funzione non e' bloccante. Valori di ritorno: SCPROT_HM_OK = comando ricevuto ed eseguito SCPROT_HM_CLOSED = chiusura handshake dallo script SCPROT_HM_NONE = nessun comando da eseguire SCPROT_HM_ERROR = errore grave*/int sp_getstatus(void);/* Restituisce lo stato corrente dello script. Non esegue gestione dei messaggi. La funzione non e' bloccante. Valori di ritorno: SCPROT_HM_OK = comando ricevuto ed eseguito SCPROT_HM_CLOSED = chiusura handshake dallo script SCPROT_HM_NONE = nessun comando da eseguire SCPROT_HM_ERROR = errore grave*/int sp_init(char *cmd);/* Inizializza un descrittore di script protocol (i) cmd script Valori di ritorno: true = ok false = errore*//* Node abstraction functions (to avoid direct access to scripting protocol) */#define DEFINE_ABS_PROT(name) int sp_send_##name (void);DEFINE_ABS_PROT(ready)DEFINE_ABS_PROT(device_not_available)DEFINE_ABS_PROT(error)DEFINE_ABS_PROT(beeping)DEFINE_ABS_PROT(dialing)DEFINE_ABS_PROT(playing)DEFINE_ABS_PROT(recording)DEFINE_ABS_PROT(waiting)DEFINE_ABS_PROT(dtmfing)DEFINE_ABS_PROT(receiving)int sp_send_tty(char *dev);int sp_send_modem(char *modem);int sp_send_dtmf(char dtmf);DEFINE_ABS_PROT(bong_tone)DEFINE_ABS_PROT(busy_tone)DEFINE_ABS_PROT(loop_break)DEFINE_ABS_PROT(call_waiting)DEFINE_ABS_PROT(dial_tone)DEFINE_ABS_PROT(data_calling_tone)DEFINE_ABS_PROT(data_or_fax_detected)DEFINE_ABS_PROT(fax_calling_tone)DEFINE_ABS_PROT(handset_on_hook)DEFINE_ABS_PROT(handset_off_hook)DEFINE_ABS_PROT(loop_polarity_change)DEFINE_ABS_PROT(no_answer)DEFINE_ABS_PROT(no_carrier)DEFINE_ABS_PROT(no_dial_tone)DEFINE_ABS_PROT(no_voice_energy)DEFINE_ABS_PROT(ring_detected)DEFINE_ABS_PROT(ringback_detected)DEFINE_ABS_PROT(receive_dtmf)DEFINE_ABS_PROT(silence_detected)DEFINE_ABS_PROT(sit_tone)DEFINE_ABS_PROT(tdd_detected)DEFINE_ABS_PROT(voice_detected)DEFINE_ABS_PROT(unknown_event)#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -