farhadi / node-smpp

SMPP client and server implementation in node.js
MIT License
420 stars 180 forks source link

USSD service via SMPP #77

Open parsibox opened 6 years ago

parsibox commented 6 years ago

hi can you explain how can use ussd via smpp?

juliangut commented 5 years ago

Hello @parsibox

I'm not very familiar with USSD but as far as I can see it can be used with SMPP through TLVs. This library supports it by ussd_service_op TLV, check it here: https://github.com/farhadi/node-smpp/blob/master/lib/defs.js#L892

As a guide I've found this that can help you, have a look at the explanation, not the code: https://www.activexperts.com/sms-component/sms/ussd/

izhrobot commented 5 years ago

hi send submit_sm session.submit_sm({ source_addr_ton: 0x05, source_addr_npi: 0x01, source_addr: 'myphone', dest_addr_ton: 0x01, dest_addr_npi: 0x01, destination_addr: '*100#', }, (pdu) => { console.log('session.submit_sm pdu='); console.log(pdu); } }); getting status 69 submit_sm failed how to send ussd to number: *100# ?

juliangut commented 5 years ago

Hi @izhrobot

You have to add that data in the corresponding TLV instead of destination_addr:

session.submit_sm(
    {
        source_addr_ton: 0x05,
        source_addr_npi: 0x01,
        source_addr: 'myphone',
        dest_addr_ton: 0x01,
        dest_addr_npi: 0x01,
        ussd_service_op: '*100#'
    },
    (pdu) => { 
        console.log('session.submit_sm pdu='); 
        console.log(pdu);
    }
);

As I mention before I don't have experience with USSD so have a look at the guide I linked

AND if you would be so kind to share if it works or not I'd really appreciate it, also as a guide for others on this matter

izhrobot commented 5 years ago

Hi this one comes to the log response session.on pdu= PDU { command_length: 16, command_id: 2147483652, command_status: 69, sequence_number: 2, command: 'submit_sm_resp' } status: 69

juliangut commented 5 years ago

Hi

You should ask your provider why you're receiving ESME_RSUBMITFAIL error (69 in decimal, 0x45 in hex) and if and how they happen to support USSD

One last thing I've just noticed reviewing the code, ussd_service_op is a 1 byte int so reconsider the value you want to send

izhrobot commented 5 years ago

I have a GoIP GSM gateway. It can work on SMPP protocol. image I can send USSD through its interface. image *100# - this is a balance request

juliangut commented 5 years ago

Have you tried sending the USSD command as the submit_sm's short_message field? and maybe 2 as ussd_service_op (USSR Request)

Take a look here for the possible values of ussd_service_op

izhrobot commented 5 years ago

sending was successful but such an answer came short_message: { message: 'id:45013692 sub:0 dlvrd:28 submit date:1908121157 done date:1908121158 stat:UNDELIV err:21 Text:*100#' }

juliangut commented 5 years ago

Well that's an standard undelivered deliver_sm_resp you should have documentation for DR errors (21 in this case) if you don't have it then request your provider what that error means

izhrobot commented 5 years ago

INVSERTYP 0x00000015 (21) Invalid Service Type

izhrobot commented 5 years ago

here is the full answer PDU { command_length: 134, command_id: 5, command_status: 0, sequence_number: 8, command: 'deliver_sm', service_type: '', source_addr_ton: 0, source_addr_npi: 0, source_addr: '', dest_addr_ton: 5, dest_addr_npi: 0, destination_addr: '', esm_class: 4, protocol_id: 8, priority_flag: 0, schedule_delivery_time: '', validity_period: '', registered_delivery: 0, replace_if_present_flag: 0, data_coding: 0, sm_default_msg_id: 0, short_message: { message: 'id:59633913 sub:0 dlvrd:28 submit date:1908121249 done date:1908121249 stat:UNDELIV err:21 Text:*100#' } }

juliangut commented 5 years ago

As you can see deliver_sm's command_status: 0, on the other hand deliver's "error status" is 21

Do not confuse them, 0x15 (ESME_RINVSERTYP) is the status you would receive in submit_sm_resp if the service was not supported, which is not your case

You have to ask your provider what that error status means, those errors are not defined in the standard

izhrobot commented 5 years ago

I do not have access to the technical specialists of the provider. the service itself works. I don’t know how to use it using the SMPP protocol. here is a link to some documentation of this provider: http://static.mts.ru/uploadmsk/contents/1655/tekhnicheskie_harakteristiki_trebovaniia_usluge_ussd_meniu.pdf

juliangut commented 5 years ago

That is as far as I can go, not knowing what the delivery errors are there is no way to debug this The service works (I assume from their panel) because they know how to send USSD messages to their own service of course, in your case you need to know how to configure the PDU and for that you need more documentation or access to tech team

izhrobot commented 5 years ago

As I understand it, you need to know the phone number of the USSD provider. And add it to destination_addr. I do not have this number. And my GoIP sends USSD using AT commands: AT + CUSD = 1, "* 100 #"

juliangut commented 5 years ago

And my GoIP sends USSD using AT commands: AT + CUSD = 1, "* 100 #"

I'm afraid I can't be of help with this as it falls out of my knowledge, sorry

izhrobot commented 5 years ago

It turns out that my GoIP is a server in which the SMPP protocol is implemented. I wrote to tech support the developers of this device. Maybe they will tell me how to send USSD via SMPP on their GoIP device.

juliangut commented 5 years ago

Please once you have it figured out share, so this lays as documentation for future developers

izhrobot commented 5 years ago

ok I'm waiting for a response from tech support

izhrobot commented 5 years ago

Came the reply from tech support

GoIP do not support USSD sending in SMPP.

juliangut commented 5 years ago

Awesome, no luck there

wuzhitian commented 3 years ago

sending was successful but such an answer came short_message: { message: 'id:45013692 sub:0 dlvrd:28 submit date:1908121157 done date:1908121158 stat:UNDELIV err:21 Text:*100#' }

Hello,How can you get de short_message? Can you offer me a demo ?

juliangut commented 3 years ago

@wuzhitian, that short_message is the payload of the deliver_sm PDU received with the delivery report of the sent sms