From the php manual:
Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.
you should not use url path for that (also note that your url does not start with /
)
I would suggest using absolute filesystem path when specifying font file:
$dir = '/full/path/to/assets/fonts/asman.ttf';
imagettftext($image, 30, 0, 10, 40, $color, $dir, $_SESSION['random_code']);
I'm sure CI has some function to return the application path from which you can reference to proper file.