Solution to upnp not working

People who are trying to use Upnp module but ended up not working well there are two workarounds.
First method is by adding line external_ip 'your_ip_address' in upnpd file.
Well the only caveat is that after few days your IP address changes. So every time you'll have to replace current IP with the new one.

In second method we use STUN tool built in upnpd module. You can find that option under services > UpnP > Advanced settings > Use STUN

I've had tried "stun.stunprotocol.org" host with "3478" port but sadly it didn't work.
Alternative is "stun.l.google.com" host with "19302" port. Finally, service miniupnpd restart upnp starts to work as it should.
So it should look like this,

config upnpd 'config'
	option download '1024'
	option upload '512'
	option internal_iface 'lan'
	option port '5000'
	option upnp_lease_file '/var/run/miniupnpd.leases'
	option igdv1 '1'
	option enabled '1'
	option uuid '354xxxx-deaf-456xxxxx-73c75xxxxxxx'
	option use_stun '1'
	option stun_host 'stun.l.google.com'
	option stun_port '19302'

config perm_rule
	option action 'allow'
	option ext_ports '1024-65535'
	option int_addr '0.0.0.0/0'
	option int_ports '1024-65535'
	option comment 'Allow high ports'

config perm_rule
	option action 'deny'
	option ext_ports '0-65535'
	option int_addr '0.0.0.0/0'
	option int_ports '0-65535'
	option comment 'Default deny'

We're not done yet. Every time we restart the router somehow STUN doesn't work. So we've to manually restart miniupnpd service in order to UpnP to function. For that we can a create script like this,

#!/bin/bash
while ! ping -c 1 -W 1 8.8.8.8 > /dev/null 2>&1; do
    sleep 15
done
service miniupnpd restart
echo "miniupnpd Service Restarted"

Place it in root folder and name it as "ping_server.sh" with 0755 permission.
Now, go to the OpenWrt router page System >Startup > Local Startup paste

/root/ping_server.sh
exit 0

Save it. Test rebooting your router.
The "ping_server.sh" script will check for internet connection every 15s after every reboot. Once wan is up it'll restart miniupnpd service automatically.