dou44364983 2016-09-21 11:50
浏览 234

无法在Go代码中设置SMPP可选参数

Iam studying SMPP protocol and tried to implement a simple transmitter with a golang code and selenium smpp simulator. I found a package "CodeMonkeyKevin/smpp34" from github. But Iam unable to set the "user_message_reference" optional parameter.

I slightly modified the "SubmitSm" function inside the "transmitter.go" file by adding these lines (just before the write operation):

err = p.SetTLVField(tag, length, []byte(value))
    if err != nil {
        fmt.Println("Set TLV failed")
        return 0, err
    }

But this is not working.

I supplied values tag=0516(int equivalent of 0x0204 user_message_reference) length=02 and value="91".

In the response i could see "tag=516,len=2,value=0x3931" in the SMSC simulator , the value field doesn't seem appropriate to me; also the "message_id" in the response still continues its sequence by adding 1 with the last message_id

can some one help me in setting the "user_message_reference" optional parameter to the "submit_sm" request?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dpd46554 2017-10-25 17:33
    关注

    You don't have edit the function in the transmitter.go

    just set your tlv fields after your submit_sm

    example

    pdu, err        := trx.Smpp.SubmitSm("+254720000000", 
    pdu.GetField("source_addr").String(), msg, &smpp.Params{})
    
    pdu.SetTLVField(0x0501, 1, []byte{2}) #eg a ussd_service_op
    

    This is the proper way to add your tlv values if you are using kevin's package See https://github.com/CodeMonkeyKevin/smpp34/issues/9 Additional parameters

    评论

报告相同问题?

悬赏问题

  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口