Esempio n. 1
0
OWPL_RESULT
owplShutdown()
{
	phTerminate();
	owsl_terminate();
	owslIsInitialized = 0;
	owplEventListenerRemoveAll();
	owplAdapterTerminate();
	return OWPL_RESULT_SUCCESS;
}
Esempio n. 2
0
static unsigned int execute_action(const char * input){
	char command[MAX_INPUT_SIZE];
	char argument[MAX_INPUT_SIZE];

	sscanf2(input, "%s %s\n", command, sizeof(command), argument, sizeof(argument));

	if(!strfilled(command)){
		return FALSE;
	}

	if(strequals(step, "start") && strequals(command, "register")){

		int i;
		char _username[100];
		char _display_name[100];
		char _passwd[100];
		char _domain[100];
		char _proxy[100];
		char _server[100];

		phTerminate();	

		strncpy(_proxy, "192.168.4.58:4060", sizeof(_proxy));
		snprintf(_display_name, sizeof(_display_name), "%s%d", "wx_wengo_", wx_wengo);
		//if(wx_wengo == 1) strncpy(_display_name, "wx_wengo_1", sizeof(_display_name));
		//if(wx_wengo == 2) strncpy(_display_name, "wx_wengo_2", sizeof(_display_name));
		strncpy( _passwd, "testwengo", sizeof(_passwd));
		strncpy( _domain, "voip.wengo.fr", sizeof(_domain));
		snprintf(_username, sizeof(_username), "%s%d", "wx_wengo_", wx_wengo);
		//if(wx_wengo == 1) strncpy(_username, "wx_wengo_1", sizeof(_username));
		//if(wx_wengo == 2) strncpy(_username, "wx_wengo_2", sizeof(_username));
		strncpy(_server, "voip.wengo.fr", sizeof(_server));

		memset(&phcfg, 0, sizeof(phcfg));
		strcpy(phcfg.local_rtp_port, "10601");
		snprintf(phcfg.sipport, sizeof(phcfg.sipport), "%s%d", "506", wx_wengo);
		//if(wx_wengo == 1) strcpy(phcfg.sipport, "5061");
		//if(wx_wengo == 2) strcpy(phcfg.sipport, "5062");
		strcpy(phcfg.nattype, "none");
		strcpy(phcfg.audio_dev,"IN=0 OUT=0");
		phcfg.asyncmode = 0;
		
		strncpy(phcfg.proxy, _proxy, sizeof(phcfg.proxy));

		phcfg.force_proxy = 1;
		phcfg.use_tunnel = 0;
		sprintf(phcfg.identity, "%s <sip:%s@%s>", _display_name, _username, _domain);

		i = phInit(&callbacks, "127.0.0.1", 0);

		phcfg.nat_refresh_time = 15; // TO CALL AFTER PHINIT, ELSE USELESS!!!!

		if (i == 0) {
			i = phAddAuthInfo(_username, _username, _passwd, 0, _domain);
		}

		if (i == 0) {
			vlid = phAddVline(_username, _server, _proxy, 10000);
		}else if (phcb) {
			phcb->regProgress(0, -1);
		}

		strncpy(SipDomain, _domain, sizeof(SipDomain));

		// register of sfp plugin
		sfp_register_plugin();
		sfp_set_plugin_callbacks(&sfp_cbks);
		sfp_set_file_transfer_port("11000");

		strncpy(step, "send", sizeof(step));

	}else if(strequals(command, "send")){

		char _dest[200];
		char tmp[200];
		char file_path[MAX_INPUT_SIZE];
		char file_name[MAX_INPUT_SIZE];
		char file_type[MAX_INPUT_SIZE];
		char file_size[MAX_INPUT_SIZE];

		if(!strfilled(argument)){
			return FALSE;
		}

		sscanf2(argument, "%s;%s;%s;%s;%s", _dest, sizeof(_dest), file_path, sizeof(file_path), file_name, sizeof(file_name), file_type, sizeof(file_type), file_size, sizeof(file_size));

		if(!strfilled(_dest) || !strfilled(file_path) || !strfilled(file_name) || !strfilled(file_type) || !strfilled(file_size)){
			return FALSE;
		}

		//if(wx_wengo == 2) strncpy(_dest, "wx_wengo_1", sizeof(_dest));
		//if(wx_wengo == 1) strncpy(_dest, "wx_wengo_2", sizeof(_dest));

		if (!strstr(_dest, "@") && !strstr("sip:", _dest)) {
			sprintf(tmp, "sip:%s@%s", _dest, SipDomain);
		}

		sfp_set_file_transfer_port("11000");
		sfp_send_file(vlid, phcfg.identity, tmp, file_path, file_name, file_type, file_size);

		//strncpy(step, "cancel", sizeof(step));

	}else if(strequals(command, "accept")){
		char user[32];
		char filename[128];
		int call_id = -1;

		if(!strfilled(argument)){
			return FALSE;
		}

		sscanf2(argument, "%s;%s", user, sizeof(user), filename, sizeof(filename));

		if(!strfilled(user) || !strfilled(filename)){
			return FALSE;
		}

		if((call_id = get_callid_from_wxwengo_user(user)) > 0){
			sfp_receive_file(call_id, argument);

			//strncpy(step, "cancel", sizeof(step));
		}

	}else if(strequalsamong(command, 2,"cancel", "refuse")){
		int call_id = -1;

		if(!strfilled(argument)){
			return FALSE;
		}

		if((call_id = get_callid_from_wxwengo_user(argument)) > 0){
			sfp_cancel_transfer(call_id);
		}

		//strncpy(step, "send", sizeof(step));

	}else if(strequals(command, "pause")){
		int call_id = -1;

		if(!strfilled(argument)){
			return FALSE;
		}

		if((call_id = get_callid_from_wxwengo_user(argument)) > 0){
			sfp_pause_transfer(call_id);
		}
	}else if(strequals(command, "resume")){
		int call_id = -1;

		if(!strfilled(argument)){
			return FALSE;
		}

		if((call_id = get_callid_from_wxwengo_user(argument)) > 0){
			sfp_resume_transfer(call_id);
		}
	}else{
		return FALSE;
	}

	return TRUE;
}
Esempio n. 3
0
MY_DLLEXPORT OWPL_RESULT
owplShutdown() {
	phTerminate();
	owplEventListenerRemoveAll();
	return OWPL_RESULT_SUCCESS;
}