fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
218 stars 135 forks source link

how to receive submitSMResponse while smpp binding with message listener #81

Open Qhodok opened 5 years ago

Qhodok commented 5 years ago

i bind smpp with handler, everytime i send submitSM, submitSMRespose always receive on handler that i register before not in return value of submitSM. how to get submitSMResponse from return value of submitSM even listen a message handler?

Qhodok commented 5 years ago

tx := &smpp.Transceiver{ Addr: "addr, User: "user", Passwd: "password", Handler: func(p pdu.Body) { switch p.Header().ID { case pdu.DeliverSMID: //incoming message or delivery report case pdu.SubmitSMRespID: //always receive on this line , } conn := tx.Bind()

sm, err := tx.Submit(&smpp.ShortMessage{ Src: r.FormValue("source"), Dst: r.FormValue("msisdn"), Text: pdutext.Raw(r.FormValue("")), Register: pdufield.NoDeliveryReceipt, TLVFields: pdutlv.Fields{ pdutlv.TagReceiptedMessageID: pdutlv.CString("hutch"), pdutlv.TagMessagePayload: pdutlv.CString(r.FormValue("msg")), }, })

sm is always nil, how to get sm.RespID on this line?

alexanderomnix commented 2 years ago

you need to call sm.RespID() to get it.