The reason why you cannot send to your own CoAP server is because of the APN. In the Arduino code this is specified in the “gprs_apn” variable (configured in arduino_secrets.h as “SECRET_GPRS_APN”). Right now you are most likely using the “telenor.iotgw” APN, which is a private APN that will only allow the device to send and receive data from the IP 172.16.32.1. Any other IP-adresses wont work. You can change the value of “SECRET_GPRS_APN” in arduino_secrets.h to “telenor.iot”, which is a public APN that will allow the device to send and receive data over the open internet (and your own CoAP server).
However, while using the public APN “telenor.iot” and CoAP you data traffic will not be encrypted. This can only be achieved by using the private APN “telenor.iotgw”, where the traffic is not routed on the open internet. This is why we use TLS encryption when using the MQTT protocol. You can get an overview of the difference between MQTT and CoAP here: https://telenorstartiot.github.io/