Beispiel #1
0
/*
 * MainIncomingCall: signals an incoming call
 * This function will be executed if a CONNECT_INDication appears to
 * inform the user.
 */
static void MainIncomingCall(ConnectionID Connection, char *CallingPartyNumber) {
	B3_PROTO_FAXG3  B3conf;

	assert (Connection != INVALID_CONNECTION_ID);
	syslog(LOG_INFO, "Incoming Call from %s\n", CallingPartyNumber);
	SetupB3Config(&B3conf, FAX_SFF_FORMAT);
	if (CalledPartyNumber && strlen(CalledPartyNumber)) {
		syslog(LOG_INFO, "Called #: %s\n", GetCalledPartyNumber(Connection));
		if (strcmp(GetCalledPartyNumber(Connection), CalledPartyNumber)) {
			AnswerCall(Connection, IGNORE, 4, 4, 4, (_cstruct)&B3conf);
			syslog(LOG_INFO, "Call from %s ignored\n", CallingPartyNumber);
			return;
		}
	}
	if (Slot == INVALID_CONNECTION_ID) {
		Slot = Connection;
		sprintf(RcvName, "rc-%s-%08lx", CallingPartyNumber, time(NULL));
		f = fopen(RcvName, "wb");
		if (f != NULL) {
			FileReceive = TRUE;
			syslog(LOG_INFO, "Call from %s accepted\n", CallingPartyNumber);
			AnswerCall(Connection, ACCEPT, 4, 4, 4, (_cstruct)&B3conf);
			chmod(RcvName, 0600);
			return;
		}
	}
	AnswerCall(Connection, REJECT, 4, 4, 4, (_cstruct)&B3conf);
	syslog(LOG_INFO, "Call from %s rejected\n", CallingPartyNumber);
}
Beispiel #2
0
Smt_Uint TBaseDevice::OnCmdAnswerCall(Smt_Pdu &pdu)
{
	Smt_Uint channel;
	Smt_Uint rings;
	pdu.GetUint(Key_IVR_ChannelID, &channel);
	pdu.GetUint(Key_IVR_RingTimes, &rings);
	if(!CheckUserAndChannel(channel))return Smt_Fail;

	AnswerCall(channel, rings);
	return Smt_Success;
}