Exemple #1
0
static int mod_init(void)
{
	if (ob_load_api(&rr_obb) == 0)
		LM_DBG("Bound rr module to outbound module\n");
	else
	{
		LM_INFO("outbound module not available\n");
		memset(&rr_obb, 0, sizeof(ob_api_t));
	}

#ifdef ENABLE_USER_CHECK
	if(ignore_user)
	{
		if (rr_obb.use_outbound)
		{
			LM_ERR("cannot use \"ignore_user\" with outbound\n");
			return -1;
		}
		i_user.s = ignore_user;
		i_user.len = strlen(ignore_user);
	}
	else
	{
		i_user.s = 0;
		i_user.len = 0;
	}
#endif

	if (add_username != 0 && rr_obb.use_outbound)
	{
		LM_ERR("cannot use \"add_username\" with outbound\n");
		return -1;
	}

	if (custom_user_spec.s) {
		custom_user_spec.len = strlen(custom_user_spec.s);
		if (pv_parse_spec(&custom_user_spec, &custom_user_avp) == 0
				&& (custom_user_avp.type != PVT_AVP)) {
			LM_ERR("malformed or non AVP custom_user "
					"AVP definition in '%.*s'\n", custom_user_spec.len,custom_user_spec.s);
			return -1;
		}
	}

	init_custom_user(custom_user_spec.s ? &custom_user_avp : 0);

	return 0;
}
Exemple #2
0
static int mod_init(void)
{
	if (use_received) {
		if (load_rr_api(&path_rrb) != 0) {
			LM_ERR("failed to load rr-API\n");
			return -1;
		}
		if (path_rrb.register_rrcb(path_rr_callback, 0) != 0) {
			LM_ERR("failed to register rr callback\n");
			return -1;
		}
	}

	if (ob_load_api(&path_obb) == 0)
		LM_DBG("Bound path module to outbound module\n");
	else {
		LM_INFO("outbound module not available\n");
		memset(&path_obb, 0, sizeof(ob_api_t));
	}
	
	return 0;
}