Beispiel #1
0
int main(int argc, char **argv) {
	int     numController;
	int     BChannels, Contr;
	int     c;
	int     ret;

	verbose = 0;
	while ((c = getopt(argc, argv, "vc:i:h:")) != EOF) {
		switch (c) {
			case 'v':
				verbose++;
				break;
			case 'c':
				CallingPartyNumber = strdup(optarg);
				break;
			case 'i':
				stationID = strdup(optarg);
				break;
			case 'h':
				headLine = strdup(optarg);
				break;
			case '?':
				usage();
		}
	}
	if (argc < optind + 2)
		usage();
	CalledPartyNumber = argv[optind++];
	Slot = INVALID_CONNECTION_ID;
	MainDataConf_p = MainDataConf;
	MainStateChange_p = MainStateChange;
	if (!RegisterCAPI())
		return -1;
	atexit (ReleaseCAPI);
	InitConnectionIDHandling();
	if (!(numController = GetNumController())) {
		fprintf(stderr, "No CAPI controllers available\n");
		return -2;
	}
	BChannels = 0;
	for (Contr=1; Contr<=numController; Contr++)
		BChannels += GetNumOfSupportedBChannels(Contr);
	if (!BChannels) {
		fprintf(stderr, "No B-Channels available\n");
		return -3;
	}
	ret = SendFax(argv[optind]);
	if ((Slot != INVALID_CONNECTION_ID) &&
		(GetState(Slot) != Disconnected) &&
		(GetState(Slot) != D_DisconnectPending))
		Disconnect(Slot);
	return ret;
}
Beispiel #2
0
Smt_Uint TBaseDevice::OnCmdSendFax(Smt_Pdu &pdu)
{
	Smt_Uint channel;
	Smt_String faxfile;
	Smt_Uint startpage;
	Smt_Uint pagenum;
	pdu.GetUint(Key_IVR_ChannelID, &channel);
	pdu.GetString(Key_IVR_FaxName, &faxfile);
	pdu.GetUint(Key_IVR_FaxStartPage, &startpage);
	pdu.GetUint(Key_IVR_FaxPageNum, &pagenum);
	if(!CheckUserAndChannel(channel))return Smt_Fail;

	SendFax(channel, faxfile, startpage, pagenum);
	return Smt_Success;
}