Title: Get message_id when sending sms · python-smpplib/python-smpplib · Discussion #246 · GitHub
Open Graph Title: Get message_id when sending sms · python-smpplib/python-smpplib · Discussion #246
X Title: Get message_id when sending sms · python-smpplib/python-smpplib · Discussion #246
Description: Get message_id when sending sms
Open Graph Description: The example contains the following snipped for sending a SMS: for part in parts: pdu = client.send_message( source_addr_ton=smpplib.consts.SMPP_TON_INTL, #source_addr_npi=smpplib.consts.SMPP_NPI_IS...
X Description: The example contains the following snipped for sending a SMS: for part in parts: pdu = client.send_message( source_addr_ton=smpplib.consts.SMPP_TON_INTL, #source_addr_npi=smpplib.consts.SMPP_NPI_IS...
Opengraph URL: https://github.com/python-smpplib/python-smpplib/discussions/246
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Get message_id when sending sms","text":"The example contains the following snipped for sending a SMS:
\nfor part in parts:\n pdu = client.send_message(\n source_addr_ton=smpplib.consts.SMPP_TON_INTL,\n #source_addr_npi=smpplib.consts.SMPP_NPI_ISDN,\n # Make sure it is a byte string, not unicode:\n source_addr='SENDERPHONENUM',\n\n dest_addr_ton=smpplib.consts.SMPP_TON_INTL,\n #dest_addr_npi=smpplib.consts.SMPP_NPI_ISDN,\n # Make sure thease two params are byte strings, not unicode:\n destination_addr='PHONENUMBER',\n short_message=part,\n\n data_coding=encoding_flag,\n esm_class=msg_type_flag,\n registered_delivery=True,\n )\n print(pdu.sequence)
\nIs it somehow possible to get the message_id that will be later echoed as receipted_message_id at this point?
\nI know that I can use the following listener:
\nclient.set_message_sent_handler(\n lambda pdu: logger.debug(f\"sent {pdu.message_id}\")\n)
\nBut I cannot know if the message_id is the message id for the message I just sent in a multi-threaded environment 🤔
","upvoteCount":1,"answerCount":5,"acceptedAnswer":{"@type":"Answer","text":"I resolved the issue by entering a lock when sending an SMS and releasing it when all parts can be associated with a message_id provided by the set_message_sent_handler. The time we are waiting is neglectable as the handler is usually called before the second part of the message is processed.
","upvoteCount":2,"url":"https://github.com/python-smpplib/python-smpplib/discussions/246#discussioncomment-8047949"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:feb615cd-e7e5-7615-ed94-f0ccb137684f |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | B886:3B5FEE:FA191C:160C146:696F52D0 |
| html-safe-nonce | 1853967152ca667074f0d3ff81d30e0719c50ba07f4118819e999851965189ac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODg2OjNCNUZFRTpGQTE5MUM6MTYwQzE0Njo2OTZGNTJEMCIsInZpc2l0b3JfaWQiOiI3MTQ3MDQ3Mzk1ODk4OTA1Mjk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4240a3e2fc5877f3eda66eebd717464df66022587a458c0eed19ec7c25b8f2e3 |
| hovercard-subject-tag | discussion:6043300 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-smpplib/python-smpplib/246/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/4e73cb5638c275fa1345c308fd14374fed705ed72a0cf3189c5440a827846fe1/python-smpplib/python-smpplib/discussions/246 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e73cb5638c275fa1345c308fd14374fed705ed72a0cf3189c5440a827846fe1/python-smpplib/python-smpplib/discussions/246 |
| og:image:alt | The example contains the following snipped for sending a SMS: for part in parts: pdu = client.send_message( source_addr_ton=smpplib.consts.SMPP_TON_INTL, #source_addr_npi=smpplib.consts.SMPP_NPI_IS... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 49bb2ee76ae1b4ec758faefafda636ff20b05a9708bb290d28422cdf542ae979 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-smpplib/python-smpplib git https://github.com/python-smpplib/python-smpplib.git |
| octolytics-dimension-user_id | 45378833 |
| octolytics-dimension-user_login | python-smpplib |
| octolytics-dimension-repository_id | 9441405 |
| octolytics-dimension-repository_nwo | python-smpplib/python-smpplib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9441405 |
| octolytics-dimension-repository_network_root_nwo | python-smpplib/python-smpplib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 036f37fe552777ac9c6ee661957f947285aab936 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width