Closed parsibox closed 9 months ago
We will need more info to help you, the pcap doesnt show call flow, who is sending the enquire_link ? Lets start with the basics:
enquire_link is automatic bind type is transmitter PDU handler is OnAllPDU
How do you handle unbind request in OnAllPDU ?
OnPDU: PDUController(),
func PDUController() func(pdu2.PDU, bool) {
return func(p pdu2.PDU, _ bool) {
pduHeader := p.GetHeader()
if pduHeader.CommandID.String() != "ENQUIRE_LINK_RESP" && pduHeader.CommandID.String() != "ENQUIRE_LINK" {
file_logger_controller.AllReceivedPDUsController(map[string]interface{}{
"CommandIDType": pduHeader.CommandID.String(),
"CommandLength": pduHeader.CommandLength,
"CommandStatus": pduHeader.CommandStatus,
"SequenceNumber": pduHeader.SequenceNumber,
})
}
switch pd := p.(type) {
case *pdu2.SubmitSMResp:
SubmitResponseController(p)
case *pdu2.GenericNack:
//fmt.Println("GenericNack Received")
case *pdu2.EnquireLinkResp:
case *pdu2.BindRequest:
BindRequestController(p)
case *pdu2.BindResp:
BindResponseController(p)
case *pdu2.Unbind:
UnbindController(p)
case *pdu2.UnbindResp:
UnbindResponseController(p)
case *pdu2.DataSM:
//fmt.Println("DataSM Received")
case *pdu2.DeliverSM:
DeliveryAndReceiveController(p)
p.IsGNack()
}
}
}
func UnbindController(p pdu2.PDU) {
switch pd := p.(type) {
case *pdu2.Unbind:
pduMap := map[string]interface{}{
"Type": "Unbind",
"CommandIDType": pd.CommandID.String(),
"CommandLength": pd.CommandLength,
"CommandStatus": pd.CommandStatus,
"SequenceNumber": pd.SequenceNumber,
"OptionalParameters": pd.OptionalParameters,
"DateTime": time.Now().UTC().Add(time.Duration(time_zone_config.TimeZoneMinute) * time.Minute),
}
file_logger_controller.NewSessionSMSController(pduMap)
}
}
The code example provide is using OnPDU, not OnAllPDU. The difference is that the Unbind request from the SMSC is automatically responded too. This also means that if the bind get closed, the enquire_link should also stop. But you are saying the enquire_link continue working, just the other submits arent.
Both the loop for sending enquire_link and the submit use the same write function call in transmitable.go .
for {
select {
case <-ticker.C:
eqp := pdu.NewEnquireLink()
n, err := t.write(eqp)
if t.check(eqp, n, err) {
return
}
case p, ok := <-t.input:
if !ok {
return
}
if p != nil {
n, err := t.write(p)
if t.check(p, n, err) {
return
}
}
}
}
Are you logging something from the OnClosed func call ? If yes, are you seeing any logs ?
yes i receive disconnect from OnClosed and i manually start create new session but when new session start submit_sm not work or connect some times not work , some times hand shake not start is there any limitation for create new session in your lib? i think there is some problem in rebind manually , we can not close old session correct
i manually start create new session
You dont need to start a new session ? Let the library reconnect for you.
But when you create the new session, do you assign it back to your Submit func ? I believe this is your issue.... Your function is still pointing to the old session.
i check it but new session hanged on connect in your library code i think something is in your lib can you create a test for have reconnect manualy?
If you provide a test that shows your issue/failure, I would gladly try and help you resolve it.
If you need a new feature, feel free to submit a PR.
hi dear after a period of time ( for example 1-2 day after bind ) we can not submit sms and we get error
connection is closing, can not send PDU to SMSC
but i create a tcp dump and see we are sending and receiving handshake but there is no log for submit_sm in tcp dump i actually can not understand what happend