Couldn't set tty to PPP discipline

Hello, I am trying to enable PPP on imx6ull with BG95-M3 using Vi SIM.
I have enabled the CONFIG_PPP and CONFIG_PPP_ASYNC option in the kernel. So I get the /dev/ppp node created.
I have attached the PPP script are as below.

# /etc/ppp/peers/quectel-pppd
# Usage:root>pppd call quectel-pppd
#Modem path, like /dev/ttyUSB3,/dev/ttyACM0, depend on your module, default path is /dev/ttyUSB3
/dev/ttymxc4 115200
#Insert the username and password for authentication, default user and password are test
user "root" password "root"
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/ppp/peers/quectel-chat-connect'
# The close script
disconnect 'chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# Debug info from pppd
debug
# If you want to use the HSDPA link as your gateway
defaultroute
replacedefaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
# For sanity, keep a lock on the serial line
lock
modem
dump
nodetach
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns
persist
# /etc/ppp/peers/quectel-chat-disconnect
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
""  +++
""  +++
""  +++
SAY "\nGoodbay\n"
# /etc/ppp/peers/quectel-chat-connect
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
TIMEOUT 30
"" AT
OK ATE0
OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2
# Insert the APN provided by your network operator, default apn is 3gnet
OK AT+CGDCONT=1,"IP","www",,0,0
OK ATD*99#
CONNECT

When running the scripts using pppd call quectelppp, the Serial link was established but immediately it got disconnected saying: Couldn’t set tty to PPP discipline: Invalid argument

Logs are as below:

pppd options in effect:
debug # (from /etc/ppp/peers/quectelppp)
nodetach # (from /etc/ppp/peers/quectelppp)
persist # (from /etc/ppp/peers/quectelppp)
dump # (from /etc/ppp/peers/quectelppp)
noauth # (from /etc/ppp/peers/quectelppp)
user root # (from /etc/ppp/peers/quectelppp)
password ??? # (from /etc/ppp/peers/quectelppp)
remotename 3gppp # (from /etc/ppp/peers/quectelppp)
/dev/ttymxc4 # (from /etc/ppp/peers/quectelppp)
115200 # (from /etc/ppp/peers/quectelppp)
lock # (from /etc/ppp/peers/quectelppp)
connect chat -s -v -f /etc/ppp/peers/quectel-chat-connect # (from /etc/ppp/peers/quectelppp)
disconnect chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect # (from /etc/ppp/peers/quectelppp)
nocrtscts # (from /etc/ppp/peers/quectelppp)
modem # (from /etc/ppp/peers/quectelppp)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/quectelppp)
novj # (from /etc/ppp/peers/quectelppp)
novjccomp # (from /etc/ppp/peers/quectelppp)
ipcp-accept-local # (from /etc/ppp/peers/quectelppp)
ipcp-accept-remote # (from /etc/ppp/peers/quectelppp)
ipparam 3gppp # (from /etc/ppp/peers/quectelppp)
noipdefault # (from /etc/ppp/peers/quectelppp)
ipcp-max-failure 30 # (from /etc/ppp/peers/quectelppp)
defaultroute # (from /etc/ppp/peers/quectelppp)
replacedefaultroute # (from /etc/ppp/peers/quectelppp)
usepeerdns # (from /etc/ppp/peers/quectelppp)
noccp # (from /etc/ppp/peers/quectelppp)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
OK
– got it

send (ATE0^M)
expect (OK)
^M
^M
OK
– got it

send (ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
BG95-M3^M
Revision: BG95M3LAR02A03^M
^M
SubEdition: V10^M
^M
+CSQ: 28,99^M
^M
+CPIN: READY^M
^M
+COPS: 0,0,“Vi India”,0^M
^M
+CGREG: 0,1^M
^M
OK
– got it

send (AT+CGDCONT=1,“IP”,“www”,0,0^M)
expect (OK)
^M
^M
OK
– got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
– got it

Script chat -s -v -f /etc/ppp/peers/quectel-chat-connect finished (pid 1110), status = 0x0
Serial connection established.
Couldn’t set tty to PPP discipline: Invalid argument
abort on (ERROR)
abort on (NO DIALTONE)

Sending break to the modem
send (+++^M)
send (+++^M)
send (+++^M)

Goodbay
Script chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect finished (pid 1113), status = 0x0
Serial link disconnected.

abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
alarm
Failed
Script chat -s -v -f /etc/ppp/peers/quectel-chat-connect finished (pid 1115), status = 0x3
Connect script failed
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
alarm
Failed
Script chat -s -v -f /etc/ppp/peers/quectel-chat-connect finished (pid 1124), status = 0x3
Connect script failed

I have got this working by just retrying. I don’t know how.
Can anyone tell me how to access the device from outside with the remote or local IP I got?

for most operator, the outside cannot access the device with the IP. Actually it still is a local IP.