go-smpp
go-smpp copied to clipboard
how to receive submitSMResponse while smpp binding with message listener
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?
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?
you need to call sm.RespID() to get it.